From 24063703ce86f54f8b44e5c4b895ba5e56c71cd1 Mon Sep 17 00:00:00 2001 From: Wim Henderickx Date: Sun, 20 Oct 2024 20:12:28 +0200 Subject: [PATCH 01/23] added new approach for storage --- DESIGN-DEPLOYMENTS.md | 55 + Makefile | 29 +- apis/backend/LabelKeys.go | 44 +- ...asclaim_interface.go => asclaim_object.go} | 589 +- apis/backend/as/asclaim_resource.go | 309 + .../{v1alpha1 => }/asclaim_syntaxvalidator.go | 15 +- .../asclaim_types.go} | 57 +- apis/backend/as/asentry_object.go | 133 + apis/backend/as/asentry_resource.go | 309 + apis/backend/as/asentry_types.go | 71 + apis/backend/as/asindex_helpers.go | 90 + apis/backend/as/asindex_object.go | 148 + apis/backend/as/asindex_resource.go | 309 + .../asindex_types.go} | 38 +- apis/backend/as/doc.go | 4 +- apis/backend/as/handlers/confighandler.go | 63 + .../as/helper.go} | 33 +- apis/backend/as/register.go | 52 + apis/backend/as/storage.go | 116 + apis/backend/as/v1alpha1/asclaim_resource.go | 80 + apis/backend/as/v1alpha1/asclaim_types.go | 11 +- apis/backend/as/v1alpha1/asentry_interface.go | 272 - apis/backend/as/v1alpha1/asentry_resource.go | 80 + apis/backend/as/v1alpha1/asentry_types.go | 19 +- .../{as_types.go => asindex_helper.go} | 0 apis/backend/as/v1alpha1/asindex_interface.go | 309 - apis/backend/as/v1alpha1/asindex_resource.go | 80 + apis/backend/as/v1alpha1/asindex_types.go | 6 +- apis/backend/as/v1alpha1/conversion.go | 172 + apis/backend/as/v1alpha1/doc.go | 4 +- apis/backend/as/v1alpha1/generated.pb.go | 3645 --- apis/backend/as/v1alpha1/generated.proto | 197 - .../backend/as/v1alpha1/helper.go | 34 +- apis/backend/as/v1alpha1/register.go | 2 - .../v1alpha1/zz_generated.defaults.go} | 13 +- .../{v1alpha1 => }/zz_generated.deepcopy.go | 61 +- apis/backend/claim_types.go | 1 - apis/backend/esi/v1alpha1/doc.go | 28 - apis/backend/esi/v1alpha1/esi_types.go | 44 - .../esi/v1alpha1/esiclaim_interface.go | 530 - .../esi/v1alpha1/esiclaim_syntaxvalidator.go | 68 - apis/backend/esi/v1alpha1/esiclaim_types.go | 87 - .../esi/v1alpha1/esientry_interface.go | 256 - apis/backend/esi/v1alpha1/esientry_types.go | 78 - .../esi/v1alpha1/esiindex_interface.go | 309 - apis/backend/esi/v1alpha1/esiindex_types.go | 78 - apis/backend/esi/v1alpha1/generated.pb.go | 3646 --- apis/backend/esi/v1alpha1/generated.proto | 197 - apis/backend/esi/v1alpha1/register.go | 69 - .../esi/v1alpha1/zz_generated.deepcopy.go | 414 - apis/backend/extcomm/doc.go | 21 - apis/backend/extcomm/v1alpha1/doc.go | 28 - .../backend/extcomm/v1alpha1/extcomm_types.go | 61 - .../v1alpha1/extcommclaim_interface.go | 595 - .../v1alpha1/extcommclaim_syntaxvalidator.go | 68 - .../extcomm/v1alpha1/extcommclaim_types.go | 87 - .../v1alpha1/extcommentry_interface.go | 274 - .../extcomm/v1alpha1/extcommentry_types.go | 78 - .../v1alpha1/extcommindex_interface.go | 376 - .../extcomm/v1alpha1/extcommindex_types.go | 91 - apis/backend/extcomm/v1alpha1/generated.pb.go | 3800 ---- apis/backend/extcomm/v1alpha1/generated.proto | 214 - apis/backend/extcomm/v1alpha1/register.go | 69 - .../extcomm/v1alpha1/zz_generated.deepcopy.go | 414 - apis/backend/genid/doc.go | 21 - apis/backend/genid/v1alpha1/doc.go | 28 - apis/backend/genid/v1alpha1/generated.pb.go | 3686 --- apis/backend/genid/v1alpha1/generated.proto | 201 - apis/backend/genid/v1alpha1/genid_types.go | 42 - .../genid/v1alpha1/genidclaim_interface.go | 594 - .../v1alpha1/genidclaim_syntaxvalidator.go | 68 - .../genid/v1alpha1/genidclaim_types.go | 87 - .../genid/v1alpha1/genidentry_interface.go | 274 - .../genid/v1alpha1/genidentry_types.go | 78 - .../genid/v1alpha1/genidindex_interface.go | 371 - .../genid/v1alpha1/genidindex_types.go | 81 - apis/backend/genid/v1alpha1/register.go | 69 - .../genid/v1alpha1/zz_generated.deepcopy.go | 414 - apis/backend/infra/doc.go | 21 - apis/backend/infra/v1alpha1/bfd_types.go | 40 - .../infra/v1alpha1/cluster_interface.go | 329 - apis/backend/infra/v1alpha1/cluster_types.go | 75 - apis/backend/infra/v1alpha1/doc.go | 28 - .../infra/v1alpha1/endpoint_interface.go | 442 - apis/backend/infra/v1alpha1/endpoint_types.go | 82 - .../infra/v1alpha1/endpointset_interface.go | 329 - .../infra/v1alpha1/endpointset_types.go | 85 - apis/backend/infra/v1alpha1/generated.pb.go | 18591 ---------------- apis/backend/infra/v1alpha1/generated.proto | 889 - apis/backend/infra/v1alpha1/id.go | 132 - apis/backend/infra/v1alpha1/igp_types.go | 92 - apis/backend/infra/v1alpha1/link_interface.go | 440 - apis/backend/infra/v1alpha1/link_types.go | 81 - .../infra/v1alpha1/linkset_interface.go | 325 - apis/backend/infra/v1alpha1/linkset_types.go | 77 - apis/backend/infra/v1alpha1/location.go | 22 - .../infra/v1alpha1/module_interface.go | 325 - apis/backend/infra/v1alpha1/module_types.go | 71 - .../infra/v1alpha1/modulebay_interface.go | 325 - .../backend/infra/v1alpha1/modulebay_types.go | 71 - apis/backend/infra/v1alpha1/node_interface.go | 354 - apis/backend/infra/v1alpha1/node_types.go | 95 - .../infra/v1alpha1/nodegroup_interface.go | 325 - .../backend/infra/v1alpha1/nodegroup_types.go | 73 - .../infra/v1alpha1/nodeitem_interface.go | 325 - apis/backend/infra/v1alpha1/nodeitem_types.go | 70 - .../infra/v1alpha1/nodeset_interface.go | 325 - apis/backend/infra/v1alpha1/nodeset_types.go | 72 - .../backend/infra/v1alpha1/objectreference.go | 34 - apis/backend/infra/v1alpha1/rack_interface.go | 325 - apis/backend/infra/v1alpha1/rack_types.go | 75 - .../infra/v1alpha1/region_interface.go | 329 - apis/backend/infra/v1alpha1/region_types.go | 66 - apis/backend/infra/v1alpha1/register.go | 91 - apis/backend/infra/v1alpha1/site_interface.go | 335 - apis/backend/infra/v1alpha1/site_types.go | 72 - .../infra/v1alpha1/zz_generated.deepcopy.go | 1955 -- apis/backend/ipam/doc.go | 21 - apis/backend/ipam/v1alpha1/doc.go | 28 - apis/backend/ipam/v1alpha1/generated.pb.go | 3970 ---- apis/backend/ipam/v1alpha1/generated.proto | 250 - apis/backend/ipam/v1alpha1/ipam_types.go | 94 - .../ipam/v1alpha1/ipclaim_interface.go | 529 - ...ipclaim_syntaxvalidator_dynamic_address.go | 65 - .../ipclaim_syntaxvalidator_dynamic_prefix.go | 99 - .../ipclaim_syntaxvalidator_static_address.go | 98 - .../ipclaim_syntaxvalidator_static_prefix.go | 111 - .../ipclaim_syntaxvalidator_static_range.go | 90 - apis/backend/ipam/v1alpha1/ipclaim_types.go | 126 - .../ipam/v1alpha1/ipentry_interface.go | 338 - .../ipam/v1alpha1/ipentry_interface_test.go | 71 - apis/backend/ipam/v1alpha1/ipentry_types.go | 93 - .../ipam/v1alpha1/ipindex_interface.go | 333 - apis/backend/ipam/v1alpha1/ipindex_types.go | 77 - apis/backend/ipam/v1alpha1/register.go | 69 - .../ipam/v1alpha1/zz_generated.deepcopy.go | 437 - apis/backend/object.go | 52 +- apis/backend/storage_providers.go | 31 + apis/backend/vlan/doc.go | 21 - apis/backend/vlan/v1alpha1/doc.go | 28 - apis/backend/vlan/v1alpha1/generated.pb.go | 3282 --- apis/backend/vlan/v1alpha1/generated.proto | 190 - apis/backend/vlan/v1alpha1/register.go | 69 - apis/backend/vlan/v1alpha1/vlan_types.go | 44 - .../vlan/v1alpha1/vlanclaim_interface.go | 530 - .../v1alpha1/vlanclaim_syntaxvalidator.go | 68 - apis/backend/vlan/v1alpha1/vlanclaim_types.go | 89 - .../vlan/v1alpha1/vlanentry_interface.go | 275 - apis/backend/vlan/v1alpha1/vlanentry_types.go | 78 - .../vlan/v1alpha1/vlanindex_interface.go | 309 - .../vlan/v1alpha1/zz_generated.deepcopy.go | 366 - apis/backend/vxlan/doc.go | 21 - apis/backend/vxlan/v1alpha1/doc.go | 28 - apis/backend/vxlan/v1alpha1/generated.pb.go | 3645 --- apis/backend/vxlan/v1alpha1/generated.proto | 197 - apis/backend/vxlan/v1alpha1/register.go | 69 - apis/backend/vxlan/v1alpha1/vxlan_types.go | 44 - .../vxlan/v1alpha1/vxlanclaim_interface.go | 530 - .../v1alpha1/vxlanclaim_syntaxvalidator.go | 68 - .../vxlan/v1alpha1/vxlanentry_interface.go | 275 - .../vxlan/v1alpha1/vxlanentry_types.go | 78 - .../vxlan/v1alpha1/vxlanindex_interface.go | 309 - .../vxlan/v1alpha1/vxlanindex_types.go | 78 - .../vxlan/v1alpha1/zz_generated.deepcopy.go | 414 - apis/{backend => common}/doc.go | 2 +- apis/common/labels.go | 86 + apis/common/v1alpha1/generated.pb.go | 1026 - apis/common/v1alpha1/generated.proto | 56 - apis/common/v1alpha1/labels.go | 41 - apis/common/v1alpha1/owner.go | 38 - apis/common/v1alpha1/zz_generated.deepcopy.go | 16 - .../zz_generated.deepcopy.go | 39 +- apis/condition/v1alpha1/condition.go | 202 - apis/condition/v1alpha1/generated.pb.go | 527 - apis/condition/v1alpha1/generated.proto | 40 - .../clientset/versioned/clientset.go | 210 - .../versioned/fake/clientset_generated.go | 133 - .../versioned/typed/as/v1alpha1/asclaim.go | 194 - .../versioned/typed/as/v1alpha1/asentry.go | 194 - .../versioned/typed/as/v1alpha1/asindex.go | 194 - .../versioned/typed/esi/v1alpha1/doc.go | 19 - .../typed/esi/v1alpha1/esi_client.go | 116 - .../versioned/typed/esi/v1alpha1/esiclaim.go | 194 - .../versioned/typed/esi/v1alpha1/esientry.go | 194 - .../versioned/typed/esi/v1alpha1/esiindex.go | 194 - .../versioned/typed/esi/v1alpha1/fake/doc.go | 19 - .../esi/v1alpha1/fake/fake_esi_client.go | 47 - .../typed/esi/v1alpha1/fake/fake_esiclaim.go | 140 - .../typed/esi/v1alpha1/fake/fake_esientry.go | 140 - .../typed/esi/v1alpha1/fake/fake_esiindex.go | 140 - .../typed/esi/v1alpha1/generated_expansion.go | 24 - .../versioned/typed/extcomm/v1alpha1/doc.go | 19 - .../typed/extcomm/v1alpha1/extcomm_client.go | 116 - .../typed/extcomm/v1alpha1/extcommclaim.go | 194 - .../typed/extcomm/v1alpha1/extcommentry.go | 194 - .../typed/extcomm/v1alpha1/extcommindex.go | 194 - .../typed/extcomm/v1alpha1/fake/doc.go | 19 - .../v1alpha1/fake/fake_extcomm_client.go | 47 - .../v1alpha1/fake/fake_extcommclaim.go | 140 - .../v1alpha1/fake/fake_extcommentry.go | 140 - .../v1alpha1/fake/fake_extcommindex.go | 140 - .../versioned/typed/genid/v1alpha1/doc.go | 19 - .../typed/genid/v1alpha1/fake/doc.go | 19 - .../genid/v1alpha1/fake/fake_genid_client.go | 47 - .../genid/v1alpha1/fake/fake_genidclaim.go | 140 - .../genid/v1alpha1/fake/fake_genidentry.go | 140 - .../genid/v1alpha1/fake/fake_genidindex.go | 140 - .../genid/v1alpha1/generated_expansion.go | 24 - .../typed/genid/v1alpha1/genid_client.go | 116 - .../typed/genid/v1alpha1/genidclaim.go | 194 - .../typed/genid/v1alpha1/genidentry.go | 194 - .../typed/genid/v1alpha1/genidindex.go | 194 - .../versioned/typed/infra/v1alpha1/cluster.go | 194 - .../versioned/typed/infra/v1alpha1/doc.go | 19 - .../typed/infra/v1alpha1/endpoint.go | 194 - .../typed/infra/v1alpha1/endpointset.go | 194 - .../typed/infra/v1alpha1/fake/doc.go | 19 - .../typed/infra/v1alpha1/fake/fake_cluster.go | 140 - .../infra/v1alpha1/fake/fake_endpoint.go | 140 - .../infra/v1alpha1/fake/fake_endpointset.go | 140 - .../infra/v1alpha1/fake/fake_infra_client.go | 91 - .../typed/infra/v1alpha1/fake/fake_link.go | 140 - .../typed/infra/v1alpha1/fake/fake_linkset.go | 140 - .../typed/infra/v1alpha1/fake/fake_module.go | 140 - .../infra/v1alpha1/fake/fake_modulebay.go | 140 - .../typed/infra/v1alpha1/fake/fake_node.go | 140 - .../infra/v1alpha1/fake/fake_nodegroup.go | 140 - .../infra/v1alpha1/fake/fake_nodeitem.go | 140 - .../typed/infra/v1alpha1/fake/fake_nodeset.go | 140 - .../typed/infra/v1alpha1/fake/fake_rack.go | 140 - .../typed/infra/v1alpha1/fake/fake_region.go | 140 - .../typed/infra/v1alpha1/fake/fake_site.go | 140 - .../infra/v1alpha1/generated_expansion.go | 46 - .../typed/infra/v1alpha1/infra_client.go | 171 - .../versioned/typed/infra/v1alpha1/link.go | 194 - .../versioned/typed/infra/v1alpha1/linkset.go | 194 - .../versioned/typed/infra/v1alpha1/module.go | 194 - .../typed/infra/v1alpha1/modulebay.go | 194 - .../versioned/typed/infra/v1alpha1/node.go | 194 - .../typed/infra/v1alpha1/nodegroup.go | 194 - .../typed/infra/v1alpha1/nodeitem.go | 194 - .../versioned/typed/infra/v1alpha1/nodeset.go | 194 - .../versioned/typed/infra/v1alpha1/rack.go | 194 - .../versioned/typed/infra/v1alpha1/region.go | 194 - .../versioned/typed/infra/v1alpha1/site.go | 194 - .../versioned/typed/ipam/v1alpha1/doc.go | 19 - .../versioned/typed/ipam/v1alpha1/fake/doc.go | 19 - .../ipam/v1alpha1/fake/fake_ipam_client.go | 47 - .../typed/ipam/v1alpha1/fake/fake_ipclaim.go | 140 - .../typed/ipam/v1alpha1/fake/fake_ipentry.go | 140 - .../typed/ipam/v1alpha1/fake/fake_ipindex.go | 140 - .../ipam/v1alpha1/generated_expansion.go | 24 - .../typed/ipam/v1alpha1/ipam_client.go | 116 - .../versioned/typed/ipam/v1alpha1/ipclaim.go | 194 - .../versioned/typed/ipam/v1alpha1/ipentry.go | 194 - .../versioned/typed/ipam/v1alpha1/ipindex.go | 194 - .../versioned/typed/vlan/v1alpha1/doc.go | 19 - .../versioned/typed/vlan/v1alpha1/fake/doc.go | 19 - .../vlan/v1alpha1/fake/fake_vlan_client.go | 47 - .../vlan/v1alpha1/fake/fake_vlanclaim.go | 140 - .../vlan/v1alpha1/fake/fake_vlanentry.go | 140 - .../vlan/v1alpha1/fake/fake_vlanindex.go | 140 - .../vlan/v1alpha1/generated_expansion.go | 24 - .../typed/vlan/v1alpha1/vlan_client.go | 116 - .../typed/vlan/v1alpha1/vlanclaim.go | 194 - .../typed/vlan/v1alpha1/vlanentry.go | 194 - .../typed/vlan/v1alpha1/vlanindex.go | 194 - .../versioned/typed/vxlan/v1alpha1/doc.go | 19 - .../typed/vxlan/v1alpha1/fake/doc.go | 19 - .../vxlan/v1alpha1/fake/fake_vxlan_client.go | 47 - .../vxlan/v1alpha1/fake/fake_vxlanclaim.go | 140 - .../vxlan/v1alpha1/fake/fake_vxlanentry.go | 140 - .../vxlan/v1alpha1/fake/fake_vxlanindex.go | 140 - .../vxlan/v1alpha1/generated_expansion.go | 24 - .../typed/vxlan/v1alpha1/vxlan_client.go | 116 - .../typed/vxlan/v1alpha1/vxlanclaim.go | 194 - .../typed/vxlan/v1alpha1/vxlanentry.go | 194 - .../typed/vxlan/v1alpha1/vxlanindex.go | 194 - .../externalversions/esi/interface.go | 45 - .../externalversions/esi/v1alpha1/esiclaim.go | 89 - .../externalversions/esi/v1alpha1/esientry.go | 89 - .../externalversions/esi/v1alpha1/esiindex.go | 89 - .../esi/v1alpha1/interface.go | 58 - .../externalversions/extcomm/interface.go | 45 - .../extcomm/v1alpha1/extcommclaim.go | 89 - .../extcomm/v1alpha1/extcommentry.go | 89 - .../extcomm/v1alpha1/extcommindex.go | 89 - .../extcomm/v1alpha1/interface.go | 58 - .../informers/externalversions/generic.go | 150 - .../externalversions/genid/interface.go | 45 - .../genid/v1alpha1/genidclaim.go | 89 - .../genid/v1alpha1/genidentry.go | 89 - .../genid/v1alpha1/genidindex.go | 89 - .../genid/v1alpha1/interface.go | 58 - .../externalversions/infra/interface.go | 45 - .../infra/v1alpha1/cluster.go | 89 - .../infra/v1alpha1/endpoint.go | 89 - .../infra/v1alpha1/endpointset.go | 89 - .../infra/v1alpha1/interface.go | 135 - .../externalversions/infra/v1alpha1/link.go | 89 - .../infra/v1alpha1/linkset.go | 89 - .../externalversions/infra/v1alpha1/module.go | 89 - .../infra/v1alpha1/modulebay.go | 89 - .../externalversions/infra/v1alpha1/node.go | 89 - .../infra/v1alpha1/nodegroup.go | 89 - .../infra/v1alpha1/nodeitem.go | 89 - .../infra/v1alpha1/nodeset.go | 89 - .../externalversions/infra/v1alpha1/rack.go | 89 - .../externalversions/infra/v1alpha1/region.go | 89 - .../externalversions/infra/v1alpha1/site.go | 89 - .../externalversions/ipam/interface.go | 45 - .../ipam/v1alpha1/interface.go | 58 - .../externalversions/ipam/v1alpha1/ipclaim.go | 89 - .../externalversions/ipam/v1alpha1/ipentry.go | 89 - .../externalversions/ipam/v1alpha1/ipindex.go | 89 - .../externalversions/vlan/interface.go | 45 - .../vlan/v1alpha1/interface.go | 58 - .../vlan/v1alpha1/vlanclaim.go | 89 - .../vlan/v1alpha1/vlanentry.go | 89 - .../vlan/v1alpha1/vlanindex.go | 89 - .../externalversions/vxlan/interface.go | 45 - .../vxlan/v1alpha1/interface.go | 58 - .../vxlan/v1alpha1/vxlanclaim.go | 89 - .../vxlan/v1alpha1/vxlanentry.go | 89 - .../vxlan/v1alpha1/vxlanindex.go | 89 - .../listers/esi/v1alpha1/esiclaim.go | 98 - .../listers/esi/v1alpha1/esientry.go | 98 - .../listers/esi/v1alpha1/esiindex.go | 98 - .../esi/v1alpha1/expansion_generated.go | 42 - .../extcomm/v1alpha1/expansion_generated.go | 42 - .../listers/extcomm/v1alpha1/extcommclaim.go | 98 - .../listers/extcomm/v1alpha1/extcommentry.go | 98 - .../listers/extcomm/v1alpha1/extcommindex.go | 98 - .../genid/v1alpha1/expansion_generated.go | 42 - .../listers/genid/v1alpha1/genidclaim.go | 98 - .../listers/genid/v1alpha1/genidentry.go | 98 - .../listers/genid/v1alpha1/genidindex.go | 98 - .../listers/infra/v1alpha1/cluster.go | 98 - .../listers/infra/v1alpha1/endpoint.go | 98 - .../listers/infra/v1alpha1/endpointset.go | 98 - .../infra/v1alpha1/expansion_generated.go | 130 - apis/generated/listers/infra/v1alpha1/link.go | 98 - .../listers/infra/v1alpha1/linkset.go | 98 - .../listers/infra/v1alpha1/module.go | 98 - .../listers/infra/v1alpha1/modulebay.go | 98 - apis/generated/listers/infra/v1alpha1/node.go | 98 - .../listers/infra/v1alpha1/nodegroup.go | 98 - .../listers/infra/v1alpha1/nodeitem.go | 98 - .../listers/infra/v1alpha1/nodeset.go | 98 - apis/generated/listers/infra/v1alpha1/rack.go | 98 - .../listers/infra/v1alpha1/region.go | 98 - apis/generated/listers/infra/v1alpha1/site.go | 98 - .../ipam/v1alpha1/expansion_generated.go | 42 - .../listers/ipam/v1alpha1/ipclaim.go | 98 - .../listers/ipam/v1alpha1/ipentry.go | 98 - .../listers/ipam/v1alpha1/ipindex.go | 98 - .../vlan/v1alpha1/expansion_generated.go | 42 - .../listers/vlan/v1alpha1/vlanclaim.go | 98 - .../listers/vlan/v1alpha1/vlanentry.go | 98 - .../listers/vlan/v1alpha1/vlanindex.go | 98 - .../vxlan/v1alpha1/expansion_generated.go | 42 - .../listers/vxlan/v1alpha1/vxlanclaim.go | 98 - .../listers/vxlan/v1alpha1/vxlanentry.go | 98 - .../listers/vxlan/v1alpha1/vxlanindex.go | 98 - .../generated/openapi/zz_generated.openapi.go | 11151 --------- apis/{condition => id}/doc.go | 4 +- apis/id/id.go | 143 + apis/{condition => id}/v1alpha1/doc.go | 0 apis/id/v1alpha1/id.go | 133 + apis/id/v1alpha1/zz_generated.deepcopy.go | 255 + apis/id/zz_generated.deepcopy.go | 255 + artifacts/out/artifacts.yaml | 2 +- examples/genid/index.yaml | 3 +- examples/ipam/prefix-network-10.0.0.0-24.yaml | 1 + go.mod | 193 +- go.sum | 482 +- main.go | 761 +- .../as/as_helpers_test.go | 3 + .../as/as_index_test.go | 3 + pkg/{backend => backend-orig}/as/as_test.go | 3 + .../backend/applicator.go | 3 + .../backend/applicator_dynamic_id.go | 5 +- .../backend/applicator_static_id.go | 3 + .../backend/applicator_static_range.go | 3 + pkg/{backend => backend-orig}/backend/be.go | 5 +- .../backend/cache_context.go | 3 + .../backend/cache_interface.go | 3 + pkg/backend-orig/backend/context.go | 70 + .../backend/store.go | 12 +- .../backend/store_interface.go | 3 + .../doc.go => pkg/backend/backend_config.go | 12 +- pkg/backend/backend_interface.go | 38 + pkg/backend/cache_instance.go | 48 + pkg/backend/cache_interface.go | 80 + pkg/backend/{backend => }/context.go | 0 pkg/backend/extcomm/extcomm_helpers_test.go | 105 - pkg/backend/extcomm/extcomm_index_test.go | 53 - pkg/backend/extcomm/extcomm_test.go | 133 - pkg/backend/generic/applicator.go | 140 + pkg/backend/generic/applicator_dynamic_id.go | 156 + pkg/backend/generic/applicator_static_id.go | 152 + .../generic/applicator_static_range.go | 167 + pkg/backend/generic/backend.go | 221 + pkg/backend/generic/backend_store.go | 364 + pkg/backend/generic/cache_instance.go | 51 + pkg/backend/genid/genid_helpers_test.go | 104 - pkg/backend/genid/genid_index_test.go | 53 - pkg/backend/genid/genid_test.go | 133 - pkg/backend/invoker.go | 68 + pkg/backend/ipam/applicator.go | 520 - .../ipam/applicator_dynamic_address_apply.go | 222 - .../ipam/applicator_dynamic_prefix_apply.go | 119 - .../ipam/applicator_static_address_apply.go | 47 - .../applicator_static_address_validate.go | 154 - .../ipam/applicator_static_prefix_apply.go | 40 - .../ipam/applicator_static_prefix_validate.go | 177 - .../ipam/applicator_static_range_apply.go | 50 - .../ipam/applicator_static_range_validate.go | 130 - pkg/backend/ipam/context.go | 78 - pkg/backend/ipam/ipam.go | 211 - pkg/backend/ipam/ipam_dynamic_address_test.go | 167 - pkg/backend/ipam/ipam_dynamic_prefix_test.go | 131 - pkg/backend/ipam/ipam_index_test.go | 35 - pkg/backend/ipam/ipam_static_address_test.go | 215 - pkg/backend/ipam/ipam_static_prefix_test.go | 273 - pkg/backend/ipam/ipam_static_range_test.go | 165 - pkg/backend/ipam/ipam_test_helpers.go | 168 - pkg/backend/ipam/store.go | 337 - pkg/backend/ipam/store_cache_context.go | 48 - pkg/backend/vlan/vlan_helpers_test.go | 102 - pkg/backend/vlan/vlan_index_test.go | 40 - pkg/backend/vlan/vlan_test.go | 128 - pkg/backend/vxlan/vxlan_helpers_test.go | 102 - pkg/backend/vxlan/vxlan_index_test.go | 40 - pkg/backend/vxlan/vxlan_test.go | 128 - .../clientset/versioned/clientset.go | 119 + .../versioned/fake/clientset_generated.go | 88 + .../generated/clientset/versioned/fake/doc.go | 0 .../clientset/versioned/fake/register.go | 14 - .../clientset/versioned/scheme/doc.go | 0 .../clientset/versioned/scheme/register.go | 14 - .../versioned/typed/as/v1alpha1/as_client.go | 2 +- .../versioned/typed/as/v1alpha1/asclaim.go | 68 + .../versioned/typed/as/v1alpha1/asentry.go | 68 + .../versioned/typed/as/v1alpha1/asindex.go | 68 + .../versioned/typed/as/v1alpha1/doc.go | 0 .../versioned/typed/as/v1alpha1/fake/doc.go | 0 .../typed/as/v1alpha1/fake/fake_as_client.go | 2 +- .../typed/as/v1alpha1/fake/fake_asclaim.go | 36 +- .../typed/as/v1alpha1/fake/fake_asentry.go | 36 +- .../typed/as/v1alpha1/fake/fake_asindex.go | 36 +- .../typed/as/v1alpha1/generated_expansion.go | 0 .../externalversions/as/interface.go | 4 +- .../externalversions/as/v1alpha1/asclaim.go | 6 +- .../externalversions/as/v1alpha1/asentry.go | 6 +- .../externalversions/as/v1alpha1/asindex.go | 6 +- .../externalversions/as/v1alpha1/interface.go | 2 +- .../informers/externalversions/factory.go | 49 +- .../informers/externalversions/generic.go | 65 + .../internalinterfaces/factory_interfaces.go | 2 +- .../generated/listers/as/v1alpha1/asclaim.go | 39 +- .../generated/listers/as/v1alpha1/asentry.go | 39 +- .../generated/listers/as/v1alpha1/asindex.go | 39 +- .../as/v1alpha1/expansion_generated.go | 0 pkg/generated/openapi/zz_generated.openapi.go | 2725 +++ pkg/kuidserver/claimserver/apistore.go | 5 +- pkg/kuidserver/claimserver/fieldselector.go | 3 + pkg/kuidserver/claimserver/strategy.go | 5 +- pkg/kuidserver/claimserver/strategy_create.go | 3 + pkg/kuidserver/claimserver/strategy_delete.go | 3 + pkg/kuidserver/claimserver/strategy_get.go | 3 + pkg/kuidserver/claimserver/strategy_list.go | 3 + pkg/kuidserver/claimserver/strategy_update.go | 3 + pkg/kuidserver/claimserver/strategy_watch.go | 3 + pkg/kuidserver/claimserver/table.go | 7 +- pkg/kuidserver/claimserver/watcher.go | 3 + pkg/kuidserver/entryserver/apistore.go | 5 +- pkg/kuidserver/entryserver/fieldselector.go | 2 + pkg/kuidserver/entryserver/strategy.go | 5 +- pkg/kuidserver/entryserver/strategy_create.go | 3 + pkg/kuidserver/entryserver/strategy_delete.go | 2 + pkg/kuidserver/entryserver/strategy_get.go | 3 + pkg/kuidserver/entryserver/strategy_list.go | 3 + pkg/kuidserver/entryserver/strategy_update.go | 3 + pkg/kuidserver/entryserver/strategy_watch.go | 3 + pkg/kuidserver/entryserver/table.go | 7 +- pkg/kuidserver/entryserver/watcher.go | 3 + pkg/kuidserver/genericserver/apistore.go | 3 + pkg/kuidserver/genericserver/fieldselector.go | 3 + pkg/kuidserver/genericserver/strategy.go | 11 +- .../genericserver/strategy_create.go | 3 + .../genericserver/strategy_delete.go | 3 + pkg/kuidserver/genericserver/strategy_get.go | 3 + pkg/kuidserver/genericserver/strategy_list.go | 3 + .../genericserver/strategy_update.go | 3 + .../genericserver/strategy_watch.go | 3 + pkg/kuidserver/genericserver/table.go | 7 +- pkg/kuidserver/genericserver/watcher.go | 3 + pkg/kuidserver/indexserver/apistore.go | 5 +- pkg/kuidserver/indexserver/fieldselector.go | 3 + pkg/kuidserver/indexserver/strategy.go | 5 +- pkg/kuidserver/indexserver/strategy_create.go | 4 + pkg/kuidserver/indexserver/strategy_delete.go | 3 + pkg/kuidserver/indexserver/strategy_get.go | 3 + pkg/kuidserver/indexserver/strategy_list.go | 3 + pkg/kuidserver/indexserver/strategy_update.go | 3 + pkg/kuidserver/indexserver/strategy_watch.go | 3 + pkg/kuidserver/indexserver/table.go | 7 +- pkg/kuidserver/indexserver/watcher.go | 3 + pkg/kuidserver/store/store.go | 3 + pkg/reconcilers/all/all.go | 10 - pkg/reconcilers/asclaim/reconciler.go | 22 +- pkg/reconcilers/asindex/reconciler.go | 9 +- pkg/reconcilers/ctrlconfig/config.go | 12 +- pkg/reconcilers/eventhandler/watch_asentry.go | 7 +- .../eventhandler/watch_extcommentry.go | 88 - .../eventhandler/watch_genidentry.go | 88 - pkg/reconcilers/eventhandler/watch_ipentry.go | 88 - .../eventhandler/watch_vlanentry.go | 88 - .../eventhandler/watch_vxlanentry.go | 88 - pkg/reconcilers/extcommclaim/reconciler.go | 149 - pkg/reconcilers/extcommindex/reconciler.go | 203 - pkg/reconcilers/genidclaim/reconciler.go | 149 - pkg/reconcilers/genidindex/reconciler.go | 203 - pkg/reconcilers/ipclaim/reconciler.go | 147 - pkg/reconcilers/ipindex/reconciler.go | 224 - pkg/reconcilers/vlanclaim/reconciler.go | 151 - pkg/reconcilers/vlanindex/reconciler.go | 206 - pkg/reconcilers/vxlanclaim/reconciler.go | 149 - pkg/reconcilers/vxlanindex/reconciler.go | 203 - .../generic/invoker.go} | 15 +- pkg/registry/generic/store.go | 140 + pkg/registry/generic/strategy_resource.go | 304 + pkg/registry/generic/strategy_status.go | 137 + pkg/registry/generic/watcher.go | 222 + pkg/registry/options/options.go | 58 + pkg/registry/store/store.go | 87 + pkg/resources/recources.go | 4 +- tools/apiserver-runtime-gen/main.go | 219 +- 539 files changed, 10080 insertions(+), 110496 deletions(-) create mode 100644 DESIGN-DEPLOYMENTS.md rename apis/backend/as/{v1alpha1/asclaim_interface.go => asclaim_object.go} (51%) create mode 100644 apis/backend/as/asclaim_resource.go rename apis/backend/as/{v1alpha1 => }/asclaim_syntaxvalidator.go (85%) rename apis/backend/{vxlan/v1alpha1/vxlanclaim_types.go => as/asclaim_types.go} (51%) create mode 100644 apis/backend/as/asentry_object.go create mode 100644 apis/backend/as/asentry_resource.go create mode 100644 apis/backend/as/asentry_types.go create mode 100644 apis/backend/as/asindex_helpers.go create mode 100644 apis/backend/as/asindex_object.go create mode 100644 apis/backend/as/asindex_resource.go rename apis/backend/{vlan/v1alpha1/vlanindex_types.go => as/asindex_types.go} (64%) create mode 100644 apis/backend/as/handlers/confighandler.go rename apis/{generated/clientset/versioned/typed/extcomm/v1alpha1/generated_expansion.go => backend/as/helper.go} (53%) create mode 100644 apis/backend/as/register.go create mode 100644 apis/backend/as/storage.go create mode 100644 apis/backend/as/v1alpha1/asclaim_resource.go delete mode 100644 apis/backend/as/v1alpha1/asentry_interface.go create mode 100644 apis/backend/as/v1alpha1/asentry_resource.go rename apis/backend/as/v1alpha1/{as_types.go => asindex_helper.go} (100%) delete mode 100644 apis/backend/as/v1alpha1/asindex_interface.go create mode 100644 apis/backend/as/v1alpha1/asindex_resource.go create mode 100644 apis/backend/as/v1alpha1/conversion.go delete mode 100644 apis/backend/as/v1alpha1/generated.pb.go delete mode 100644 apis/backend/as/v1alpha1/generated.proto rename pkg/backend/ipam/applicator_dynamic_address_validate.go => apis/backend/as/v1alpha1/helper.go (58%) rename apis/backend/{ipam/v1alpha1/ipclaim_syntaxvalidator.go => as/v1alpha1/zz_generated.defaults.go} (58%) rename apis/backend/as/{v1alpha1 => }/zz_generated.deepcopy.go (89%) delete mode 100644 apis/backend/esi/v1alpha1/doc.go delete mode 100644 apis/backend/esi/v1alpha1/esi_types.go delete mode 100644 apis/backend/esi/v1alpha1/esiclaim_interface.go delete mode 100644 apis/backend/esi/v1alpha1/esiclaim_syntaxvalidator.go delete mode 100644 apis/backend/esi/v1alpha1/esiclaim_types.go delete mode 100644 apis/backend/esi/v1alpha1/esientry_interface.go delete mode 100644 apis/backend/esi/v1alpha1/esientry_types.go delete mode 100644 apis/backend/esi/v1alpha1/esiindex_interface.go delete mode 100644 apis/backend/esi/v1alpha1/esiindex_types.go delete mode 100644 apis/backend/esi/v1alpha1/generated.pb.go delete mode 100644 apis/backend/esi/v1alpha1/generated.proto delete mode 100644 apis/backend/esi/v1alpha1/register.go delete mode 100644 apis/backend/esi/v1alpha1/zz_generated.deepcopy.go delete mode 100644 apis/backend/extcomm/doc.go delete mode 100644 apis/backend/extcomm/v1alpha1/doc.go delete mode 100644 apis/backend/extcomm/v1alpha1/extcomm_types.go delete mode 100644 apis/backend/extcomm/v1alpha1/extcommclaim_interface.go delete mode 100644 apis/backend/extcomm/v1alpha1/extcommclaim_syntaxvalidator.go delete mode 100644 apis/backend/extcomm/v1alpha1/extcommclaim_types.go delete mode 100644 apis/backend/extcomm/v1alpha1/extcommentry_interface.go delete mode 100644 apis/backend/extcomm/v1alpha1/extcommentry_types.go delete mode 100644 apis/backend/extcomm/v1alpha1/extcommindex_interface.go delete mode 100644 apis/backend/extcomm/v1alpha1/extcommindex_types.go delete mode 100644 apis/backend/extcomm/v1alpha1/generated.pb.go delete mode 100644 apis/backend/extcomm/v1alpha1/generated.proto delete mode 100644 apis/backend/extcomm/v1alpha1/register.go delete mode 100644 apis/backend/extcomm/v1alpha1/zz_generated.deepcopy.go delete mode 100644 apis/backend/genid/doc.go delete mode 100644 apis/backend/genid/v1alpha1/doc.go delete mode 100644 apis/backend/genid/v1alpha1/generated.pb.go delete mode 100644 apis/backend/genid/v1alpha1/generated.proto delete mode 100644 apis/backend/genid/v1alpha1/genid_types.go delete mode 100644 apis/backend/genid/v1alpha1/genidclaim_interface.go delete mode 100644 apis/backend/genid/v1alpha1/genidclaim_syntaxvalidator.go delete mode 100644 apis/backend/genid/v1alpha1/genidclaim_types.go delete mode 100644 apis/backend/genid/v1alpha1/genidentry_interface.go delete mode 100644 apis/backend/genid/v1alpha1/genidentry_types.go delete mode 100644 apis/backend/genid/v1alpha1/genidindex_interface.go delete mode 100644 apis/backend/genid/v1alpha1/genidindex_types.go delete mode 100644 apis/backend/genid/v1alpha1/register.go delete mode 100644 apis/backend/genid/v1alpha1/zz_generated.deepcopy.go delete mode 100644 apis/backend/infra/doc.go delete mode 100644 apis/backend/infra/v1alpha1/bfd_types.go delete mode 100644 apis/backend/infra/v1alpha1/cluster_interface.go delete mode 100644 apis/backend/infra/v1alpha1/cluster_types.go delete mode 100644 apis/backend/infra/v1alpha1/doc.go delete mode 100644 apis/backend/infra/v1alpha1/endpoint_interface.go delete mode 100644 apis/backend/infra/v1alpha1/endpoint_types.go delete mode 100644 apis/backend/infra/v1alpha1/endpointset_interface.go delete mode 100644 apis/backend/infra/v1alpha1/endpointset_types.go delete mode 100644 apis/backend/infra/v1alpha1/generated.pb.go delete mode 100644 apis/backend/infra/v1alpha1/generated.proto delete mode 100644 apis/backend/infra/v1alpha1/id.go delete mode 100644 apis/backend/infra/v1alpha1/igp_types.go delete mode 100644 apis/backend/infra/v1alpha1/link_interface.go delete mode 100644 apis/backend/infra/v1alpha1/link_types.go delete mode 100644 apis/backend/infra/v1alpha1/linkset_interface.go delete mode 100644 apis/backend/infra/v1alpha1/linkset_types.go delete mode 100644 apis/backend/infra/v1alpha1/location.go delete mode 100644 apis/backend/infra/v1alpha1/module_interface.go delete mode 100644 apis/backend/infra/v1alpha1/module_types.go delete mode 100644 apis/backend/infra/v1alpha1/modulebay_interface.go delete mode 100644 apis/backend/infra/v1alpha1/modulebay_types.go delete mode 100644 apis/backend/infra/v1alpha1/node_interface.go delete mode 100644 apis/backend/infra/v1alpha1/node_types.go delete mode 100644 apis/backend/infra/v1alpha1/nodegroup_interface.go delete mode 100644 apis/backend/infra/v1alpha1/nodegroup_types.go delete mode 100644 apis/backend/infra/v1alpha1/nodeitem_interface.go delete mode 100644 apis/backend/infra/v1alpha1/nodeitem_types.go delete mode 100644 apis/backend/infra/v1alpha1/nodeset_interface.go delete mode 100644 apis/backend/infra/v1alpha1/nodeset_types.go delete mode 100644 apis/backend/infra/v1alpha1/objectreference.go delete mode 100644 apis/backend/infra/v1alpha1/rack_interface.go delete mode 100644 apis/backend/infra/v1alpha1/rack_types.go delete mode 100644 apis/backend/infra/v1alpha1/region_interface.go delete mode 100644 apis/backend/infra/v1alpha1/region_types.go delete mode 100644 apis/backend/infra/v1alpha1/register.go delete mode 100644 apis/backend/infra/v1alpha1/site_interface.go delete mode 100644 apis/backend/infra/v1alpha1/site_types.go delete mode 100644 apis/backend/infra/v1alpha1/zz_generated.deepcopy.go delete mode 100644 apis/backend/ipam/doc.go delete mode 100644 apis/backend/ipam/v1alpha1/doc.go delete mode 100644 apis/backend/ipam/v1alpha1/generated.pb.go delete mode 100644 apis/backend/ipam/v1alpha1/generated.proto delete mode 100644 apis/backend/ipam/v1alpha1/ipam_types.go delete mode 100644 apis/backend/ipam/v1alpha1/ipclaim_interface.go delete mode 100644 apis/backend/ipam/v1alpha1/ipclaim_syntaxvalidator_dynamic_address.go delete mode 100644 apis/backend/ipam/v1alpha1/ipclaim_syntaxvalidator_dynamic_prefix.go delete mode 100644 apis/backend/ipam/v1alpha1/ipclaim_syntaxvalidator_static_address.go delete mode 100644 apis/backend/ipam/v1alpha1/ipclaim_syntaxvalidator_static_prefix.go delete mode 100644 apis/backend/ipam/v1alpha1/ipclaim_syntaxvalidator_static_range.go delete mode 100644 apis/backend/ipam/v1alpha1/ipclaim_types.go delete mode 100644 apis/backend/ipam/v1alpha1/ipentry_interface.go delete mode 100644 apis/backend/ipam/v1alpha1/ipentry_interface_test.go delete mode 100644 apis/backend/ipam/v1alpha1/ipentry_types.go delete mode 100644 apis/backend/ipam/v1alpha1/ipindex_interface.go delete mode 100644 apis/backend/ipam/v1alpha1/ipindex_types.go delete mode 100644 apis/backend/ipam/v1alpha1/register.go delete mode 100644 apis/backend/ipam/v1alpha1/zz_generated.deepcopy.go create mode 100644 apis/backend/storage_providers.go delete mode 100644 apis/backend/vlan/doc.go delete mode 100644 apis/backend/vlan/v1alpha1/doc.go delete mode 100644 apis/backend/vlan/v1alpha1/generated.pb.go delete mode 100644 apis/backend/vlan/v1alpha1/generated.proto delete mode 100644 apis/backend/vlan/v1alpha1/register.go delete mode 100644 apis/backend/vlan/v1alpha1/vlan_types.go delete mode 100644 apis/backend/vlan/v1alpha1/vlanclaim_interface.go delete mode 100644 apis/backend/vlan/v1alpha1/vlanclaim_syntaxvalidator.go delete mode 100644 apis/backend/vlan/v1alpha1/vlanclaim_types.go delete mode 100644 apis/backend/vlan/v1alpha1/vlanentry_interface.go delete mode 100644 apis/backend/vlan/v1alpha1/vlanentry_types.go delete mode 100644 apis/backend/vlan/v1alpha1/vlanindex_interface.go delete mode 100644 apis/backend/vlan/v1alpha1/zz_generated.deepcopy.go delete mode 100644 apis/backend/vxlan/doc.go delete mode 100644 apis/backend/vxlan/v1alpha1/doc.go delete mode 100644 apis/backend/vxlan/v1alpha1/generated.pb.go delete mode 100644 apis/backend/vxlan/v1alpha1/generated.proto delete mode 100644 apis/backend/vxlan/v1alpha1/register.go delete mode 100644 apis/backend/vxlan/v1alpha1/vxlan_types.go delete mode 100644 apis/backend/vxlan/v1alpha1/vxlanclaim_interface.go delete mode 100644 apis/backend/vxlan/v1alpha1/vxlanclaim_syntaxvalidator.go delete mode 100644 apis/backend/vxlan/v1alpha1/vxlanentry_interface.go delete mode 100644 apis/backend/vxlan/v1alpha1/vxlanentry_types.go delete mode 100644 apis/backend/vxlan/v1alpha1/vxlanindex_interface.go delete mode 100644 apis/backend/vxlan/v1alpha1/vxlanindex_types.go delete mode 100644 apis/backend/vxlan/v1alpha1/zz_generated.deepcopy.go rename apis/{backend => common}/doc.go (97%) create mode 100644 apis/common/labels.go delete mode 100644 apis/common/v1alpha1/generated.pb.go delete mode 100644 apis/common/v1alpha1/generated.proto delete mode 100644 apis/common/v1alpha1/owner.go rename apis/{condition/v1alpha1 => common}/zz_generated.deepcopy.go (61%) delete mode 100644 apis/condition/v1alpha1/condition.go delete mode 100644 apis/condition/v1alpha1/generated.pb.go delete mode 100644 apis/condition/v1alpha1/generated.proto delete mode 100644 apis/generated/clientset/versioned/clientset.go delete mode 100644 apis/generated/clientset/versioned/fake/clientset_generated.go delete mode 100644 apis/generated/clientset/versioned/typed/as/v1alpha1/asclaim.go delete mode 100644 apis/generated/clientset/versioned/typed/as/v1alpha1/asentry.go delete mode 100644 apis/generated/clientset/versioned/typed/as/v1alpha1/asindex.go delete mode 100644 apis/generated/clientset/versioned/typed/esi/v1alpha1/doc.go delete mode 100644 apis/generated/clientset/versioned/typed/esi/v1alpha1/esi_client.go delete mode 100644 apis/generated/clientset/versioned/typed/esi/v1alpha1/esiclaim.go delete mode 100644 apis/generated/clientset/versioned/typed/esi/v1alpha1/esientry.go delete mode 100644 apis/generated/clientset/versioned/typed/esi/v1alpha1/esiindex.go delete mode 100644 apis/generated/clientset/versioned/typed/esi/v1alpha1/fake/doc.go delete mode 100644 apis/generated/clientset/versioned/typed/esi/v1alpha1/fake/fake_esi_client.go delete mode 100644 apis/generated/clientset/versioned/typed/esi/v1alpha1/fake/fake_esiclaim.go delete mode 100644 apis/generated/clientset/versioned/typed/esi/v1alpha1/fake/fake_esientry.go delete mode 100644 apis/generated/clientset/versioned/typed/esi/v1alpha1/fake/fake_esiindex.go delete mode 100644 apis/generated/clientset/versioned/typed/esi/v1alpha1/generated_expansion.go delete mode 100644 apis/generated/clientset/versioned/typed/extcomm/v1alpha1/doc.go delete mode 100644 apis/generated/clientset/versioned/typed/extcomm/v1alpha1/extcomm_client.go delete mode 100644 apis/generated/clientset/versioned/typed/extcomm/v1alpha1/extcommclaim.go delete mode 100644 apis/generated/clientset/versioned/typed/extcomm/v1alpha1/extcommentry.go delete mode 100644 apis/generated/clientset/versioned/typed/extcomm/v1alpha1/extcommindex.go delete mode 100644 apis/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/doc.go delete mode 100644 apis/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/fake_extcomm_client.go delete mode 100644 apis/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/fake_extcommclaim.go delete mode 100644 apis/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/fake_extcommentry.go delete mode 100644 apis/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/fake_extcommindex.go delete mode 100644 apis/generated/clientset/versioned/typed/genid/v1alpha1/doc.go delete mode 100644 apis/generated/clientset/versioned/typed/genid/v1alpha1/fake/doc.go delete mode 100644 apis/generated/clientset/versioned/typed/genid/v1alpha1/fake/fake_genid_client.go delete mode 100644 apis/generated/clientset/versioned/typed/genid/v1alpha1/fake/fake_genidclaim.go delete mode 100644 apis/generated/clientset/versioned/typed/genid/v1alpha1/fake/fake_genidentry.go delete mode 100644 apis/generated/clientset/versioned/typed/genid/v1alpha1/fake/fake_genidindex.go delete mode 100644 apis/generated/clientset/versioned/typed/genid/v1alpha1/generated_expansion.go delete mode 100644 apis/generated/clientset/versioned/typed/genid/v1alpha1/genid_client.go delete mode 100644 apis/generated/clientset/versioned/typed/genid/v1alpha1/genidclaim.go delete mode 100644 apis/generated/clientset/versioned/typed/genid/v1alpha1/genidentry.go delete mode 100644 apis/generated/clientset/versioned/typed/genid/v1alpha1/genidindex.go delete mode 100644 apis/generated/clientset/versioned/typed/infra/v1alpha1/cluster.go delete mode 100644 apis/generated/clientset/versioned/typed/infra/v1alpha1/doc.go delete mode 100644 apis/generated/clientset/versioned/typed/infra/v1alpha1/endpoint.go delete mode 100644 apis/generated/clientset/versioned/typed/infra/v1alpha1/endpointset.go delete mode 100644 apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/doc.go delete mode 100644 apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_cluster.go delete mode 100644 apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_endpoint.go delete mode 100644 apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_endpointset.go delete mode 100644 apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_infra_client.go delete mode 100644 apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_link.go delete mode 100644 apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_linkset.go delete mode 100644 apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_module.go delete mode 100644 apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_modulebay.go delete mode 100644 apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_node.go delete mode 100644 apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_nodegroup.go delete mode 100644 apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_nodeitem.go delete mode 100644 apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_nodeset.go delete mode 100644 apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_rack.go delete mode 100644 apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_region.go delete mode 100644 apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_site.go delete mode 100644 apis/generated/clientset/versioned/typed/infra/v1alpha1/generated_expansion.go delete mode 100644 apis/generated/clientset/versioned/typed/infra/v1alpha1/infra_client.go delete mode 100644 apis/generated/clientset/versioned/typed/infra/v1alpha1/link.go delete mode 100644 apis/generated/clientset/versioned/typed/infra/v1alpha1/linkset.go delete mode 100644 apis/generated/clientset/versioned/typed/infra/v1alpha1/module.go delete mode 100644 apis/generated/clientset/versioned/typed/infra/v1alpha1/modulebay.go delete mode 100644 apis/generated/clientset/versioned/typed/infra/v1alpha1/node.go delete mode 100644 apis/generated/clientset/versioned/typed/infra/v1alpha1/nodegroup.go delete mode 100644 apis/generated/clientset/versioned/typed/infra/v1alpha1/nodeitem.go delete mode 100644 apis/generated/clientset/versioned/typed/infra/v1alpha1/nodeset.go delete mode 100644 apis/generated/clientset/versioned/typed/infra/v1alpha1/rack.go delete mode 100644 apis/generated/clientset/versioned/typed/infra/v1alpha1/region.go delete mode 100644 apis/generated/clientset/versioned/typed/infra/v1alpha1/site.go delete mode 100644 apis/generated/clientset/versioned/typed/ipam/v1alpha1/doc.go delete mode 100644 apis/generated/clientset/versioned/typed/ipam/v1alpha1/fake/doc.go delete mode 100644 apis/generated/clientset/versioned/typed/ipam/v1alpha1/fake/fake_ipam_client.go delete mode 100644 apis/generated/clientset/versioned/typed/ipam/v1alpha1/fake/fake_ipclaim.go delete mode 100644 apis/generated/clientset/versioned/typed/ipam/v1alpha1/fake/fake_ipentry.go delete mode 100644 apis/generated/clientset/versioned/typed/ipam/v1alpha1/fake/fake_ipindex.go delete mode 100644 apis/generated/clientset/versioned/typed/ipam/v1alpha1/generated_expansion.go delete mode 100644 apis/generated/clientset/versioned/typed/ipam/v1alpha1/ipam_client.go delete mode 100644 apis/generated/clientset/versioned/typed/ipam/v1alpha1/ipclaim.go delete mode 100644 apis/generated/clientset/versioned/typed/ipam/v1alpha1/ipentry.go delete mode 100644 apis/generated/clientset/versioned/typed/ipam/v1alpha1/ipindex.go delete mode 100644 apis/generated/clientset/versioned/typed/vlan/v1alpha1/doc.go delete mode 100644 apis/generated/clientset/versioned/typed/vlan/v1alpha1/fake/doc.go delete mode 100644 apis/generated/clientset/versioned/typed/vlan/v1alpha1/fake/fake_vlan_client.go delete mode 100644 apis/generated/clientset/versioned/typed/vlan/v1alpha1/fake/fake_vlanclaim.go delete mode 100644 apis/generated/clientset/versioned/typed/vlan/v1alpha1/fake/fake_vlanentry.go delete mode 100644 apis/generated/clientset/versioned/typed/vlan/v1alpha1/fake/fake_vlanindex.go delete mode 100644 apis/generated/clientset/versioned/typed/vlan/v1alpha1/generated_expansion.go delete mode 100644 apis/generated/clientset/versioned/typed/vlan/v1alpha1/vlan_client.go delete mode 100644 apis/generated/clientset/versioned/typed/vlan/v1alpha1/vlanclaim.go delete mode 100644 apis/generated/clientset/versioned/typed/vlan/v1alpha1/vlanentry.go delete mode 100644 apis/generated/clientset/versioned/typed/vlan/v1alpha1/vlanindex.go delete mode 100644 apis/generated/clientset/versioned/typed/vxlan/v1alpha1/doc.go delete mode 100644 apis/generated/clientset/versioned/typed/vxlan/v1alpha1/fake/doc.go delete mode 100644 apis/generated/clientset/versioned/typed/vxlan/v1alpha1/fake/fake_vxlan_client.go delete mode 100644 apis/generated/clientset/versioned/typed/vxlan/v1alpha1/fake/fake_vxlanclaim.go delete mode 100644 apis/generated/clientset/versioned/typed/vxlan/v1alpha1/fake/fake_vxlanentry.go delete mode 100644 apis/generated/clientset/versioned/typed/vxlan/v1alpha1/fake/fake_vxlanindex.go delete mode 100644 apis/generated/clientset/versioned/typed/vxlan/v1alpha1/generated_expansion.go delete mode 100644 apis/generated/clientset/versioned/typed/vxlan/v1alpha1/vxlan_client.go delete mode 100644 apis/generated/clientset/versioned/typed/vxlan/v1alpha1/vxlanclaim.go delete mode 100644 apis/generated/clientset/versioned/typed/vxlan/v1alpha1/vxlanentry.go delete mode 100644 apis/generated/clientset/versioned/typed/vxlan/v1alpha1/vxlanindex.go delete mode 100644 apis/generated/informers/externalversions/esi/interface.go delete mode 100644 apis/generated/informers/externalversions/esi/v1alpha1/esiclaim.go delete mode 100644 apis/generated/informers/externalversions/esi/v1alpha1/esientry.go delete mode 100644 apis/generated/informers/externalversions/esi/v1alpha1/esiindex.go delete mode 100644 apis/generated/informers/externalversions/esi/v1alpha1/interface.go delete mode 100644 apis/generated/informers/externalversions/extcomm/interface.go delete mode 100644 apis/generated/informers/externalversions/extcomm/v1alpha1/extcommclaim.go delete mode 100644 apis/generated/informers/externalversions/extcomm/v1alpha1/extcommentry.go delete mode 100644 apis/generated/informers/externalversions/extcomm/v1alpha1/extcommindex.go delete mode 100644 apis/generated/informers/externalversions/extcomm/v1alpha1/interface.go delete mode 100644 apis/generated/informers/externalversions/generic.go delete mode 100644 apis/generated/informers/externalversions/genid/interface.go delete mode 100644 apis/generated/informers/externalversions/genid/v1alpha1/genidclaim.go delete mode 100644 apis/generated/informers/externalversions/genid/v1alpha1/genidentry.go delete mode 100644 apis/generated/informers/externalversions/genid/v1alpha1/genidindex.go delete mode 100644 apis/generated/informers/externalversions/genid/v1alpha1/interface.go delete mode 100644 apis/generated/informers/externalversions/infra/interface.go delete mode 100644 apis/generated/informers/externalversions/infra/v1alpha1/cluster.go delete mode 100644 apis/generated/informers/externalversions/infra/v1alpha1/endpoint.go delete mode 100644 apis/generated/informers/externalversions/infra/v1alpha1/endpointset.go delete mode 100644 apis/generated/informers/externalversions/infra/v1alpha1/interface.go delete mode 100644 apis/generated/informers/externalversions/infra/v1alpha1/link.go delete mode 100644 apis/generated/informers/externalversions/infra/v1alpha1/linkset.go delete mode 100644 apis/generated/informers/externalversions/infra/v1alpha1/module.go delete mode 100644 apis/generated/informers/externalversions/infra/v1alpha1/modulebay.go delete mode 100644 apis/generated/informers/externalversions/infra/v1alpha1/node.go delete mode 100644 apis/generated/informers/externalversions/infra/v1alpha1/nodegroup.go delete mode 100644 apis/generated/informers/externalversions/infra/v1alpha1/nodeitem.go delete mode 100644 apis/generated/informers/externalversions/infra/v1alpha1/nodeset.go delete mode 100644 apis/generated/informers/externalversions/infra/v1alpha1/rack.go delete mode 100644 apis/generated/informers/externalversions/infra/v1alpha1/region.go delete mode 100644 apis/generated/informers/externalversions/infra/v1alpha1/site.go delete mode 100644 apis/generated/informers/externalversions/ipam/interface.go delete mode 100644 apis/generated/informers/externalversions/ipam/v1alpha1/interface.go delete mode 100644 apis/generated/informers/externalversions/ipam/v1alpha1/ipclaim.go delete mode 100644 apis/generated/informers/externalversions/ipam/v1alpha1/ipentry.go delete mode 100644 apis/generated/informers/externalversions/ipam/v1alpha1/ipindex.go delete mode 100644 apis/generated/informers/externalversions/vlan/interface.go delete mode 100644 apis/generated/informers/externalversions/vlan/v1alpha1/interface.go delete mode 100644 apis/generated/informers/externalversions/vlan/v1alpha1/vlanclaim.go delete mode 100644 apis/generated/informers/externalversions/vlan/v1alpha1/vlanentry.go delete mode 100644 apis/generated/informers/externalversions/vlan/v1alpha1/vlanindex.go delete mode 100644 apis/generated/informers/externalversions/vxlan/interface.go delete mode 100644 apis/generated/informers/externalversions/vxlan/v1alpha1/interface.go delete mode 100644 apis/generated/informers/externalversions/vxlan/v1alpha1/vxlanclaim.go delete mode 100644 apis/generated/informers/externalversions/vxlan/v1alpha1/vxlanentry.go delete mode 100644 apis/generated/informers/externalversions/vxlan/v1alpha1/vxlanindex.go delete mode 100644 apis/generated/listers/esi/v1alpha1/esiclaim.go delete mode 100644 apis/generated/listers/esi/v1alpha1/esientry.go delete mode 100644 apis/generated/listers/esi/v1alpha1/esiindex.go delete mode 100644 apis/generated/listers/esi/v1alpha1/expansion_generated.go delete mode 100644 apis/generated/listers/extcomm/v1alpha1/expansion_generated.go delete mode 100644 apis/generated/listers/extcomm/v1alpha1/extcommclaim.go delete mode 100644 apis/generated/listers/extcomm/v1alpha1/extcommentry.go delete mode 100644 apis/generated/listers/extcomm/v1alpha1/extcommindex.go delete mode 100644 apis/generated/listers/genid/v1alpha1/expansion_generated.go delete mode 100644 apis/generated/listers/genid/v1alpha1/genidclaim.go delete mode 100644 apis/generated/listers/genid/v1alpha1/genidentry.go delete mode 100644 apis/generated/listers/genid/v1alpha1/genidindex.go delete mode 100644 apis/generated/listers/infra/v1alpha1/cluster.go delete mode 100644 apis/generated/listers/infra/v1alpha1/endpoint.go delete mode 100644 apis/generated/listers/infra/v1alpha1/endpointset.go delete mode 100644 apis/generated/listers/infra/v1alpha1/expansion_generated.go delete mode 100644 apis/generated/listers/infra/v1alpha1/link.go delete mode 100644 apis/generated/listers/infra/v1alpha1/linkset.go delete mode 100644 apis/generated/listers/infra/v1alpha1/module.go delete mode 100644 apis/generated/listers/infra/v1alpha1/modulebay.go delete mode 100644 apis/generated/listers/infra/v1alpha1/node.go delete mode 100644 apis/generated/listers/infra/v1alpha1/nodegroup.go delete mode 100644 apis/generated/listers/infra/v1alpha1/nodeitem.go delete mode 100644 apis/generated/listers/infra/v1alpha1/nodeset.go delete mode 100644 apis/generated/listers/infra/v1alpha1/rack.go delete mode 100644 apis/generated/listers/infra/v1alpha1/region.go delete mode 100644 apis/generated/listers/infra/v1alpha1/site.go delete mode 100644 apis/generated/listers/ipam/v1alpha1/expansion_generated.go delete mode 100644 apis/generated/listers/ipam/v1alpha1/ipclaim.go delete mode 100644 apis/generated/listers/ipam/v1alpha1/ipentry.go delete mode 100644 apis/generated/listers/ipam/v1alpha1/ipindex.go delete mode 100644 apis/generated/listers/vlan/v1alpha1/expansion_generated.go delete mode 100644 apis/generated/listers/vlan/v1alpha1/vlanclaim.go delete mode 100644 apis/generated/listers/vlan/v1alpha1/vlanentry.go delete mode 100644 apis/generated/listers/vlan/v1alpha1/vlanindex.go delete mode 100644 apis/generated/listers/vxlan/v1alpha1/expansion_generated.go delete mode 100644 apis/generated/listers/vxlan/v1alpha1/vxlanclaim.go delete mode 100644 apis/generated/listers/vxlan/v1alpha1/vxlanentry.go delete mode 100644 apis/generated/listers/vxlan/v1alpha1/vxlanindex.go delete mode 100644 apis/generated/openapi/zz_generated.openapi.go rename apis/{condition => id}/doc.go (91%) create mode 100644 apis/id/id.go rename apis/{condition => id}/v1alpha1/doc.go (100%) create mode 100644 apis/id/v1alpha1/id.go create mode 100644 apis/id/v1alpha1/zz_generated.deepcopy.go create mode 100644 apis/id/zz_generated.deepcopy.go rename pkg/{backend => backend-orig}/as/as_helpers_test.go (99%) rename pkg/{backend => backend-orig}/as/as_index_test.go (99%) rename pkg/{backend => backend-orig}/as/as_test.go (99%) rename pkg/{backend => backend-orig}/backend/applicator.go (99%) rename pkg/{backend => backend-orig}/backend/applicator_dynamic_id.go (98%) rename pkg/{backend => backend-orig}/backend/applicator_static_id.go (99%) rename pkg/{backend => backend-orig}/backend/applicator_static_range.go (99%) rename pkg/{backend => backend-orig}/backend/be.go (99%) rename pkg/{backend => backend-orig}/backend/cache_context.go (99%) rename pkg/{backend => backend-orig}/backend/cache_interface.go (99%) create mode 100644 pkg/backend-orig/backend/context.go rename pkg/{backend => backend-orig}/backend/store.go (99%) rename pkg/{backend => backend-orig}/backend/store_interface.go (99%) rename apis/backend/esi/doc.go => pkg/backend/backend_config.go (79%) create mode 100644 pkg/backend/backend_interface.go create mode 100644 pkg/backend/cache_instance.go create mode 100644 pkg/backend/cache_interface.go rename pkg/backend/{backend => }/context.go (100%) delete mode 100644 pkg/backend/extcomm/extcomm_helpers_test.go delete mode 100644 pkg/backend/extcomm/extcomm_index_test.go delete mode 100644 pkg/backend/extcomm/extcomm_test.go create mode 100644 pkg/backend/generic/applicator.go create mode 100644 pkg/backend/generic/applicator_dynamic_id.go create mode 100644 pkg/backend/generic/applicator_static_id.go create mode 100644 pkg/backend/generic/applicator_static_range.go create mode 100644 pkg/backend/generic/backend.go create mode 100644 pkg/backend/generic/backend_store.go create mode 100644 pkg/backend/generic/cache_instance.go delete mode 100644 pkg/backend/genid/genid_helpers_test.go delete mode 100644 pkg/backend/genid/genid_index_test.go delete mode 100644 pkg/backend/genid/genid_test.go create mode 100644 pkg/backend/invoker.go delete mode 100644 pkg/backend/ipam/applicator.go delete mode 100644 pkg/backend/ipam/applicator_dynamic_address_apply.go delete mode 100644 pkg/backend/ipam/applicator_dynamic_prefix_apply.go delete mode 100644 pkg/backend/ipam/applicator_static_address_apply.go delete mode 100644 pkg/backend/ipam/applicator_static_address_validate.go delete mode 100644 pkg/backend/ipam/applicator_static_prefix_apply.go delete mode 100644 pkg/backend/ipam/applicator_static_prefix_validate.go delete mode 100644 pkg/backend/ipam/applicator_static_range_apply.go delete mode 100644 pkg/backend/ipam/applicator_static_range_validate.go delete mode 100644 pkg/backend/ipam/context.go delete mode 100644 pkg/backend/ipam/ipam.go delete mode 100644 pkg/backend/ipam/ipam_dynamic_address_test.go delete mode 100644 pkg/backend/ipam/ipam_dynamic_prefix_test.go delete mode 100644 pkg/backend/ipam/ipam_index_test.go delete mode 100644 pkg/backend/ipam/ipam_static_address_test.go delete mode 100644 pkg/backend/ipam/ipam_static_prefix_test.go delete mode 100644 pkg/backend/ipam/ipam_static_range_test.go delete mode 100644 pkg/backend/ipam/ipam_test_helpers.go delete mode 100644 pkg/backend/ipam/store.go delete mode 100644 pkg/backend/ipam/store_cache_context.go delete mode 100644 pkg/backend/vlan/vlan_helpers_test.go delete mode 100644 pkg/backend/vlan/vlan_index_test.go delete mode 100644 pkg/backend/vlan/vlan_test.go delete mode 100644 pkg/backend/vxlan/vxlan_helpers_test.go delete mode 100644 pkg/backend/vxlan/vxlan_index_test.go delete mode 100644 pkg/backend/vxlan/vxlan_test.go create mode 100644 pkg/generated/clientset/versioned/clientset.go create mode 100644 pkg/generated/clientset/versioned/fake/clientset_generated.go rename {apis => pkg}/generated/clientset/versioned/fake/doc.go (100%) rename {apis => pkg}/generated/clientset/versioned/fake/register.go (73%) rename {apis => pkg}/generated/clientset/versioned/scheme/doc.go (100%) rename {apis => pkg}/generated/clientset/versioned/scheme/register.go (73%) rename {apis => pkg}/generated/clientset/versioned/typed/as/v1alpha1/as_client.go (97%) create mode 100644 pkg/generated/clientset/versioned/typed/as/v1alpha1/asclaim.go create mode 100644 pkg/generated/clientset/versioned/typed/as/v1alpha1/asentry.go create mode 100644 pkg/generated/clientset/versioned/typed/as/v1alpha1/asindex.go rename {apis => pkg}/generated/clientset/versioned/typed/as/v1alpha1/doc.go (100%) rename {apis => pkg}/generated/clientset/versioned/typed/as/v1alpha1/fake/doc.go (100%) rename {apis => pkg}/generated/clientset/versioned/typed/as/v1alpha1/fake/fake_as_client.go (93%) rename {apis => pkg}/generated/clientset/versioned/typed/as/v1alpha1/fake/fake_asclaim.go (76%) rename {apis => pkg}/generated/clientset/versioned/typed/as/v1alpha1/fake/fake_asentry.go (76%) rename {apis => pkg}/generated/clientset/versioned/typed/as/v1alpha1/fake/fake_asindex.go (76%) rename {apis => pkg}/generated/clientset/versioned/typed/as/v1alpha1/generated_expansion.go (100%) rename {apis => pkg}/generated/informers/externalversions/as/interface.go (87%) rename {apis => pkg}/generated/informers/externalversions/as/v1alpha1/asclaim.go (93%) rename {apis => pkg}/generated/informers/externalversions/as/v1alpha1/asentry.go (93%) rename {apis => pkg}/generated/informers/externalversions/as/v1alpha1/asindex.go (93%) rename {apis => pkg}/generated/informers/externalversions/as/v1alpha1/interface.go (94%) rename {apis => pkg}/generated/informers/externalversions/factory.go (83%) create mode 100644 pkg/generated/informers/externalversions/generic.go rename {apis => pkg}/generated/informers/externalversions/internalinterfaces/factory_interfaces.go (94%) rename {apis => pkg}/generated/listers/as/v1alpha1/asclaim.go (64%) rename {apis => pkg}/generated/listers/as/v1alpha1/asentry.go (65%) rename {apis => pkg}/generated/listers/as/v1alpha1/asindex.go (65%) rename {apis => pkg}/generated/listers/as/v1alpha1/expansion_generated.go (100%) create mode 100644 pkg/generated/openapi/zz_generated.openapi.go delete mode 100644 pkg/reconcilers/eventhandler/watch_extcommentry.go delete mode 100644 pkg/reconcilers/eventhandler/watch_genidentry.go delete mode 100644 pkg/reconcilers/eventhandler/watch_ipentry.go delete mode 100644 pkg/reconcilers/eventhandler/watch_vlanentry.go delete mode 100644 pkg/reconcilers/eventhandler/watch_vxlanentry.go delete mode 100644 pkg/reconcilers/extcommclaim/reconciler.go delete mode 100644 pkg/reconcilers/extcommindex/reconciler.go delete mode 100644 pkg/reconcilers/genidclaim/reconciler.go delete mode 100644 pkg/reconcilers/genidindex/reconciler.go delete mode 100644 pkg/reconcilers/ipclaim/reconciler.go delete mode 100644 pkg/reconcilers/ipindex/reconciler.go delete mode 100644 pkg/reconcilers/vlanclaim/reconciler.go delete mode 100644 pkg/reconcilers/vlanindex/reconciler.go delete mode 100644 pkg/reconcilers/vxlanclaim/reconciler.go delete mode 100644 pkg/reconcilers/vxlanindex/reconciler.go rename pkg/{backend/ipam/applicator_dynamic_prefix_validate.go => registry/generic/invoker.go} (68%) create mode 100644 pkg/registry/generic/store.go create mode 100644 pkg/registry/generic/strategy_resource.go create mode 100644 pkg/registry/generic/strategy_status.go create mode 100644 pkg/registry/generic/watcher.go create mode 100644 pkg/registry/options/options.go create mode 100644 pkg/registry/store/store.go diff --git a/DESIGN-DEPLOYMENTS.md b/DESIGN-DEPLOYMENTS.md new file mode 100644 index 0000000..4f1cd86 --- /dev/null +++ b/DESIGN-DEPLOYMENTS.md @@ -0,0 +1,55 @@ +# deployment options + +- asynchronous design with a generic backend +- synchronous design with a generic backend +- synchronous design with choreo + + +async versus sync: +- We could initialize the storage in such way that we use a special method for storing the objects -> useful for the backend object like ipam/as/vlan/etc +- Create/Update/Delete is Handled special +- List and Watch handled in the traditional way + +## How to select which objects should be rendered? + + - name: ENABLE_BE_AS (group) + value: "sync" | "true" + - name: ENABLE_BE_VLAN (group) + value: "sync" | "true" + - name: ENABLE_BE_IPAM (group) + value: "sync" | "true" + +## Select between sync and async also per group + +-> using ENV flags + + + +## sync versus async + +1. We do a special init for both options -> main reason is to use a direct storage interface for saveALL and restore functions +-> we init all 3 resources together due to the storage + +2. The sync or async is decided on init + + + +## store interface + +-> for tests it is better to use a regular storage interface +-> memory for tests +-> badgerdb or other for a real deployment + +What about config maps ?? + + +## open + +- FieldSelector would be nice when listing the items to be able to check if they belong to the index +- Update? How to handle +- Conversion function for CRD(s) - how does this work ???? -> this will determine if we can keep the resources aligned or not + +to be tested: +- getting storage +- how to walk over a list ? unstructured ? +- field manager is handled by diff --git a/Makefile b/Makefile index 5b00afa..32d6e78 100644 --- a/Makefile +++ b/Makefile @@ -17,10 +17,12 @@ KFORM ?= $(LOCALBIN)/kform KFORM_VERSION ?= v0.0.2 # go versions -TARGET_GO_VERSION := go1.21.4 -GO_FALLBACK := go +#TARGET_GO_VERSION := go1.21.4 +#GO_FALLBACK := go # We prefer $TARGET_GO_VERSION if it is not available we go with whatever go we find ($GO_FALLBACK) -GO_BIN := $(shell if [ "$$(which $(TARGET_GO_VERSION))" != "" ]; then echo $$(which $(TARGET_GO_VERSION)); else echo $$(which $(GO_FALLBACK)); fi) +#GO_BIN := $(shell if [ "$$(which $(TARGET_GO_VERSION))" != "" ]; then echo $$(which $(TARGET_GO_VERSION)); else echo $$(which $(GO_FALLBACK)); fi) + +GOBIN := $(shell go env GOPATH)/bin .PHONY: codegen fix fmt vet lint test tidy @@ -60,23 +62,22 @@ genclients: -g informer-gen \ -g lister-gen \ -g openapi-gen \ - -g go-to-protobuf \ + -g defaulter-gen \ + -g conversion-gen \ + #-g go-to-protobuf \ --module $(REPO) \ - --versions $(REPO)/apis/condition/v1alpha1,$(REPO)/apis/common/v1alpha1,$(REPO)/apis/backend/ipam/v1alpha1,$(REPO)/apis/backend/vlan/v1alpha1,$(REPO)/apis/backend/vxlan/v1alpha1,$(REPO)/apis/backend/as/v1alpha1,$(REPO)/apis/backend/esi/v1alpha1,$(REPO)/apis/backend/extcomm/v1alpha1,$(REPO)/apis/backend/genid/v1alpha1,$(REPO)/apis/backend/infra/v1alpha1 .PHONY: generate generate: controller-gen - $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./apis/inv/..." - -.PHONY: manifests -manifests: controller-gen artifacts ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects. - mkdir -p artifacts - ##$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./apis/resource/..." output:crd:artifacts:config=artifacts - ##$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./apis/resource/..." - ##$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./apis/inv/..." + $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./apis/..." + +.PHONY: crds +crds: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects. + mkdir -p crds + $(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./apis/..." output:crd:artifacts:config=crds .PHONY: artifacts -artifacts: kform manifests +artifacts: kform mkdir -p artifacts/out $(KFORM) apply artifacts -o artifacts/out/artifacts.yaml diff --git a/apis/backend/LabelKeys.go b/apis/backend/LabelKeys.go index 12532c4..e73380f 100644 --- a/apis/backend/LabelKeys.go +++ b/apis/backend/LabelKeys.go @@ -20,20 +20,21 @@ import "k8s.io/apimachinery/pkg/util/sets" const ( // system defined common - KuidOwnerGroupKey = "be.kuid.dev/owner-group" - KuidOwnerVersionKey = "be.kuid.dev/owner-version" - KuidOwnerKindKey = "be.kuid.dev/owner-kind" - KuidOwnerNameKey = "be.kuid.dev/owner-name" - KuidOwnerNamespaceKey = "be.kuid.dev/owner-namespace" - KuidClaimNameKey = "be.kuid.dev/claim-name" - KuidClaimTypeKey = "be.kuid.dev/claim-type" + //KuidOwnerGroupKey = "be.kuid.dev/owner-group" + //KuidOwnerVersionKey = "be.kuid.dev/owner-version" + //KuidOwnerNameKey = "be.kuid.dev/owner-name" + //KuidOwnerNamespaceKey = "be.kuid.dev/owner-namespace" + KuidOwnerKindKey = "be.kuid.dev/owner-kind" // we need to track this to ensure a claim from an index is distinguished from a regular claim + KuidClaimNameKey = "be.kuid.dev/claim-name" + KuidClaimUIDKey = "be.kuid.dev/claim-uid" + KuidClaimTypeKey = "be.kuid.dev/claim-type" // system defined ipam KuidIPAMIPPrefixTypeKey = "ipam.be.kuid.dev/ipprefix-type" - KuidIPAMClaimSummaryTypeKey = "ipam.be.kuid.dev/claim-summary-type" + KuidIPAMClaimSummaryTypeKey = "ipam.be.kuid.dev/claim-summary-type" // used for easy lookup KuidIPAMddressFamilyKey = "ipam.be.kuid.dev/address-family" KuidIPAMSubnetKey = "ipam.be.kuid.dev/subnet" // this is the subnet in prefix annotation used for GW selection KuidIPAMDefaultGatewayKey = "ipam.be.kuid.dev/default-gateway" - KuidIPAMIndexKey = "ipam.be.kuid.dev/index" + //KuidIPAMIndexKey = "ipam.be.kuid.dev/index" // DNS used keys KuidINVNetworkKey = "inv.kuid.dev/network" @@ -61,23 +62,26 @@ const ( KuidINVNetworkLinkBFDMinRX = "link.network.infra.be.kuid.dev/bfd-min-rx" // ) -var BackendSystemKeys = sets.New[string](KuidOwnerGroupKey, - KuidOwnerVersionKey, - KuidOwnerKindKey, - KuidOwnerNameKey, - KuidOwnerNamespaceKey, +// BackendSystemKeys defined the system keys +// used internally in the cache for faster label based lookups. +// Used to filter the system keys from the information presented +// to the outside world when generating the XXEntry object +var BackendSystemKeys = sets.New[string]( KuidClaimNameKey, + KuidClaimUIDKey, + KuidOwnerKindKey, + KuidClaimTypeKey, ) -var BackendIPAMSystemKeys = sets.New[string](KuidOwnerGroupKey, +// BackendIPAMSystemKeys defined the system IPAM keys +// used internally in the cache for faster label based lookups +// Used to filter the system keys from the information presented +// to the outside world when generating the IP Entry object +var BackendIPAMSystemKeys = sets.New[string]( KuidIPAMIPPrefixTypeKey, KuidIPAMClaimSummaryTypeKey, + KuidClaimTypeKey, KuidIPAMddressFamilyKey, KuidIPAMSubnetKey, KuidIPAMDefaultGatewayKey, - KuidIPAMIndexKey, -) - -var BackendSystemClaimKeys = sets.New[string](KuidOwnerGroupKey, - KuidClaimTypeKey, ) diff --git a/apis/backend/as/v1alpha1/asclaim_interface.go b/apis/backend/as/asclaim_object.go similarity index 51% rename from apis/backend/as/v1alpha1/asclaim_interface.go rename to apis/backend/as/asclaim_object.go index 74a89b4..96dcd53 100644 --- a/apis/backend/as/v1alpha1/asclaim_interface.go +++ b/apis/backend/as/asclaim_object.go @@ -14,186 +14,252 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package as import ( - "crypto/sha1" - "encoding/json" "errors" "fmt" "strconv" "strings" - "github.com/henderiw/apiserver-builder/pkg/builder/resource" "github.com/henderiw/idxtable/pkg/table" "github.com/henderiw/idxtable/pkg/table/table32" "github.com/henderiw/idxtable/pkg/tree" "github.com/henderiw/idxtable/pkg/tree/id32" "github.com/henderiw/store" + "github.com/kform-dev/choreo/apis/condition" "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/selection" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/validation/field" "k8s.io/utils/ptr" ) -const ASClaimPlural = "asclaims" -const ASClaimSingular = "asclaim" -const ASID_Min = 0 -const ASID_Max = 4294967295 +var _ backend.ClaimObject = &ASClaim{} -// +k8s:deepcopy-gen=false -var _ resource.Object = &ASClaim{} -var _ resource.ObjectList = &ASClaimList{} - -var _ resource.ObjectWithStatusSubResource = &ASClaim{} - -func (ASClaimStatus) SubResourceName() string { - return fmt.Sprintf("%s/%s", ASClaimPlural, "status") -} - -func (r ASClaimStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { - cfg, ok := obj.(*ASClaim) - if ok { - cfg.Status = r +func (r *ASClaim) GetNamespacedName() types.NamespacedName { + return types.NamespacedName{ + Namespace: r.GetNamespace(), + Name: r.GetName(), } } -func (r *ASClaim) GetStatus() resource.StatusSubResource { - return r.Status +func (r *ASClaim) GetKey() store.Key { + return store.KeyFromNSN(types.NamespacedName{Namespace: r.Namespace, Name: r.Spec.Index}) } -// GetListMeta returns the ListMeta -func (r *ASClaimList) GetListMeta() *metav1.ListMeta { - return &r.ListMeta +// GetCondition returns the condition based on the condition kind +func (r *ASClaim) GetCondition(t condition.ConditionType) condition.Condition { + return r.Status.GetCondition(t) } -func (r *ASClaim) GetSingularName() string { - return ASClaimSingular +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *ASClaim) SetConditions(c ...condition.Condition) { + r.Status.SetConditions(c...) } -func (ASClaim) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Resource: ASClaimPlural, +func (r *ASClaim) ValidateSyntax(s string) field.ErrorList { + var allErrs field.ErrorList + + if err := r.ValidateASClaimType(); err != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath(""), + r, + err.Error(), + )) + return allErrs + } + var v SyntaxValidator + claimType := r.GetClaimType() + switch claimType { + case backend.ClaimType_DynamicID: + v = &ASDynamicIDSyntaxValidator{Name: string(claimType)} + case backend.ClaimType_StaticID: + v = &ASStaticIDSyntaxValidator{Name: string(claimType)} + case backend.ClaimType_Range: + v = &ASRangeSyntaxValidator{Name: string(claimType)} + default: + return allErrs } + return v.Validate(r) } -// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. -// IsStorageVersion implements resource.Object. -func (ASClaim) IsStorageVersion() bool { - return true +func (r *ASClaim) ValidateASRange() error { + if r.Spec.Range == nil { + return fmt.Errorf("no AS range provided") + } + parts := strings.SplitN(*r.Spec.Range, "-", 2) + if len(parts) != 2 { + return fmt.Errorf("invalid AS range, expected -, got: %s", *r.Spec.Range) + } + var errm error + if r.Name == r.Spec.Index { + // to be able to check if the entry is reserved we get a parentname (rang name) equal to index + // this is because the ownerreference uses the name of the index in its labels in the cache + errm = errors.Join(errm, fmt.Errorf("a name of range cannot be the same as the index")) + } + start, err := strconv.Atoi(parts[0]) + if err != nil { + errm = errors.Join(errm, fmt.Errorf("invalid AS range start, got: %s, err: %s", *r.Spec.Range, err.Error())) + } + end, err := strconv.Atoi(parts[1]) + if err != nil { + errm = errors.Join(errm, fmt.Errorf("invalid AS range end, got: %s, err: %s", *r.Spec.Range, err.Error())) + } + if errm != nil { + return errm + } + if start > end { + errm = errors.Join(errm, fmt.Errorf("invalid AS range start > end %s", *r.Spec.Range)) + } + if err := validateASID(start); err != nil { + errm = errors.Join(errm, fmt.Errorf("invalid AS start err %s", err.Error())) + } + if err := validateASID(end); err != nil { + errm = errors.Join(errm, fmt.Errorf("invalid AS end err %s", err.Error())) + } + return errm } -// GetObjectMeta implements resource.Object -func (r *ASClaim) GetObjectMeta() *metav1.ObjectMeta { - return &r.ObjectMeta +func (r *ASClaim) ValidateASID() error { + if r.Spec.ID == nil { + return fmt.Errorf("no id provided") + } + if err := validateASID(int(*r.Spec.ID)); err != nil { + return fmt.Errorf("invalid id err %s", err.Error()) + } + return nil } -// NamespaceScoped returns true to indicate Fortune is a namespaced resource. -// NamespaceScoped implements resource.Object. -func (ASClaim) NamespaceScoped() bool { - return true -} +func (r *ASClaim) ValidateASClaimType() error { + var sb strings.Builder + count := 0 + if r.Spec.ID != nil { + sb.WriteString(fmt.Sprintf("id: %d", *r.Spec.ID)) + count++ -// New implements resource.Object -func (ASClaim) New() runtime.Object { - return &ASClaim{} -} + } + if r.Spec.Range != nil { + if count > 0 { + sb.WriteString(", ") + } + sb.WriteString(fmt.Sprintf("range: %s", *r.Spec.Range)) + count++ -// NewList implements resource.Object -func (ASClaim) NewList() runtime.Object { - return &ASClaimList{} + } + if count > 1 { + return fmt.Errorf("a claim can only have 1 type, got %s", sb.String()) + } + return nil } -// GetCondition returns the condition based on the condition kind -func (r *ASClaim) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { - return r.Status.GetCondition(t) -} +func (r *ASClaim) GetIndex() string { return r.Spec.Index } -// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions -// to be set at once -func (r *ASClaim) SetConditions(c ...conditionv1alpha1.Condition) { - r.Status.SetConditions(c...) -} +func (r *ASClaim) GetSelector() *metav1.LabelSelector { return r.Spec.Selector } -// ASClaimConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for ASClaim -func ASClaimConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { - switch label { - case "metadata.name": - return label, value, nil - case "metadata.namespace": - return label, value, nil - case "spec.index": - return label, value, nil - default: - return "", "", fmt.Errorf("%q is not a known field selector", label) +// GetOwnerSelector selects the route based on the name of the claim +func (r *ASClaim) GetOwnerSelector() (labels.Selector, error) { + claimName := r.Name + claimKind := r.Kind + claimUID := r.UID + for _, owner := range r.GetOwnerReferences() { + if owner.APIVersion == SchemeGroupVersion.Identifier() && + owner.Kind == ASIndexKind { + claimName = owner.Name + claimKind = owner.Kind + claimUID = owner.UID + } } -} -func (r *ASClaimList) GetItems() []backend.Object { - objs := []backend.Object{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) + l := map[string]string{ + backend.KuidClaimNameKey: claimName, + backend.KuidClaimUIDKey: string(claimUID), + backend.KuidOwnerKindKey: claimKind, } - return objs -} -func (r *ASClaim) CalculateHash() ([sha1.Size]byte, error) { - // Convert the struct to JSON - jsonData, err := json.Marshal(r) - if err != nil { - return [sha1.Size]byte{}, err + fullselector := labels.NewSelector() + for k, v := range l { + req, err := labels.NewRequirement(k, selection.Equals, []string{v}) + if err != nil { + return nil, err + } + fullselector = fullselector.Add(*req) } - - // Calculate SHA-1 hash - return sha1.Sum(jsonData), nil + return fullselector, nil } -func (r *ASClaim) GetNamespacedName() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.GetNamespace(), - Name: r.GetName(), +func (r *ASClaim) GetLabelSelector() (labels.Selector, error) { return r.Spec.GetLabelSelector() } + +func (r *ASClaim) GetClaimLabels() labels.Set { + labels := r.Spec.GetUserDefinedLabels() + + // for claims originated from the index we need to use the ownerreferences, since these claims + // are never stored in the apiserver, the ip entries need to reference the index instead + claimName := r.Name + claimKind := ASClaimKind + claimUID := r.UID + for _, owner := range r.GetOwnerReferences() { + if owner.APIVersion == SchemeGroupVersion.Identifier() && + owner.Kind == ASIndexKind { + claimName = owner.Name + claimKind = owner.Kind + claimUID = owner.UID + } } + // system defined labels + labels[backend.KuidClaimTypeKey] = string(r.GetClaimType()) + labels[backend.KuidClaimNameKey] = claimName + labels[backend.KuidClaimUIDKey] = string(claimUID) + labels[backend.KuidOwnerKindKey] = claimKind + return labels } -func (r *ASClaim) GetKey() store.Key { - return store.KeyFromNSN(types.NamespacedName{Namespace: r.Namespace, Name: r.Spec.Index}) -} +func (r *ASClaim) ValidateOwner(labels labels.Set) error { + routeClaimName := labels[backend.KuidClaimNameKey] + routeClaimUID := labels[backend.KuidClaimUIDKey] -func (r *ASClaim) GetIndex() string { - return r.Spec.Index + if string(r.UID) != routeClaimUID && r.Name != routeClaimName { + return fmt.Errorf("route owned by different claim got name %s/%s uid %s/%s", + r.Name, + routeClaimName, + string(r.UID), + routeClaimUID, + ) + } + return nil } -func (r *ASClaim) GetSelector() *metav1.LabelSelector { - return r.Spec.Selector -} +func (r *ASClaim) GetClaimType() backend.ClaimType { + claimType := backend.ClaimType_Invalid + count := 0 + if r.Spec.ID != nil { + claimType = backend.ClaimType_StaticID + count++ -func (r *ASClaim) GetOwnerReference() *commonv1alpha1.OwnerReference { - return &commonv1alpha1.OwnerReference{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Kind: r.Kind, - Namespace: r.Namespace, - Name: r.Name, } -} + if r.Spec.Range != nil { + claimType = backend.ClaimType_Range + count++ + } + if count > 1 { + return backend.ClaimType_Invalid + } + if count == 0 { + return backend.ClaimType_DynamicID + } + return claimType +} func (r *ASClaim) GetStaticID() *uint64 { if r.Spec.ID == nil { return nil } return ptr.To[uint64](uint64(*r.Spec.ID)) } - func (r *ASClaim) GetStaticTreeID(t string) tree.ID { if r.Spec.ID == nil { return nil @@ -209,24 +275,34 @@ func (r *ASClaim) GetRange() *string { return r.Spec.Range } -func (r *ASClaim) GetRangeID(_ string) (tree.Range, error) { +func (r *ASClaim) GetRangeID(t string) (tree.Range, error) { if r.Spec.Range == nil { return nil, fmt.Errorf("cannot provide a range without an id") } return id32.ParseRange(*r.Spec.Range) } -func (r *ASClaim) GetTable(s string, to, from uint64) table.Table { +func (r *ASClaim) GetTable(t string, to, from uint64) table.Table { return table32.New(uint32(to), uint32(from)) } -func getASDot(asn uint32) string { - if asn > 65536 { - a := asn / 65536 - b := asn - (a * 65536) - return fmt.Sprintf("%d.%d", a, b) +func (r *ASClaim) SetStatusRange(s *string) { + r.Status.Range = s +} + +func (r *ASClaim) SetStatusID(s *uint64) { + if s == nil { + r.Status.ID = nil + return } - return strconv.Itoa(int(asn)) + r.Status.ID = ptr.To[uint32](uint32(*s)) +} + +func (r *ASClaim) GetStatusID() *uint64 { + if r.Status.ID == nil { + return nil + } + return ptr.To[uint64](uint64(*r.Status.ID)) } func (r *ASClaim) GetClaimRequest() string { @@ -257,230 +333,25 @@ func (r *ASClaim) GetClaimResponse() string { return "" } -func (r *ASClaim) GetClaimType() backend.ClaimType { - claimType := backend.ClaimType_Invalid - count := 0 - if r.Spec.ID != nil { - claimType = backend.ClaimType_StaticID - count++ - - } - if r.Spec.Range != nil { - claimType = backend.ClaimType_Range - count++ - - } - if count > 1 { - return backend.ClaimType_Invalid - } - if count == 0 { - return backend.ClaimType_DynamicID - } - return claimType -} - -func (r *ASClaim) ValidateASClaimType() error { - var sb strings.Builder - count := 0 - if r.Spec.ID != nil { - sb.WriteString(fmt.Sprintf("id: %d", *r.Spec.ID)) - count++ - - } - if r.Spec.Range != nil { - if count > 0 { - sb.WriteString(", ") - } - sb.WriteString(fmt.Sprintf("range: %s", *r.Spec.Range)) - count++ - - } - if count > 1 { - return fmt.Errorf("a claim can only have 1 type, got %s", sb.String()) - } - return nil -} - -func validateASID(id int) error { - if id < ASID_Min { - return fmt.Errorf("invalid id, got %d", id) - } - if id > ASID_Max { - return fmt.Errorf("invalid id, got %d", id) - } - return nil -} - -func (r *ASClaim) ValidateASID() error { - if r.Spec.ID == nil { - return fmt.Errorf("no id provided") - } - if err := validateASID(int(*r.Spec.ID)); err != nil { - return fmt.Errorf("invalid id err %s", err.Error()) - } - return nil -} - -func (r *ASClaim) GetASRange() (int, int) { - if r.Spec.Range == nil { - return 0, 0 - } - parts := strings.SplitN(*r.Spec.Range, "-", 2) - if len(parts) != 2 { - return 0, 0 - } - start, err := strconv.Atoi(parts[0]) +func ASClaimFromUnstructured(ru runtime.Unstructured) (backend.ClaimObject, error) { + obj := &ASClaim{} + err := runtime.DefaultUnstructuredConverter.FromUnstructured(ru.UnstructuredContent(), obj) if err != nil { - return 0, 0 + return nil, fmt.Errorf("error converting unstructured to asIndex: %v", err) } - end, err := strconv.Atoi(parts[1]) - if err != nil { - return 0, 0 - } - return start, end + return obj, nil } -func (r *ASClaim) ValidateASRange() error { - if r.Spec.Range == nil { - return fmt.Errorf("no AS range provided") - } - parts := strings.SplitN(*r.Spec.Range, "-", 2) - if len(parts) != 2 { - return fmt.Errorf("invalid AS range, expected -, got: %s", *r.Spec.Range) - } - var errm error - start, err := strconv.Atoi(parts[0]) - if err != nil { - errm = errors.Join(errm, fmt.Errorf("invalid AS range start, got: %s, err: %s", *r.Spec.Range, err.Error())) - } - end, err := strconv.Atoi(parts[1]) - if err != nil { - errm = errors.Join(errm, fmt.Errorf("invalid AS range end, got: %s, err: %s", *r.Spec.Range, err.Error())) - } - if errm != nil { - return errm - } - if start > end { - errm = errors.Join(errm, fmt.Errorf("invalid AS range start > end %s", *r.Spec.Range)) +func ASClaimFromRuntime(ru runtime.Object) (backend.ClaimObject, error) { + claim, ok := ru.(*ASClaim) + if !ok { + return nil, errors.New("runtime object not ASClaim") } - if err := validateASID(start); err != nil { - errm = errors.Join(errm, fmt.Errorf("invalid AS start err %s", err.Error())) - } - if err := validateASID(end); err != nil { - errm = errors.Join(errm, fmt.Errorf("invalid AS end err %s", err.Error())) - } - return errm -} - -func (r *ASClaim) ValidateSyntax(_ string) field.ErrorList { - var allErrs field.ErrorList - - gv, err := schema.ParseGroupVersion(r.APIVersion) - if err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("apiVersion"), - r, - fmt.Errorf("invalid apiVersion: err: %s", err.Error()).Error(), - )) - return allErrs - } - - // this is for user convenience - if r.Spec.Owner == nil { - r.Spec.Owner = &commonv1alpha1.OwnerReference{ - Group: gv.Group, - Version: gv.Version, - Kind: r.Kind, - Namespace: r.Namespace, - Name: r.Name, - } - } - - if err := r.ValidateASClaimType(); err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath(""), - r, - err.Error(), - )) - return allErrs - } - var v SyntaxValidator - claimType := r.GetClaimType() - switch claimType { - case backend.ClaimType_DynamicID: - v = &ASDynamicIDSyntaxValidator{name: string(claimType)} - case backend.ClaimType_StaticID: - v = &ASStaticIDSyntaxValidator{name: string(claimType)} - case backend.ClaimType_Range: - v = &ASRangeSyntaxValidator{name: string(claimType)} - default: - return allErrs - } - return v.Validate(r) -} - -func (r *ASClaim) ValidateOwner(labels labels.Set) error { - routeClaimName := labels[backend.KuidClaimNameKey] - routeOwner := commonv1alpha1.OwnerReference{ - Group: labels[backend.KuidOwnerGroupKey], - Version: labels[backend.KuidOwnerVersionKey], - Kind: labels[backend.KuidOwnerKindKey], - Namespace: labels[backend.KuidOwnerNamespaceKey], - Name: labels[backend.KuidOwnerNameKey], - } - if (r.Spec.Owner != nil && *r.Spec.Owner != routeOwner) || r.Name != routeClaimName { - return fmt.Errorf("route owned by different claim got name %s/%s owner %s/%s", - r.Name, - routeClaimName, - r.Spec.Owner.String(), - routeOwner.String(), - ) - } - return nil -} - -// GetLabelSelector returns a labels selector based on the label selector -func (r *ASClaim) GetLabelSelector() (labels.Selector, error) { - return r.Spec.GetLabelSelector() -} - -func (r *ASClaim) GetClaimLabels() labels.Set { - labels := r.Spec.GetUserDefinedLabels() - // system defined labels - labels[backend.KuidClaimTypeKey] = string(r.GetClaimType()) - labels[backend.KuidClaimNameKey] = r.Name - labels[backend.KuidOwnerGroupKey] = r.Spec.Owner.Group - labels[backend.KuidOwnerVersionKey] = r.Spec.Owner.Version - labels[backend.KuidOwnerKindKey] = r.Spec.Owner.Kind - labels[backend.KuidOwnerNamespaceKey] = r.Spec.Owner.Namespace - labels[backend.KuidOwnerNameKey] = r.Spec.Owner.Name - return labels -} - -// GetOwnerSelector returns a label selector to select the owner of the claim in the backend -func (r *ASClaim) GetOwnerSelector() (labels.Selector, error) { - l := map[string]string{ - backend.KuidOwnerGroupKey: r.Spec.Owner.Group, - backend.KuidOwnerVersionKey: r.Spec.Owner.Version, - backend.KuidOwnerKindKey: r.Spec.Owner.Kind, - backend.KuidOwnerNamespaceKey: r.Spec.Owner.Namespace, - backend.KuidOwnerNameKey: r.Spec.Owner.Name, - backend.KuidClaimNameKey: r.Name, - } - - fullselector := labels.NewSelector() - for k, v := range l { - req, err := labels.NewRequirement(k, selection.Equals, []string{v}) - if err != nil { - return nil, err - } - fullselector = fullselector.Add(*req) - } - return fullselector, nil + return claim, nil } // BuildASClaim returns a reource from a client Object a Spec/Status -func BuildASClaim(meta metav1.ObjectMeta, spec *ASClaimSpec, status *ASClaimStatus) *ASClaim { +func BuildASClaim(meta metav1.ObjectMeta, spec *ASClaimSpec, status *ASClaimStatus) backend.ClaimObject { aspec := ASClaimSpec{} if spec != nil { aspec = *spec @@ -499,47 +370,3 @@ func BuildASClaim(meta metav1.ObjectMeta, spec *ASClaimSpec, status *ASClaimStat Status: astatus, } } - -func (r *ASClaim) SetStatusRange(s *string) { - r.Status.Range = s -} - -func (r *ASClaim) SetStatusID(s *uint64) { - if s == nil { - r.Status.ID = nil - return - } - r.Status.ID = ptr.To[uint32](uint32(*s)) -} - -func (r *ASClaim) GetStatusID() *uint64 { - if r.Status.ID == nil { - return nil - } - return ptr.To[uint64](uint64(*r.Status.ID)) -} - -func (r *ASClaim) GetSpec() any { - return r.Spec -} - -func (r *ASClaim) SetSpec(s any) { - if spec, ok := s.(ASClaimSpec); ok { - r.Spec = spec - } -} - -func (r *ASClaim) NewObjList() backend.GenericObjectList { - return &ASClaimList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: ASClaimListKind}, - } -} - -func (r *ASClaimList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} diff --git a/apis/backend/as/asclaim_resource.go b/apis/backend/as/asclaim_resource.go new file mode 100644 index 0000000..d3e1eec --- /dev/null +++ b/apis/backend/as/asclaim_resource.go @@ -0,0 +1,309 @@ +/* +Copyright 2024 Nokia. + +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 as + +import ( + "context" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/kform-dev/choreo/apis/condition" + apiequality "k8s.io/apimachinery/pkg/api/equality" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/util/validation/field" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +const ( + ASClaimPlural = "asclaims" + ASClaimSingular = "asclaim" +) + +var ( + ASClaimShortNames = []string{} + ASClaimCategories = []string{"kuid", "knet"} +) + +// +k8s:deepcopy-gen=false +var _ resource.InternalObject = &ASClaim{} +var _ resource.ObjectList = &ASClaimList{} +var _ resource.ObjectWithStatusSubResource = &ASClaim{} +var _ resource.StatusSubResource = &ASClaimStatus{} + +func (ASClaim) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: ASClaimPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (ASClaim) IsStorageVersion() bool { + return true +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (ASClaim) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *ASClaim) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// GetSingularName returns the singular name of the resource +// GetSingularName implements resource.Object +func (ASClaim) GetSingularName() string { + return ASClaimSingular +} + +// GetShortNames returns the shortnames for the resource +// GetShortNames implements resource.Object +func (ASClaim) GetShortNames() []string { + return ASClaimShortNames +} + +// GetCategories return the categories of the resource +// GetCategories implements resource.Object +func (ASClaim) GetCategories() []string { + return ASClaimCategories +} + +// New return an empty resource +// New implements resource.Object +func (ASClaim) New() runtime.Object { + return &ASClaim{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (ASClaim) NewList() runtime.Object { + return &ASClaimList{} +} + +// IsEqual returns a bool indicating if the desired state of both resources is equal or not +func (r *ASClaim) IsEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*ASClaim) + oldobj := old.(*ASClaim) + + if !apiequality.Semantic.DeepEqual(oldobj.ObjectMeta, newobj.ObjectMeta) { + return false + } + // if equal we also test the spec + return apiequality.Semantic.DeepEqual(oldobj.Spec, newobj.Spec) +} + +// GetStatus return the resource.StatusSubResource interface +func (r *ASClaim) GetStatus() resource.StatusSubResource { + return r.Status +} + +// IsStatusEqual returns a bool indicating if the status of both resources is equal or not +func (r *ASClaim) IsStatusEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*ASClaim) + oldobj := old.(*ASClaim) + return apiequality.Semantic.DeepEqual(oldobj.Status, newobj.Status) +} + +// PrepareForStatusUpdate prepares the status update +func (r *ASClaim) PrepareForStatusUpdate(ctx context.Context, obj, old runtime.Object) { + newObj := obj.(*ASClaim) + oldObj := old.(*ASClaim) + newObj.Spec = oldObj.Spec + + // Status updates are for only for updating status, not objectmeta. + metav1.ResetObjectMetaForStatus(&newObj.ObjectMeta, &newObj.ObjectMeta) +} + +// ValidateStatusUpdate validates status updates +func (r *ASClaim) ValidateStatusUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +// SubResourceName resturns the name of the subresource +// SubResourceName implements the resource.StatusSubResource +func (ASClaimStatus) SubResourceName() string { + return fmt.Sprintf("%s/%s", ASClaimPlural, "status") +} + +// CopyTo copies the content of the status subresource to a parent resource. +// CopyTo implements the resource.StatusSubResource +func (r ASClaimStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { + parent, ok := obj.(*ASClaim) + if ok { + parent.Status = r + } +} + +// GetListMeta returns the ListMeta +// GetListMeta implements the resource.ObjectList +func (r *ASClaimList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// TableConvertor return the table format of the resource +func (r *ASClaim) TableConvertor() func(gr schema.GroupResource) rest.TableConvertor { + return func(gr schema.GroupResource) rest.TableConvertor { + return registry.NewTableConverter( + gr, + func(obj runtime.Object) []interface{} { + claim, ok := obj.(*ASClaim) + if !ok { + return nil + } + return []interface{}{ + claim.Name, + claim.GetCondition(condition.ConditionTypeReady).Status, + claim.GetCondition(condition.ConditionTypeReady).Reason, + } + }, + []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + {Name: "Ready", Type: "string"}, + {Name: "Reason", Type: "string"}, + }, + ) + } +} + +// FieldLabelConversion is the schema conversion function for normalizing the FieldSelector for the resource +func (r *ASClaim) FieldLabelConversion() runtime.FieldLabelConversionFunc { + return func(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } + } +} + +func (r *ASClaim) FieldSelector() func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + return func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + var filter *ASClaimFilter + + // add the namespace to the list + namespace, ok := genericapirequest.NamespaceFrom(ctx) + if fieldSelector == nil { + if ok { + return &ASClaimFilter{Namespace: namespace}, nil + } + return filter, nil + } + requirements := fieldSelector.Requirements() + for _, requirement := range requirements { + filter = &ASClaimFilter{} + switch requirement.Operator { + case selection.Equals, selection.DoesNotExist: + if requirement.Value == "" { + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) + } + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) + } + + switch requirement.Field { + case "metadata.name": + filter.Name = requirement.Value + case "metadata.namespace": + filter.Namespace = requirement.Value + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) + } + } + // add namespace to the filter selector if specified + if ok { + if filter != nil { + filter.Namespace = namespace + } else { + filter = &ASClaimFilter{Namespace: namespace} + } + return filter, nil + } + + return &ASClaimFilter{}, nil + } + +} + +type ASClaimFilter struct { + // Name filters by the name of the objects + Name string `protobuf:"bytes,1,opt,name=name"` + + // Namespace filters by the namespace of the objects + Namespace string `protobuf:"bytes,2,opt,name=namespace"` +} + +func (r *ASClaimFilter) Filter(ctx context.Context, obj runtime.Object) bool { + f := false // result of the previous filter + o, ok := obj.(*ASClaim) + if !ok { + return f + } + if r.Name != "" { + if o.GetName() == r.Name { + f = false + } else { + f = true + } + } + if r.Namespace != "" { + if o.GetNamespace() == r.Namespace { + f = false + } else { + f = true + } + } + return f +} + +func (r *ASClaim) PrepareForCreate(ctx context.Context, obj runtime.Object) { + // status cannot be set upon create -> reset it + newobj := obj.(*ASClaim) + newobj.Status = ASClaimStatus{} +} + +// ValidateCreate statically validates +func (r *ASClaim) ValidateCreate(ctx context.Context, obj runtime.Object) field.ErrorList { + return r.ValidateSyntax("") +} + +func (r *ASClaim) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { + // ensure the status dont get updated + newobj := obj.(*ASClaim) + oldObj := old.(*ASClaim) + newobj.Status = oldObj.Status +} + +func (r *ASClaim) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + return r.ValidateSyntax("") +} diff --git a/apis/backend/as/v1alpha1/asclaim_syntaxvalidator.go b/apis/backend/as/asclaim_syntaxvalidator.go similarity index 85% rename from apis/backend/as/v1alpha1/asclaim_syntaxvalidator.go rename to apis/backend/as/asclaim_syntaxvalidator.go index 2fcb0b5..722fbec 100644 --- a/apis/backend/as/v1alpha1/asclaim_syntaxvalidator.go +++ b/apis/backend/as/asclaim_syntaxvalidator.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package as import ( fmt "fmt" @@ -22,12 +22,15 @@ import ( "k8s.io/apimachinery/pkg/util/validation/field" ) +// +kubebuilder:object:generate=false +// +k8s:deepcopy-gen:false type SyntaxValidator interface { Validate(claim *ASClaim) field.ErrorList } +// +k8s:deepcopy-gen:false type ASRangeSyntaxValidator struct { - name string + Name string } func (r *ASRangeSyntaxValidator) Validate(claim *ASClaim) field.ErrorList { @@ -36,14 +39,14 @@ func (r *ASRangeSyntaxValidator) Validate(claim *ASClaim) field.ErrorList { allErrs = append(allErrs, field.Invalid( field.NewPath("spec.range"), claim, - fmt.Errorf("invalid AS range %s", r.name).Error(), + fmt.Errorf("invalid AS range %s", r.Name).Error(), )) } return allErrs } type ASDynamicIDSyntaxValidator struct { - name string + Name string } func (r *ASDynamicIDSyntaxValidator) Validate(claim *ASClaim) field.ErrorList { @@ -52,7 +55,7 @@ func (r *ASDynamicIDSyntaxValidator) Validate(claim *ASClaim) field.ErrorList { } type ASStaticIDSyntaxValidator struct { - name string + Name string } func (r *ASStaticIDSyntaxValidator) Validate(claim *ASClaim) field.ErrorList { @@ -61,7 +64,7 @@ func (r *ASStaticIDSyntaxValidator) Validate(claim *ASClaim) field.ErrorList { allErrs = append(allErrs, field.Invalid( field.NewPath("spec.id"), claim, - fmt.Errorf("invalid AS id %s", r.name).Error(), + fmt.Errorf("invalid AS id %s", r.Name).Error(), )) } return allErrs diff --git a/apis/backend/vxlan/v1alpha1/vxlanclaim_types.go b/apis/backend/as/asclaim_types.go similarity index 51% rename from apis/backend/vxlan/v1alpha1/vxlanclaim_types.go rename to apis/backend/as/asclaim_types.go index 296c58f..b66f216 100644 --- a/apis/backend/vxlan/v1alpha1/vxlanclaim_types.go +++ b/apis/backend/as/asclaim_types.go @@ -14,43 +14,40 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package as import ( "reflect" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/common" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) -// VXLANClaimSpec defines the desired state of VXLANClaim -type VXLANClaimSpec struct { - // VXLANIndex defines the VXLAN index for the VXLAN Claim +// ASClaimSpec defines the desired state of ASClaim +type ASClaimSpec struct { + // Index defines the index for the AS Claim Index string `json:"index" yaml:"index" protobuf:"bytes,1,opt,name=index"` - // VXLANID defines the VXLAN for the VXLAN claim + // ASID defines the AS for the AS claim ID *uint32 `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,2,opt,name=id"` - // Range defines the VXLAN range for the VXLAN claim - // The following notation is used: start-end - - // the VXLANs in the range must be consecutive + // Range defines the AS range for the AS claim + // The following notation is used: start-end - + // the ASs in the range must be consecutive Range *string `json:"range,omitempty" yaml:"range,omitempty" protobuf:"bytes,3,opt,name=range"` // ClaimLabels define the user defined labels and selector labels used // in resource claim - commonv1alpha1.ClaimLabels `json:",inline" yaml:",inline" protobuf:"bytes,4,opt,name=claimLabels"` - // Owner defines the ownerReference of the VXLANClaim - // Allow for different namesapces, hence it is part of the spec - Owner *commonv1alpha1.OwnerReference `json:"owner,omitempty" yaml:"owner,omitempty" protobuf:"bytes,5,opt,name=owner"` + common.ClaimLabels `json:",inline" yaml:",inline" protobuf:"bytes,4,opt,name=claimLabels"` } -// VXLANClaimStatus defines the observed state of VXLANClaim -type VXLANClaimStatus struct { - // ConditionedStatus provides the status of the IPClain using conditions +// ASClaimStatus defines the observed state of ASClaim +type ASClaimStatus struct { + // ConditionedStatus provides the status of the ASClain using conditions // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` - // VXLANID defines the VXLAN for the VXLAN claim + condition.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` + // ASID defines the AS for the AS claim // +optional ID *uint32 `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,2,opt,name=id"` - // VXLANRange defines the VXLAN range for the VXLAN claim + // ASRange defines the AS range for the AS claim // +optional Range *string `json:"range,omitempty" yaml:"range,omitempty" protobuf:"bytes,3,opt,name=range"` // ExpiryTime defines when the claim expires @@ -62,26 +59,24 @@ type VXLANClaimStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// VXLANClaim is the Schema for the VXLANClaim API -// -// +k8s:openapi-gen=true -type VXLANClaim struct { +// ASClaim is the Schema for the ASClaim API +type ASClaim struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Spec VXLANClaimSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - Status VXLANClaimStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` + Spec ASClaimSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status ASClaimStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } -// VXLANClaimList contains a list of VXLANClaims +// ASClaimList contains a list of ASClaims // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type VXLANClaimList struct { +type ASClaimList struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []VXLANClaim `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` + Items []ASClaim `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` } var ( - VXLANClaimKind = reflect.TypeOf(VXLANClaim{}).Name() - VXLANClaimListKind = reflect.TypeOf(VXLANClaimList{}).Name() + ASClaimKind = reflect.TypeOf(ASClaim{}).Name() + ASClaimListKind = reflect.TypeOf(ASClaimList{}).Name() ) diff --git a/apis/backend/as/asentry_object.go b/apis/backend/as/asentry_object.go new file mode 100644 index 0000000..dcfaca2 --- /dev/null +++ b/apis/backend/as/asentry_object.go @@ -0,0 +1,133 @@ +/* +Copyright 2024 Nokia. + +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 as + +import ( + "errors" + "fmt" + "strings" + + "github.com/henderiw/store" + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/backend" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +var _ backend.EntryObject = &ASEntry{} + +func (r *ASEntry) GetNamespacedName() types.NamespacedName { + return types.NamespacedName{ + Namespace: r.GetNamespace(), + Name: r.GetName(), + } +} +func (r *ASEntry) GetKey() store.Key { + return store.KeyFromNSN(types.NamespacedName{Namespace: r.Namespace, Name: r.Spec.Index}) +} + +// GetCondition returns the condition based on the condition kind +func (r *ASEntry) GetCondition(t condition.ConditionType) condition.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *ASEntry) SetConditions(c ...condition.Condition) { + r.Status.SetConditions(c...) +} + +func (r *ASEntry) ValidateSyntax(s string) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +func (r *ASEntry) GetIndex() string { return r.Spec.Index } +func (r *ASEntry) GetClaimType() backend.ClaimType { return r.Spec.ClaimType } +func (r *ASEntry) GetSpecID() string { return r.Spec.ID } + +func ASEntryFromRuntime(ru runtime.Object) (backend.EntryObject, error) { + entry, ok := ru.(*ASEntry) + if !ok { + return nil, errors.New("runtime object not ASIndex") + } + return entry, nil +} + +func GetASEntry(k store.Key, vrange, id string, labels map[string]string) backend.EntryObject { + index := k.Name + ns := k.Namespace + + spec := &ASEntrySpec{ + Index: index, + ClaimType: backend.GetClaimTypeFromString(labels[backend.KuidClaimTypeKey]), + ID: id, + } + // filter the system defined labels from the labels to prepare for the user defined labels + udLabels := map[string]string{} + for k, v := range labels { + if !backend.BackendSystemKeys.Has(k) { + udLabels[k] = v + } + } + spec.UserDefinedLabels.Labels = udLabels + + id = strings.ReplaceAll(id, "/", "-") + name := fmt.Sprintf("%s.%s", index, id) + if vrange != "" { + name = fmt.Sprintf("%s.%s", vrange, id) + } + + return BuildASEntry( + metav1.ObjectMeta{ + Name: name, + Namespace: ns, + OwnerReferences: []metav1.OwnerReference{ + { + APIVersion: SchemeGroupVersion.Identifier(), + Kind: labels[backend.KuidOwnerKindKey], + Name: labels[backend.KuidClaimNameKey], + UID: types.UID(labels[backend.KuidClaimUIDKey]), + }, + }, + }, + spec, + nil, + ) +} + +func BuildASEntry(meta metav1.ObjectMeta, spec *ASEntrySpec, status *ASEntryStatus) backend.EntryObject { + aspec := ASEntrySpec{} + if spec != nil { + aspec = *spec + } + astatus := ASEntryStatus{} + if status != nil { + astatus = *status + } + return &ASEntry{ + TypeMeta: metav1.TypeMeta{ + APIVersion: SchemeGroupVersion.Identifier(), + Kind: ASEntryKind, + }, + ObjectMeta: meta, + Spec: aspec, + Status: astatus, + } +} diff --git a/apis/backend/as/asentry_resource.go b/apis/backend/as/asentry_resource.go new file mode 100644 index 0000000..848edfe --- /dev/null +++ b/apis/backend/as/asentry_resource.go @@ -0,0 +1,309 @@ +/* +Copyright 2024 Nokia. + +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 as + +import ( + "context" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/kform-dev/choreo/apis/condition" + apiequality "k8s.io/apimachinery/pkg/api/equality" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/util/validation/field" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +const ( + ASEntryPlural = "asentries" + ASEntrySingular = "asentry" +) + +var ( + ASEntryShortNames = []string{} + ASEntryCategories = []string{"kuid", "knet"} +) + +// +k8s:deepcopy-gen=false +var _ resource.InternalObject = &ASEntry{} +var _ resource.ObjectList = &ASEntryList{} +var _ resource.ObjectWithStatusSubResource = &ASEntry{} +var _ resource.StatusSubResource = &ASEntryStatus{} + +func (ASEntry) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: ASEntryPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (ASEntry) IsStorageVersion() bool { + return true +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (ASEntry) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *ASEntry) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// GetSingularName returns the singular name of the resource +// GetSingularName implements resource.Object +func (ASEntry) GetSingularName() string { + return ASEntrySingular +} + +// GetShortNames returns the shortnames for the resource +// GetShortNames implements resource.Object +func (ASEntry) GetShortNames() []string { + return ASEntryShortNames +} + +// GetCategories return the categories of the resource +// GetCategories implements resource.Object +func (ASEntry) GetCategories() []string { + return ASEntryCategories +} + +// New return an empty resource +// New implements resource.Object +func (ASEntry) New() runtime.Object { + return &ASEntry{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (ASEntry) NewList() runtime.Object { + return &ASEntryList{} +} + +// IsEqual returns a bool indicating if the desired state of both resources is equal or not +func (r *ASEntry) IsEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*ASEntry) + oldobj := old.(*ASEntry) + + if !apiequality.Semantic.DeepEqual(oldobj.ObjectMeta, newobj.ObjectMeta) { + return false + } + // if equal we also test the spec + return apiequality.Semantic.DeepEqual(oldobj.Spec, newobj.Spec) +} + +// GetStatus return the resource.StatusSubResource interface +func (r *ASEntry) GetStatus() resource.StatusSubResource { + return r.Status +} + +// IsStatusEqual returns a bool indicating if the status of both resources is equal or not +func (r *ASEntry) IsStatusEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*ASEntry) + oldobj := old.(*ASEntry) + return apiequality.Semantic.DeepEqual(oldobj.Status, newobj.Status) +} + +// PrepareForStatusUpdate prepares the status update +func (r *ASEntry) PrepareForStatusUpdate(ctx context.Context, obj, old runtime.Object) { + newObj := obj.(*ASEntry) + oldObj := old.(*ASEntry) + newObj.Spec = oldObj.Spec + + // Status updates are for only for updating status, not objectmeta. + metav1.ResetObjectMetaForStatus(&newObj.ObjectMeta, &newObj.ObjectMeta) +} + +// ValidateStatusUpdate validates status updates +func (r *ASEntry) ValidateStatusUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +// SubResourceName resturns the name of the subresource +// SubResourceName implements the resource.StatusSubResource +func (ASEntryStatus) SubResourceName() string { + return fmt.Sprintf("%s/%s", ASEntryPlural, "status") +} + +// CopyTo copies the content of the status subresource to a parent resource. +// CopyTo implements the resource.StatusSubResource +func (r ASEntryStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { + parent, ok := obj.(*ASEntry) + if ok { + parent.Status = r + } +} + +// GetListMeta returns the ListMeta +// GetListMeta implements the resource.ObjectList +func (r *ASEntryList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// TableConvertor return the table format of the resource +func (r *ASEntry) TableConvertor() func(gr schema.GroupResource) rest.TableConvertor { + return func(gr schema.GroupResource) rest.TableConvertor { + return registry.NewTableConverter( + gr, + func(obj runtime.Object) []interface{} { + config, ok := obj.(*ASEntry) + if !ok { + return nil + } + return []interface{}{ + config.Name, + config.GetCondition(condition.ConditionTypeReady).Status, + config.GetCondition(condition.ConditionTypeReady).Reason, + } + }, + []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + {Name: "Ready", Type: "string"}, + {Name: "Reason", Type: "string"}, + }, + ) + } +} + +// FieldLabelConversion is the schema conversion function for normalizing the FieldSelector for the resource +func (r *ASEntry) FieldLabelConversion() runtime.FieldLabelConversionFunc { + return func(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } + } +} + +func (r *ASEntry) FieldSelector() func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + return func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + var filter *ASEntryFilter + + // add the namespace to the list + namespace, ok := genericapirequest.NamespaceFrom(ctx) + if fieldSelector == nil { + if ok { + return &ASEntryFilter{Namespace: namespace}, nil + } + return filter, nil + } + requirements := fieldSelector.Requirements() + for _, requirement := range requirements { + filter = &ASEntryFilter{} + switch requirement.Operator { + case selection.Equals, selection.DoesNotExist: + if requirement.Value == "" { + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) + } + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) + } + + switch requirement.Field { + case "metadata.name": + filter.Name = requirement.Value + case "metadata.namespace": + filter.Namespace = requirement.Value + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) + } + } + // add namespace to the filter selector if specified + if ok { + if filter != nil { + filter.Namespace = namespace + } else { + filter = &ASEntryFilter{Namespace: namespace} + } + return filter, nil + } + + return &ASEntryFilter{}, nil + } + +} + +type ASEntryFilter struct { + // Name filters by the name of the objects + Name string `protobuf:"bytes,1,opt,name=name"` + + // Namespace filters by the namespace of the objects + Namespace string `protobuf:"bytes,2,opt,name=namespace"` +} + +func (r *ASEntryFilter) Filter(ctx context.Context, obj runtime.Object) bool { + f := false // result of the previous filter + o, ok := obj.(*ASEntry) + if !ok { + return f + } + if r.Name != "" { + if o.GetName() == r.Name { + f = false + } else { + f = true + } + } + if r.Namespace != "" { + if o.GetNamespace() == r.Namespace { + f = false + } else { + f = true + } + } + return f +} + +func (r *ASEntry) PrepareForCreate(ctx context.Context, obj runtime.Object) { + // status cannot be set upon create -> reset it + newobj := obj.(*ASEntry) + newobj.Status = ASEntryStatus{} +} + +// ValidateCreate statically validates +func (r *ASEntry) ValidateCreate(ctx context.Context, obj runtime.Object) field.ErrorList { + return r.ValidateSyntax("") +} + +func (r *ASEntry) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { + // ensure the sttaus dont get updated + newobj := obj.(*ASEntry) + oldObj := old.(*ASEntry) + newobj.Status = oldObj.Status +} + +func (r *ASEntry) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + return r.ValidateSyntax("") +} diff --git a/apis/backend/as/asentry_types.go b/apis/backend/as/asentry_types.go new file mode 100644 index 0000000..1e5dc12 --- /dev/null +++ b/apis/backend/as/asentry_types.go @@ -0,0 +1,71 @@ +/* +Copyright 2024 Nokia. + +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 as + +import ( + "reflect" + + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/backend" + "github.com/kuidio/kuid/apis/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// ASEntrySpec defines the desired state of ASEntry +type ASEntrySpec struct { + // Index defines the index for the resource + Index string `json:"index" yaml:"index" protobuf:"bytes,1,opt,name=index"` + // ClaimType defines the claimType of the resource + ClaimType backend.ClaimType `json:"claimType,omitempty" yaml:"claimType,omitempty" protobuf:"bytes,2,opt,name=claimType"` + // ID defines the id of the resource in the tree + ID string `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,3,opt,name=id"` + // ClaimLabels define the user defined labels and selector labels used + // in resource claim + common.ClaimLabels `json:",inline" yaml:",inline" protobuf:"bytes,5,opt,name=claimLabels"` +} + +// ASEntryStatus defines the observed state of ASEntry +type ASEntryStatus struct { + // ConditionedStatus provides the status of the ASEntry using conditions + // - a ready condition indicates the overall status of the resource + condition.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ASEntry is the Schema for the ASentry API +type ASEntry struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec ASEntrySpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status ASEntryStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// ASEntryList contains a list of ASEntries +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type ASEntryList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []ASEntry `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + ASEntryKind = reflect.TypeOf(ASEntry{}).Name() + ASEntryListKind = reflect.TypeOf(ASEntryList{}).Name() +) diff --git a/apis/backend/as/asindex_helpers.go b/apis/backend/as/asindex_helpers.go new file mode 100644 index 0000000..9e2f774 --- /dev/null +++ b/apis/backend/as/asindex_helpers.go @@ -0,0 +1,90 @@ +/* +Copyright 2024 Nokia. + +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 as + +import ( + "fmt" + + "github.com/kform-dev/choreo/apis/condition" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +// GetCondition returns the condition based on the condition kind +func (r *ASIndex) GetCondition(t condition.ConditionType) condition.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *ASIndex) SetConditions(c ...condition.Condition) { + r.Status.SetConditions(c...) +} + +func (r *ASIndex) ValidateSyntax(s string) field.ErrorList { + var allErrs field.ErrorList + + if r.Spec.MinID != nil { + if err := validateASID(int(*r.Spec.MinID)); err != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.minID"), + r, + fmt.Errorf("invalid vlan ID %d", *r.Spec.MinID).Error(), + )) + } + } + if r.Spec.MaxID != nil { + if err := validateASID(int(*r.Spec.MaxID)); err != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.maxID"), + r, + fmt.Errorf("invalid vlan ID %d", *r.Spec.MaxID).Error(), + )) + } + } + if r.Spec.MinID != nil && r.Spec.MaxID != nil { + if *r.Spec.MinID > *r.Spec.MaxID { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.maxID"), + r, + fmt.Errorf("min vlan ID %d cannot be bigger than max vlan ID %d", *r.Spec.MinID, *r.Spec.MaxID).Error(), + )) + } + } + return allErrs +} + +// BuildASIndex returns a reource from a client Object a Spec/Status +func BuildASIndex(meta metav1.ObjectMeta, spec *ASIndexSpec, status *ASIndexStatus) *ASIndex { + aspec := ASIndexSpec{} + if spec != nil { + aspec = *spec + } + astatus := ASIndexStatus{} + if status != nil { + astatus = *status + } + return &ASIndex{ + TypeMeta: metav1.TypeMeta{ + APIVersion: SchemeGroupVersion.Identifier(), + Kind: ASIndexKind, + }, + ObjectMeta: meta, + Spec: aspec, + Status: astatus, + } +} diff --git a/apis/backend/as/asindex_object.go b/apis/backend/as/asindex_object.go new file mode 100644 index 0000000..8c1e2c7 --- /dev/null +++ b/apis/backend/as/asindex_object.go @@ -0,0 +1,148 @@ +/* +Copyright 2024 Nokia. + +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 as + +import ( + "errors" + "fmt" + + "github.com/henderiw/idxtable/pkg/tree/gtree" + "github.com/henderiw/idxtable/pkg/tree/tree32" + "github.com/henderiw/store" + "github.com/kuidio/kuid/apis/backend" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" + "k8s.io/utils/ptr" +) + +var _ backend.IndexObject = &ASIndex{} + +func (r *ASIndex) GetKey() store.Key { + return store.KeyFromNSN(r.GetNamespacedName()) +} + +func (r *ASIndex) GetNamespacedName() types.NamespacedName { + return types.NamespacedName{ + Namespace: r.GetNamespace(), + Name: r.GetName(), + } +} + +func (r *ASIndex) GetTree() gtree.GTree { + tree, err := tree32.New(32) + if err != nil { + panic(err) + } + return tree +} + +func (r *ASIndex) GetType() string { + return "" +} + +func (r *ASIndex) GetMinID() *uint64 { + if r.Spec.MinID == nil { + return nil + } + return ptr.To[uint64](uint64(*r.Spec.MinID)) +} + +func (r *ASIndex) GetMaxID() *uint64 { + if r.Spec.MaxID == nil { + return nil + } + return ptr.To[uint64](uint64(*r.Spec.MaxID)) +} + +func (r *ASIndex) GetMax() uint64 { + return ASID_Max +} + +func GetMinClaimRange(id uint32) string { + return fmt.Sprintf("%d-%d", ASID_Min, id-1) +} + +func GetMaxClaimRange(id uint32) string { + return fmt.Sprintf("%d-%d", id+1, ASID_Max) +} + +func (r *ASIndex) GetMinClaimNSN() types.NamespacedName { + return types.NamespacedName{ + Namespace: r.Namespace, + Name: fmt.Sprintf("%s.%s", r.Name, backend.IndexReservedMinName), + } +} + +func (r *ASIndex) GetMaxClaimNSN() types.NamespacedName { + return types.NamespacedName{ + Namespace: r.Namespace, + Name: fmt.Sprintf("%s.%s", r.Name, backend.IndexReservedMaxName), + } +} + +func (r *ASIndex) GetMinClaim() backend.ClaimObject { + return BuildASClaim( + metav1.ObjectMeta{ + Namespace: r.GetNamespace(), + Name: r.GetMinClaimNSN().Name, + OwnerReferences: []metav1.OwnerReference{ + { + APIVersion: r.APIVersion, + Kind: r.Kind, + Name: r.Name, + UID: r.UID, + }, + }, + }, + &ASClaimSpec{ + Index: r.Name, + Range: ptr.To[string](GetMinClaimRange(*r.Spec.MinID)), + }, + nil, + ) +} + +func (r *ASIndex) GetMaxClaim() backend.ClaimObject { + return BuildASClaim( + metav1.ObjectMeta{ + Namespace: r.GetNamespace(), + Name: r.GetMaxClaimNSN().Name, + OwnerReferences: []metav1.OwnerReference{ + { + APIVersion: r.APIVersion, + Kind: r.Kind, + Name: r.Name, + UID: r.UID, + }, + }, + }, + &ASClaimSpec{ + Index: r.Name, + Range: ptr.To[string](GetMaxClaimRange(*r.Spec.MaxID)), + }, + nil, + ) +} + +func ASIndexFromRuntime(ru runtime.Object) (backend.IndexObject, error) { + index, ok := ru.(*ASIndex) + if !ok { + return nil, errors.New("runtime object not ASIndex") + } + return index, nil +} diff --git a/apis/backend/as/asindex_resource.go b/apis/backend/as/asindex_resource.go new file mode 100644 index 0000000..2e00c9b --- /dev/null +++ b/apis/backend/as/asindex_resource.go @@ -0,0 +1,309 @@ +/* +Copyright 2024 Nokia. + +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 as + +import ( + "context" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/kform-dev/choreo/apis/condition" + apiequality "k8s.io/apimachinery/pkg/api/equality" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/util/validation/field" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +const ( + ASIndexPlural = "asindices" + ASIndexSingular = "asindex" +) + +var ( + ASIndexShortNames = []string{} + ASIndexCategories = []string{"kuid", "knet"} +) + +// +k8s:deepcopy-gen=false +var _ resource.InternalObject = &ASIndex{} +var _ resource.ObjectList = &ASIndexList{} +var _ resource.ObjectWithStatusSubResource = &ASIndex{} +var _ resource.StatusSubResource = &ASIndexStatus{} + +func (ASIndex) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: ASIndexPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (ASIndex) IsStorageVersion() bool { + return true +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (ASIndex) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *ASIndex) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// GetSingularName returns the singular name of the resource +// GetSingularName implements resource.Object +func (ASIndex) GetSingularName() string { + return ASIndexSingular +} + +// GetShortNames returns the shortnames for the resource +// GetShortNames implements resource.Object +func (ASIndex) GetShortNames() []string { + return ASIndexShortNames +} + +// GetCategories return the categories of the resource +// GetCategories implements resource.Object +func (ASIndex) GetCategories() []string { + return ASIndexCategories +} + +// New return an empty resource +// New implements resource.Object +func (ASIndex) New() runtime.Object { + return &ASIndex{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (ASIndex) NewList() runtime.Object { + return &ASIndexList{} +} + +// IsEqual returns a bool indicating if the desired state of both resources is equal or not +func (r *ASIndex) IsEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*ASIndex) + oldobj := old.(*ASIndex) + + if !apiequality.Semantic.DeepEqual(oldobj.ObjectMeta, newobj.ObjectMeta) { + return false + } + // if equal we also test the spec + return apiequality.Semantic.DeepEqual(oldobj.Spec, newobj.Spec) +} + +// GetStatus return the resource.StatusSubResource interface +func (r *ASIndex) GetStatus() resource.StatusSubResource { + return r.Status +} + +// IsStatusEqual returns a bool indicating if the status of both resources is equal or not +func (r *ASIndex) IsStatusEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*ASIndex) + oldobj := old.(*ASIndex) + return apiequality.Semantic.DeepEqual(oldobj.Status, newobj.Status) +} + +// PrepareForStatusUpdate prepares the status update +func (r *ASIndex) PrepareForStatusUpdate(ctx context.Context, obj, old runtime.Object) { + newObj := obj.(*ASIndex) + oldObj := old.(*ASIndex) + newObj.Spec = oldObj.Spec + + // Status updates are for only for updating status, not objectmeta. + metav1.ResetObjectMetaForStatus(&newObj.ObjectMeta, &newObj.ObjectMeta) +} + +// ValidateStatusUpdate validates status updates +func (r *ASIndex) ValidateStatusUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +// SubResourceName resturns the name of the subresource +// SubResourceName implements the resource.StatusSubResource +func (ASIndexStatus) SubResourceName() string { + return fmt.Sprintf("%s/%s", ASIndexPlural, "status") +} + +// CopyTo copies the content of the status subresource to a parent resource. +// CopyTo implements the resource.StatusSubResource +func (r ASIndexStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { + parent, ok := obj.(*ASIndex) + if ok { + parent.Status = r + } +} + +// GetListMeta returns the ListMeta +// GetListMeta implements the resource.ObjectList +func (r *ASIndexList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// TableConvertor return the table format of the resource +func (r *ASIndex) TableConvertor() func(gr schema.GroupResource) rest.TableConvertor { + return func(gr schema.GroupResource) rest.TableConvertor { + return registry.NewTableConverter( + gr, + func(obj runtime.Object) []interface{} { + config, ok := obj.(*ASIndex) + if !ok { + return nil + } + return []interface{}{ + config.Name, + config.GetCondition(condition.ConditionTypeReady).Status, + config.GetCondition(condition.ConditionTypeReady).Reason, + } + }, + []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + {Name: "Ready", Type: "string"}, + {Name: "Reason", Type: "string"}, + }, + ) + } +} + +// FieldLabelConversion is the schema conversion function for normalizing the FieldSelector for the resource +func (r *ASIndex) FieldLabelConversion() runtime.FieldLabelConversionFunc { + return func(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } + } +} + +func (r *ASIndex) FieldSelector() func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + return func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + var filter *ASIndexFilter + + // add the namespace to the list + namespace, ok := genericapirequest.NamespaceFrom(ctx) + if fieldSelector == nil { + if ok { + return &ASIndexFilter{Namespace: namespace}, nil + } + return filter, nil + } + requirements := fieldSelector.Requirements() + for _, requirement := range requirements { + filter = &ASIndexFilter{} + switch requirement.Operator { + case selection.Equals, selection.DoesNotExist: + if requirement.Value == "" { + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) + } + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) + } + + switch requirement.Field { + case "metadata.name": + filter.Name = requirement.Value + case "metadata.namespace": + filter.Namespace = requirement.Value + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) + } + } + // add namespace to the filter selector if specified + if ok { + if filter != nil { + filter.Namespace = namespace + } else { + filter = &ASIndexFilter{Namespace: namespace} + } + return filter, nil + } + + return &ASIndexFilter{}, nil + } + +} + +type ASIndexFilter struct { + // Name filters by the name of the objects + Name string `protobuf:"bytes,1,opt,name=name"` + + // Namespace filters by the namespace of the objects + Namespace string `protobuf:"bytes,2,opt,name=namespace"` +} + +func (r *ASIndexFilter) Filter(ctx context.Context, obj runtime.Object) bool { + f := false // result of the previous filter + o, ok := obj.(*ASIndex) + if !ok { + return f + } + if r.Name != "" { + if o.GetName() == r.Name { + f = false + } else { + f = true + } + } + if r.Namespace != "" { + if o.GetNamespace() == r.Namespace { + f = false + } else { + f = true + } + } + return f +} + +func (r *ASIndex) PrepareForCreate(ctx context.Context, obj runtime.Object) { + // status cannot be set upon create -> reset it + newobj := obj.(*ASIndex) + newobj.Status = ASIndexStatus{} +} + +// ValidateCreate statically validates +func (r *ASIndex) ValidateCreate(ctx context.Context, obj runtime.Object) field.ErrorList { + return r.ValidateSyntax("") +} + +func (r *ASIndex) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { + // ensure the sttaus dont get updated + newobj := obj.(*ASIndex) + oldObj := old.(*ASIndex) + newobj.Status = oldObj.Status +} + +func (r *ASIndex) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + return r.ValidateSyntax("") +} diff --git a/apis/backend/vlan/v1alpha1/vlanindex_types.go b/apis/backend/as/asindex_types.go similarity index 64% rename from apis/backend/vlan/v1alpha1/vlanindex_types.go rename to apis/backend/as/asindex_types.go index 3f8643f..6a7d26f 100644 --- a/apis/backend/vlan/v1alpha1/vlanindex_types.go +++ b/apis/backend/as/asindex_types.go @@ -14,18 +14,18 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package as import ( "reflect" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/common" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) -// VLANIndexSpec defines the desired state of VLANIndex -type VLANIndexSpec struct { +// ASIndexSpec defines the desired state of ASIndex +type ASIndexSpec struct { // MinID defines the min VLAN ID the index supports // +optional MinID *uint32 `json:"minID,omitempty" yaml:"minID,omitempty" protobuf:"bytes,1,opt,name=minID"` @@ -34,11 +34,11 @@ type VLANIndexSpec struct { MaxID *uint32 `json:"maxID,omitempty" yaml:"maxID,omitempty" protobuf:"bytes,2,opt,name=maxID"` // UserDefinedLabels define metadata to the resource. // defined in the spec to distingiush metadata labels from user defined labels - commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` + common.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` } -// VLANIndexStatus defines the observed state of VLANIndex -type VLANIndexStatus struct { +// ASIndexStatus defines the observed state of ASIndex +type ASIndexStatus struct { // MinID defines the min VLAN ID the index supports // +optional MinID *uint32 `json:"minID,omitempty" yaml:"minID,omitempty" protobuf:"bytes,1,opt,name=minID"` @@ -47,32 +47,30 @@ type VLANIndexStatus struct { MaxID *uint32 `json:"maxID,omitempty" yaml:"maxID,omitempty" protobuf:"bytes,2,opt,name=maxID"` // ConditionedStatus provides the status of the VLANIndex using conditions // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=conditionedStatus"` + condition.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=conditionedStatus"` } // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// VLANIndex is the Schema for the VLANIndex API -// -// +k8s:openapi-gen=true -type VLANIndex struct { +// ASIndex is the Schema for the ASIndex API +type ASIndex struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Spec VLANIndexSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - Status VLANIndexStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` + Spec ASIndexSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status ASIndexStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } -// VLANIndexList contains a list of VLANIndexs +// ASIndexList contains a list of ASIndexs // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type VLANIndexList struct { +type ASIndexList struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []VLANIndex `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` + Items []ASIndex `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` } var ( - VLANIndexKind = reflect.TypeOf(VLANIndex{}).Name() - VLANIndexListKind = reflect.TypeOf(VLANIndexList{}).Name() + ASIndexKind = reflect.TypeOf(ASIndex{}).Name() + ASIndexListKind = reflect.TypeOf(ASIndexList{}).Name() ) diff --git a/apis/backend/as/doc.go b/apis/backend/as/doc.go index 520491c..3e1993e 100644 --- a/apis/backend/as/doc.go +++ b/apis/backend/as/doc.go @@ -17,5 +17,5 @@ limitations under the License. // +k8s:deepcopy-gen=package,register // +groupName=as.be.kuid.dev -// as defines the as api -package as +// Package v1alpha1 is the internal version of the API. +package as // import "github.com/kuidio/kuid/apis/backend/as" diff --git a/apis/backend/as/handlers/confighandler.go b/apis/backend/as/handlers/confighandler.go new file mode 100644 index 0000000..794e843 --- /dev/null +++ b/apis/backend/as/handlers/confighandler.go @@ -0,0 +1,63 @@ +package handlers + +import ( + "context" + + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" +) + +type ASStoreHandler struct { +} + +func (r *ASStoreHandler) DryRunCreateFn(ctx context.Context, key types.NamespacedName, obj runtime.Object, dryrun bool) (runtime.Object, error) { + /* + accessor, err := meta.Accessor(obj) + if err != nil { + return obj, err + } + targetKey, err := config.GetTargetKey(accessor.GetLabels()) + if err != nil { + return obj, err + } + cfg := obj.(*config.Config) + obj, _, err = r.Handler.SetIntent(ctx, targetKey, cfg, true, dryrun) + if err != nil { + return obj, err + } + */ + return obj, nil +} +func (r *ASStoreHandler) DryRunUpdateFn(ctx context.Context, key types.NamespacedName, obj, old runtime.Object, dryrun bool) (runtime.Object, error) { + /* + accessor, err := meta.Accessor(obj) + if err != nil { + return obj, err + } + targetKey, err := config.GetTargetKey(accessor.GetLabels()) + if err != nil { + return obj, err + } + cfg := obj.(*config.Config) + obj, _, err = r.Handler.SetIntent(ctx, targetKey, cfg, true, dryrun) + if err != nil { + return obj, err + } + */ + return obj, nil +} +func (r *ASStoreHandler) DryRunDeleteFn(ctx context.Context, key types.NamespacedName, obj runtime.Object, dryrun bool) (runtime.Object, error) { + /* + accessor, err := meta.Accessor(obj) + if err != nil { + return obj, err + } + targetKey, err := config.GetTargetKey(accessor.GetLabels()) + if err != nil { + return obj, err + } + cfg := obj.(*config.Config) + return r.Handler.DeleteIntent(ctx, targetKey, cfg, dryrun) + */ + return obj, nil +} diff --git a/apis/generated/clientset/versioned/typed/extcomm/v1alpha1/generated_expansion.go b/apis/backend/as/helper.go similarity index 53% rename from apis/generated/clientset/versioned/typed/extcomm/v1alpha1/generated_expansion.go rename to apis/backend/as/helper.go index d4af5c7..e354dee 100644 --- a/apis/generated/clientset/versioned/typed/extcomm/v1alpha1/generated_expansion.go +++ b/apis/backend/as/helper.go @@ -13,12 +13,35 @@ 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 v1alpha1 +package as -type EXTCOMMClaimExpansion interface{} +import ( + "fmt" + "strconv" +) -type EXTCOMMEntryExpansion interface{} +const ASID_Min = 0 +const ASID_Max = 4294967295 -type EXTCOMMIndexExpansion interface{} +func validateASID(id int) error { + if id < ASID_Min { + return fmt.Errorf("invalid id, got %d", id) + } + if id > ASID_Max { + return fmt.Errorf("invalid id, got %d", id) + } + return nil +} + +func getASDot(asn uint32) string { + if asn > 65536 { + a := asn / 65536 + b := asn - (a * 65536) + return fmt.Sprintf("%d.%d", a, b) + } + return strconv.Itoa(int(asn)) +} + +// storage +// create a backend diff --git a/apis/backend/as/register.go b/apis/backend/as/register.go new file mode 100644 index 0000000..8ec001a --- /dev/null +++ b/apis/backend/as/register.go @@ -0,0 +1,52 @@ +// Copyright 2022 The kpt 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. + +package as + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +const ( + GroupName = "as.be.kuid.dev" + Version = runtime.APIVersionInternal +) + +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: Version} + +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme +) + +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &ASIndex{}, + &ASIndexList{}, + &ASClaim{}, + &ASClaimList{}, + &ASEntry{}, + &ASEntryList{}, + ) + return nil +} diff --git a/apis/backend/as/storage.go b/apis/backend/as/storage.go new file mode 100644 index 0000000..8d9ab21 --- /dev/null +++ b/apis/backend/as/storage.go @@ -0,0 +1,116 @@ +// Copyright 2022 The kpt 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. + +package as + +import ( + "context" + + "github.com/henderiw/apiserver-builder/pkg/builder" + "github.com/henderiw/apiserver-builder/pkg/builder/rest" + "github.com/kuidio/kuid/apis/backend" + bebackend "github.com/kuidio/kuid/pkg/backend" + genericbackend "github.com/kuidio/kuid/pkg/backend/generic" + genericregistry "github.com/kuidio/kuid/pkg/registry/generic" + "github.com/kuidio/kuid/pkg/registry/options" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apiserver/pkg/registry/generic" +) + +func NewStorageProviders(ctx context.Context, sync bool, options *options.Options) backend.StorageProviders { + r := &storageProviders{ + be: genericbackend.New( + ASClaimKind, + ASIndexFromRuntime, + ASClaimFromRuntime, + ASEntryFromRuntime, + GetASEntry, + ), + } + + if sync { + opts := *options + opts.BackendInvoker = bebackend.NewIndexInvoker(r.be) + r.indexStorageProvider = genericregistry.NewStorageProvider(ctx, &ASIndex{}, &opts) + } + if sync { + opts := *options + opts.BackendInvoker = bebackend.NewClaimInvoker(r.be) + r.claimStorageProvider = genericregistry.NewStorageProvider(ctx, &ASClaim{}, &opts) + } + r.entryStorageProvider = genericregistry.NewStorageProvider(ctx, &ASEntry{}, options) + + return r +} + +type storageProviders struct { + be bebackend.Backend + indexStorageProvider *rest.StorageProvider + claimStorageProvider *rest.StorageProvider + entryStorageProvider *rest.StorageProvider +} + +func (r *storageProviders) GetIndexStorageProvider() *rest.StorageProvider { + return r.indexStorageProvider + +} +func (r *storageProviders) GetClaimStorageProvider() *rest.StorageProvider { + return r.claimStorageProvider + +} +func (r *storageProviders) GetEntryStorageProvider() *rest.StorageProvider { + return r.entryStorageProvider +} + +func (r *storageProviders) ApplyStorageToBackend(ctx context.Context, apiServer *builder.Server) error { + claimStorageProvider := apiServer.StorageProvider[schema.GroupResource{ + Group: SchemeGroupVersion.Group, + Resource: ASClaimPlural, + }] + + claimStorage, err := claimStorageProvider.Get(ctx, apiServer.Schemes[0], &ClaimGetter{}) + if err != nil { + return err + } + + entryStorageProvider := apiServer.StorageProvider[schema.GroupResource{ + Group: SchemeGroupVersion.Group, + Resource: ASIndexPlural, + }] + + entryStorage, err := entryStorageProvider.Get(ctx, apiServer.Schemes[0], &EntryGetter{}) + if err != nil { + return err + } + + r.be.AddStorage(entryStorage, claimStorage) + return nil +} + +var _ generic.RESTOptionsGetter = &ClaimGetter{} + +type ClaimGetter struct{} + +func (r *ClaimGetter) GetRESTOptions(resource schema.GroupResource, example runtime.Object) (generic.RESTOptions, error) { + return generic.RESTOptions{}, nil +} + +var _ generic.RESTOptionsGetter = &EntryGetter{} + +type EntryGetter struct{} + +func (r *EntryGetter) GetRESTOptions(resource schema.GroupResource, example runtime.Object) (generic.RESTOptions, error) { + return generic.RESTOptions{}, nil +} diff --git a/apis/backend/as/v1alpha1/asclaim_resource.go b/apis/backend/as/v1alpha1/asclaim_resource.go new file mode 100644 index 0000000..cf272a9 --- /dev/null +++ b/apis/backend/as/v1alpha1/asclaim_resource.go @@ -0,0 +1,80 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/kuidio/kuid/apis/backend/as" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +k8s:deepcopy-gen=false +var _ resource.Object = &ASClaim{} +var _ resource.ObjectList = &ASClaimList{} +var _ resource.MultiVersionObject = &ASClaim{} + +func (ASClaim) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: as.ASClaimPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (ASClaim) IsStorageVersion() bool { + return false +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (ASClaim) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *ASClaim) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// New return an empty resource +// New implements resource.Object +func (ASClaim) New() runtime.Object { + return &ASClaim{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (ASClaim) NewList() runtime.Object { + return &ASClaimList{} +} + +// GetListMeta returns the ListMeta +// GetListMeta implements resource.ObjectList +func (r *ASClaimList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// RegisterConversions registers the conversions. +// RegisterConversions implements resource.MultiVersionObject +func (ASClaim) RegisterConversions() func(s *runtime.Scheme) error { + return RegisterConversions +} diff --git a/apis/backend/as/v1alpha1/asclaim_types.go b/apis/backend/as/v1alpha1/asclaim_types.go index 9f7d4be..7e72a02 100644 --- a/apis/backend/as/v1alpha1/asclaim_types.go +++ b/apis/backend/as/v1alpha1/asclaim_types.go @@ -19,8 +19,8 @@ package v1alpha1 import ( "reflect" + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -37,16 +37,13 @@ type ASClaimSpec struct { // ClaimLabels define the user defined labels and selector labels used // in resource claim commonv1alpha1.ClaimLabels `json:",inline" yaml:",inline" protobuf:"bytes,4,opt,name=claimLabels"` - // Owner defines the ownerReference of the ASClaim - // Allow for different namesapces, hence it is part of the spec - Owner *commonv1alpha1.OwnerReference `json:"owner,omitempty" yaml:"owner,omitempty" protobuf:"bytes,5,opt,name=owner"` } // ASClaimStatus defines the observed state of ASClaim type ASClaimStatus struct { - // ConditionedStatus provides the status of the IPClain using conditions + // ConditionedStatus provides the status of the ASClain using conditions // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` + condv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` // ASID defines the AS for the AS claim // +optional ID *uint32 `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,2,opt,name=id"` @@ -63,8 +60,6 @@ type ASClaimStatus struct { // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // ASClaim is the Schema for the ASClaim API -// -// +k8s:openapi-gen=true type ASClaim struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/apis/backend/as/v1alpha1/asentry_interface.go b/apis/backend/as/v1alpha1/asentry_interface.go deleted file mode 100644 index 0c46851..0000000 --- a/apis/backend/as/v1alpha1/asentry_interface.go +++ /dev/null @@ -1,272 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "crypto/sha1" - "encoding/json" - "fmt" - "strings" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" -) - -const ASEntryPlural = "asentries" -const ASEntrySingular = "asentry" - -// +k8s:deepcopy-gen=false -var _ resource.Object = &ASEntry{} -var _ resource.ObjectList = &ASEntryList{} - -// GetListMeta returns the ListMeta -func (r *ASEntryList) GetListMeta() *metav1.ListMeta { - return &r.ListMeta -} - -func (r *ASEntryList) GetItems() []backend.Object { - entries := make([]backend.Object, 0, len(r.Items)) - for _, entry := range r.Items { - entries = append(entries, &entry) - } - return entries -} - -func (r *ASEntry) GetSingularName() string { - return ASEntrySingular -} - -func (ASEntry) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Resource: ASEntryPlural, - } -} - -// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. -// IsStorageVersion implements resource.Object. -func (ASEntry) IsStorageVersion() bool { - return true -} - -// GetObjectMeta implements resource.Object -func (r *ASEntry) GetObjectMeta() *metav1.ObjectMeta { - return &r.ObjectMeta -} - -// NamespaceScoped returns true to indicate Fortune is a namespaced resource. -// NamespaceScoped implements resource.Object. -func (ASEntry) NamespaceScoped() bool { - return true -} - -// New implements resource.Object -func (ASEntry) New() runtime.Object { - return &ASEntry{} -} - -// NewList implements resource.Object -func (ASEntry) NewList() runtime.Object { - return &ASEntryList{} -} - -// GetCondition returns the condition based on the condition kind -func (r *ASEntry) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { - return r.Status.GetCondition(t) -} - -// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions -// to be set at once -func (r *ASEntry) SetConditions(c ...conditionv1alpha1.Condition) { - r.Status.SetConditions(c...) -} - -// ASEntryConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for ASEntry -func ASEntryConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { - switch label { - case "metadata.name": - return label, value, nil - case "metadata.namespace": - return label, value, nil - case "spec.index": - return label, value, nil - default: - return "", "", fmt.Errorf("%q is not a known field selector", label) - } -} - -func (r *ASEntry) CalculateHash() ([sha1.Size]byte, error) { - // Convert the struct to JSON - jsonData, err := json.Marshal(r) - if err != nil { - return [sha1.Size]byte{}, err - } - - // Calculate SHA-1 hash - return sha1.Sum(jsonData), nil -} - -func (r *ASEntry) GetNamespacedName() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.GetNamespace(), - Name: r.GetName(), - } -} - -func (r *ASEntry) GetKey() store.Key { - return store.KeyFromNSN(types.NamespacedName{Namespace: r.Namespace, Name: r.Spec.Index}) -} - -func (r *ASEntry) GetOwnerReference() *commonv1alpha1.OwnerReference { - return r.Spec.Owner -} - -func (r *ASEntry) GetClaimName() string { - return r.Spec.Claim -} - -func (r *ASEntry) GetClaimType() backend.ClaimType { - return r.Spec.ClaimType -} - -func (r *ASEntry) GetIndex() string { - return r.Spec.Index -} - -func (r *ASEntry) GetOwnerGVK() schema.GroupVersionKind { - return schema.GroupVersionKind{ - Group: r.Spec.Owner.Group, - Version: r.Spec.Owner.Version, - Kind: r.Spec.Owner.Kind, - } -} - -func (r *ASEntry) GetOwnerNSN() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.Spec.Owner.Namespace, - Name: r.Spec.Owner.Name, - } -} - -func (r *ASEntry) GetSpec() any { - return r.Spec -} - -func (r *ASEntry) GetSpecID() string { - return r.Spec.ID -} - -func (r *ASEntry) SetSpec(s any) { - if spec, ok := s.(ASEntrySpec); ok { - r.Spec = spec - } -} - -func GetASEntry(k store.Key, vrange, id string, labels map[string]string) backend.EntryObject { - index := k.Name - ns := k.Namespace - - spec := &ASEntrySpec{ - Index: index, - ClaimType: backend.GetClaimTypeFromString(labels[backend.KuidClaimTypeKey]), - Claim: labels[backend.KuidClaimNameKey], - ID: id, - Owner: &commonv1alpha1.OwnerReference{ - Group: labels[backend.KuidOwnerGroupKey], - Version: labels[backend.KuidOwnerVersionKey], - Kind: labels[backend.KuidOwnerKindKey], - Namespace: labels[backend.KuidOwnerNamespaceKey], - Name: labels[backend.KuidOwnerNameKey], - }, - } - // filter the system defined labels from the labels to prepare for the user defined labels - udLabels := map[string]string{} - for k, v := range labels { - if !backend.BackendSystemKeys.Has(k) { - udLabels[k] = v - } - } - spec.UserDefinedLabels.Labels = udLabels - - status := &ASEntryStatus{} - status.SetConditions(conditionv1alpha1.Ready()) - - id = strings.ReplaceAll(id, "/", "-") - name := fmt.Sprintf("%s.%s", index, id) - if vrange != "" { - name = fmt.Sprintf("%s.%s", vrange, id) - } - - return BuildASEntry( - metav1.ObjectMeta{ - Name: name, - Namespace: ns, - }, - spec, - status, - ) -} - -// BuildASEntry returns a reource from a client Object a Spec/Status -func BuildASEntry(meta metav1.ObjectMeta, spec *ASEntrySpec, status *ASEntryStatus) backend.EntryObject { - aspec := ASEntrySpec{} - if spec != nil { - aspec = *spec - } - astatus := ASEntryStatus{} - if status != nil { - astatus = *status - } - return &ASEntry{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: ASEntryKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -func (r *ASEntry) ValidateSyntax(_ string) field.ErrorList { - var allErrs field.ErrorList - return allErrs -} - -func (r *ASEntry) NewObjList() backend.GenericObjectList { - return &ASEntryList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: ASEntryListKind}, - } -} - -func (r *ASEntryList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} diff --git a/apis/backend/as/v1alpha1/asentry_resource.go b/apis/backend/as/v1alpha1/asentry_resource.go new file mode 100644 index 0000000..9f2f5f7 --- /dev/null +++ b/apis/backend/as/v1alpha1/asentry_resource.go @@ -0,0 +1,80 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/kuidio/kuid/apis/backend/as" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +k8s:deepcopy-gen=false +var _ resource.Object = &ASEntry{} +var _ resource.ObjectList = &ASEntryList{} +var _ resource.MultiVersionObject = &ASEntry{} + +func (ASEntry) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: as.ASEntryPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (ASEntry) IsStorageVersion() bool { + return false +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (ASEntry) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *ASEntry) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// New return an empty resource +// New implements resource.Object +func (ASEntry) New() runtime.Object { + return &ASClaim{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (ASEntry) NewList() runtime.Object { + return &ASClaimList{} +} + +// GetListMeta returns the ListMeta +// GetListMeta implements resource.ObjectList +func (r *ASEntryList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// RegisterConversions registers the conversions. +// RegisterConversions implements resource.MultiVersionObject +func (ASEntry) RegisterConversions() func(s *runtime.Scheme) error { + return RegisterConversions +} diff --git a/apis/backend/as/v1alpha1/asentry_types.go b/apis/backend/as/v1alpha1/asentry_types.go index 2f81d49..eed3d3b 100644 --- a/apis/backend/as/v1alpha1/asentry_types.go +++ b/apis/backend/as/v1alpha1/asentry_types.go @@ -19,43 +19,36 @@ package v1alpha1 import ( "reflect" + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" "github.com/kuidio/kuid/apis/backend" commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) // ASEntrySpec defines the desired state of ASEntry type ASEntrySpec struct { - // ASIndex defines the AS index for the AS Claim + // Index defines the index for the resource Index string `json:"index" yaml:"index" protobuf:"bytes,1,opt,name=index"` - // ClaimType defines the claimType of the AS Entry + // ClaimType defines the claimType of the resource ClaimType backend.ClaimType `json:"claimType,omitempty" yaml:"claimType,omitempty" protobuf:"bytes,2,opt,name=claimType"` - // ID defines the id of the AS entry in the tree + // ID defines the id of the resource in the tree ID string `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,3,opt,name=id"` // ClaimLabels define the user defined labels and selector labels used // in resource claim - commonv1alpha1.ClaimLabels `json:",inline" yaml:",inline" protobuf:"bytes,4,opt,name=claimLabels"` - // Claim defines the name of the claim that is the origin of this entry - Claim string `json:"claim" yaml:"claim" protobuf:"bytes,5,opt,name=claim"` - // Owner defines the ownerReference of the ASClaim - // Allow for different namesapces, hence it is part of the spec - Owner *commonv1alpha1.OwnerReference `json:"owner,omitempty" yaml:"owner,omitempty" protobuf:"bytes,6,opt,name=owner"` + commonv1alpha1.ClaimLabels `json:",inline" yaml:",inline" protobuf:"bytes,5,opt,name=claimLabels"` } // ASEntryStatus defines the observed state of ASEntry type ASEntryStatus struct { // ConditionedStatus provides the status of the ASEntry using conditions // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` + condv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` } // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // ASEntry is the Schema for the ASentry API -// -// +k8s:openapi-gen=true type ASEntry struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/apis/backend/as/v1alpha1/as_types.go b/apis/backend/as/v1alpha1/asindex_helper.go similarity index 100% rename from apis/backend/as/v1alpha1/as_types.go rename to apis/backend/as/v1alpha1/asindex_helper.go diff --git a/apis/backend/as/v1alpha1/asindex_interface.go b/apis/backend/as/v1alpha1/asindex_interface.go deleted file mode 100644 index 03eaaf2..0000000 --- a/apis/backend/as/v1alpha1/asindex_interface.go +++ /dev/null @@ -1,309 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "crypto/sha1" - "encoding/json" - "fmt" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/idxtable/pkg/tree/gtree" - "github.com/henderiw/idxtable/pkg/tree/tree32" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" - "k8s.io/utils/ptr" -) - -const ASIndexPlural = "asindices" -const ASIndexSingular = "asindex" - -// +k8s:deepcopy-gen=false -var _ resource.Object = &ASIndex{} -var _ resource.ObjectList = &ASIndexList{} - -// GetListMeta returns the ListMeta -func (r *ASIndexList) GetListMeta() *metav1.ListMeta { - return &r.ListMeta -} - -func (r *ASIndex) GetSingularName() string { - return ASIndexSingular -} - -func (ASIndex) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Resource: ASIndexPlural, - } -} - -// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. -// IsStorageVersion implements resource.Object. -func (ASIndex) IsStorageVersion() bool { - return true -} - -// GetObjectMeta implements resource.Object -func (r *ASIndex) GetObjectMeta() *metav1.ObjectMeta { - return &r.ObjectMeta -} - -// NamespaceScoped returns true to indicate Fortune is a namespaced resource. -// NamespaceScoped implements resource.Object. -func (ASIndex) NamespaceScoped() bool { - return true -} - -// New implements resource.Object -func (ASIndex) New() runtime.Object { - return &ASIndex{} -} - -// NewList implements resource.Object -func (ASIndex) NewList() runtime.Object { - return &ASIndexList{} -} - -// GetCondition returns the condition based on the condition kind -func (r *ASIndex) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { - return r.Status.GetCondition(t) -} - -// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions -// to be set at once -func (r *ASIndex) SetConditions(c ...conditionv1alpha1.Condition) { - r.Status.SetConditions(c...) -} - -// ASIndexConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for ASIndex -func ASIndexConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { - switch label { - case "metadata.name": - return label, value, nil - case "metadata.namespace": - return label, value, nil - default: - return "", "", fmt.Errorf("%q is not a known field selector", label) - } -} - -func (r *ASIndexList) GetItems() []backend.Object { - objs := []backend.Object{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *ASIndex) CalculateHash() ([sha1.Size]byte, error) { - // Convert the struct to JSON - jsonData, err := json.Marshal(r) - if err != nil { - return [sha1.Size]byte{}, err - } - - // Calculate SHA-1 hash - return sha1.Sum(jsonData), nil -} - -func (r *ASIndex) GetNamespacedName() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.GetNamespace(), - Name: r.GetName(), - } -} - -func (r *ASIndex) GetTree() gtree.GTree { - tree, err := tree32.New(32) - if err != nil { - panic(err) - } - return tree -} - -func (r *ASIndex) GetKey() store.Key { - return store.KeyFromNSN(r.GetNamespacedName()) -} - -func (r *ASIndex) GetType() string { - return "" -} - -func (r *ASIndex) GetOwnerReference() *commonv1alpha1.OwnerReference { - return &commonv1alpha1.OwnerReference{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Kind: ASIndexKind, - Namespace: r.Namespace, - Name: r.Name, - } -} - -func (r *ASIndex) ValidateSyntax(_ string) field.ErrorList { - var allErrs field.ErrorList - - if r.Spec.MinID != nil { - if err := validateASID(int(*r.Spec.MinID)); err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.minID"), - r, - fmt.Errorf("invalid vlan ID %d", *r.Spec.MinID).Error(), - )) - } - } - if r.Spec.MaxID != nil { - if err := validateASID(int(*r.Spec.MaxID)); err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.maxID"), - r, - fmt.Errorf("invalid vlan ID %d", *r.Spec.MaxID).Error(), - )) - } - } - if r.Spec.MinID != nil && r.Spec.MaxID != nil { - if *r.Spec.MinID > *r.Spec.MaxID { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.maxID"), - r, - fmt.Errorf("min vlan ID %d cannot be bigger than max vlan ID %d", *r.Spec.MinID, *r.Spec.MaxID).Error(), - )) - } - } - return allErrs -} - -func GetMinClaimRange(id uint32) string { - return fmt.Sprintf("%d-%d", ASID_Min, id-1) -} - -func GetMaxClaimRange(id uint32) string { - return fmt.Sprintf("%d-%d", id+1, ASID_Max) -} - -func (r *ASIndex) GetMinID() *uint64 { - if r.Spec.MinID == nil { - return nil - } - return ptr.To[uint64](uint64(*r.Spec.MinID)) -} - -func (r *ASIndex) GetMaxID() *uint64 { - if r.Spec.MaxID == nil { - return nil - } - return ptr.To[uint64](uint64(*r.Spec.MaxID)) -} - -func (r *ASIndex) GetMinClaimNSN() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.Namespace, - Name: fmt.Sprintf("%s.%s", r.Name, backend.IndexReservedMinName), - } -} - -func (r *ASIndex) GetMaxClaimNSN() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.Namespace, - Name: fmt.Sprintf("%s.%s", r.Name, backend.IndexReservedMaxName), - } -} - -func (r *ASIndex) GetMinClaim() backend.ClaimObject { - return BuildASClaim( - metav1.ObjectMeta{ - Namespace: r.GetNamespace(), - Name: r.GetMinClaimNSN().Name, - }, - &ASClaimSpec{ - Index: r.Name, - Range: ptr.To[string](GetMinClaimRange(*r.Spec.MinID)), - Owner: commonv1alpha1.GetOwnerReference(r), - }, - nil, - ) -} - -func (r *ASIndex) GetMaxClaim() backend.ClaimObject { - return BuildASClaim( - metav1.ObjectMeta{ - Namespace: r.GetNamespace(), - Name: r.GetMaxClaimNSN().Name, - }, - &ASClaimSpec{ - Index: r.Name, - Range: ptr.To[string](GetMaxClaimRange(*r.Spec.MaxID)), - Owner: commonv1alpha1.GetOwnerReference(r), - }, - nil, - ) -} - -// BuildASIndex returns a reource from a client Object a Spec/Status -func BuildASIndex(meta metav1.ObjectMeta, spec *ASIndexSpec, status *ASIndexStatus) *ASIndex { - aspec := ASIndexSpec{} - if spec != nil { - aspec = *spec - } - astatus := ASIndexStatus{} - if status != nil { - astatus = *status - } - return &ASIndex{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: ASIndexKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -func (r *ASIndex) GetSpec() any { - return r.Spec -} - -func (r *ASIndex) SetSpec(s any) { - if spec, ok := s.(ASIndexSpec); ok { - r.Spec = spec - } -} - -func (r *ASIndex) NewObjList() backend.GenericObjectList { - return &ASClaimList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: ASClaimListKind}, - } -} - -func (r *ASIndexList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} diff --git a/apis/backend/as/v1alpha1/asindex_resource.go b/apis/backend/as/v1alpha1/asindex_resource.go new file mode 100644 index 0000000..fd89635 --- /dev/null +++ b/apis/backend/as/v1alpha1/asindex_resource.go @@ -0,0 +1,80 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/kuidio/kuid/apis/backend/as" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +k8s:deepcopy-gen=false +var _ resource.Object = &ASIndex{} +var _ resource.ObjectList = &ASIndexList{} +var _ resource.MultiVersionObject = &ASIndex{} + +func (ASIndex) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: as.ASIndexPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (ASIndex) IsStorageVersion() bool { + return false +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (ASIndex) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *ASIndex) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// New return an empty resource +// New implements resource.Object +func (ASIndex) New() runtime.Object { + return &ASClaim{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (ASIndex) NewList() runtime.Object { + return &ASClaimList{} +} + +// GetListMeta returns the ListMeta +// GetListMeta implements resource.ObjectList +func (r *ASIndexList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// RegisterConversions registers the conversions. +// RegisterConversions implements resource.MultiVersionObject +func (ASIndex) RegisterConversions() func(s *runtime.Scheme) error { + return RegisterConversions +} diff --git a/apis/backend/as/v1alpha1/asindex_types.go b/apis/backend/as/v1alpha1/asindex_types.go index 87f0dfd..58e157a 100644 --- a/apis/backend/as/v1alpha1/asindex_types.go +++ b/apis/backend/as/v1alpha1/asindex_types.go @@ -19,8 +19,8 @@ package v1alpha1 import ( "reflect" + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -47,15 +47,13 @@ type ASIndexStatus struct { MaxID *uint32 `json:"maxID,omitempty" yaml:"maxID,omitempty" protobuf:"bytes,2,opt,name=maxID"` // ConditionedStatus provides the status of the VLANIndex using conditions // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=conditionedStatus"` + condv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=conditionedStatus"` } // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // ASIndex is the Schema for the ASIndex API -// -// +k8s:openapi-gen=true type ASIndex struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/apis/backend/as/v1alpha1/conversion.go b/apis/backend/as/v1alpha1/conversion.go new file mode 100644 index 0000000..770b724 --- /dev/null +++ b/apis/backend/as/v1alpha1/conversion.go @@ -0,0 +1,172 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "errors" + unsafe "unsafe" + + "github.com/kform-dev/choreo/apis/condition" + conditionv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + "github.com/kuidio/kuid/apis/common" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + conversion "k8s.io/apimachinery/pkg/conversion" +) + +// Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus is hand made conversion function. +func Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(in *conditionv1alpha1.ConditionedStatus, out *condition.ConditionedStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(in, out, s) +} + +func autoConvert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(in *conditionv1alpha1.ConditionedStatus, out *condition.ConditionedStatus, _ conversion.Scope) error { + out.Conditions = *(*[]condition.Condition)(unsafe.Pointer(&in.Conditions)) + return nil +} + +// Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus is hand made conversion function. +func Convert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(in *condition.ConditionedStatus, out *conditionv1alpha1.ConditionedStatus, s conversion.Scope) error { + return autoConvert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(in, out, s) +} + +func autoConvert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(in *condition.ConditionedStatus, out *conditionv1alpha1.ConditionedStatus, _ conversion.Scope) error { + out.Conditions = *(*[]conditionv1alpha1.Condition)(unsafe.Pointer(&in.Conditions)) + return nil +} + +// Convert_condition_Condition_To_v1alpha1_Condition is hand made conversion function. +func Convert_condition_Condition_To_v1alpha1_Condition(in *condition.Condition, out *conditionv1alpha1.Condition, s conversion.Scope) error { + return autoConvert_condition_Condition_To_v1alpha1_Condition(in, out, s) +} + +func autoConvert_condition_Condition_To_v1alpha1_Condition(in *condition.Condition, out *conditionv1alpha1.Condition, _ conversion.Scope) error { + out.Condition = in.Condition + return nil +} + +// Convert_TargetStatus_To_config_TargetStatus is hand made conversion function. +func Convert_v1alpha1_Condition_To_condition_Condition(in *conditionv1alpha1.Condition, out *condition.Condition, s conversion.Scope) error { + return autoConvert_v1alpha1_Condition_To_condition_Condition(in, out, s) +} + +func autoConvert_v1alpha1_Condition_To_condition_Condition(in *conditionv1alpha1.Condition, out *condition.Condition, _ conversion.Scope) error { + out.Condition = in.Condition + return nil +} + +// Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus is hand made conversion function. +func Convert_common_ClaimLabels_To_v1alpha1_ClaimLabels(in *common.ClaimLabels, out *commonv1alpha1.ClaimLabels, s conversion.Scope) error { + return autoConvert_common_ClaimLabels_To_v1alpha1_ClaimLabels(in, out, s) +} + +func autoConvert_common_ClaimLabels_To_v1alpha1_ClaimLabels(in *common.ClaimLabels, out *commonv1alpha1.ClaimLabels, _ conversion.Scope) error { + if in == nil { + return errors.New("input ClaimLabels is nil") + } + if out == nil { + out = &commonv1alpha1.ClaimLabels{} // Allocate new structure if out is nil, depending on the use case this might be handled differently + } + + // Assuming UserDefinedLabels can be directly copied + out.UserDefinedLabels = commonv1alpha1.UserDefinedLabels(in.UserDefinedLabels) + + // Manually handle the conversion of the LabelSelector + if in.Selector != nil { + out.Selector = &metav1.LabelSelector{} + if in.Selector.MatchLabels != nil { + out.Selector.MatchLabels = make(map[string]string) + for key, value := range in.Selector.MatchLabels { + out.Selector.MatchLabels[key] = value + } + } + if in.Selector.MatchExpressions != nil { + out.Selector.MatchExpressions = make([]metav1.LabelSelectorRequirement, len(in.Selector.MatchExpressions)) + for i, expr := range in.Selector.MatchExpressions { + out.Selector.MatchExpressions[i] = metav1.LabelSelectorRequirement{ + Key: expr.Key, + Operator: expr.Operator, + Values: append([]string{}, expr.Values...), // Copy slice to avoid reference issues + } + } + } + } else { + out.Selector = nil // Explicitly setting to nil if the input is nil + } + + return nil +} + +func Convert_v1alpha1_ClaimLabels_To_common_ClaimLabels(in *commonv1alpha1.ClaimLabels, out *common.ClaimLabels, s conversion.Scope) error { + return autoConvert_v1alpha1_ClaimLabels_To_common_ClaimLabels(in, out, s) +} + +func autoConvert_v1alpha1_ClaimLabels_To_common_ClaimLabels(in *commonv1alpha1.ClaimLabels, out *common.ClaimLabels, s conversion.Scope) error { + if in == nil { + return errors.New("input v1alpha1.ClaimLabels is nil") + } + if out == nil { + out = &common.ClaimLabels{} // Allocate new structure if out is nil + } + + // Directly copy UserDefinedLabels assuming direct compatibility + out.UserDefinedLabels = common.UserDefinedLabels(in.UserDefinedLabels) + + // Handle conversion of LabelSelector + if in.Selector != nil { + out.Selector = &metav1.LabelSelector{} + if in.Selector.MatchLabels != nil { + out.Selector.MatchLabels = make(map[string]string) + for key, value := range in.Selector.MatchLabels { + out.Selector.MatchLabels[key] = value + } + } + if in.Selector.MatchExpressions != nil { + out.Selector.MatchExpressions = make([]metav1.LabelSelectorRequirement, len(in.Selector.MatchExpressions)) + for i, expr := range in.Selector.MatchExpressions { + out.Selector.MatchExpressions[i] = metav1.LabelSelectorRequirement{ + Key: expr.Key, + Operator: metav1.LabelSelectorOperator(expr.Operator), + Values: append([]string{}, expr.Values...), // Copy slice to avoid reference issues + } + } + } + } else { + out.Selector = nil // Set to nil if the source is nil + } + + return nil +} + + +func Convert_common_UserDefinedLabels_To_v1alpha1_UserDefinedLabels(in *common.UserDefinedLabels, out *commonv1alpha1.UserDefinedLabels, s conversion.Scope) error { + return autoConvert_common_UserDefinedLabels_To_v1alpha1_UserDefinedLabels(in, out, s) +} + +func autoConvert_common_UserDefinedLabels_To_v1alpha1_UserDefinedLabels(in *common.UserDefinedLabels, out *commonv1alpha1.UserDefinedLabels, _ conversion.Scope) error { + in.Labels = out.Labels + return nil +} + + +func Convert_v1alpha1_UserDefinedLabels_To_common_UserDefinedLabels(in *commonv1alpha1.UserDefinedLabels, out *common.UserDefinedLabels, s conversion.Scope) error { + return autoConvert_v1alpha1_UserDefinedLabels_To_common_UserDefinedLabels(in, out, s) +} + +func autoConvert_v1alpha1_UserDefinedLabels_To_common_UserDefinedLabels(in *commonv1alpha1.UserDefinedLabels, out *common.UserDefinedLabels, _ conversion.Scope) error { + in.Labels = out.Labels + return nil +} \ No newline at end of file diff --git a/apis/backend/as/v1alpha1/doc.go b/apis/backend/as/v1alpha1/doc.go index f054b32..02a8f82 100644 --- a/apis/backend/as/v1alpha1/doc.go +++ b/apis/backend/as/v1alpha1/doc.go @@ -24,5 +24,5 @@ limitations under the License. // +k8s:defaulter-gen=TypeMeta // +groupName=as.be.kuid.dev -// Package v1alpha1 is the v1alpha1 version of the API. -package v1alpha1 // import "github.com/kuidio/kuid/apis/backend/as/v1alpha1" +// v1alpha1 is the v1alpha1 version of the API. +package v1alpha1 diff --git a/apis/backend/as/v1alpha1/generated.pb.go b/apis/backend/as/v1alpha1/generated.pb.go deleted file mode 100644 index a4b1f8f..0000000 --- a/apis/backend/as/v1alpha1/generated.pb.go +++ /dev/null @@ -1,3645 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 protoc-gen-gogo. DO NOT EDIT. -// source: github.com/kuidio/kuid/apis/backend/as/v1alpha1/generated.proto - -package v1alpha1 - -import ( - fmt "fmt" - - io "io" - - proto "github.com/gogo/protobuf/proto" - github_com_kuidio_kuid_apis_backend "github.com/kuidio/kuid/apis/backend" - v1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - - math "math" - math_bits "math/bits" - reflect "reflect" - strings "strings" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -func (m *ASClaim) Reset() { *m = ASClaim{} } -func (*ASClaim) ProtoMessage() {} -func (*ASClaim) Descriptor() ([]byte, []int) { - return fileDescriptor_e8bb9ac9d57dd6eb, []int{0} -} -func (m *ASClaim) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ASClaim) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ASClaim) XXX_Merge(src proto.Message) { - xxx_messageInfo_ASClaim.Merge(m, src) -} -func (m *ASClaim) XXX_Size() int { - return m.Size() -} -func (m *ASClaim) XXX_DiscardUnknown() { - xxx_messageInfo_ASClaim.DiscardUnknown(m) -} - -var xxx_messageInfo_ASClaim proto.InternalMessageInfo - -func (m *ASClaimList) Reset() { *m = ASClaimList{} } -func (*ASClaimList) ProtoMessage() {} -func (*ASClaimList) Descriptor() ([]byte, []int) { - return fileDescriptor_e8bb9ac9d57dd6eb, []int{1} -} -func (m *ASClaimList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ASClaimList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ASClaimList) XXX_Merge(src proto.Message) { - xxx_messageInfo_ASClaimList.Merge(m, src) -} -func (m *ASClaimList) XXX_Size() int { - return m.Size() -} -func (m *ASClaimList) XXX_DiscardUnknown() { - xxx_messageInfo_ASClaimList.DiscardUnknown(m) -} - -var xxx_messageInfo_ASClaimList proto.InternalMessageInfo - -func (m *ASClaimSpec) Reset() { *m = ASClaimSpec{} } -func (*ASClaimSpec) ProtoMessage() {} -func (*ASClaimSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_e8bb9ac9d57dd6eb, []int{2} -} -func (m *ASClaimSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ASClaimSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ASClaimSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_ASClaimSpec.Merge(m, src) -} -func (m *ASClaimSpec) XXX_Size() int { - return m.Size() -} -func (m *ASClaimSpec) XXX_DiscardUnknown() { - xxx_messageInfo_ASClaimSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_ASClaimSpec proto.InternalMessageInfo - -func (m *ASClaimStatus) Reset() { *m = ASClaimStatus{} } -func (*ASClaimStatus) ProtoMessage() {} -func (*ASClaimStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_e8bb9ac9d57dd6eb, []int{3} -} -func (m *ASClaimStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ASClaimStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ASClaimStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_ASClaimStatus.Merge(m, src) -} -func (m *ASClaimStatus) XXX_Size() int { - return m.Size() -} -func (m *ASClaimStatus) XXX_DiscardUnknown() { - xxx_messageInfo_ASClaimStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_ASClaimStatus proto.InternalMessageInfo - -func (m *ASDynamicIDSyntaxValidator) Reset() { *m = ASDynamicIDSyntaxValidator{} } -func (*ASDynamicIDSyntaxValidator) ProtoMessage() {} -func (*ASDynamicIDSyntaxValidator) Descriptor() ([]byte, []int) { - return fileDescriptor_e8bb9ac9d57dd6eb, []int{4} -} -func (m *ASDynamicIDSyntaxValidator) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ASDynamicIDSyntaxValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ASDynamicIDSyntaxValidator) XXX_Merge(src proto.Message) { - xxx_messageInfo_ASDynamicIDSyntaxValidator.Merge(m, src) -} -func (m *ASDynamicIDSyntaxValidator) XXX_Size() int { - return m.Size() -} -func (m *ASDynamicIDSyntaxValidator) XXX_DiscardUnknown() { - xxx_messageInfo_ASDynamicIDSyntaxValidator.DiscardUnknown(m) -} - -var xxx_messageInfo_ASDynamicIDSyntaxValidator proto.InternalMessageInfo - -func (m *ASEntry) Reset() { *m = ASEntry{} } -func (*ASEntry) ProtoMessage() {} -func (*ASEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_e8bb9ac9d57dd6eb, []int{5} -} -func (m *ASEntry) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ASEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ASEntry) XXX_Merge(src proto.Message) { - xxx_messageInfo_ASEntry.Merge(m, src) -} -func (m *ASEntry) XXX_Size() int { - return m.Size() -} -func (m *ASEntry) XXX_DiscardUnknown() { - xxx_messageInfo_ASEntry.DiscardUnknown(m) -} - -var xxx_messageInfo_ASEntry proto.InternalMessageInfo - -func (m *ASEntryList) Reset() { *m = ASEntryList{} } -func (*ASEntryList) ProtoMessage() {} -func (*ASEntryList) Descriptor() ([]byte, []int) { - return fileDescriptor_e8bb9ac9d57dd6eb, []int{6} -} -func (m *ASEntryList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ASEntryList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ASEntryList) XXX_Merge(src proto.Message) { - xxx_messageInfo_ASEntryList.Merge(m, src) -} -func (m *ASEntryList) XXX_Size() int { - return m.Size() -} -func (m *ASEntryList) XXX_DiscardUnknown() { - xxx_messageInfo_ASEntryList.DiscardUnknown(m) -} - -var xxx_messageInfo_ASEntryList proto.InternalMessageInfo - -func (m *ASEntrySpec) Reset() { *m = ASEntrySpec{} } -func (*ASEntrySpec) ProtoMessage() {} -func (*ASEntrySpec) Descriptor() ([]byte, []int) { - return fileDescriptor_e8bb9ac9d57dd6eb, []int{7} -} -func (m *ASEntrySpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ASEntrySpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ASEntrySpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_ASEntrySpec.Merge(m, src) -} -func (m *ASEntrySpec) XXX_Size() int { - return m.Size() -} -func (m *ASEntrySpec) XXX_DiscardUnknown() { - xxx_messageInfo_ASEntrySpec.DiscardUnknown(m) -} - -var xxx_messageInfo_ASEntrySpec proto.InternalMessageInfo - -func (m *ASEntryStatus) Reset() { *m = ASEntryStatus{} } -func (*ASEntryStatus) ProtoMessage() {} -func (*ASEntryStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_e8bb9ac9d57dd6eb, []int{8} -} -func (m *ASEntryStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ASEntryStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ASEntryStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_ASEntryStatus.Merge(m, src) -} -func (m *ASEntryStatus) XXX_Size() int { - return m.Size() -} -func (m *ASEntryStatus) XXX_DiscardUnknown() { - xxx_messageInfo_ASEntryStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_ASEntryStatus proto.InternalMessageInfo - -func (m *ASIndex) Reset() { *m = ASIndex{} } -func (*ASIndex) ProtoMessage() {} -func (*ASIndex) Descriptor() ([]byte, []int) { - return fileDescriptor_e8bb9ac9d57dd6eb, []int{9} -} -func (m *ASIndex) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ASIndex) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ASIndex) XXX_Merge(src proto.Message) { - xxx_messageInfo_ASIndex.Merge(m, src) -} -func (m *ASIndex) XXX_Size() int { - return m.Size() -} -func (m *ASIndex) XXX_DiscardUnknown() { - xxx_messageInfo_ASIndex.DiscardUnknown(m) -} - -var xxx_messageInfo_ASIndex proto.InternalMessageInfo - -func (m *ASIndexList) Reset() { *m = ASIndexList{} } -func (*ASIndexList) ProtoMessage() {} -func (*ASIndexList) Descriptor() ([]byte, []int) { - return fileDescriptor_e8bb9ac9d57dd6eb, []int{10} -} -func (m *ASIndexList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ASIndexList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ASIndexList) XXX_Merge(src proto.Message) { - xxx_messageInfo_ASIndexList.Merge(m, src) -} -func (m *ASIndexList) XXX_Size() int { - return m.Size() -} -func (m *ASIndexList) XXX_DiscardUnknown() { - xxx_messageInfo_ASIndexList.DiscardUnknown(m) -} - -var xxx_messageInfo_ASIndexList proto.InternalMessageInfo - -func (m *ASIndexSpec) Reset() { *m = ASIndexSpec{} } -func (*ASIndexSpec) ProtoMessage() {} -func (*ASIndexSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_e8bb9ac9d57dd6eb, []int{11} -} -func (m *ASIndexSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ASIndexSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ASIndexSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_ASIndexSpec.Merge(m, src) -} -func (m *ASIndexSpec) XXX_Size() int { - return m.Size() -} -func (m *ASIndexSpec) XXX_DiscardUnknown() { - xxx_messageInfo_ASIndexSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_ASIndexSpec proto.InternalMessageInfo - -func (m *ASIndexStatus) Reset() { *m = ASIndexStatus{} } -func (*ASIndexStatus) ProtoMessage() {} -func (*ASIndexStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_e8bb9ac9d57dd6eb, []int{12} -} -func (m *ASIndexStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ASIndexStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ASIndexStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_ASIndexStatus.Merge(m, src) -} -func (m *ASIndexStatus) XXX_Size() int { - return m.Size() -} -func (m *ASIndexStatus) XXX_DiscardUnknown() { - xxx_messageInfo_ASIndexStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_ASIndexStatus proto.InternalMessageInfo - -func (m *ASRangeSyntaxValidator) Reset() { *m = ASRangeSyntaxValidator{} } -func (*ASRangeSyntaxValidator) ProtoMessage() {} -func (*ASRangeSyntaxValidator) Descriptor() ([]byte, []int) { - return fileDescriptor_e8bb9ac9d57dd6eb, []int{13} -} -func (m *ASRangeSyntaxValidator) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ASRangeSyntaxValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ASRangeSyntaxValidator) XXX_Merge(src proto.Message) { - xxx_messageInfo_ASRangeSyntaxValidator.Merge(m, src) -} -func (m *ASRangeSyntaxValidator) XXX_Size() int { - return m.Size() -} -func (m *ASRangeSyntaxValidator) XXX_DiscardUnknown() { - xxx_messageInfo_ASRangeSyntaxValidator.DiscardUnknown(m) -} - -var xxx_messageInfo_ASRangeSyntaxValidator proto.InternalMessageInfo - -func (m *ASStaticIDSyntaxValidator) Reset() { *m = ASStaticIDSyntaxValidator{} } -func (*ASStaticIDSyntaxValidator) ProtoMessage() {} -func (*ASStaticIDSyntaxValidator) Descriptor() ([]byte, []int) { - return fileDescriptor_e8bb9ac9d57dd6eb, []int{14} -} -func (m *ASStaticIDSyntaxValidator) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ASStaticIDSyntaxValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ASStaticIDSyntaxValidator) XXX_Merge(src proto.Message) { - xxx_messageInfo_ASStaticIDSyntaxValidator.Merge(m, src) -} -func (m *ASStaticIDSyntaxValidator) XXX_Size() int { - return m.Size() -} -func (m *ASStaticIDSyntaxValidator) XXX_DiscardUnknown() { - xxx_messageInfo_ASStaticIDSyntaxValidator.DiscardUnknown(m) -} - -var xxx_messageInfo_ASStaticIDSyntaxValidator proto.InternalMessageInfo - -func init() { - proto.RegisterType((*ASClaim)(nil), "github.com.kuidio.kuid.apis.backend.as.v1alpha1.ASClaim") - proto.RegisterType((*ASClaimList)(nil), "github.com.kuidio.kuid.apis.backend.as.v1alpha1.ASClaimList") - proto.RegisterType((*ASClaimSpec)(nil), "github.com.kuidio.kuid.apis.backend.as.v1alpha1.ASClaimSpec") - proto.RegisterType((*ASClaimStatus)(nil), "github.com.kuidio.kuid.apis.backend.as.v1alpha1.ASClaimStatus") - proto.RegisterType((*ASDynamicIDSyntaxValidator)(nil), "github.com.kuidio.kuid.apis.backend.as.v1alpha1.ASDynamicIDSyntaxValidator") - proto.RegisterType((*ASEntry)(nil), "github.com.kuidio.kuid.apis.backend.as.v1alpha1.ASEntry") - proto.RegisterType((*ASEntryList)(nil), "github.com.kuidio.kuid.apis.backend.as.v1alpha1.ASEntryList") - proto.RegisterType((*ASEntrySpec)(nil), "github.com.kuidio.kuid.apis.backend.as.v1alpha1.ASEntrySpec") - proto.RegisterType((*ASEntryStatus)(nil), "github.com.kuidio.kuid.apis.backend.as.v1alpha1.ASEntryStatus") - proto.RegisterType((*ASIndex)(nil), "github.com.kuidio.kuid.apis.backend.as.v1alpha1.ASIndex") - proto.RegisterType((*ASIndexList)(nil), "github.com.kuidio.kuid.apis.backend.as.v1alpha1.ASIndexList") - proto.RegisterType((*ASIndexSpec)(nil), "github.com.kuidio.kuid.apis.backend.as.v1alpha1.ASIndexSpec") - proto.RegisterType((*ASIndexStatus)(nil), "github.com.kuidio.kuid.apis.backend.as.v1alpha1.ASIndexStatus") - proto.RegisterType((*ASRangeSyntaxValidator)(nil), "github.com.kuidio.kuid.apis.backend.as.v1alpha1.ASRangeSyntaxValidator") - proto.RegisterType((*ASStaticIDSyntaxValidator)(nil), "github.com.kuidio.kuid.apis.backend.as.v1alpha1.ASStaticIDSyntaxValidator") -} - -func init() { - proto.RegisterFile("github.com/kuidio/kuid/apis/backend/as/v1alpha1/generated.proto", fileDescriptor_e8bb9ac9d57dd6eb) -} - -var fileDescriptor_e8bb9ac9d57dd6eb = []byte{ - // 905 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x57, 0x4f, 0x6f, 0x1b, 0x45, - 0x14, 0xf7, 0x6e, 0xb2, 0xa1, 0x1e, 0x93, 0x8a, 0x2c, 0x52, 0xe5, 0x1a, 0xb4, 0xae, 0xdc, 0x4b, - 0x2f, 0x9d, 0x25, 0x15, 0x42, 0x95, 0x8a, 0x8a, 0xbc, 0x71, 0x0f, 0x96, 0xa8, 0x2a, 0x8d, 0x5b, - 0x0e, 0xa8, 0xa0, 0x8e, 0x77, 0x27, 0xf6, 0x60, 0xef, 0x1f, 0xed, 0x8e, 0x83, 0x7d, 0xe3, 0x82, - 0x90, 0x38, 0xf1, 0x01, 0x38, 0xf2, 0x0d, 0xb8, 0xf1, 0x09, 0x22, 0x4e, 0x3d, 0x96, 0x8b, 0x45, - 0xcc, 0xb7, 0xe0, 0x84, 0xe6, 0xcd, 0xd8, 0xbb, 0xd8, 0xb5, 0x71, 0x22, 0x02, 0xcd, 0x69, 0x33, - 0x6f, 0xde, 0xfb, 0xfd, 0xe6, 0xbd, 0x37, 0xef, 0x97, 0x31, 0xfa, 0xa4, 0xc7, 0x45, 0x7f, 0xd4, - 0xc5, 0x7e, 0x1c, 0xba, 0x83, 0x11, 0x0f, 0x78, 0x0c, 0x1f, 0x97, 0x26, 0x3c, 0x73, 0xbb, 0xd4, - 0x1f, 0xb0, 0x28, 0x70, 0x69, 0xe6, 0x9e, 0x1c, 0xd2, 0x61, 0xd2, 0xa7, 0x87, 0x6e, 0x8f, 0x45, - 0x2c, 0xa5, 0x82, 0x05, 0x38, 0x49, 0x63, 0x11, 0xdb, 0x6e, 0x0e, 0x80, 0x15, 0x00, 0x7c, 0xb0, - 0x04, 0xc0, 0x1a, 0x00, 0xd3, 0x0c, 0xcf, 0x01, 0x6a, 0x77, 0x0b, 0x8c, 0xbd, 0xb8, 0x17, 0xbb, - 0x80, 0xd3, 0x1d, 0x1d, 0xc3, 0x0a, 0x16, 0xf0, 0x97, 0xc2, 0xaf, 0x3d, 0xd8, 0x74, 0x40, 0x3f, - 0x0e, 0xc3, 0x38, 0x5a, 0x7b, 0xb8, 0xda, 0xc3, 0xcd, 0xc1, 0x51, 0xc0, 0x05, 0xdf, 0x14, 0xff, - 0xe1, 0xe0, 0x7e, 0x86, 0x79, 0x2c, 0xfd, 0x43, 0xea, 0xf7, 0x79, 0xc4, 0xd2, 0x89, 0x9b, 0x0c, - 0x7a, 0x0a, 0x20, 0x64, 0x82, 0xba, 0x27, 0xab, 0x51, 0x1f, 0xad, 0x8b, 0x4a, 0x47, 0x91, 0xe0, - 0x21, 0x73, 0x33, 0xbf, 0xcf, 0x42, 0xba, 0x1c, 0xd7, 0xf8, 0xd9, 0x44, 0x6f, 0x35, 0x3b, 0x47, - 0x43, 0xca, 0x43, 0xfb, 0x05, 0xba, 0x26, 0xe1, 0x03, 0x2a, 0x68, 0xd5, 0xb8, 0x65, 0xdc, 0xa9, - 0xdc, 0xfb, 0x00, 0x2b, 0x58, 0x5c, 0x84, 0xc5, 0xc9, 0xa0, 0xa7, 0x4a, 0x2d, 0xbd, 0xf1, 0xc9, - 0x21, 0x7e, 0xd2, 0xfd, 0x8a, 0xf9, 0xe2, 0x31, 0x13, 0xd4, 0xb3, 0x4f, 0xa7, 0xf5, 0xd2, 0x6c, - 0x5a, 0x47, 0xb9, 0x8d, 0x2c, 0x50, 0xed, 0x2f, 0xd1, 0x6e, 0x96, 0x30, 0xbf, 0x6a, 0x02, 0xfa, - 0xc7, 0xf8, 0x9c, 0x7d, 0xc4, 0xfa, 0xa4, 0x9d, 0x84, 0xf9, 0xde, 0xdb, 0x9a, 0x69, 0x57, 0xae, - 0x08, 0xe0, 0xda, 0xc7, 0x68, 0x2f, 0x13, 0x54, 0x8c, 0xb2, 0xea, 0x0e, 0x30, 0x3c, 0xbc, 0x30, - 0x03, 0xa0, 0x78, 0xd7, 0x35, 0xc7, 0x9e, 0x5a, 0x13, 0x8d, 0xde, 0xf8, 0xd5, 0x40, 0x15, 0xed, - 0xf9, 0x29, 0xcf, 0x84, 0xfd, 0x7c, 0xa5, 0x72, 0x78, 0xbb, 0xca, 0xc9, 0x68, 0xa8, 0xdb, 0x3b, - 0x9a, 0xe9, 0xda, 0xdc, 0x52, 0xa8, 0xda, 0x17, 0xc8, 0xe2, 0x82, 0x85, 0x59, 0xd5, 0xbc, 0xb5, - 0x73, 0xa7, 0x72, 0xef, 0xfe, 0x45, 0x93, 0xf2, 0xf6, 0x35, 0x89, 0xd5, 0x96, 0x70, 0x44, 0xa1, - 0x36, 0x7e, 0x31, 0x17, 0xc9, 0xc8, 0x52, 0xda, 0xb7, 0x91, 0xc5, 0xa3, 0x80, 0x8d, 0x21, 0x93, - 0x72, 0x21, 0x48, 0x1a, 0x89, 0xda, 0xb3, 0x6f, 0x20, 0x93, 0x07, 0xd0, 0xc7, 0x7d, 0x6f, 0x6f, - 0x36, 0xad, 0x9b, 0xed, 0x16, 0x31, 0x79, 0x60, 0xd7, 0x91, 0x95, 0xd2, 0xa8, 0xc7, 0xa0, 0x01, - 0x65, 0xaf, 0x2c, 0x03, 0x89, 0x34, 0x10, 0x65, 0xb7, 0x63, 0x54, 0xf1, 0xa1, 0x6e, 0xb4, 0xcb, - 0x86, 0x59, 0x75, 0x17, 0xaa, 0xb5, 0x39, 0x25, 0x35, 0x71, 0x79, 0x3a, 0x47, 0x79, 0xbc, 0xf7, - 0xae, 0x3e, 0x5d, 0xa5, 0x60, 0x24, 0x45, 0x06, 0xfb, 0x39, 0xb2, 0xe2, 0xaf, 0x23, 0x96, 0x56, - 0x2d, 0xa0, 0x7a, 0x70, 0x2e, 0xaa, 0x27, 0x32, 0x92, 0xb0, 0x63, 0x96, 0xb2, 0xc8, 0x67, 0x2a, - 0x1d, 0x65, 0x53, 0xa0, 0x8d, 0x6f, 0x4d, 0xb4, 0xff, 0xb7, 0x3b, 0x63, 0x7f, 0x6f, 0xa0, 0x83, - 0xc5, 0x98, 0xb3, 0x40, 0x59, 0xf5, 0xad, 0x68, 0xfe, 0x03, 0xb9, 0x8e, 0x2a, 0xa4, 0xba, 0x0c, - 0xe4, 0xdd, 0xd4, 0x09, 0x1f, 0xac, 0x6c, 0x91, 0x55, 0xda, 0x8b, 0xb7, 0x09, 0x23, 0xc4, 0xc6, - 0x09, 0x4f, 0x27, 0x4f, 0x79, 0xc8, 0xa0, 0x4b, 0x65, 0xef, 0xba, 0x9c, 0xeb, 0x47, 0x0b, 0x2b, - 0x29, 0x78, 0x34, 0xde, 0x47, 0xb5, 0x66, 0xa7, 0x35, 0x89, 0x68, 0xc8, 0xfd, 0x76, 0xab, 0x33, - 0x89, 0x04, 0x1d, 0x7f, 0x46, 0x87, 0x3c, 0xa0, 0x22, 0x4e, 0xb5, 0xca, 0x3c, 0x8a, 0x44, 0x3a, - 0xb9, 0x12, 0x2a, 0x03, 0x27, 0xbd, 0x54, 0x95, 0x51, 0x0c, 0xdb, 0xa8, 0x0c, 0x78, 0x5e, 0x0d, - 0x95, 0x81, 0xa3, 0xae, 0x51, 0x99, 0x9f, 0x76, 0x16, 0xc9, 0x6c, 0xaf, 0x32, 0x2f, 0x50, 0x19, - 0x46, 0xf9, 0xe9, 0x24, 0x61, 0xd0, 0xce, 0xb2, 0xe7, 0x69, 0xc7, 0xf2, 0xd1, 0x7c, 0xe3, 0xcf, - 0x69, 0xfd, 0xee, 0x16, 0x2f, 0x0a, 0xbc, 0x08, 0x20, 0x39, 0xa8, 0x5d, 0x83, 0x01, 0x51, 0x53, - 0x80, 0x34, 0xf4, 0x7c, 0x48, 0xfe, 0x73, 0xa9, 0xba, 0x8d, 0x2c, 0x58, 0x82, 0x54, 0x15, 0x6a, - 0x02, 0x01, 0x44, 0xed, 0xe5, 0x7a, 0xb6, 0x77, 0x19, 0x7a, 0xf6, 0xa3, 0x21, 0xf5, 0xac, 0x70, - 0x3b, 0xdf, 0x28, 0x3d, 0xd3, 0x42, 0xd2, 0xd6, 0x97, 0xe3, 0xcd, 0x17, 0x12, 0x38, 0xe9, 0xa5, - 0x0a, 0x89, 0x62, 0xd8, 0x46, 0x48, 0xc0, 0xf3, 0x6a, 0x08, 0x09, 0x1c, 0x75, 0x8d, 0x90, 0xfc, - 0x96, 0x27, 0x03, 0x42, 0x52, 0x47, 0x56, 0xc8, 0xa3, 0x76, 0x0b, 0x32, 0xd9, 0x57, 0x57, 0xfa, - 0xb1, 0x34, 0x10, 0x65, 0x07, 0x07, 0x3a, 0x6e, 0xb7, 0xf4, 0xbf, 0x41, 0xe5, 0x20, 0x0d, 0x44, - 0xd9, 0xed, 0xef, 0x0c, 0x74, 0x30, 0xca, 0x58, 0xda, 0x62, 0xc7, 0x3c, 0x62, 0x81, 0x1e, 0xf7, - 0x6d, 0x5a, 0xb2, 0x3c, 0x5e, 0xcf, 0x96, 0x51, 0xf2, 0xeb, 0xbd, 0xb2, 0x45, 0x56, 0x39, 0x1b, - 0x53, 0x98, 0xbe, 0x42, 0x4b, 0xff, 0x85, 0xec, 0x5e, 0x3f, 0xbf, 0x3b, 0xff, 0xcf, 0xfc, 0x56, - 0xd1, 0x8d, 0x66, 0x07, 0x1e, 0x1a, 0xcb, 0x4f, 0x84, 0xf7, 0xd0, 0xcd, 0x66, 0x47, 0x7a, 0xbd, - 0xe6, 0xfd, 0xe0, 0x3d, 0x3b, 0x3d, 0x73, 0x4a, 0x2f, 0xcf, 0x9c, 0xd2, 0xab, 0x33, 0xa7, 0xf4, - 0xcd, 0xcc, 0x31, 0x4e, 0x67, 0x8e, 0xf1, 0x72, 0xe6, 0x18, 0xaf, 0x66, 0x8e, 0xf1, 0xfb, 0xcc, - 0x31, 0x7e, 0xf8, 0xc3, 0x29, 0x7d, 0xee, 0x9e, 0xf3, 0x77, 0xe5, 0x5f, 0x01, 0x00, 0x00, 0xff, - 0xff, 0x0a, 0xb4, 0xaf, 0x00, 0x89, 0x0e, 0x00, 0x00, -} - -func (m *ASClaim) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ASClaim) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ASClaim) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ASClaimList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ASClaimList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ASClaimList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ASClaimSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ASClaimSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ASClaimSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Owner != nil { - { - size, err := m.Owner.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - { - size, err := m.ClaimLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - if m.Range != nil { - i -= len(*m.Range) - copy(dAtA[i:], *m.Range) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Range))) - i-- - dAtA[i] = 0x1a - } - if m.ID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.ID)) - i-- - dAtA[i] = 0x10 - } - i -= len(m.Index) - copy(dAtA[i:], m.Index) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Index))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ASClaimStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ASClaimStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ASClaimStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ExpiryTime != nil { - i -= len(*m.ExpiryTime) - copy(dAtA[i:], *m.ExpiryTime) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ExpiryTime))) - i-- - dAtA[i] = 0x22 - } - if m.Range != nil { - i -= len(*m.Range) - copy(dAtA[i:], *m.Range) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Range))) - i-- - dAtA[i] = 0x1a - } - if m.ID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.ID)) - i-- - dAtA[i] = 0x10 - } - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ASDynamicIDSyntaxValidator) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ASDynamicIDSyntaxValidator) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ASDynamicIDSyntaxValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *ASEntry) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ASEntry) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ASEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ASEntryList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ASEntryList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ASEntryList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ASEntrySpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ASEntrySpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ASEntrySpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Owner != nil { - { - size, err := m.Owner.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - i -= len(m.Claim) - copy(dAtA[i:], m.Claim) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Claim))) - i-- - dAtA[i] = 0x2a - { - size, err := m.ClaimLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - i -= len(m.ID) - copy(dAtA[i:], m.ID) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.ID))) - i-- - dAtA[i] = 0x1a - i -= len(m.ClaimType) - copy(dAtA[i:], m.ClaimType) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.ClaimType))) - i-- - dAtA[i] = 0x12 - i -= len(m.Index) - copy(dAtA[i:], m.Index) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Index))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ASEntryStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ASEntryStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ASEntryStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ASIndex) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ASIndex) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ASIndex) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ASIndexList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ASIndexList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ASIndexList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ASIndexSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ASIndexSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ASIndexSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.UserDefinedLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if m.MaxID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MaxID)) - i-- - dAtA[i] = 0x10 - } - if m.MinID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MinID)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *ASIndexStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ASIndexStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ASIndexStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if m.MaxID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MaxID)) - i-- - dAtA[i] = 0x10 - } - if m.MinID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MinID)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *ASRangeSyntaxValidator) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ASRangeSyntaxValidator) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ASRangeSyntaxValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *ASStaticIDSyntaxValidator) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ASStaticIDSyntaxValidator) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ASStaticIDSyntaxValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { - offset -= sovGenerated(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *ASClaim) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ASClaimList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *ASClaimSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Index) - n += 1 + l + sovGenerated(uint64(l)) - if m.ID != nil { - n += 1 + sovGenerated(uint64(*m.ID)) - } - if m.Range != nil { - l = len(*m.Range) - n += 1 + l + sovGenerated(uint64(l)) - } - l = m.ClaimLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.Owner != nil { - l = m.Owner.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *ASClaimStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.ID != nil { - n += 1 + sovGenerated(uint64(*m.ID)) - } - if m.Range != nil { - l = len(*m.Range) - n += 1 + l + sovGenerated(uint64(l)) - } - if m.ExpiryTime != nil { - l = len(*m.ExpiryTime) - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *ASDynamicIDSyntaxValidator) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *ASEntry) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ASEntryList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *ASEntrySpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Index) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.ClaimType) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.ID) - n += 1 + l + sovGenerated(uint64(l)) - l = m.ClaimLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Claim) - n += 1 + l + sovGenerated(uint64(l)) - if m.Owner != nil { - l = m.Owner.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *ASEntryStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ASIndex) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ASIndexList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *ASIndexSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MinID != nil { - n += 1 + sovGenerated(uint64(*m.MinID)) - } - if m.MaxID != nil { - n += 1 + sovGenerated(uint64(*m.MaxID)) - } - l = m.UserDefinedLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ASIndexStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MinID != nil { - n += 1 + sovGenerated(uint64(*m.MinID)) - } - if m.MaxID != nil { - n += 1 + sovGenerated(uint64(*m.MaxID)) - } - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ASRangeSyntaxValidator) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *ASStaticIDSyntaxValidator) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func sovGenerated(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenerated(x uint64) (n int) { - return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *ASClaim) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ASClaim{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "ASClaimSpec", "ASClaimSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "ASClaimStatus", "ASClaimStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *ASClaimList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]ASClaim{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "ASClaim", "ASClaim", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&ASClaimList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *ASClaimSpec) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ASClaimSpec{`, - `Index:` + fmt.Sprintf("%v", this.Index) + `,`, - `ID:` + valueToStringGenerated(this.ID) + `,`, - `Range:` + valueToStringGenerated(this.Range) + `,`, - `ClaimLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ClaimLabels), "ClaimLabels", "v1alpha1.ClaimLabels", 1), `&`, ``, 1) + `,`, - `Owner:` + strings.Replace(fmt.Sprintf("%v", this.Owner), "OwnerReference", "v1alpha1.OwnerReference", 1) + `,`, - `}`, - }, "") - return s -} -func (this *ASClaimStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ASClaimStatus{`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `ID:` + valueToStringGenerated(this.ID) + `,`, - `Range:` + valueToStringGenerated(this.Range) + `,`, - `ExpiryTime:` + valueToStringGenerated(this.ExpiryTime) + `,`, - `}`, - }, "") - return s -} -func (this *ASDynamicIDSyntaxValidator) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ASDynamicIDSyntaxValidator{`, - `}`, - }, "") - return s -} -func (this *ASEntry) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ASEntry{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "ASEntrySpec", "ASEntrySpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "ASEntryStatus", "ASEntryStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *ASEntryList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]ASEntry{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "ASEntry", "ASEntry", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&ASEntryList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *ASEntrySpec) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ASEntrySpec{`, - `Index:` + fmt.Sprintf("%v", this.Index) + `,`, - `ClaimType:` + fmt.Sprintf("%v", this.ClaimType) + `,`, - `ID:` + fmt.Sprintf("%v", this.ID) + `,`, - `ClaimLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ClaimLabels), "ClaimLabels", "v1alpha1.ClaimLabels", 1), `&`, ``, 1) + `,`, - `Claim:` + fmt.Sprintf("%v", this.Claim) + `,`, - `Owner:` + strings.Replace(fmt.Sprintf("%v", this.Owner), "OwnerReference", "v1alpha1.OwnerReference", 1) + `,`, - `}`, - }, "") - return s -} -func (this *ASEntryStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ASEntryStatus{`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *ASIndex) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ASIndex{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "ASIndexSpec", "ASIndexSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "ASIndexStatus", "ASIndexStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *ASIndexList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]ASIndex{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "ASIndex", "ASIndex", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&ASIndexList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *ASIndexSpec) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ASIndexSpec{`, - `MinID:` + valueToStringGenerated(this.MinID) + `,`, - `MaxID:` + valueToStringGenerated(this.MaxID) + `,`, - `UserDefinedLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.UserDefinedLabels), "UserDefinedLabels", "v1alpha1.UserDefinedLabels", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *ASIndexStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ASIndexStatus{`, - `MinID:` + valueToStringGenerated(this.MinID) + `,`, - `MaxID:` + valueToStringGenerated(this.MaxID) + `,`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *ASRangeSyntaxValidator) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ASRangeSyntaxValidator{`, - `}`, - }, "") - return s -} -func (this *ASStaticIDSyntaxValidator) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ASStaticIDSyntaxValidator{`, - `}`, - }, "") - return s -} -func valueToStringGenerated(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *ASClaim) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ASClaim: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ASClaim: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ASClaimList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ASClaimList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ASClaimList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, ASClaim{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ASClaimSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ASClaimSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ASClaimSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Index = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ID = &v - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Range", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Range = &s - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ClaimLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Owner == nil { - m.Owner = &v1alpha1.OwnerReference{} - } - if err := m.Owner.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ASClaimStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ASClaimStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ASClaimStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ID = &v - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Range", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Range = &s - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExpiryTime", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.ExpiryTime = &s - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ASDynamicIDSyntaxValidator) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ASDynamicIDSyntaxValidator: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ASDynamicIDSyntaxValidator: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ASEntry) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ASEntry: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ASEntry: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ASEntryList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ASEntryList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ASEntryList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, ASEntry{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ASEntrySpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ASEntrySpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ASEntrySpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Index = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClaimType = github_com_kuidio_kuid_apis_backend.ClaimType(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ClaimLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Claim", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Claim = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Owner == nil { - m.Owner = &v1alpha1.OwnerReference{} - } - if err := m.Owner.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ASEntryStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ASEntryStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ASEntryStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ASIndex) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ASIndex: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ASIndex: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ASIndexList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ASIndexList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ASIndexList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, ASIndex{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ASIndexSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ASIndexSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ASIndexSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinID", wireType) - } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MinID = &v - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxID", wireType) - } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MaxID = &v - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UserDefinedLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.UserDefinedLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ASIndexStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ASIndexStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ASIndexStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinID", wireType) - } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MinID = &v - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxID", wireType) - } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MaxID = &v - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ASRangeSyntaxValidator) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ASRangeSyntaxValidator: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ASRangeSyntaxValidator: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ASStaticIDSyntaxValidator) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ASStaticIDSyntaxValidator: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ASStaticIDSyntaxValidator: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenerated(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenerated - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenerated - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenerated - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") -) diff --git a/apis/backend/as/v1alpha1/generated.proto b/apis/backend/as/v1alpha1/generated.proto deleted file mode 100644 index edaa158..0000000 --- a/apis/backend/as/v1alpha1/generated.proto +++ /dev/null @@ -1,197 +0,0 @@ -/* -Copyright 2024 Nokia. - -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. -*/ -// This file was autogenerated by go-to-protobuf. Do not edit it manually! - -syntax = "proto2"; - -package github.com.kuidio.kuid.apis.backend.as.v1alpha1; - -import "github.com/kuidio/kuid/apis/common/v1alpha1/generated.proto"; -import "github.com/kuidio/kuid/apis/condition/v1alpha1/generated.proto"; -import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; -import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; - -// Package-wide variables from generator "generated". -option go_package = "github.com/kuidio/kuid/apis/backend/as/v1alpha1"; - -// ASClaim is the Schema for the ASClaim API -// -// +k8s:openapi-gen=true -message ASClaim { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional ASClaimSpec spec = 2; - - optional ASClaimStatus status = 3; -} - -// ASClaimList contains a list of ASClaims -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message ASClaimList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated ASClaim items = 2; -} - -// ASClaimSpec defines the desired state of ASClaim -message ASClaimSpec { - // Index defines the index for the AS Claim - optional string index = 1; - - // ASID defines the AS for the AS claim - optional uint32 id = 2; - - // Range defines the AS range for the AS claim - // The following notation is used: start-end - - // the ASs in the range must be consecutive - optional string range = 3; - - // ClaimLabels define the user defined labels and selector labels used - // in resource claim - optional github.com.kuidio.kuid.apis.common.v1alpha1.ClaimLabels claimLabels = 4; - - // Owner defines the ownerReference of the ASClaim - // Allow for different namesapces, hence it is part of the spec - optional github.com.kuidio.kuid.apis.common.v1alpha1.OwnerReference owner = 5; -} - -// ASClaimStatus defines the observed state of ASClaim -message ASClaimStatus { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 1; - - // ASID defines the AS for the AS claim - // +optional - optional uint32 id = 2; - - // ASRange defines the AS range for the AS claim - // +optional - optional string range = 3; - - // ExpiryTime defines when the claim expires - // +kubebuilder:validation:Optional - // +optional - optional string expiryTime = 4; -} - -message ASDynamicIDSyntaxValidator { -} - -// ASEntry is the Schema for the ASentry API -// -// +k8s:openapi-gen=true -message ASEntry { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional ASEntrySpec spec = 2; - - optional ASEntryStatus status = 3; -} - -// ASEntryList contains a list of ASEntries -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message ASEntryList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated ASEntry items = 2; -} - -// ASEntrySpec defines the desired state of ASEntry -message ASEntrySpec { - // ASIndex defines the AS index for the AS Claim - optional string index = 1; - - // ClaimType defines the claimType of the AS Entry - optional string claimType = 2; - - // ID defines the id of the AS entry in the tree - optional string id = 3; - - // ClaimLabels define the user defined labels and selector labels used - // in resource claim - optional github.com.kuidio.kuid.apis.common.v1alpha1.ClaimLabels claimLabels = 4; - - // Claim defines the name of the claim that is the origin of this entry - optional string claim = 5; - - // Owner defines the ownerReference of the ASClaim - // Allow for different namesapces, hence it is part of the spec - optional github.com.kuidio.kuid.apis.common.v1alpha1.OwnerReference owner = 6; -} - -// ASEntryStatus defines the observed state of ASEntry -message ASEntryStatus { - // ConditionedStatus provides the status of the ASEntry using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 1; -} - -// ASIndex is the Schema for the ASIndex API -// -// +k8s:openapi-gen=true -message ASIndex { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional ASIndexSpec spec = 2; - - optional ASIndexStatus status = 3; -} - -// ASIndexList contains a list of ASIndexs -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message ASIndexList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated ASIndex items = 2; -} - -// ASIndexSpec defines the desired state of ASIndex -message ASIndexSpec { - // MinID defines the min VLAN ID the index supports - // +optional - optional uint32 minID = 1; - - // MaxID defines the max VLAN ID the index supports - // +optional - optional uint32 maxID = 2; - - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - optional github.com.kuidio.kuid.apis.common.v1alpha1.UserDefinedLabels userDefinedLabels = 3; -} - -// ASIndexStatus defines the observed state of ASIndex -message ASIndexStatus { - // MinID defines the min VLAN ID the index supports - // +optional - optional uint32 minID = 1; - - // MaxID defines the max VLAN ID the index supports - // +optional - optional uint32 maxID = 2; - - // ConditionedStatus provides the status of the VLANIndex using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 3; -} - -message ASRangeSyntaxValidator { -} - -message ASStaticIDSyntaxValidator { -} - diff --git a/pkg/backend/ipam/applicator_dynamic_address_validate.go b/apis/backend/as/v1alpha1/helper.go similarity index 58% rename from pkg/backend/ipam/applicator_dynamic_address_validate.go rename to apis/backend/as/v1alpha1/helper.go index 2d9ed4e..e65077c 100644 --- a/pkg/backend/ipam/applicator_dynamic_address_validate.go +++ b/apis/backend/as/v1alpha1/helper.go @@ -14,23 +14,31 @@ See the License for the specific language governing permissions and limitations under the License. */ -package ipam +package v1alpha1 import ( - "context" - - ipambev1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" + "fmt" + "strconv" ) -type dynamicAddressApplicator struct { - name string - applicator - parentClaimSummaryType ipambev1alpha1.IPClaimSummaryType - parentRangeName string - parentNetwork bool - parentLabels map[string]string -} +const ASID_Min = 0 +const ASID_Max = 4294967295 -func (r *dynamicAddressApplicator) Validate(ctx context.Context, claim *ipambev1alpha1.IPClaim) error { +func validateASID(id int) error { + if id < ASID_Min { + return fmt.Errorf("invalid id, got %d", id) + } + if id > ASID_Max { + return fmt.Errorf("invalid id, got %d", id) + } return nil } + +func getASDot(asn uint32) string { + if asn > 65536 { + a := asn / 65536 + b := asn - (a * 65536) + return fmt.Sprintf("%d.%d", a, b) + } + return strconv.Itoa(int(asn)) +} diff --git a/apis/backend/as/v1alpha1/register.go b/apis/backend/as/v1alpha1/register.go index 2570b31..064a86a 100644 --- a/apis/backend/as/v1alpha1/register.go +++ b/apis/backend/as/v1alpha1/register.go @@ -14,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. */ -// +kubebuilder:object:generate=true -// +groupName=as.be.kuid.dev package v1alpha1 import ( diff --git a/apis/backend/ipam/v1alpha1/ipclaim_syntaxvalidator.go b/apis/backend/as/v1alpha1/zz_generated.defaults.go similarity index 58% rename from apis/backend/ipam/v1alpha1/ipclaim_syntaxvalidator.go rename to apis/backend/as/v1alpha1/zz_generated.defaults.go index 488f94b..c38f9bb 100644 --- a/apis/backend/ipam/v1alpha1/ipclaim_syntaxvalidator.go +++ b/apis/backend/as/v1alpha1/zz_generated.defaults.go @@ -1,3 +1,6 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + /* Copyright 2024 Nokia. @@ -13,13 +16,17 @@ 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 defaulter-gen. DO NOT EDIT. package v1alpha1 import ( - "k8s.io/apimachinery/pkg/util/validation/field" + runtime "k8s.io/apimachinery/pkg/runtime" ) -type SyntaxValidator interface { - Validate(claim *IPClaim) field.ErrorList +// RegisterDefaults adds defaulters functions to the given scheme. +// Public to allow building arbitrary schemes. +// All generated defaulters are covering - they call all nested defaulters. +func RegisterDefaults(scheme *runtime.Scheme) error { + return nil } diff --git a/apis/backend/as/v1alpha1/zz_generated.deepcopy.go b/apis/backend/as/zz_generated.deepcopy.go similarity index 89% rename from apis/backend/as/v1alpha1/zz_generated.deepcopy.go rename to apis/backend/as/zz_generated.deepcopy.go index 07083c4..76df54f 100644 --- a/apis/backend/as/v1alpha1/zz_generated.deepcopy.go +++ b/apis/backend/as/zz_generated.deepcopy.go @@ -18,10 +18,9 @@ limitations under the License. */ // Code generated by deepcopy-gen. DO NOT EDIT. -package v1alpha1 +package as import ( - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -53,6 +52,22 @@ func (in *ASClaim) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ASClaimFilter) DeepCopyInto(out *ASClaimFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ASClaimFilter. +func (in *ASClaimFilter) DeepCopy() *ASClaimFilter { + if in == nil { + return nil + } + out := new(ASClaimFilter) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ASClaimList) DeepCopyInto(out *ASClaimList) { *out = *in @@ -100,11 +115,6 @@ func (in *ASClaimSpec) DeepCopyInto(out *ASClaimSpec) { **out = **in } in.ClaimLabels.DeepCopyInto(&out.ClaimLabels) - if in.Owner != nil { - in, out := &in.Owner, &out.Owner - *out = new(commonv1alpha1.OwnerReference) - **out = **in - } return } @@ -194,6 +204,22 @@ func (in *ASEntry) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ASEntryFilter) DeepCopyInto(out *ASEntryFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ASEntryFilter. +func (in *ASEntryFilter) DeepCopy() *ASEntryFilter { + if in == nil { + return nil + } + out := new(ASEntryFilter) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ASEntryList) DeepCopyInto(out *ASEntryList) { *out = *in @@ -231,11 +257,6 @@ func (in *ASEntryList) DeepCopyObject() runtime.Object { func (in *ASEntrySpec) DeepCopyInto(out *ASEntrySpec) { *out = *in in.ClaimLabels.DeepCopyInto(&out.ClaimLabels) - if in.Owner != nil { - in, out := &in.Owner, &out.Owner - *out = new(commonv1alpha1.OwnerReference) - **out = **in - } return } @@ -294,6 +315,22 @@ func (in *ASIndex) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ASIndexFilter) DeepCopyInto(out *ASIndexFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ASIndexFilter. +func (in *ASIndexFilter) DeepCopy() *ASIndexFilter { + if in == nil { + return nil + } + out := new(ASIndexFilter) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ASIndexList) DeepCopyInto(out *ASIndexList) { *out = *in diff --git a/apis/backend/claim_types.go b/apis/backend/claim_types.go index 257fb3a..d791572 100644 --- a/apis/backend/claim_types.go +++ b/apis/backend/claim_types.go @@ -16,7 +16,6 @@ limitations under the License. package backend - // +k8s:openapi-gen=true // ClaimType define the type of the claim type ClaimType string diff --git a/apis/backend/esi/v1alpha1/doc.go b/apis/backend/esi/v1alpha1/doc.go deleted file mode 100644 index d6d5468..0000000 --- a/apis/backend/esi/v1alpha1/doc.go +++ /dev/null @@ -1,28 +0,0 @@ -/* -Copyright 2024 Nokia. - -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. -*/ - -//go:generate deepcopy-gen -O zz_generated.deepcopy -i . -h ../../../../boilerplate.go.txt -//go:generate defaulter-gen -O zz_generated.defaults -i . -h ../../../../boilerplate.go.txt -//go:generate conversion-gen -O zz_generated.conversion -i . -h ../../../../boilerplate.go.txt - -// +k8s:openapi-gen=true -// +k8s:deepcopy-gen=package,register -// +k8s:conversion-gen=github.com/kuidio/kuid/apis/backend/esi -// +k8s:defaulter-gen=TypeMeta -// +groupName=esi.be.kuid.dev - -// Package v1alpha1 is the v1alpha1 version of the API. -package v1alpha1 // import "github.com/kuidio/kuid/apis/backend/esi/v1alpha1" diff --git a/apis/backend/esi/v1alpha1/esi_types.go b/apis/backend/esi/v1alpha1/esi_types.go deleted file mode 100644 index 1b35cb7..0000000 --- a/apis/backend/esi/v1alpha1/esi_types.go +++ /dev/null @@ -1,44 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -type ESIClaimType string - -const ( - ClaimType_Invalid ESIClaimType = "invalid" - ClaimType_StaticID ESIClaimType = "staticESIID" - ClaimType_DynamicID ESIClaimType = "dynamicESIID" - ClaimType_Range ESIClaimType = "esiRange" -) - -func GetClaimTypeFromString(s string) ESIClaimType { - switch s { - case string(ClaimType_StaticID): - return ClaimType_StaticID - case string(ClaimType_DynamicID): - return ClaimType_DynamicID - case string(ClaimType_Range): - return ClaimType_Range - default: - return ClaimType_Invalid - } -} - -const ( - ESIIndexReservedMinName = "rangeReservedMin" - ESIIndexReservedMaxName = "rangeReservedMax" -) diff --git a/apis/backend/esi/v1alpha1/esiclaim_interface.go b/apis/backend/esi/v1alpha1/esiclaim_interface.go deleted file mode 100644 index 12cb2c9..0000000 --- a/apis/backend/esi/v1alpha1/esiclaim_interface.go +++ /dev/null @@ -1,530 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "crypto/sha1" - "encoding/json" - "errors" - "fmt" - "strconv" - "strings" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/idxtable/pkg/table" - "github.com/henderiw/idxtable/pkg/table/table64" - "github.com/henderiw/idxtable/pkg/tree" - "github.com/henderiw/idxtable/pkg/tree/id64" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/selection" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" - "k8s.io/utils/ptr" -) - -const ESIClaimPlural = "esiclaims" -const ESIClaimSingular = "esiclaim" -const ESIID_Min = 0 -const ESIID_Max = 4294967295 - -// +k8s:deepcopy-gen=false -var _ resource.Object = &ESIClaim{} -var _ resource.ObjectList = &ESIClaimList{} - -var _ resource.ObjectWithStatusSubResource = &ESIClaim{} - -func (ESIClaimStatus) SubResourceName() string { - return fmt.Sprintf("%s/%s", ESIClaimPlural, "status") -} - -func (r ESIClaimStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { - cfg, ok := obj.(*ESIClaim) - if ok { - cfg.Status = r - } -} - -func (r *ESIClaim) GetStatus() resource.StatusSubResource { - return r.Status -} - -// GetListMeta returns the ListMeta -func (r *ESIClaimList) GetListMeta() *metav1.ListMeta { - return &r.ListMeta -} - -func (r *ESIClaim) GetSingularName() string { - return ESIClaimSingular -} - -func (ESIClaim) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Resource: ESIClaimPlural, - } -} - -// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. -// IsStorageVersion implements resource.Object. -func (ESIClaim) IsStorageVersion() bool { - return true -} - -// GetObjectMeta implements resource.Object -func (r *ESIClaim) GetObjectMeta() *metav1.ObjectMeta { - return &r.ObjectMeta -} - -// NamespaceScoped returns true to indicate Fortune is a namespaced resource. -// NamespaceScoped implements resource.Object. -func (ESIClaim) NamespaceScoped() bool { - return true -} - -// New implements resource.Object -func (ESIClaim) New() runtime.Object { - return &ESIClaim{} -} - -// NewList implements resource.Object -func (ESIClaim) NewList() runtime.Object { - return &ESIClaimList{} -} - -// GetCondition returns the condition based on the condition kind -func (r *ESIClaim) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { - return r.Status.GetCondition(t) -} - -// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions -// to be set at once -func (r *ESIClaim) SetConditions(c ...conditionv1alpha1.Condition) { - r.Status.SetConditions(c...) -} - -// ConvertESIClaimFieldSelector is the schema conversion function for normalizing the FieldSelector for ESIClaim -func ConvertESIClaimFieldSelector(label, value string) (internalLabel, internalValue string, err error) { - switch label { - case "metadata.name": - return label, value, nil - case "metadata.namespace": - return label, value, nil - case "spec.index": - return label, value, nil - default: - return "", "", fmt.Errorf("%q is not a known field selector", label) - } -} - -func (r *ESIClaimList) GetItems() []backend.Object { - objs := []backend.Object{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *ESIClaim) CalculateHash() ([sha1.Size]byte, error) { - // Convert the struct to JSON - jsonData, err := json.Marshal(r) - if err != nil { - return [sha1.Size]byte{}, err - } - - // Calculate SHA-1 hash - return sha1.Sum(jsonData), nil -} - -func (r *ESIClaim) GetNamespacedName() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.GetNamespace(), - Name: r.GetName(), - } -} - -func (r *ESIClaim) GetKey() store.Key { - return store.KeyFromNSN(types.NamespacedName{Namespace: r.Namespace, Name: r.Spec.Index}) -} - -func (r *ESIClaim) GetIndex() string { - return r.Spec.Index -} - -func (r *ESIClaim) GetSelector() *metav1.LabelSelector { - return r.Spec.Selector -} - -func (r *ESIClaim) GetOwnerReference() *commonv1alpha1.OwnerReference { - return &commonv1alpha1.OwnerReference{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Kind: r.Kind, - Namespace: r.Namespace, - Name: r.Name, - } -} - -func (r *ESIClaim) GetStaticID() *uint64 { - if r.Spec.ID == nil { - return nil - } - return ptr.To[uint64](uint64(*r.Spec.ID)) -} - -func (r *ESIClaim) GetStaticTreeID(t string) tree.ID { - if r.Spec.ID == nil { - return nil - } - return id64.NewID(uint64(*r.Spec.ID), id64.IDBitSize) -} - -func (r *ESIClaim) GetClaimID(t string, id uint64) tree.ID { - return id64.NewID(uint64(id), id64.IDBitSize) -} - -func (r *ESIClaim) GetRange() *string { - return r.Spec.Range -} - -func (r *ESIClaim) GetRangeID(_ string) (tree.Range, error) { - if r.Spec.Range == nil { - return nil, fmt.Errorf("cannot provide a range without an id") - } - return id64.ParseRange(*r.Spec.Range) -} - -func (r *ESIClaim) GetTable(s string, to, from uint64) table.Table { - return table64.New(uint64(to), uint64(from)) -} - -func (r *ESIClaim) GetClaimRequest() string { - // we assume validation is already done when calling this - if r.Spec.ID != nil { - return strconv.Itoa(int(*r.Spec.ID)) - } - if r.Spec.Range != nil { - return *r.Spec.Range - } - return "" -} - -func (r *ESIClaim) GetClaimResponse() string { - // we assume validation is already done when calling this - if r.Status.ID != nil { - return strconv.Itoa(int(*r.Status.ID)) - } - if r.Status.Range != nil { - return *r.Status.Range - } - return "" -} - -func (r *ESIClaim) GetClaimType() backend.ClaimType { - claimType := backend.ClaimType_Invalid - count := 0 - if r.Spec.ID != nil { - claimType = backend.ClaimType_StaticID - count++ - - } - if r.Spec.Range != nil { - claimType = backend.ClaimType_Range - count++ - - } - if count > 1 { - return backend.ClaimType_Invalid - } - if count == 0 { - return backend.ClaimType_DynamicID - } - return claimType -} - -func (r *ESIClaim) ValidateESIClaimType() error { - var sb strings.Builder - count := 0 - if r.Spec.ID != nil { - sb.WriteString(fmt.Sprintf("id: %d", *r.Spec.ID)) - count++ - - } - if r.Spec.Range != nil { - if count > 0 { - sb.WriteString(", ") - } - sb.WriteString(fmt.Sprintf("range: %s", *r.Spec.Range)) - count++ - - } - if count > 1 { - return fmt.Errorf("a claim can only have 1 type, got %s", sb.String()) - } - return nil -} - -func validateESIID(id int) error { - if id < ESIID_Min { - return fmt.Errorf("invalid id, got %d", id) - } - if id > ESIID_Max { - return fmt.Errorf("invalid id, got %d", id) - } - return nil -} - -func (r *ESIClaim) ValidateESIID() error { - if r.Spec.ID == nil { - return fmt.Errorf("no id provided") - } - if err := validateESIID(int(*r.Spec.ID)); err != nil { - return fmt.Errorf("invalid id err %s", err.Error()) - } - return nil -} - -func (r *ESIClaim) GetESIRange() (int, int) { - if r.Spec.Range == nil { - return 0, 0 - } - parts := strings.SplitN(*r.Spec.Range, "-", 2) - if len(parts) != 2 { - return 0, 0 - } - start, err := strconv.Atoi(parts[0]) - if err != nil { - return 0, 0 - } - end, err := strconv.Atoi(parts[1]) - if err != nil { - return 0, 0 - } - return start, end -} - -func (r *ESIClaim) ValidateESIRange() error { - if r.Spec.Range == nil { - return fmt.Errorf("no ESI range provided") - } - parts := strings.SplitN(*r.Spec.Range, "-", 2) - if len(parts) != 2 { - return fmt.Errorf("invalid ESI range, expected -, got: %s", *r.Spec.Range) - } - var errm error - start, err := strconv.Atoi(parts[0]) - if err != nil { - errm = errors.Join(errm, fmt.Errorf("invalid ESI range start, got: %s, err: %s", *r.Spec.Range, err.Error())) - } - end, err := strconv.Atoi(parts[1]) - if err != nil { - errm = errors.Join(errm, fmt.Errorf("invalid ESI range end, got: %s, err: %s", *r.Spec.Range, err.Error())) - } - if errm != nil { - return errm - } - if start > end { - errm = errors.Join(errm, fmt.Errorf("invalid ESI range start > end %s", *r.Spec.Range)) - } - if err := validateESIID(start); err != nil { - errm = errors.Join(errm, fmt.Errorf("invalid ESI start err %s", err.Error())) - } - if err := validateESIID(end); err != nil { - errm = errors.Join(errm, fmt.Errorf("invalid ESI end err %s", err.Error())) - } - return errm -} - -func (r *ESIClaim) ValidateSyntax(s string) field.ErrorList { - var allErrs field.ErrorList - - gv, err := schema.ParseGroupVersion(r.APIVersion) - if err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("apiVersion"), - r, - fmt.Errorf("invalid apiVersion: err: %s", err.Error()).Error(), - )) - return allErrs - } - - // this is for user convenience - if r.Spec.Owner == nil { - r.Spec.Owner = &commonv1alpha1.OwnerReference{ - Group: gv.Group, - Version: gv.Version, - Kind: r.Kind, - Namespace: r.Namespace, - Name: r.Name, - } - } - - if err := r.ValidateESIClaimType(); err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath(""), - r, - err.Error(), - )) - return allErrs - } - var v SyntaxValidator - claimType := r.GetClaimType() - switch claimType { - case backend.ClaimType_DynamicID: - v = &ESIDynamicIDSyntaxValidator{name: string(claimType)} - case backend.ClaimType_StaticID: - v = &ESIStaticIDSyntaxValidator{name: string(claimType)} - case backend.ClaimType_Range: - v = &ESIRangeSyntaxValidator{name: string(claimType)} - default: - return allErrs - } - return v.Validate(r) -} - -func (r *ESIClaim) ValidateOwner(labels labels.Set) error { - routeClaimName := labels[backend.KuidClaimNameKey] - routeOwner := commonv1alpha1.OwnerReference{ - Group: labels[backend.KuidOwnerGroupKey], - Version: labels[backend.KuidOwnerVersionKey], - Kind: labels[backend.KuidOwnerKindKey], - Namespace: labels[backend.KuidOwnerNamespaceKey], - Name: labels[backend.KuidOwnerNameKey], - } - if (r.Spec.Owner != nil && *r.Spec.Owner != routeOwner) || r.Name != routeClaimName { - return fmt.Errorf("route owned by different claim got name %s/%s owner %s/%s", - r.Name, - routeClaimName, - r.Spec.Owner.String(), - routeOwner.String(), - ) - } - return nil -} - -// GetLabelSelector returns a labels selector based on the label selector -func (r *ESIClaim) GetLabelSelector() (labels.Selector, error) { - return r.Spec.GetLabelSelector() -} - -func (r *ESIClaim) GetClaimLabels() labels.Set { - labels := r.Spec.GetUserDefinedLabels() - // system defined labels - labels[backend.KuidClaimTypeKey] = string(r.GetClaimType()) - labels[backend.KuidClaimNameKey] = r.Name - labels[backend.KuidOwnerGroupKey] = r.Spec.Owner.Group - labels[backend.KuidOwnerVersionKey] = r.Spec.Owner.Version - labels[backend.KuidOwnerKindKey] = r.Spec.Owner.Kind - labels[backend.KuidOwnerNamespaceKey] = r.Spec.Owner.Namespace - labels[backend.KuidOwnerNameKey] = r.Spec.Owner.Name - return labels -} - -// GetOwnerSelector returns a label selector to select the owner of the claim in the backend -func (r *ESIClaim) GetOwnerSelector() (labels.Selector, error) { - l := map[string]string{ - backend.KuidOwnerGroupKey: r.Spec.Owner.Group, - backend.KuidOwnerVersionKey: r.Spec.Owner.Version, - backend.KuidOwnerKindKey: r.Spec.Owner.Kind, - backend.KuidOwnerNamespaceKey: r.Spec.Owner.Namespace, - backend.KuidOwnerNameKey: r.Spec.Owner.Name, - backend.KuidClaimNameKey: r.Name, - } - - fullselector := labels.NewSelector() - for k, v := range l { - req, err := labels.NewRequirement(k, selection.Equals, []string{v}) - if err != nil { - return nil, err - } - fullselector = fullselector.Add(*req) - } - return fullselector, nil -} - -// BuildESIClaim returns a reource from a client Object a Spec/Status -func BuildESIClaim(meta metav1.ObjectMeta, spec *ESIClaimSpec, status *ESIClaimStatus) *ESIClaim { - aspec := ESIClaimSpec{} - if spec != nil { - aspec = *spec - } - astatus := ESIClaimStatus{} - if status != nil { - astatus = *status - } - return &ESIClaim{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: ESIClaimKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -func (r *ESIClaim) SetStatusRange(s *string) { - r.Status.Range = s -} - -func (r *ESIClaim) SetStatusID(s *uint64) { - if s == nil { - r.Status.ID = nil - return - } - r.Status.ID = ptr.To[uint64](uint64(*s)) -} - -func (r *ESIClaim) GetStatusID() *uint64 { - if r.Status.ID == nil { - return nil - } - return ptr.To[uint64](uint64(*r.Status.ID)) -} - -func (r *ESIClaim) GetSpec() any { - return r.Spec -} - -func (r *ESIClaim) SetSpec(s any) { - if spec, ok := s.(ESIClaimSpec); ok { - r.Spec = spec - } -} - -func (r *ESIClaim) NewObjList() backend.GenericObjectList { - return &ESIClaimList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: ESIClaimListKind}, - } -} - -func (r *ESIClaimList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} diff --git a/apis/backend/esi/v1alpha1/esiclaim_syntaxvalidator.go b/apis/backend/esi/v1alpha1/esiclaim_syntaxvalidator.go deleted file mode 100644 index 7f847d7..0000000 --- a/apis/backend/esi/v1alpha1/esiclaim_syntaxvalidator.go +++ /dev/null @@ -1,68 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - fmt "fmt" - - "k8s.io/apimachinery/pkg/util/validation/field" -) - -type SyntaxValidator interface { - Validate(claim *ESIClaim) field.ErrorList -} - -type ESIRangeSyntaxValidator struct { - name string -} - -func (r *ESIRangeSyntaxValidator) Validate(claim *ESIClaim) field.ErrorList { - var allErrs field.ErrorList - if err := claim.ValidateESIRange(); err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.range"), - claim, - fmt.Errorf("invalid ESI range %s", r.name).Error(), - )) - } - return allErrs -} - -type ESIDynamicIDSyntaxValidator struct { - name string -} - -func (r *ESIDynamicIDSyntaxValidator) Validate(claim *ESIClaim) field.ErrorList { - var allErrs field.ErrorList - return allErrs -} - -type ESIStaticIDSyntaxValidator struct { - name string -} - -func (r *ESIStaticIDSyntaxValidator) Validate(claim *ESIClaim) field.ErrorList { - var allErrs field.ErrorList - if err := claim.ValidateESIID(); err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.id"), - claim, - fmt.Errorf("invalid ESI id %s", r.name).Error(), - )) - } - return allErrs -} diff --git a/apis/backend/esi/v1alpha1/esiclaim_types.go b/apis/backend/esi/v1alpha1/esiclaim_types.go deleted file mode 100644 index 5fd7129..0000000 --- a/apis/backend/esi/v1alpha1/esiclaim_types.go +++ /dev/null @@ -1,87 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "reflect" - - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// ESIClaimSpec defines the desired state of ESIClaim -type ESIClaimSpec struct { - // ESIIndex defines the ESI index for the ESI Claim - Index string `json:"index" yaml:"index" protobuf:"bytes,1,opt,name=index"` - // ESIID defines the ESI for the ESI claim - ID *uint64 `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,2,opt,name=id"` - // Range defines the ESI range for the ESI claim - // The following notation is used: start-end - - // the ESIs in the range must be consecutive - Range *string `json:"range,omitempty" yaml:"range,omitempty" protobuf:"bytes,3,opt,name=range"` - // ClaimLabels define the user defined labels and selector labels used - // in resource claim - commonv1alpha1.ClaimLabels `json:",inline" yaml:",inline" protobuf:"bytes,4,opt,name=claimLabels"` - // Owner defines the ownerReference of the ESIClaim - // Allow for different namesapces, hence it is part of the spec - Owner *commonv1alpha1.OwnerReference `json:"owner,omitempty" yaml:"owner,omitempty" protobuf:"bytes,5,opt,name=owner"` -} - -// ESIClaimStatus defines the observed state of ESIClaim -type ESIClaimStatus struct { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` - // ESIID defines the ESI for the ESI claim - // +optional - ID *uint64 `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,2,opt,name=id"` - // ESIRange defines the ESI range for the ESI claim - // +optional - Range *string `json:"range,omitempty" yaml:"range,omitempty" protobuf:"bytes,3,opt,name=range"` - // ExpiryTime defines when the claim expires - // +kubebuilder:validation:Optional - // +optional - ExpiryTime *string `json:"expiryTime,omitempty" yaml:"expiryTime,omitempty" protobuf:"bytes,4,opt,name=expiryTime"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// ESIClaim is the Schema for the ESIClaim API -// -// +k8s:openapi-gen=true -type ESIClaim struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - Spec ESIClaimSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - Status ESIClaimStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// ESIClaimList contains a list of ESIClaims -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type ESIClaimList struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []ESIClaim `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` -} - -var ( - ESIClaimKind = reflect.TypeOf(ESIClaim{}).Name() - ESIClaimListKind = reflect.TypeOf(ESIClaimList{}).Name() -) diff --git a/apis/backend/esi/v1alpha1/esientry_interface.go b/apis/backend/esi/v1alpha1/esientry_interface.go deleted file mode 100644 index 3ba23ec..0000000 --- a/apis/backend/esi/v1alpha1/esientry_interface.go +++ /dev/null @@ -1,256 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "crypto/sha1" - "encoding/json" - "fmt" - strings "strings" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" -) - -const ESIEntryPlural = "esientries" -const ESIEntrySingular = "esientry" - -// +k8s:deepcopy-gen=false -var _ resource.Object = &ESIEntry{} -var _ resource.ObjectList = &ESIEntryList{} - -// GetListMeta returns the ListMeta -func (r *ESIEntryList) GetListMeta() *metav1.ListMeta { - return &r.ListMeta -} - -func (r *ESIEntryList) GetItems() []*ESIEntry { - entries := make([]*ESIEntry, 0, len(r.Items)) - for _, entry := range r.Items { - entries = append(entries, &entry) - } - return entries -} - -func (r *ESIEntry) GetSingularName() string { - return ESIEntrySingular -} - -func (ESIEntry) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Resource: ESIEntryPlural, - } -} - -// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. -// IsStorageVersion implements resource.Object. -func (ESIEntry) IsStorageVersion() bool { - return true -} - -// GetObjectMeta implements resource.Object -func (r *ESIEntry) GetObjectMeta() *metav1.ObjectMeta { - return &r.ObjectMeta -} - -// NamespaceScoped returns true to indicate Fortune is a namespaced resource. -// NamespaceScoped implements resource.Object. -func (ESIEntry) NamespaceScoped() bool { - return true -} - -// New implements resource.Object -func (ESIEntry) New() runtime.Object { - return &ESIEntry{} -} - -// NewList implements resource.Object -func (ESIEntry) NewList() runtime.Object { - return &ESIEntryList{} -} - -// GetCondition returns the condition based on the condition kind -func (r *ESIEntry) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { - return r.Status.GetCondition(t) -} - -// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions -// to be set at once -func (r *ESIEntry) SetConditions(c ...conditionv1alpha1.Condition) { - r.Status.SetConditions(c...) -} - -// ConvertESIEntryFieldSelector is the schema conversion function for normalizing the FieldSelector for ESIEntry -func ConvertESIEntryFieldSelector(label, value string) (internalLabel, internalValue string, err error) { - switch label { - case "metadata.name": - return label, value, nil - case "metadata.namespace": - return label, value, nil - case "spec.index": - return label, value, nil - default: - return "", "", fmt.Errorf("%q is not a known field selector", label) - } -} - -func (r *ESIEntry) CalculateHash() ([sha1.Size]byte, error) { - // Convert the struct to JSON - jsonData, err := json.Marshal(r) - if err != nil { - return [sha1.Size]byte{}, err - } - - // Calculate SHA-1 hash - return sha1.Sum(jsonData), nil -} - -func (r *ESIEntry) GetNamespacedName() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.GetNamespace(), - Name: r.GetName(), - } -} - -func (r *ESIEntry) GetKey() store.Key { - return store.KeyFromNSN(types.NamespacedName{Namespace: r.Namespace, Name: r.Spec.Index}) -} - -func (r *ESIEntry) GetIndex() string { - return r.Spec.Index -} - -func (r *ESIEntry) GetOwnerReference() *commonv1alpha1.OwnerReference { - return r.Spec.Owner -} - -func (r *ESIEntry) GetClaimName() string { - return r.Spec.Claim -} - -func (r *ESIEntry) GetSpecID() string { - return r.Spec.ID -} - -func GetESIEntry(ctx context.Context, k store.Key, vrange, id string, labels map[string]string) *ESIEntry { - //log := log.FromContext(ctx) - - index := k.Name - ns := k.Namespace - - spec := &ESIEntrySpec{ - Index: index, - ClaimType: backend.GetClaimTypeFromString(labels[backend.KuidClaimTypeKey]), - Claim: labels[backend.KuidClaimNameKey], - ID: id, - Owner: &commonv1alpha1.OwnerReference{ - Group: labels[backend.KuidOwnerGroupKey], - Version: labels[backend.KuidOwnerVersionKey], - Kind: labels[backend.KuidOwnerKindKey], - Namespace: labels[backend.KuidOwnerNamespaceKey], - Name: labels[backend.KuidOwnerNameKey], - }, - } - // filter the system defined labels from the labels to prepare for the user defined labels - udLabels := map[string]string{} - for k, v := range labels { - if !backend.BackendSystemKeys.Has(k) { - udLabels[k] = v - } - } - spec.UserDefinedLabels.Labels = udLabels - - status := &ESIEntryStatus{} - status.SetConditions(conditionv1alpha1.Ready()) - - id = strings.ReplaceAll(id, "/", "-") - name := fmt.Sprintf("%s.%s", index, id) - if vrange != "" { - name = fmt.Sprintf("%s.%s", vrange, id) - } - - return BuildESIEntry( - metav1.ObjectMeta{ - Name: name, - Namespace: ns, - }, - spec, - status, - ) -} - -// BuildESIEntry returns a reource from a client Object a Spec/Status -func BuildESIEntry(meta metav1.ObjectMeta, spec *ESIEntrySpec, status *ESIEntryStatus) *ESIEntry { - aspec := ESIEntrySpec{} - if spec != nil { - aspec = *spec - } - astatus := ESIEntryStatus{} - if status != nil { - astatus = *status - } - return &ESIEntry{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: ESIEntryKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -func (r *ESIEntry) ValidateSyntax(_ string) field.ErrorList { - var allErrs field.ErrorList - return allErrs -} - -func (r *ESIEntry) GetSpec() any { - return r.Spec -} - -func (r *ESIEntry) SetSpec(s any) { - if spec, ok := s.(ESIEntrySpec); ok { - r.Spec = spec - } -} - -func (r *ESIEntry) NewObjList() backend.GenericObjectList { - return &ESIEntryList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: ESIEntryListKind}, - } -} - -func (r *ESIEntryList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} diff --git a/apis/backend/esi/v1alpha1/esientry_types.go b/apis/backend/esi/v1alpha1/esientry_types.go deleted file mode 100644 index 5f52faa..0000000 --- a/apis/backend/esi/v1alpha1/esientry_types.go +++ /dev/null @@ -1,78 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "reflect" - - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// ESIEntrySpec defines the desired state of ESIEntry -type ESIEntrySpec struct { - // ESIIndex defines the ESI index for the ESI Claim - Index string `json:"index" yaml:"index" protobuf:"bytes,1,opt,name=index"` - // ClaimType defines the claimType of the ESI Entry - ClaimType backend.ClaimType `json:"claimType,omitempty" yaml:"claimType,omitempty" protobuf:"bytes,2,opt,name=claimType"` - // ID defines the id of the ESI entry in the tree - ID string `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,3,opt,name=id"` - // ClaimLabels define the user defined labels and selector labels used - // in resource claim - commonv1alpha1.ClaimLabels `json:",inline" yaml:",inline" protobuf:"bytes,4,opt,name=claimLabels"` - // Claim defines the name of the claim that is the origin of this entry - Claim string `json:"claim" yaml:"claim" protobuf:"bytes,5,opt,name=claim"` - // Owner defines the ownerReference of the ESIClaim - // Allow for different namesapces, hence it is part of the spec - Owner *commonv1alpha1.OwnerReference `json:"owner,omitempty" yaml:"owner,omitempty" protobuf:"bytes,6,opt,name=owner"` -} - -// ESIEntryStatus defines the observed state of ESIEntry -type ESIEntryStatus struct { - // ConditionedStatus provides the status of the ESIEntry using conditions - // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// ESIEntry is the Schema for the ESIentry API -// -// +k8s:openapi-gen=true -type ESIEntry struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - Spec ESIEntrySpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - Status ESIEntryStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// ESIEntryList contains a list of ESIEntries -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type ESIEntryList struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []ESIEntry `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` -} - -var ( - ESIEntryKind = reflect.TypeOf(ESIEntry{}).Name() - ESIEntryListKind = reflect.TypeOf(ESIEntryList{}).Name() -) diff --git a/apis/backend/esi/v1alpha1/esiindex_interface.go b/apis/backend/esi/v1alpha1/esiindex_interface.go deleted file mode 100644 index cd978eb..0000000 --- a/apis/backend/esi/v1alpha1/esiindex_interface.go +++ /dev/null @@ -1,309 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "crypto/sha1" - "encoding/json" - "fmt" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/idxtable/pkg/tree/gtree" - "github.com/henderiw/idxtable/pkg/tree/tree64" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" - "k8s.io/utils/ptr" -) - -const ESIIndexPlural = "esiindices" -const ESIIndexSingular = "esiindex" - -// +k8s:deepcopy-gen=false -var _ resource.Object = &ESIIndex{} -var _ resource.ObjectList = &ESIIndexList{} - -// GetListMeta returns the ListMeta -func (r *ESIIndexList) GetListMeta() *metav1.ListMeta { - return &r.ListMeta -} - -func (r *ESIIndex) GetSingularName() string { - return ESIIndexSingular -} - -func (ESIIndex) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Resource: ESIIndexPlural, - } -} - -// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. -// IsStorageVersion implements resource.Object. -func (ESIIndex) IsStorageVersion() bool { - return true -} - -// GetObjectMeta implements resource.Object -func (r *ESIIndex) GetObjectMeta() *metav1.ObjectMeta { - return &r.ObjectMeta -} - -// NamespaceScoped returns true to indicate Fortune is a namespaced resource. -// NamespaceScoped implements resource.Object. -func (ESIIndex) NamespaceScoped() bool { - return true -} - -// New implements resource.Object -func (ESIIndex) New() runtime.Object { - return &ESIIndex{} -} - -// NewList implements resource.Object -func (ESIIndex) NewList() runtime.Object { - return &ESIIndexList{} -} - -// GetCondition returns the condition based on the condition kind -func (r *ESIIndex) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { - return r.Status.GetCondition(t) -} - -// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions -// to be set at once -func (r *ESIIndex) SetConditions(c ...conditionv1alpha1.Condition) { - r.Status.SetConditions(c...) -} - -// ConvertESIIndexFieldSelector is the schema conversion function for normalizing the FieldSelector for ESIIndex -func ConvertESIIndexFieldSelector(label, value string) (internalLabel, internalValue string, err error) { - switch label { - case "metadata.name": - return label, value, nil - case "metadata.namespace": - return label, value, nil - default: - return "", "", fmt.Errorf("%q is not a known field selector", label) - } -} - -func (r *ESIIndexList) GetItems() []backend.Object { - objs := []backend.Object{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *ESIIndex) CalculateHash() ([sha1.Size]byte, error) { - // Convert the struct to JSON - jsonData, err := json.Marshal(r) - if err != nil { - return [sha1.Size]byte{}, err - } - - // Calculate SHA-1 hash - return sha1.Sum(jsonData), nil -} - -func (r *ESIIndex) GetNamespacedName() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.GetNamespace(), - Name: r.GetName(), - } -} - -func (r *ESIIndex) GetTree() gtree.GTree { - tree, err := tree64.New(64) - if err != nil { - return nil - } - return tree -} - -func (r *ESIIndex) GetKey() store.Key { - return store.KeyFromNSN(r.GetNamespacedName()) -} - -func (r *ESIIndex) GetType() string { - return "" -} - -func (r *ESIIndex) GetOwnerReference() *commonv1alpha1.OwnerReference { - return &commonv1alpha1.OwnerReference{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Kind: ESIIndexKind, - Namespace: r.Namespace, - Name: r.Name, - } -} - -func (r *ESIIndex) ValidateSyntax(_ string) field.ErrorList { - var allErrs field.ErrorList - - if r.Spec.MinID != nil { - if err := validateESIID(int(*r.Spec.MinID)); err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.minID"), - r, - fmt.Errorf("invalid ESI ID %d", *r.Spec.MinID).Error(), - )) - } - } - if r.Spec.MaxID != nil { - if err := validateESIID(int(*r.Spec.MaxID)); err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.maxID"), - r, - fmt.Errorf("invalid ESI ID %d", *r.Spec.MaxID).Error(), - )) - } - } - if r.Spec.MinID != nil && r.Spec.MaxID != nil { - if *r.Spec.MinID > *r.Spec.MaxID { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.maxID"), - r, - fmt.Errorf("min ESI ID %d cannot be bigger than max ESI ID %d", *r.Spec.MinID, *r.Spec.MaxID).Error(), - )) - } - } - return allErrs -} - -func GetMinClaimRange(id uint64) string { - return fmt.Sprintf("%d-%d", ESIID_Min, id-1) -} - -func GetMaxClaimRange(id uint64) string { - return fmt.Sprintf("%d-%d", id+1, ESIID_Max) -} - -func (r *ESIIndex) GetMinID() *uint64 { - if r.Spec.MinID == nil { - return nil - } - return ptr.To[uint64](uint64(*r.Spec.MinID)) -} - -func (r *ESIIndex) GetMaxID() *uint64 { - if r.Spec.MaxID == nil { - return nil - } - return ptr.To[uint64](uint64(*r.Spec.MaxID)) -} - -func (r *ESIIndex) GetMinClaimNSN() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.Namespace, - Name: fmt.Sprintf("%s.%s", r.Name, ESIIndexReservedMinName), - } -} - -func (r *ESIIndex) GetMaxClaimNSN() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.Namespace, - Name: fmt.Sprintf("%s.%s", r.Name, ESIIndexReservedMaxName), - } -} - -func (r *ESIIndex) GetMinClaim() backend.ClaimObject { - return BuildESIClaim( - metav1.ObjectMeta{ - Namespace: r.GetNamespace(), - Name: r.GetMinClaimNSN().Name, - }, - &ESIClaimSpec{ - Index: r.Name, - Range: ptr.To[string](GetMinClaimRange(*r.Spec.MinID)), - Owner: commonv1alpha1.GetOwnerReference(r), - }, - nil, - ) -} - -func (r *ESIIndex) GetMaxClaim() backend.ClaimObject { - return BuildESIClaim( - metav1.ObjectMeta{ - Namespace: r.GetNamespace(), - Name: r.GetMaxClaimNSN().Name, - }, - &ESIClaimSpec{ - Index: r.Name, - Range: ptr.To[string](GetMaxClaimRange(*r.Spec.MaxID)), - Owner: commonv1alpha1.GetOwnerReference(r), - }, - nil, - ) -} - -// BuildESIIndex returns a reource from a client Object a Spec/Status -func BuildESIIndex(meta metav1.ObjectMeta, spec *ESIIndexSpec, status *ESIIndexStatus) *ESIIndex { - aspec := ESIIndexSpec{} - if spec != nil { - aspec = *spec - } - astatus := ESIIndexStatus{} - if status != nil { - astatus = *status - } - return &ESIIndex{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: ESIIndexKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -func (r *ESIIndex) GetSpec() any { - return r.Spec -} - -func (r *ESIIndex) SetSpec(s any) { - if spec, ok := s.(ESIIndexSpec); ok { - r.Spec = spec - } -} - -func (r *ESIIndex) NewObjList() backend.GenericObjectList { - return &ESIIndexList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: ESIIndexListKind}, - } -} - -func (r *ESIIndexList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} diff --git a/apis/backend/esi/v1alpha1/esiindex_types.go b/apis/backend/esi/v1alpha1/esiindex_types.go deleted file mode 100644 index a0ae9af..0000000 --- a/apis/backend/esi/v1alpha1/esiindex_types.go +++ /dev/null @@ -1,78 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "reflect" - - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// ESIIndexSpec defines the desired state of ESIIndex -type ESIIndexSpec struct { - // MinID defines the min ESI ID the index supports - // +optional - MinID *uint64 `json:"minID,omitempty" yaml:"minID,omitempty" protobuf:"bytes,1,opt,name=minID"` - // MaxID defines the max ESI ID the index supports - // +optional - MaxID *uint64 `json:"maxID,omitempty" yaml:"maxID,omitempty" protobuf:"bytes,2,opt,name=maxID"` - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` -} - -// ESIIndexStatus defines the observed state of ESIIndex -type ESIIndexStatus struct { - // MinID defines the min ESI ID the index supports - // +optional - MinID *uint64 `json:"minID,omitempty" yaml:"minID,omitempty" protobuf:"bytes,1,opt,name=minID"` - // MaxID defines the max ESI ID the index supports - // +optional - MaxID *uint64 `json:"maxID,omitempty" yaml:"maxID,omitempty" protobuf:"bytes,2,opt,name=maxID"` - // ConditionedStatus provides the status of the ESIIndex using conditions - // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=conditionedStatus"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// ESIIndex is the Schema for the ESIIndex API -// -// +k8s:openapi-gen=true -type ESIIndex struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - Spec ESIIndexSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - Status ESIIndexStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// ESIIndexList contains a list of ESIIndexs -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type ESIIndexList struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []ESIIndex `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` -} - -var ( - ESIIndexKind = reflect.TypeOf(ESIIndex{}).Name() - ESIIndexListKind = reflect.TypeOf(ESIIndexList{}).Name() -) diff --git a/apis/backend/esi/v1alpha1/generated.pb.go b/apis/backend/esi/v1alpha1/generated.pb.go deleted file mode 100644 index 450ec5c..0000000 --- a/apis/backend/esi/v1alpha1/generated.pb.go +++ /dev/null @@ -1,3646 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 protoc-gen-gogo. DO NOT EDIT. -// source: github.com/kuidio/kuid/apis/backend/esi/v1alpha1/generated.proto - -package v1alpha1 - -import ( - fmt "fmt" - - io "io" - - proto "github.com/gogo/protobuf/proto" - github_com_kuidio_kuid_apis_backend "github.com/kuidio/kuid/apis/backend" - v1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - - math "math" - math_bits "math/bits" - reflect "reflect" - strings "strings" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -func (m *ESIClaim) Reset() { *m = ESIClaim{} } -func (*ESIClaim) ProtoMessage() {} -func (*ESIClaim) Descriptor() ([]byte, []int) { - return fileDescriptor_73cef4d43c0b1929, []int{0} -} -func (m *ESIClaim) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ESIClaim) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ESIClaim) XXX_Merge(src proto.Message) { - xxx_messageInfo_ESIClaim.Merge(m, src) -} -func (m *ESIClaim) XXX_Size() int { - return m.Size() -} -func (m *ESIClaim) XXX_DiscardUnknown() { - xxx_messageInfo_ESIClaim.DiscardUnknown(m) -} - -var xxx_messageInfo_ESIClaim proto.InternalMessageInfo - -func (m *ESIClaimList) Reset() { *m = ESIClaimList{} } -func (*ESIClaimList) ProtoMessage() {} -func (*ESIClaimList) Descriptor() ([]byte, []int) { - return fileDescriptor_73cef4d43c0b1929, []int{1} -} -func (m *ESIClaimList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ESIClaimList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ESIClaimList) XXX_Merge(src proto.Message) { - xxx_messageInfo_ESIClaimList.Merge(m, src) -} -func (m *ESIClaimList) XXX_Size() int { - return m.Size() -} -func (m *ESIClaimList) XXX_DiscardUnknown() { - xxx_messageInfo_ESIClaimList.DiscardUnknown(m) -} - -var xxx_messageInfo_ESIClaimList proto.InternalMessageInfo - -func (m *ESIClaimSpec) Reset() { *m = ESIClaimSpec{} } -func (*ESIClaimSpec) ProtoMessage() {} -func (*ESIClaimSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_73cef4d43c0b1929, []int{2} -} -func (m *ESIClaimSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ESIClaimSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ESIClaimSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_ESIClaimSpec.Merge(m, src) -} -func (m *ESIClaimSpec) XXX_Size() int { - return m.Size() -} -func (m *ESIClaimSpec) XXX_DiscardUnknown() { - xxx_messageInfo_ESIClaimSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_ESIClaimSpec proto.InternalMessageInfo - -func (m *ESIClaimStatus) Reset() { *m = ESIClaimStatus{} } -func (*ESIClaimStatus) ProtoMessage() {} -func (*ESIClaimStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_73cef4d43c0b1929, []int{3} -} -func (m *ESIClaimStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ESIClaimStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ESIClaimStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_ESIClaimStatus.Merge(m, src) -} -func (m *ESIClaimStatus) XXX_Size() int { - return m.Size() -} -func (m *ESIClaimStatus) XXX_DiscardUnknown() { - xxx_messageInfo_ESIClaimStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_ESIClaimStatus proto.InternalMessageInfo - -func (m *ESIDynamicIDSyntaxValidator) Reset() { *m = ESIDynamicIDSyntaxValidator{} } -func (*ESIDynamicIDSyntaxValidator) ProtoMessage() {} -func (*ESIDynamicIDSyntaxValidator) Descriptor() ([]byte, []int) { - return fileDescriptor_73cef4d43c0b1929, []int{4} -} -func (m *ESIDynamicIDSyntaxValidator) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ESIDynamicIDSyntaxValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ESIDynamicIDSyntaxValidator) XXX_Merge(src proto.Message) { - xxx_messageInfo_ESIDynamicIDSyntaxValidator.Merge(m, src) -} -func (m *ESIDynamicIDSyntaxValidator) XXX_Size() int { - return m.Size() -} -func (m *ESIDynamicIDSyntaxValidator) XXX_DiscardUnknown() { - xxx_messageInfo_ESIDynamicIDSyntaxValidator.DiscardUnknown(m) -} - -var xxx_messageInfo_ESIDynamicIDSyntaxValidator proto.InternalMessageInfo - -func (m *ESIEntry) Reset() { *m = ESIEntry{} } -func (*ESIEntry) ProtoMessage() {} -func (*ESIEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_73cef4d43c0b1929, []int{5} -} -func (m *ESIEntry) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ESIEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ESIEntry) XXX_Merge(src proto.Message) { - xxx_messageInfo_ESIEntry.Merge(m, src) -} -func (m *ESIEntry) XXX_Size() int { - return m.Size() -} -func (m *ESIEntry) XXX_DiscardUnknown() { - xxx_messageInfo_ESIEntry.DiscardUnknown(m) -} - -var xxx_messageInfo_ESIEntry proto.InternalMessageInfo - -func (m *ESIEntryList) Reset() { *m = ESIEntryList{} } -func (*ESIEntryList) ProtoMessage() {} -func (*ESIEntryList) Descriptor() ([]byte, []int) { - return fileDescriptor_73cef4d43c0b1929, []int{6} -} -func (m *ESIEntryList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ESIEntryList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ESIEntryList) XXX_Merge(src proto.Message) { - xxx_messageInfo_ESIEntryList.Merge(m, src) -} -func (m *ESIEntryList) XXX_Size() int { - return m.Size() -} -func (m *ESIEntryList) XXX_DiscardUnknown() { - xxx_messageInfo_ESIEntryList.DiscardUnknown(m) -} - -var xxx_messageInfo_ESIEntryList proto.InternalMessageInfo - -func (m *ESIEntrySpec) Reset() { *m = ESIEntrySpec{} } -func (*ESIEntrySpec) ProtoMessage() {} -func (*ESIEntrySpec) Descriptor() ([]byte, []int) { - return fileDescriptor_73cef4d43c0b1929, []int{7} -} -func (m *ESIEntrySpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ESIEntrySpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ESIEntrySpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_ESIEntrySpec.Merge(m, src) -} -func (m *ESIEntrySpec) XXX_Size() int { - return m.Size() -} -func (m *ESIEntrySpec) XXX_DiscardUnknown() { - xxx_messageInfo_ESIEntrySpec.DiscardUnknown(m) -} - -var xxx_messageInfo_ESIEntrySpec proto.InternalMessageInfo - -func (m *ESIEntryStatus) Reset() { *m = ESIEntryStatus{} } -func (*ESIEntryStatus) ProtoMessage() {} -func (*ESIEntryStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_73cef4d43c0b1929, []int{8} -} -func (m *ESIEntryStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ESIEntryStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ESIEntryStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_ESIEntryStatus.Merge(m, src) -} -func (m *ESIEntryStatus) XXX_Size() int { - return m.Size() -} -func (m *ESIEntryStatus) XXX_DiscardUnknown() { - xxx_messageInfo_ESIEntryStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_ESIEntryStatus proto.InternalMessageInfo - -func (m *ESIIndex) Reset() { *m = ESIIndex{} } -func (*ESIIndex) ProtoMessage() {} -func (*ESIIndex) Descriptor() ([]byte, []int) { - return fileDescriptor_73cef4d43c0b1929, []int{9} -} -func (m *ESIIndex) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ESIIndex) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ESIIndex) XXX_Merge(src proto.Message) { - xxx_messageInfo_ESIIndex.Merge(m, src) -} -func (m *ESIIndex) XXX_Size() int { - return m.Size() -} -func (m *ESIIndex) XXX_DiscardUnknown() { - xxx_messageInfo_ESIIndex.DiscardUnknown(m) -} - -var xxx_messageInfo_ESIIndex proto.InternalMessageInfo - -func (m *ESIIndexList) Reset() { *m = ESIIndexList{} } -func (*ESIIndexList) ProtoMessage() {} -func (*ESIIndexList) Descriptor() ([]byte, []int) { - return fileDescriptor_73cef4d43c0b1929, []int{10} -} -func (m *ESIIndexList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ESIIndexList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ESIIndexList) XXX_Merge(src proto.Message) { - xxx_messageInfo_ESIIndexList.Merge(m, src) -} -func (m *ESIIndexList) XXX_Size() int { - return m.Size() -} -func (m *ESIIndexList) XXX_DiscardUnknown() { - xxx_messageInfo_ESIIndexList.DiscardUnknown(m) -} - -var xxx_messageInfo_ESIIndexList proto.InternalMessageInfo - -func (m *ESIIndexSpec) Reset() { *m = ESIIndexSpec{} } -func (*ESIIndexSpec) ProtoMessage() {} -func (*ESIIndexSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_73cef4d43c0b1929, []int{11} -} -func (m *ESIIndexSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ESIIndexSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ESIIndexSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_ESIIndexSpec.Merge(m, src) -} -func (m *ESIIndexSpec) XXX_Size() int { - return m.Size() -} -func (m *ESIIndexSpec) XXX_DiscardUnknown() { - xxx_messageInfo_ESIIndexSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_ESIIndexSpec proto.InternalMessageInfo - -func (m *ESIIndexStatus) Reset() { *m = ESIIndexStatus{} } -func (*ESIIndexStatus) ProtoMessage() {} -func (*ESIIndexStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_73cef4d43c0b1929, []int{12} -} -func (m *ESIIndexStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ESIIndexStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ESIIndexStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_ESIIndexStatus.Merge(m, src) -} -func (m *ESIIndexStatus) XXX_Size() int { - return m.Size() -} -func (m *ESIIndexStatus) XXX_DiscardUnknown() { - xxx_messageInfo_ESIIndexStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_ESIIndexStatus proto.InternalMessageInfo - -func (m *ESIRangeSyntaxValidator) Reset() { *m = ESIRangeSyntaxValidator{} } -func (*ESIRangeSyntaxValidator) ProtoMessage() {} -func (*ESIRangeSyntaxValidator) Descriptor() ([]byte, []int) { - return fileDescriptor_73cef4d43c0b1929, []int{13} -} -func (m *ESIRangeSyntaxValidator) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ESIRangeSyntaxValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ESIRangeSyntaxValidator) XXX_Merge(src proto.Message) { - xxx_messageInfo_ESIRangeSyntaxValidator.Merge(m, src) -} -func (m *ESIRangeSyntaxValidator) XXX_Size() int { - return m.Size() -} -func (m *ESIRangeSyntaxValidator) XXX_DiscardUnknown() { - xxx_messageInfo_ESIRangeSyntaxValidator.DiscardUnknown(m) -} - -var xxx_messageInfo_ESIRangeSyntaxValidator proto.InternalMessageInfo - -func (m *ESIStaticIDSyntaxValidator) Reset() { *m = ESIStaticIDSyntaxValidator{} } -func (*ESIStaticIDSyntaxValidator) ProtoMessage() {} -func (*ESIStaticIDSyntaxValidator) Descriptor() ([]byte, []int) { - return fileDescriptor_73cef4d43c0b1929, []int{14} -} -func (m *ESIStaticIDSyntaxValidator) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ESIStaticIDSyntaxValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ESIStaticIDSyntaxValidator) XXX_Merge(src proto.Message) { - xxx_messageInfo_ESIStaticIDSyntaxValidator.Merge(m, src) -} -func (m *ESIStaticIDSyntaxValidator) XXX_Size() int { - return m.Size() -} -func (m *ESIStaticIDSyntaxValidator) XXX_DiscardUnknown() { - xxx_messageInfo_ESIStaticIDSyntaxValidator.DiscardUnknown(m) -} - -var xxx_messageInfo_ESIStaticIDSyntaxValidator proto.InternalMessageInfo - -func init() { - proto.RegisterType((*ESIClaim)(nil), "github.com.kuidio.kuid.apis.backend.esi.v1alpha1.ESIClaim") - proto.RegisterType((*ESIClaimList)(nil), "github.com.kuidio.kuid.apis.backend.esi.v1alpha1.ESIClaimList") - proto.RegisterType((*ESIClaimSpec)(nil), "github.com.kuidio.kuid.apis.backend.esi.v1alpha1.ESIClaimSpec") - proto.RegisterType((*ESIClaimStatus)(nil), "github.com.kuidio.kuid.apis.backend.esi.v1alpha1.ESIClaimStatus") - proto.RegisterType((*ESIDynamicIDSyntaxValidator)(nil), "github.com.kuidio.kuid.apis.backend.esi.v1alpha1.ESIDynamicIDSyntaxValidator") - proto.RegisterType((*ESIEntry)(nil), "github.com.kuidio.kuid.apis.backend.esi.v1alpha1.ESIEntry") - proto.RegisterType((*ESIEntryList)(nil), "github.com.kuidio.kuid.apis.backend.esi.v1alpha1.ESIEntryList") - proto.RegisterType((*ESIEntrySpec)(nil), "github.com.kuidio.kuid.apis.backend.esi.v1alpha1.ESIEntrySpec") - proto.RegisterType((*ESIEntryStatus)(nil), "github.com.kuidio.kuid.apis.backend.esi.v1alpha1.ESIEntryStatus") - proto.RegisterType((*ESIIndex)(nil), "github.com.kuidio.kuid.apis.backend.esi.v1alpha1.ESIIndex") - proto.RegisterType((*ESIIndexList)(nil), "github.com.kuidio.kuid.apis.backend.esi.v1alpha1.ESIIndexList") - proto.RegisterType((*ESIIndexSpec)(nil), "github.com.kuidio.kuid.apis.backend.esi.v1alpha1.ESIIndexSpec") - proto.RegisterType((*ESIIndexStatus)(nil), "github.com.kuidio.kuid.apis.backend.esi.v1alpha1.ESIIndexStatus") - proto.RegisterType((*ESIRangeSyntaxValidator)(nil), "github.com.kuidio.kuid.apis.backend.esi.v1alpha1.ESIRangeSyntaxValidator") - proto.RegisterType((*ESIStaticIDSyntaxValidator)(nil), "github.com.kuidio.kuid.apis.backend.esi.v1alpha1.ESIStaticIDSyntaxValidator") -} - -func init() { - proto.RegisterFile("github.com/kuidio/kuid/apis/backend/esi/v1alpha1/generated.proto", fileDescriptor_73cef4d43c0b1929) -} - -var fileDescriptor_73cef4d43c0b1929 = []byte{ - // 913 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x57, 0x4f, 0x6f, 0x1b, 0x45, - 0x14, 0xf7, 0xae, 0xbd, 0x51, 0x3c, 0x29, 0x11, 0x59, 0x24, 0x70, 0x0d, 0xac, 0x2b, 0xf7, 0xd2, - 0x4b, 0x67, 0x93, 0x0a, 0xa1, 0x8a, 0x4a, 0x55, 0xd9, 0xd8, 0x87, 0x95, 0xa8, 0x2a, 0x8d, 0x4b, - 0x0f, 0xa8, 0x12, 0x19, 0xef, 0x4e, 0xec, 0xc1, 0xd9, 0x3f, 0xda, 0x1d, 0x87, 0xf8, 0xc6, 0x09, - 0x24, 0x4e, 0x7c, 0x01, 0x8e, 0x7c, 0x07, 0x24, 0xbe, 0x40, 0x2e, 0x48, 0x3d, 0x56, 0x1c, 0x02, - 0x31, 0xdf, 0x82, 0x13, 0x9a, 0x37, 0xbb, 0xd9, 0xc5, 0xae, 0x8d, 0x13, 0x08, 0xd4, 0xa7, 0xcd, - 0xbc, 0x79, 0xef, 0xf7, 0x9b, 0xf7, 0xde, 0xbc, 0x5f, 0xc6, 0xe8, 0xd1, 0x80, 0x8b, 0xe1, 0xb8, - 0x8f, 0xbd, 0x28, 0xb0, 0x47, 0x63, 0xee, 0xf3, 0x08, 0x3e, 0x36, 0x8d, 0x79, 0x6a, 0xf7, 0xa9, - 0x37, 0x62, 0xa1, 0x6f, 0xb3, 0x94, 0xdb, 0xc7, 0x7b, 0xf4, 0x28, 0x1e, 0xd2, 0x3d, 0x7b, 0xc0, - 0x42, 0x96, 0x50, 0xc1, 0x7c, 0x1c, 0x27, 0x91, 0x88, 0xcc, 0xdd, 0x02, 0x01, 0x2b, 0x04, 0xf8, - 0x60, 0x89, 0x80, 0x33, 0x04, 0xcc, 0x52, 0x8e, 0x73, 0x84, 0xe6, 0xdd, 0x12, 0xe7, 0x20, 0x1a, - 0x44, 0x36, 0x00, 0xf5, 0xc7, 0x87, 0xb0, 0x82, 0x05, 0xfc, 0xa5, 0x08, 0x9a, 0x0f, 0x96, 0x1d, - 0xd1, 0x8b, 0x82, 0x20, 0x0a, 0x17, 0x9e, 0xae, 0xf9, 0x70, 0x79, 0x70, 0xe8, 0x73, 0xc1, 0x97, - 0xc5, 0x7f, 0x30, 0xba, 0x9f, 0x62, 0x1e, 0x49, 0xff, 0x80, 0x7a, 0x43, 0x1e, 0xb2, 0x64, 0x62, - 0xc7, 0xa3, 0x81, 0x02, 0x08, 0x98, 0xa0, 0xf6, 0xf1, 0x7c, 0xd4, 0x87, 0x8b, 0xa2, 0x92, 0x71, - 0x28, 0x78, 0xc0, 0xec, 0xd4, 0x1b, 0xb2, 0x80, 0xce, 0xc6, 0xb5, 0x7f, 0xd4, 0xd1, 0x66, 0xb7, - 0xe7, 0xee, 0x1f, 0x51, 0x1e, 0x98, 0x07, 0x68, 0x53, 0xe2, 0xfb, 0x54, 0xd0, 0x86, 0x76, 0x4b, - 0xbb, 0xb3, 0x75, 0x6f, 0x17, 0x2b, 0x5c, 0x5c, 0xc6, 0xc5, 0xf1, 0x68, 0xa0, 0x8a, 0x2d, 0xbd, - 0xf1, 0xf1, 0x1e, 0x7e, 0xd2, 0xff, 0x82, 0x79, 0xe2, 0x31, 0x13, 0xd4, 0x31, 0x4f, 0xcf, 0x5a, - 0x95, 0xe9, 0x59, 0x0b, 0x15, 0x36, 0x72, 0x81, 0x6a, 0x1e, 0xa0, 0x5a, 0x1a, 0x33, 0xaf, 0xa1, - 0x03, 0xfa, 0x43, 0x7c, 0xd9, 0x4e, 0xe2, 0xfc, 0xac, 0xbd, 0x98, 0x79, 0xce, 0x8d, 0x8c, 0xab, - 0x26, 0x57, 0x04, 0x90, 0xcd, 0x21, 0xda, 0x48, 0x05, 0x15, 0xe3, 0xb4, 0x51, 0x05, 0x8e, 0x47, - 0xff, 0x80, 0x03, 0x70, 0x9c, 0xed, 0x8c, 0x65, 0x43, 0xad, 0x49, 0x86, 0xdf, 0xfe, 0x59, 0x43, - 0x37, 0x72, 0xd7, 0x4f, 0x78, 0x2a, 0xcc, 0xe7, 0x73, 0xe5, 0xc3, 0xab, 0x95, 0x4f, 0x46, 0x43, - 0xf1, 0xde, 0xcc, 0xa8, 0x36, 0x73, 0x4b, 0xa9, 0x74, 0x9f, 0x23, 0x83, 0x0b, 0x16, 0xa4, 0x0d, - 0xfd, 0x56, 0xf5, 0xce, 0xd6, 0xbd, 0x8f, 0xae, 0x9e, 0x97, 0xf3, 0x46, 0x46, 0x63, 0xb8, 0x12, - 0x90, 0x28, 0xdc, 0xf6, 0x4f, 0x7a, 0x91, 0x8f, 0x2c, 0xa8, 0x79, 0x1b, 0x19, 0x3c, 0xf4, 0xd9, - 0x09, 0x24, 0x53, 0x2f, 0x45, 0x49, 0x23, 0x51, 0x7b, 0xe6, 0xdb, 0x48, 0xe7, 0x3e, 0xf4, 0xb3, - 0xe6, 0x6c, 0x4c, 0xcf, 0x5a, 0xba, 0xdb, 0x21, 0x3a, 0xf7, 0xcd, 0x16, 0x32, 0x12, 0x1a, 0x0e, - 0x18, 0xb4, 0xa1, 0xee, 0xd4, 0x65, 0x20, 0x91, 0x06, 0xa2, 0xec, 0x66, 0x84, 0xb6, 0x3c, 0x28, - 0x1d, 0xed, 0xb3, 0xa3, 0xb4, 0x51, 0x83, 0x82, 0xdd, 0x5f, 0x9a, 0x95, 0x1a, 0xbd, 0x22, 0xa1, - 0xfd, 0x22, 0xde, 0x79, 0x2b, 0x3b, 0xdd, 0x56, 0xc9, 0x48, 0xca, 0x0c, 0xe6, 0x73, 0x64, 0x44, - 0x5f, 0x86, 0x2c, 0x69, 0x18, 0x40, 0xf5, 0xe0, 0x52, 0x54, 0x4f, 0x64, 0x24, 0x61, 0x87, 0x2c, - 0x61, 0xa1, 0xc7, 0x54, 0x3a, 0xca, 0xa6, 0x40, 0xdb, 0x5f, 0xeb, 0x68, 0xfb, 0xaf, 0x17, 0xc7, - 0xfc, 0x56, 0x43, 0x3b, 0x17, 0x03, 0xcf, 0x7c, 0x65, 0xcd, 0x6e, 0xc6, 0xc7, 0x7f, 0xc3, 0x9e, - 0x45, 0x95, 0x72, 0x9d, 0x05, 0x72, 0x6e, 0x66, 0x19, 0xef, 0xcc, 0x6d, 0x91, 0x79, 0xda, 0xab, - 0xf7, 0x09, 0x23, 0xc4, 0x4e, 0x62, 0x9e, 0x4c, 0x9e, 0xf2, 0x80, 0x41, 0x9b, 0xea, 0xce, 0xb6, - 0x1c, 0xf0, 0xee, 0x85, 0x95, 0x94, 0x3c, 0xda, 0xef, 0xa3, 0x77, 0xbb, 0x3d, 0xb7, 0x33, 0x09, - 0x69, 0xc0, 0x3d, 0xb7, 0xd3, 0x9b, 0x84, 0x82, 0x9e, 0x3c, 0xa3, 0x47, 0xdc, 0xa7, 0x22, 0x4a, - 0x72, 0xc1, 0xe9, 0x86, 0x22, 0x99, 0xac, 0x89, 0xe0, 0xc0, 0x59, 0xaf, 0x59, 0x70, 0x14, 0xc7, - 0x4a, 0x82, 0x03, 0xae, 0xeb, 0x22, 0x38, 0x70, 0xd8, 0x05, 0x82, 0xf3, 0x43, 0xb5, 0xc8, 0x67, - 0x75, 0xc1, 0x39, 0x40, 0x75, 0x98, 0xea, 0xa7, 0x93, 0x98, 0x41, 0x5b, 0xeb, 0x8e, 0x93, 0x39, - 0xd6, 0xf7, 0xf3, 0x8d, 0x3f, 0xce, 0x5a, 0x77, 0x57, 0x78, 0x67, 0xe0, 0x8b, 0x00, 0x52, 0x80, - 0x9a, 0x4d, 0x18, 0x15, 0x35, 0x0f, 0x28, 0x83, 0xce, 0xc7, 0xe5, 0x3f, 0x57, 0xad, 0xdb, 0xc8, - 0x80, 0x25, 0xa8, 0x56, 0xa9, 0x26, 0x10, 0x40, 0xd4, 0x5e, 0x21, 0x6d, 0x1b, 0xd7, 0x21, 0x6d, - 0xdf, 0x6b, 0x20, 0x6d, 0xa5, 0x2b, 0xfa, 0x5a, 0x49, 0x5b, 0x2e, 0x29, 0x6e, 0x76, 0x3d, 0xd6, - 0x41, 0x52, 0xe0, 0xac, 0xd7, 0x2c, 0x29, 0x8a, 0x63, 0x25, 0x49, 0x01, 0xd7, 0x75, 0x91, 0x14, - 0x38, 0xec, 0x02, 0x49, 0xf9, 0xa5, 0x94, 0x0f, 0x48, 0x4a, 0x0b, 0x19, 0x01, 0x0f, 0xdd, 0x0e, - 0x24, 0x53, 0x53, 0x97, 0xfb, 0xb1, 0x34, 0x10, 0x65, 0x07, 0x07, 0x7a, 0xe2, 0x76, 0xb2, 0x7f, - 0x8d, 0xca, 0x41, 0x1a, 0x88, 0xb2, 0x9b, 0xdf, 0x68, 0x68, 0x67, 0x9c, 0xb2, 0xa4, 0xc3, 0x0e, - 0x79, 0xc8, 0xfc, 0x6c, 0xf0, 0xab, 0x2b, 0x34, 0x7f, 0x76, 0xd0, 0x3e, 0x9d, 0x45, 0x29, 0xee, - 0xf9, 0xdc, 0x16, 0x99, 0xe7, 0x6c, 0xff, 0xaa, 0xe6, 0xb0, 0xd4, 0xd7, 0x7f, 0x21, 0xbd, 0x57, - 0x4f, 0x72, 0xf5, 0xff, 0x99, 0xe4, 0x9b, 0xe8, 0x9d, 0x6e, 0xcf, 0x85, 0xe7, 0xc7, 0xec, 0xbb, - 0xe1, 0x3d, 0xd4, 0xec, 0xf6, 0x5c, 0xe9, 0xf7, 0x8a, 0x57, 0x85, 0xf3, 0xec, 0xf4, 0xdc, 0xaa, - 0xbc, 0x38, 0xb7, 0x2a, 0x2f, 0xcf, 0xad, 0xca, 0x57, 0x53, 0x4b, 0x3b, 0x9d, 0x5a, 0xda, 0x8b, - 0xa9, 0xa5, 0xbd, 0x9c, 0x5a, 0xda, 0x6f, 0x53, 0x4b, 0xfb, 0xee, 0x77, 0xab, 0xf2, 0xd9, 0xee, - 0x65, 0x7f, 0x7a, 0xfe, 0x19, 0x00, 0x00, 0xff, 0xff, 0xa0, 0x7d, 0x73, 0x35, 0xad, 0x0e, 0x00, - 0x00, -} - -func (m *ESIClaim) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ESIClaim) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ESIClaim) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ESIClaimList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ESIClaimList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ESIClaimList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ESIClaimSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ESIClaimSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ESIClaimSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Owner != nil { - { - size, err := m.Owner.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - { - size, err := m.ClaimLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - if m.Range != nil { - i -= len(*m.Range) - copy(dAtA[i:], *m.Range) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Range))) - i-- - dAtA[i] = 0x1a - } - if m.ID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.ID)) - i-- - dAtA[i] = 0x10 - } - i -= len(m.Index) - copy(dAtA[i:], m.Index) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Index))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ESIClaimStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ESIClaimStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ESIClaimStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ExpiryTime != nil { - i -= len(*m.ExpiryTime) - copy(dAtA[i:], *m.ExpiryTime) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ExpiryTime))) - i-- - dAtA[i] = 0x22 - } - if m.Range != nil { - i -= len(*m.Range) - copy(dAtA[i:], *m.Range) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Range))) - i-- - dAtA[i] = 0x1a - } - if m.ID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.ID)) - i-- - dAtA[i] = 0x10 - } - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ESIDynamicIDSyntaxValidator) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ESIDynamicIDSyntaxValidator) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ESIDynamicIDSyntaxValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *ESIEntry) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ESIEntry) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ESIEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ESIEntryList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ESIEntryList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ESIEntryList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ESIEntrySpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ESIEntrySpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ESIEntrySpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Owner != nil { - { - size, err := m.Owner.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - i -= len(m.Claim) - copy(dAtA[i:], m.Claim) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Claim))) - i-- - dAtA[i] = 0x2a - { - size, err := m.ClaimLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - i -= len(m.ID) - copy(dAtA[i:], m.ID) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.ID))) - i-- - dAtA[i] = 0x1a - i -= len(m.ClaimType) - copy(dAtA[i:], m.ClaimType) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.ClaimType))) - i-- - dAtA[i] = 0x12 - i -= len(m.Index) - copy(dAtA[i:], m.Index) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Index))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ESIEntryStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ESIEntryStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ESIEntryStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ESIIndex) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ESIIndex) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ESIIndex) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ESIIndexList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ESIIndexList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ESIIndexList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ESIIndexSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ESIIndexSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ESIIndexSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.UserDefinedLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if m.MaxID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MaxID)) - i-- - dAtA[i] = 0x10 - } - if m.MinID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MinID)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *ESIIndexStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ESIIndexStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ESIIndexStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if m.MaxID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MaxID)) - i-- - dAtA[i] = 0x10 - } - if m.MinID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MinID)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *ESIRangeSyntaxValidator) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ESIRangeSyntaxValidator) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ESIRangeSyntaxValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *ESIStaticIDSyntaxValidator) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ESIStaticIDSyntaxValidator) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ESIStaticIDSyntaxValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { - offset -= sovGenerated(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *ESIClaim) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ESIClaimList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *ESIClaimSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Index) - n += 1 + l + sovGenerated(uint64(l)) - if m.ID != nil { - n += 1 + sovGenerated(uint64(*m.ID)) - } - if m.Range != nil { - l = len(*m.Range) - n += 1 + l + sovGenerated(uint64(l)) - } - l = m.ClaimLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.Owner != nil { - l = m.Owner.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *ESIClaimStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.ID != nil { - n += 1 + sovGenerated(uint64(*m.ID)) - } - if m.Range != nil { - l = len(*m.Range) - n += 1 + l + sovGenerated(uint64(l)) - } - if m.ExpiryTime != nil { - l = len(*m.ExpiryTime) - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *ESIDynamicIDSyntaxValidator) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *ESIEntry) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ESIEntryList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *ESIEntrySpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Index) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.ClaimType) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.ID) - n += 1 + l + sovGenerated(uint64(l)) - l = m.ClaimLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Claim) - n += 1 + l + sovGenerated(uint64(l)) - if m.Owner != nil { - l = m.Owner.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *ESIEntryStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ESIIndex) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ESIIndexList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *ESIIndexSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MinID != nil { - n += 1 + sovGenerated(uint64(*m.MinID)) - } - if m.MaxID != nil { - n += 1 + sovGenerated(uint64(*m.MaxID)) - } - l = m.UserDefinedLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ESIIndexStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MinID != nil { - n += 1 + sovGenerated(uint64(*m.MinID)) - } - if m.MaxID != nil { - n += 1 + sovGenerated(uint64(*m.MaxID)) - } - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ESIRangeSyntaxValidator) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *ESIStaticIDSyntaxValidator) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func sovGenerated(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenerated(x uint64) (n int) { - return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *ESIClaim) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ESIClaim{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "ESIClaimSpec", "ESIClaimSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "ESIClaimStatus", "ESIClaimStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *ESIClaimList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]ESIClaim{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "ESIClaim", "ESIClaim", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&ESIClaimList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *ESIClaimSpec) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ESIClaimSpec{`, - `Index:` + fmt.Sprintf("%v", this.Index) + `,`, - `ID:` + valueToStringGenerated(this.ID) + `,`, - `Range:` + valueToStringGenerated(this.Range) + `,`, - `ClaimLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ClaimLabels), "ClaimLabels", "v1alpha1.ClaimLabels", 1), `&`, ``, 1) + `,`, - `Owner:` + strings.Replace(fmt.Sprintf("%v", this.Owner), "OwnerReference", "v1alpha1.OwnerReference", 1) + `,`, - `}`, - }, "") - return s -} -func (this *ESIClaimStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ESIClaimStatus{`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `ID:` + valueToStringGenerated(this.ID) + `,`, - `Range:` + valueToStringGenerated(this.Range) + `,`, - `ExpiryTime:` + valueToStringGenerated(this.ExpiryTime) + `,`, - `}`, - }, "") - return s -} -func (this *ESIDynamicIDSyntaxValidator) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ESIDynamicIDSyntaxValidator{`, - `}`, - }, "") - return s -} -func (this *ESIEntry) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ESIEntry{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "ESIEntrySpec", "ESIEntrySpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "ESIEntryStatus", "ESIEntryStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *ESIEntryList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]ESIEntry{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "ESIEntry", "ESIEntry", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&ESIEntryList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *ESIEntrySpec) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ESIEntrySpec{`, - `Index:` + fmt.Sprintf("%v", this.Index) + `,`, - `ClaimType:` + fmt.Sprintf("%v", this.ClaimType) + `,`, - `ID:` + fmt.Sprintf("%v", this.ID) + `,`, - `ClaimLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ClaimLabels), "ClaimLabels", "v1alpha1.ClaimLabels", 1), `&`, ``, 1) + `,`, - `Claim:` + fmt.Sprintf("%v", this.Claim) + `,`, - `Owner:` + strings.Replace(fmt.Sprintf("%v", this.Owner), "OwnerReference", "v1alpha1.OwnerReference", 1) + `,`, - `}`, - }, "") - return s -} -func (this *ESIEntryStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ESIEntryStatus{`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *ESIIndex) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ESIIndex{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "ESIIndexSpec", "ESIIndexSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "ESIIndexStatus", "ESIIndexStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *ESIIndexList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]ESIIndex{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "ESIIndex", "ESIIndex", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&ESIIndexList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *ESIIndexSpec) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ESIIndexSpec{`, - `MinID:` + valueToStringGenerated(this.MinID) + `,`, - `MaxID:` + valueToStringGenerated(this.MaxID) + `,`, - `UserDefinedLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.UserDefinedLabels), "UserDefinedLabels", "v1alpha1.UserDefinedLabels", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *ESIIndexStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ESIIndexStatus{`, - `MinID:` + valueToStringGenerated(this.MinID) + `,`, - `MaxID:` + valueToStringGenerated(this.MaxID) + `,`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *ESIRangeSyntaxValidator) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ESIRangeSyntaxValidator{`, - `}`, - }, "") - return s -} -func (this *ESIStaticIDSyntaxValidator) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ESIStaticIDSyntaxValidator{`, - `}`, - }, "") - return s -} -func valueToStringGenerated(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *ESIClaim) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ESIClaim: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ESIClaim: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ESIClaimList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ESIClaimList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ESIClaimList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, ESIClaim{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ESIClaimSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ESIClaimSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ESIClaimSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Index = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ID = &v - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Range", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Range = &s - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ClaimLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Owner == nil { - m.Owner = &v1alpha1.OwnerReference{} - } - if err := m.Owner.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ESIClaimStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ESIClaimStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ESIClaimStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ID = &v - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Range", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Range = &s - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExpiryTime", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.ExpiryTime = &s - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ESIDynamicIDSyntaxValidator) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ESIDynamicIDSyntaxValidator: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ESIDynamicIDSyntaxValidator: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ESIEntry) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ESIEntry: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ESIEntry: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ESIEntryList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ESIEntryList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ESIEntryList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, ESIEntry{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ESIEntrySpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ESIEntrySpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ESIEntrySpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Index = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClaimType = github_com_kuidio_kuid_apis_backend.ClaimType(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ClaimLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Claim", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Claim = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Owner == nil { - m.Owner = &v1alpha1.OwnerReference{} - } - if err := m.Owner.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ESIEntryStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ESIEntryStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ESIEntryStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ESIIndex) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ESIIndex: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ESIIndex: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ESIIndexList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ESIIndexList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ESIIndexList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, ESIIndex{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ESIIndexSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ESIIndexSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ESIIndexSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinID", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MinID = &v - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxID", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MaxID = &v - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UserDefinedLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.UserDefinedLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ESIIndexStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ESIIndexStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ESIIndexStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinID", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MinID = &v - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxID", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MaxID = &v - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ESIRangeSyntaxValidator) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ESIRangeSyntaxValidator: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ESIRangeSyntaxValidator: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ESIStaticIDSyntaxValidator) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ESIStaticIDSyntaxValidator: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ESIStaticIDSyntaxValidator: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenerated(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenerated - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenerated - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenerated - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") -) diff --git a/apis/backend/esi/v1alpha1/generated.proto b/apis/backend/esi/v1alpha1/generated.proto deleted file mode 100644 index fb12117..0000000 --- a/apis/backend/esi/v1alpha1/generated.proto +++ /dev/null @@ -1,197 +0,0 @@ -/* -Copyright 2024 Nokia. - -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. -*/ -// This file was autogenerated by go-to-protobuf. Do not edit it manually! - -syntax = "proto2"; - -package github.com.kuidio.kuid.apis.backend.esi.v1alpha1; - -import "github.com/kuidio/kuid/apis/common/v1alpha1/generated.proto"; -import "github.com/kuidio/kuid/apis/condition/v1alpha1/generated.proto"; -import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; -import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; - -// Package-wide variables from generator "generated". -option go_package = "github.com/kuidio/kuid/apis/backend/esi/v1alpha1"; - -// ESIClaim is the Schema for the ESIClaim API -// -// +k8s:openapi-gen=true -message ESIClaim { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional ESIClaimSpec spec = 2; - - optional ESIClaimStatus status = 3; -} - -// ESIClaimList contains a list of ESIClaims -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message ESIClaimList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated ESIClaim items = 2; -} - -// ESIClaimSpec defines the desired state of ESIClaim -message ESIClaimSpec { - // ESIIndex defines the ESI index for the ESI Claim - optional string index = 1; - - // ESIID defines the ESI for the ESI claim - optional uint64 id = 2; - - // Range defines the ESI range for the ESI claim - // The following notation is used: start-end - - // the ESIs in the range must be consecutive - optional string range = 3; - - // ClaimLabels define the user defined labels and selector labels used - // in resource claim - optional github.com.kuidio.kuid.apis.common.v1alpha1.ClaimLabels claimLabels = 4; - - // Owner defines the ownerReference of the ESIClaim - // Allow for different namesapces, hence it is part of the spec - optional github.com.kuidio.kuid.apis.common.v1alpha1.OwnerReference owner = 5; -} - -// ESIClaimStatus defines the observed state of ESIClaim -message ESIClaimStatus { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 1; - - // ESIID defines the ESI for the ESI claim - // +optional - optional uint64 id = 2; - - // ESIRange defines the ESI range for the ESI claim - // +optional - optional string range = 3; - - // ExpiryTime defines when the claim expires - // +kubebuilder:validation:Optional - // +optional - optional string expiryTime = 4; -} - -message ESIDynamicIDSyntaxValidator { -} - -// ESIEntry is the Schema for the ESIentry API -// -// +k8s:openapi-gen=true -message ESIEntry { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional ESIEntrySpec spec = 2; - - optional ESIEntryStatus status = 3; -} - -// ESIEntryList contains a list of ESIEntries -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message ESIEntryList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated ESIEntry items = 2; -} - -// ESIEntrySpec defines the desired state of ESIEntry -message ESIEntrySpec { - // ESIIndex defines the ESI index for the ESI Claim - optional string index = 1; - - // ClaimType defines the claimType of the ESI Entry - optional string claimType = 2; - - // ID defines the id of the ESI entry in the tree - optional string id = 3; - - // ClaimLabels define the user defined labels and selector labels used - // in resource claim - optional github.com.kuidio.kuid.apis.common.v1alpha1.ClaimLabels claimLabels = 4; - - // Claim defines the name of the claim that is the origin of this entry - optional string claim = 5; - - // Owner defines the ownerReference of the ESIClaim - // Allow for different namesapces, hence it is part of the spec - optional github.com.kuidio.kuid.apis.common.v1alpha1.OwnerReference owner = 6; -} - -// ESIEntryStatus defines the observed state of ESIEntry -message ESIEntryStatus { - // ConditionedStatus provides the status of the ESIEntry using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 1; -} - -// ESIIndex is the Schema for the ESIIndex API -// -// +k8s:openapi-gen=true -message ESIIndex { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional ESIIndexSpec spec = 2; - - optional ESIIndexStatus status = 3; -} - -// ESIIndexList contains a list of ESIIndexs -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message ESIIndexList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated ESIIndex items = 2; -} - -// ESIIndexSpec defines the desired state of ESIIndex -message ESIIndexSpec { - // MinID defines the min ESI ID the index supports - // +optional - optional uint64 minID = 1; - - // MaxID defines the max ESI ID the index supports - // +optional - optional uint64 maxID = 2; - - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - optional github.com.kuidio.kuid.apis.common.v1alpha1.UserDefinedLabels userDefinedLabels = 3; -} - -// ESIIndexStatus defines the observed state of ESIIndex -message ESIIndexStatus { - // MinID defines the min ESI ID the index supports - // +optional - optional uint64 minID = 1; - - // MaxID defines the max ESI ID the index supports - // +optional - optional uint64 maxID = 2; - - // ConditionedStatus provides the status of the ESIIndex using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 3; -} - -message ESIRangeSyntaxValidator { -} - -message ESIStaticIDSyntaxValidator { -} - diff --git a/apis/backend/esi/v1alpha1/register.go b/apis/backend/esi/v1alpha1/register.go deleted file mode 100644 index c9a892d..0000000 --- a/apis/backend/esi/v1alpha1/register.go +++ /dev/null @@ -1,69 +0,0 @@ -/* -Copyright 2024 Nokia. - -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. -*/ - -// +kubebuilder:object:generate=true -// +groupName=esi.be.kuid.dev -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -const ( - Group = "esi.be.kuid.dev" - Version = "v1alpha1" -) - -var ( - // SchemeGroupVersion contains the API group and version information for the types in this package. - SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version} - // AddToScheme applies all the stored functions to the scheme. A non-nil error - // indicates that one function failed and the attempt was abandoned. - //AddToScheme = (&runtime.SchemeBuilder{}).AddToScheme - AddToScheme = localSchemeBuilder.AddToScheme - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - schemeBuilder runtime.SchemeBuilder - localSchemeBuilder = &schemeBuilder -) - -// Resource takes an unqualified resource and returns a Group qualified GroupResource -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} - -func init() { - localSchemeBuilder.Register(addKnownTypes) -} - -// Adds the list of known types to the given scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - // +kubebuilder:scaffold:install - - scheme.AddKnownTypes(SchemeGroupVersion, - &ESIClaim{}, - &ESIClaimList{}, - &ESIEntry{}, - &ESIEntryList{}, - &ESIIndex{}, - &ESIIndexList{}, - ) - - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/apis/backend/esi/v1alpha1/zz_generated.deepcopy.go b/apis/backend/esi/v1alpha1/zz_generated.deepcopy.go deleted file mode 100644 index 8f964d1..0000000 --- a/apis/backend/esi/v1alpha1/zz_generated.deepcopy.go +++ /dev/null @@ -1,414 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - 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 *ESIClaim) DeepCopyInto(out *ESIClaim) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ESIClaim. -func (in *ESIClaim) DeepCopy() *ESIClaim { - if in == nil { - return nil - } - out := new(ESIClaim) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ESIClaim) 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 *ESIClaimList) DeepCopyInto(out *ESIClaimList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]ESIClaim, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ESIClaimList. -func (in *ESIClaimList) DeepCopy() *ESIClaimList { - if in == nil { - return nil - } - out := new(ESIClaimList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ESIClaimList) 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 *ESIClaimSpec) DeepCopyInto(out *ESIClaimSpec) { - *out = *in - if in.ID != nil { - in, out := &in.ID, &out.ID - *out = new(uint64) - **out = **in - } - if in.Range != nil { - in, out := &in.Range, &out.Range - *out = new(string) - **out = **in - } - in.ClaimLabels.DeepCopyInto(&out.ClaimLabels) - if in.Owner != nil { - in, out := &in.Owner, &out.Owner - *out = new(commonv1alpha1.OwnerReference) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ESIClaimSpec. -func (in *ESIClaimSpec) DeepCopy() *ESIClaimSpec { - if in == nil { - return nil - } - out := new(ESIClaimSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ESIClaimStatus) DeepCopyInto(out *ESIClaimStatus) { - *out = *in - in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) - if in.ID != nil { - in, out := &in.ID, &out.ID - *out = new(uint64) - **out = **in - } - if in.Range != nil { - in, out := &in.Range, &out.Range - *out = new(string) - **out = **in - } - if in.ExpiryTime != nil { - in, out := &in.ExpiryTime, &out.ExpiryTime - *out = new(string) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ESIClaimStatus. -func (in *ESIClaimStatus) DeepCopy() *ESIClaimStatus { - if in == nil { - return nil - } - out := new(ESIClaimStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ESIDynamicIDSyntaxValidator) DeepCopyInto(out *ESIDynamicIDSyntaxValidator) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ESIDynamicIDSyntaxValidator. -func (in *ESIDynamicIDSyntaxValidator) DeepCopy() *ESIDynamicIDSyntaxValidator { - if in == nil { - return nil - } - out := new(ESIDynamicIDSyntaxValidator) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ESIEntry) DeepCopyInto(out *ESIEntry) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ESIEntry. -func (in *ESIEntry) DeepCopy() *ESIEntry { - if in == nil { - return nil - } - out := new(ESIEntry) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ESIEntry) 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 *ESIEntryList) DeepCopyInto(out *ESIEntryList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]ESIEntry, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ESIEntryList. -func (in *ESIEntryList) DeepCopy() *ESIEntryList { - if in == nil { - return nil - } - out := new(ESIEntryList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ESIEntryList) 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 *ESIEntrySpec) DeepCopyInto(out *ESIEntrySpec) { - *out = *in - in.ClaimLabels.DeepCopyInto(&out.ClaimLabels) - if in.Owner != nil { - in, out := &in.Owner, &out.Owner - *out = new(commonv1alpha1.OwnerReference) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ESIEntrySpec. -func (in *ESIEntrySpec) DeepCopy() *ESIEntrySpec { - if in == nil { - return nil - } - out := new(ESIEntrySpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ESIEntryStatus) DeepCopyInto(out *ESIEntryStatus) { - *out = *in - in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ESIEntryStatus. -func (in *ESIEntryStatus) DeepCopy() *ESIEntryStatus { - if in == nil { - return nil - } - out := new(ESIEntryStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ESIIndex) DeepCopyInto(out *ESIIndex) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ESIIndex. -func (in *ESIIndex) DeepCopy() *ESIIndex { - if in == nil { - return nil - } - out := new(ESIIndex) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ESIIndex) 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 *ESIIndexList) DeepCopyInto(out *ESIIndexList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]ESIIndex, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ESIIndexList. -func (in *ESIIndexList) DeepCopy() *ESIIndexList { - if in == nil { - return nil - } - out := new(ESIIndexList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ESIIndexList) 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 *ESIIndexSpec) DeepCopyInto(out *ESIIndexSpec) { - *out = *in - if in.MinID != nil { - in, out := &in.MinID, &out.MinID - *out = new(uint64) - **out = **in - } - if in.MaxID != nil { - in, out := &in.MaxID, &out.MaxID - *out = new(uint64) - **out = **in - } - in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ESIIndexSpec. -func (in *ESIIndexSpec) DeepCopy() *ESIIndexSpec { - if in == nil { - return nil - } - out := new(ESIIndexSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ESIIndexStatus) DeepCopyInto(out *ESIIndexStatus) { - *out = *in - if in.MinID != nil { - in, out := &in.MinID, &out.MinID - *out = new(uint64) - **out = **in - } - if in.MaxID != nil { - in, out := &in.MaxID, &out.MaxID - *out = new(uint64) - **out = **in - } - in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ESIIndexStatus. -func (in *ESIIndexStatus) DeepCopy() *ESIIndexStatus { - if in == nil { - return nil - } - out := new(ESIIndexStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ESIRangeSyntaxValidator) DeepCopyInto(out *ESIRangeSyntaxValidator) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ESIRangeSyntaxValidator. -func (in *ESIRangeSyntaxValidator) DeepCopy() *ESIRangeSyntaxValidator { - if in == nil { - return nil - } - out := new(ESIRangeSyntaxValidator) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ESIStaticIDSyntaxValidator) DeepCopyInto(out *ESIStaticIDSyntaxValidator) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ESIStaticIDSyntaxValidator. -func (in *ESIStaticIDSyntaxValidator) DeepCopy() *ESIStaticIDSyntaxValidator { - if in == nil { - return nil - } - out := new(ESIStaticIDSyntaxValidator) - in.DeepCopyInto(out) - return out -} diff --git a/apis/backend/extcomm/doc.go b/apis/backend/extcomm/doc.go deleted file mode 100644 index add9e47..0000000 --- a/apis/backend/extcomm/doc.go +++ /dev/null @@ -1,21 +0,0 @@ -/* -Copyright 2024 Nokia. - -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. -*/ - -// +k8s:deepcopy-gen=package,register -// +groupName=extcomm.be.kuid.dev - -// extcomm defines the extcomm api -package extcomm diff --git a/apis/backend/extcomm/v1alpha1/doc.go b/apis/backend/extcomm/v1alpha1/doc.go deleted file mode 100644 index ef02c30..0000000 --- a/apis/backend/extcomm/v1alpha1/doc.go +++ /dev/null @@ -1,28 +0,0 @@ -/* -Copyright 2024 Nokia. - -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. -*/ - -//go:generate deepcopy-gen -O zz_generated.deepcopy -i . -h ../../../../boilerplate.go.txt -//go:generate defaulter-gen -O zz_generated.defaults -i . -h ../../../../boilerplate.go.txt -//go:generate conversion-gen -O zz_generated.conversion -i . -h ../../../../boilerplate.go.txt - -// +k8s:openapi-gen=true -// +k8s:deepcopy-gen=package,register -// +k8s:conversion-gen=github.com/kuidio/kuid/apis/backend/extcomm -// +k8s:defaulter-gen=TypeMeta -// +groupName=extcomm.be.kuid.dev - -// Package v1alpha1 is the v1alpha1 version of the API. -package v1alpha1 // import "github.com/kuidio/kuid/apis/backend/esi/v1alpha1" diff --git a/apis/backend/extcomm/v1alpha1/extcomm_types.go b/apis/backend/extcomm/v1alpha1/extcomm_types.go deleted file mode 100644 index 496d258..0000000 --- a/apis/backend/extcomm/v1alpha1/extcomm_types.go +++ /dev/null @@ -1,61 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -type ExtendedCommunityType string - -const ( - ExtendedCommunityType_Invalid ExtendedCommunityType = "invalid" - ExtendedCommunityType_2byteAS ExtendedCommunityType = "2byteAS" // 0x00, 0x40 -> 4 byte local admin - ExtendedCommunityType_IPv4Address ExtendedCommunityType = "ipv4Address" // 0x01, 0x41 -> 2 byte local admin - ExtendedCommunityType_4byteAS ExtendedCommunityType = "4byteAS" // 0x02, 0x42 -> 2 byte local admin - ExtendedCommunityType_Opaque ExtendedCommunityType = "opaque" // 0x03, 0x43 -> 6 byte local admin -) - -func GetExtendedCommunityType(s string) ExtendedCommunityType { - switch s { - case string(ExtendedCommunityType_2byteAS): - return ExtendedCommunityType_2byteAS - case string(ExtendedCommunityType_IPv4Address): - return ExtendedCommunityType_IPv4Address - case string(ExtendedCommunityType_4byteAS): - return ExtendedCommunityType_4byteAS - case string(ExtendedCommunityType_Opaque): - return ExtendedCommunityType_Opaque - default: - return ExtendedCommunityType_Invalid - } -} - -type ExtendedCommunitySubType string - -const ( - ExtendedCommunitySubType_Invalid ExtendedCommunitySubType = "invalid" - ExtendedCommunitySubType_RouteTarget ExtendedCommunitySubType = "target" // 0x02 - ExtendedCommunitySubType_RouteOrigin ExtendedCommunitySubType = "origin" // 0x03 -) - -func GetExtendedCommunitySubType(s string) ExtendedCommunitySubType { - switch s { - case string(ExtendedCommunitySubType_RouteTarget): - return ExtendedCommunitySubType_RouteTarget - case string(ExtendedCommunitySubType_RouteOrigin): - return ExtendedCommunitySubType_RouteOrigin - default: - return ExtendedCommunitySubType_Invalid - } -} diff --git a/apis/backend/extcomm/v1alpha1/extcommclaim_interface.go b/apis/backend/extcomm/v1alpha1/extcommclaim_interface.go deleted file mode 100644 index f02d5c8..0000000 --- a/apis/backend/extcomm/v1alpha1/extcommclaim_interface.go +++ /dev/null @@ -1,595 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "crypto/sha1" - "encoding/json" - "errors" - "fmt" - "strconv" - "strings" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/idxtable/pkg/table" - "github.com/henderiw/idxtable/pkg/table/table16" - "github.com/henderiw/idxtable/pkg/table/table32" - "github.com/henderiw/idxtable/pkg/table/table64" - "github.com/henderiw/idxtable/pkg/tree" - "github.com/henderiw/idxtable/pkg/tree/id16" - "github.com/henderiw/idxtable/pkg/tree/id32" - "github.com/henderiw/idxtable/pkg/tree/id64" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/selection" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" - "k8s.io/utils/ptr" -) - -const EXTCOMMClaimPlural = "extcommclaims" -const EXTCOMMClaimSingular = "extcommclaim" -const EXTCOMMID_Min = 0 - -var EXTCOMMID_MaxBits = map[ExtendedCommunityType]int{ - ExtendedCommunityType_Invalid: 0, - ExtendedCommunityType_2byteAS: 32, - ExtendedCommunityType_4byteAS: 16, - ExtendedCommunityType_IPv4Address: 16, - ExtendedCommunityType_Opaque: 48, -} - -var EXTCOMMID_MaxValue = map[ExtendedCommunityType]int64{ - ExtendedCommunityType_Invalid: 1< 1 { - return backend.ClaimType_Invalid - } - if count == 0 { - return backend.ClaimType_DynamicID - } - return claimType -} - -func (r *EXTCOMMClaim) ValidateEXTCOMMClaimType() error { - var sb strings.Builder - count := 0 - if r.Spec.ID != nil { - sb.WriteString(fmt.Sprintf("id: %d", *r.Spec.ID)) - count++ - - } - if r.Spec.Range != nil { - if count > 0 { - sb.WriteString(", ") - } - sb.WriteString(fmt.Sprintf("range: %s", *r.Spec.Range)) - count++ - - } - if count > 1 { - return fmt.Errorf("a claim can only have 1 type, got %s", sb.String()) - } - return nil -} - -func validateEXTCOMMID(extCommType ExtendedCommunityType, id int64) error { - if id < EXTCOMMID_Min { - return fmt.Errorf("invalid id, got %d", id) - } - if id > int64(EXTCOMMID_MaxValue[extCommType]) { - return fmt.Errorf("invalid id, got %d", id) - } - return nil -} - -func (r *EXTCOMMClaim) ValidateEXTCOMMID(extCommType ExtendedCommunityType) error { - if r.Spec.ID == nil { - return fmt.Errorf("no id provided") - } - if err := validateEXTCOMMID(extCommType, *r.Spec.ID); err != nil { - return fmt.Errorf("invalid id err %s", err.Error()) - } - return nil -} - -func (r *EXTCOMMClaim) GetEXTCOMMRange() (int, int) { - if r.Spec.Range == nil { - return 0, 0 - } - parts := strings.SplitN(*r.Spec.Range, "-", 2) - if len(parts) != 2 { - return 0, 0 - } - start, err := strconv.Atoi(parts[0]) - if err != nil { - return 0, 0 - } - end, err := strconv.Atoi(parts[1]) - if err != nil { - return 0, 0 - } - return start, end -} - -func (r *EXTCOMMClaim) ValidateEXTCOMMRange(extCommType ExtendedCommunityType) error { - if r.Spec.Range == nil { - return fmt.Errorf("no EXTCOMM range provided") - } - parts := strings.SplitN(*r.Spec.Range, "-", 2) - if len(parts) != 2 { - return fmt.Errorf("invalid EXTCOMM range, expected -, got: %s", *r.Spec.Range) - } - var errm error - start, err := strconv.Atoi(parts[0]) - if err != nil { - errm = errors.Join(errm, fmt.Errorf("invalid EXTCOMM range start, got: %s, err: %s", *r.Spec.Range, err.Error())) - } - end, err := strconv.Atoi(parts[1]) - if err != nil { - errm = errors.Join(errm, fmt.Errorf("invalid EXTCOMM range end, got: %s, err: %s", *r.Spec.Range, err.Error())) - } - if errm != nil { - return errm - } - if start > end { - errm = errors.Join(errm, fmt.Errorf("invalid EXTCOMM range start > end %s", *r.Spec.Range)) - } - if err := validateEXTCOMMID(extCommType, int64(start)); err != nil { - errm = errors.Join(errm, fmt.Errorf("invalid EXTCOMM start err %s", err.Error())) - } - if err := validateEXTCOMMID(extCommType, int64(end)); err != nil { - errm = errors.Join(errm, fmt.Errorf("invalid EXTCOMM end err %s", err.Error())) - } - return errm -} - -func (r *EXTCOMMClaim) ValidateSyntax(s string) field.ErrorList { - var allErrs field.ErrorList - - gv, err := schema.ParseGroupVersion(r.APIVersion) - if err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("apiVersion"), - r, - fmt.Errorf("invalid apiVersion: err: %s", err.Error()).Error(), - )) - return allErrs - } - - // this is for user convenience - if r.Spec.Owner == nil { - r.Spec.Owner = &commonv1alpha1.OwnerReference{ - Group: gv.Group, - Version: gv.Version, - Kind: r.Kind, - Namespace: r.Namespace, - Name: r.Name, - } - } - - if GetExtendedCommunityType(s) == ExtendedCommunityType_Invalid { - allErrs = append(allErrs, field.Invalid( - field.NewPath(""), - r, - fmt.Errorf("invalid extended community type. got %s", s).Error(), - )) - return allErrs - } - - if err := r.ValidateEXTCOMMClaimType(); err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath(""), - r, - err.Error(), - )) - return allErrs - } - var v SyntaxValidator - claimType := r.GetClaimType() - switch claimType { - case backend.ClaimType_DynamicID: - v = &EXTCOMMDynamicIDSyntaxValidator{name: string(claimType)} - case backend.ClaimType_StaticID: - v = &EXTCOMMStaticIDSyntaxValidator{name: string(claimType)} - case backend.ClaimType_Range: - v = &EXTCOMMRangeSyntaxValidator{name: string(claimType)} - default: - return allErrs - } - return v.Validate(r, GetExtendedCommunityType(s)) -} - -func (r *EXTCOMMClaim) ValidateOwner(labels labels.Set) error { - routeClaimName := labels[backend.KuidClaimNameKey] - routeOwner := commonv1alpha1.OwnerReference{ - Group: labels[backend.KuidOwnerGroupKey], - Version: labels[backend.KuidOwnerVersionKey], - Kind: labels[backend.KuidOwnerKindKey], - Namespace: labels[backend.KuidOwnerNamespaceKey], - Name: labels[backend.KuidOwnerNameKey], - } - if (r.Spec.Owner != nil && *r.Spec.Owner != routeOwner) || r.Name != routeClaimName { - return fmt.Errorf("route owned by different claim got name %s/%s owner %s/%s", - r.Name, - routeClaimName, - r.Spec.Owner.String(), - routeOwner.String(), - ) - } - return nil -} - -// GetLabelSelector returns a labels selector based on the label selector -func (r *EXTCOMMClaim) GetLabelSelector() (labels.Selector, error) { - return r.Spec.GetLabelSelector() -} - -func (r *EXTCOMMClaim) GetClaimLabels() labels.Set { - labels := r.Spec.GetUserDefinedLabels() - // system defined labels - labels[backend.KuidClaimTypeKey] = string(r.GetClaimType()) - labels[backend.KuidClaimNameKey] = r.Name - labels[backend.KuidOwnerGroupKey] = r.Spec.Owner.Group - labels[backend.KuidOwnerVersionKey] = r.Spec.Owner.Version - labels[backend.KuidOwnerKindKey] = r.Spec.Owner.Kind - labels[backend.KuidOwnerNamespaceKey] = r.Spec.Owner.Namespace - labels[backend.KuidOwnerNameKey] = r.Spec.Owner.Name - return labels -} - -// GetOwnerSelector returns a label selector to select the owner of the claim in the backend -func (r *EXTCOMMClaim) GetOwnerSelector() (labels.Selector, error) { - l := map[string]string{ - backend.KuidOwnerGroupKey: r.Spec.Owner.Group, - backend.KuidOwnerVersionKey: r.Spec.Owner.Version, - backend.KuidOwnerKindKey: r.Spec.Owner.Kind, - backend.KuidOwnerNamespaceKey: r.Spec.Owner.Namespace, - backend.KuidOwnerNameKey: r.Spec.Owner.Name, - backend.KuidClaimNameKey: r.Name, - } - - fullselector := labels.NewSelector() - for k, v := range l { - req, err := labels.NewRequirement(k, selection.Equals, []string{v}) - if err != nil { - return nil, err - } - fullselector = fullselector.Add(*req) - } - return fullselector, nil -} - -// BuildEXTCOMMClaim returns a reource from a client Object a Spec/Status -func BuildEXTCOMMClaim(meta metav1.ObjectMeta, spec *EXTCOMMClaimSpec, status *EXTCOMMClaimStatus) *EXTCOMMClaim { - aspec := EXTCOMMClaimSpec{} - if spec != nil { - aspec = *spec - } - astatus := EXTCOMMClaimStatus{} - if status != nil { - astatus = *status - } - return &EXTCOMMClaim{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: EXTCOMMClaimKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -func (r *EXTCOMMClaim) SetStatusRange(s *string) { - r.Status.Range = s -} - -func (r *EXTCOMMClaim) SetStatusID(s *uint64) { - if s == nil { - r.Status.ID = nil - return - } - r.Status.ID = ptr.To[int64](int64(*s)) -} - -func (r *EXTCOMMClaim) GetStatusID() *uint64 { - if r.Status.ID == nil { - return nil - } - return ptr.To[uint64](uint64(*r.Status.ID)) -} - -func (r *EXTCOMMClaim) GetSpec() any { - return r.Spec -} - -func (r *EXTCOMMClaim) SetSpec(s any) { - if spec, ok := s.(EXTCOMMClaimSpec); ok { - r.Spec = spec - } -} - -func (r *EXTCOMMClaim) NewObjList() backend.GenericObjectList { - return &EXTCOMMClaimList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: EXTCOMMClaimListKind}, - } -} - -func (r *EXTCOMMClaimList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} diff --git a/apis/backend/extcomm/v1alpha1/extcommclaim_syntaxvalidator.go b/apis/backend/extcomm/v1alpha1/extcommclaim_syntaxvalidator.go deleted file mode 100644 index 5367e14..0000000 --- a/apis/backend/extcomm/v1alpha1/extcommclaim_syntaxvalidator.go +++ /dev/null @@ -1,68 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - fmt "fmt" - - "k8s.io/apimachinery/pkg/util/validation/field" -) - -type SyntaxValidator interface { - Validate(claim *EXTCOMMClaim, extCommType ExtendedCommunityType) field.ErrorList -} - -type EXTCOMMRangeSyntaxValidator struct { - name string -} - -func (r *EXTCOMMRangeSyntaxValidator) Validate(claim *EXTCOMMClaim, extCommType ExtendedCommunityType) field.ErrorList { - var allErrs field.ErrorList - if err := claim.ValidateEXTCOMMRange(extCommType); err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.range"), - claim, - fmt.Errorf("invalid EXTCOMM range %s", r.name).Error(), - )) - } - return allErrs -} - -type EXTCOMMDynamicIDSyntaxValidator struct { - name string -} - -func (r *EXTCOMMDynamicIDSyntaxValidator) Validate(claim *EXTCOMMClaim, extCommType ExtendedCommunityType) field.ErrorList { - var allErrs field.ErrorList - return allErrs -} - -type EXTCOMMStaticIDSyntaxValidator struct { - name string -} - -func (r *EXTCOMMStaticIDSyntaxValidator) Validate(claim *EXTCOMMClaim, extCommType ExtendedCommunityType) field.ErrorList { - var allErrs field.ErrorList - if err := claim.ValidateEXTCOMMID(extCommType); err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.id"), - claim, - fmt.Errorf("invalid EXTCOMM id %s", r.name).Error(), - )) - } - return allErrs -} diff --git a/apis/backend/extcomm/v1alpha1/extcommclaim_types.go b/apis/backend/extcomm/v1alpha1/extcommclaim_types.go deleted file mode 100644 index cf73653..0000000 --- a/apis/backend/extcomm/v1alpha1/extcommclaim_types.go +++ /dev/null @@ -1,87 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "reflect" - - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// EXTCOMMClaimSpec defines the dEXTCOMMred state of EXTCOMMClaim -type EXTCOMMClaimSpec struct { - // EXTCOMMIndex defines the EXTCOMM index for the EXTCOMM Claim - Index string `json:"index" yaml:"index" protobuf:"bytes,1,opt,name=index"` - // EXTCOMMID defines the EXTCOMM for the EXTCOMM claim - ID *int64 `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,2,opt,name=id"` - // Range defines the EXTCOMM range for the EXTCOMM claim - // The following notation is used: start-end - - // the EXTCOMMs in the range must be consecutive - Range *string `json:"range,omitempty" yaml:"range,omitempty" protobuf:"bytes,3,opt,name=range"` - // ClaimLabels define the user defined labels and selector labels used - // in resource claim - commonv1alpha1.ClaimLabels `json:",inline" yaml:",inline" protobuf:"bytes,4,opt,name=claimLabels"` - // Owner defines the ownerReference of the EXTCOMMClaim - // Allow for different namesapces, hence it is part of the spec - Owner *commonv1alpha1.OwnerReference `json:"owner,omitempty" yaml:"owner,omitempty" protobuf:"bytes,5,opt,name=owner"` -} - -// EXTCOMMClaimStatus defines the observed state of EXTCOMMClaim -type EXTCOMMClaimStatus struct { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` - // EXTCOMMID defines the EXTCOMM for the EXTCOMM claim - // +optional - ID *int64 `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,2,opt,name=id"` - // EXTCOMMRange defines the EXTCOMM range for the EXTCOMM claim - // +optional - Range *string `json:"range,omitempty" yaml:"range,omitempty" protobuf:"bytes,3,opt,name=range"` - // ExpiryTime defines when the claim expires - // +kubebuilder:validation:Optional - // +optional - ExpiryTime *string `json:"expiryTime,omitempty" yaml:"expiryTime,omitempty" protobuf:"bytes,4,opt,name=expiryTime"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// EXTCOMMClaim is the Schema for the EXTCOMMClaim API -// -// +k8s:openapi-gen=true -type EXTCOMMClaim struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - Spec EXTCOMMClaimSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - Status EXTCOMMClaimStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// EXTCOMMClaimList contains a list of EXTCOMMClaims -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type EXTCOMMClaimList struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []EXTCOMMClaim `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` -} - -var ( - EXTCOMMClaimKind = reflect.TypeOf(EXTCOMMClaim{}).Name() - EXTCOMMClaimListKind = reflect.TypeOf(EXTCOMMClaimList{}).Name() -) diff --git a/apis/backend/extcomm/v1alpha1/extcommentry_interface.go b/apis/backend/extcomm/v1alpha1/extcommentry_interface.go deleted file mode 100644 index 867e2e1..0000000 --- a/apis/backend/extcomm/v1alpha1/extcommentry_interface.go +++ /dev/null @@ -1,274 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "crypto/sha1" - "encoding/json" - "fmt" - strings "strings" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" -) - -const EXTCOMMEntryPlural = "extcommentries" -const EXTCOMMEntrySingular = "extcommentry" - -// +k8s:deepcopy-gen=false -var _ resource.Object = &EXTCOMMEntry{} -var _ resource.ObjectList = &EXTCOMMEntryList{} - -// GetListMeta returns the ListMeta -func (r *EXTCOMMEntryList) GetListMeta() *metav1.ListMeta { - return &r.ListMeta -} - -func (r *EXTCOMMEntryList) GetItems() []backend.Object { - entries := make([]backend.Object, 0, len(r.Items)) - for _, entry := range r.Items { - entries = append(entries, &entry) - } - return entries -} - -func (r *EXTCOMMEntry) GetSingularName() string { - return EXTCOMMEntrySingular -} - -func (EXTCOMMEntry) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Resource: EXTCOMMEntryPlural, - } -} - -// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. -// IsStorageVersion implements resource.Object. -func (EXTCOMMEntry) IsStorageVersion() bool { - return true -} - -// GetObjectMeta implements resource.Object -func (r *EXTCOMMEntry) GetObjectMeta() *metav1.ObjectMeta { - return &r.ObjectMeta -} - -// NamespaceScoped returns true to indicate Fortune is a namespaced resource. -// NamespaceScoped implements resource.Object. -func (EXTCOMMEntry) NamespaceScoped() bool { - return true -} - -// New implements resource.Object -func (EXTCOMMEntry) New() runtime.Object { - return &EXTCOMMEntry{} -} - -// NewList implements resource.Object -func (EXTCOMMEntry) NewList() runtime.Object { - return &EXTCOMMEntryList{} -} - -// GetCondition returns the condition based on the condition kind -func (r *EXTCOMMEntry) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { - return r.Status.GetCondition(t) -} - -// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions -// to be set at once -func (r *EXTCOMMEntry) SetConditions(c ...conditionv1alpha1.Condition) { - r.Status.SetConditions(c...) -} - -// EXTCOMMEntryConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for EXTCOMMEntry -func EXTCOMMEntryConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { - switch label { - case "metadata.name": - return label, value, nil - case "metadata.namespace": - return label, value, nil - case "spec.index": - return label, value, nil - default: - return "", "", fmt.Errorf("%q is not a known field selector", label) - } -} - -func (r *EXTCOMMEntry) CalculateHash() ([sha1.Size]byte, error) { - // Convert the struct to JSON - jsonData, err := json.Marshal(r) - if err != nil { - return [sha1.Size]byte{}, err - } - - // Calculate SHA-1 hash - return sha1.Sum(jsonData), nil -} - -func (r *EXTCOMMEntry) GetNamespacedName() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.GetNamespace(), - Name: r.GetName(), - } -} - -func (r *EXTCOMMEntry) GetKey() store.Key { - return store.KeyFromNSN(types.NamespacedName{Namespace: r.Namespace, Name: r.Spec.Index}) -} - -func (r *EXTCOMMEntry) GetIndex() string { - return r.Spec.Index -} - -func (r *EXTCOMMEntry) GetOwnerReference() *commonv1alpha1.OwnerReference { - return r.Spec.Owner -} - -func (r *EXTCOMMEntry) GetClaimName() string { - return r.Spec.Claim -} - -func (r *EXTCOMMEntry) GetClaimType() backend.ClaimType { - return r.Spec.ClaimType -} - -func (r *EXTCOMMEntry) GetOwnerGVK() schema.GroupVersionKind { - return schema.GroupVersionKind{ - Group: r.Spec.Owner.Group, - Version: r.Spec.Owner.Version, - Kind: r.Spec.Owner.Kind, - } -} - -func (r *EXTCOMMEntry) GetOwnerNSN() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.Spec.Owner.Namespace, - Name: r.Spec.Owner.Name, - } -} - -func (r *EXTCOMMEntry) GetSpec() any { - return r.Spec -} - -func (r *EXTCOMMEntry) GetSpecID() string { - return r.Spec.ID -} - -func (r *EXTCOMMEntry) SetSpec(s any) { - if spec, ok := s.(EXTCOMMEntrySpec); ok { - r.Spec = spec - } -} - -func GetEXTCOMMEntry(k store.Key, vrange, id string, labels map[string]string) backend.EntryObject { - //log := log.FromContext(ctx) - - index := k.Name - ns := k.Namespace - - spec := &EXTCOMMEntrySpec{ - Index: index, - ClaimType: backend.GetClaimTypeFromString(labels[backend.KuidClaimTypeKey]), - Claim: labels[backend.KuidClaimNameKey], - ID: id, - Owner: &commonv1alpha1.OwnerReference{ - Group: labels[backend.KuidOwnerGroupKey], - Version: labels[backend.KuidOwnerVersionKey], - Kind: labels[backend.KuidOwnerKindKey], - Namespace: labels[backend.KuidOwnerNamespaceKey], - Name: labels[backend.KuidOwnerNameKey], - }, - } - // filter the system defined labels from the labels to prepare for the user defined labels - udLabels := map[string]string{} - for k, v := range labels { - if !backend.BackendSystemKeys.Has(k) { - udLabels[k] = v - } - } - spec.UserDefinedLabels.Labels = udLabels - - status := &EXTCOMMEntryStatus{} - status.SetConditions(conditionv1alpha1.Ready()) - - id = strings.ReplaceAll(id, "/", "-") - name := fmt.Sprintf("%s.%s", index, id) - if vrange != "" { - name = fmt.Sprintf("%s.%s", vrange, id) - } - - return BuildEXTCOMMEntry( - metav1.ObjectMeta{ - Name: name, - Namespace: ns, - }, - spec, - status, - ) -} - -// BuildEXTCOMMEntry returns a reource from a client Object a Spec/Status -func BuildEXTCOMMEntry(meta metav1.ObjectMeta, spec *EXTCOMMEntrySpec, status *EXTCOMMEntryStatus) *EXTCOMMEntry { - aspec := EXTCOMMEntrySpec{} - if spec != nil { - aspec = *spec - } - astatus := EXTCOMMEntryStatus{} - if status != nil { - astatus = *status - } - return &EXTCOMMEntry{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: EXTCOMMEntryKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -func (r *EXTCOMMEntry) ValidateSyntax(_ string) field.ErrorList { - var allErrs field.ErrorList - return allErrs -} - -func (r *EXTCOMMEntry) NewObjList() backend.GenericObjectList { - return &EXTCOMMEntryList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: EXTCOMMEntryListKind}, - } -} - -func (r *EXTCOMMEntryList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} diff --git a/apis/backend/extcomm/v1alpha1/extcommentry_types.go b/apis/backend/extcomm/v1alpha1/extcommentry_types.go deleted file mode 100644 index 5e33041..0000000 --- a/apis/backend/extcomm/v1alpha1/extcommentry_types.go +++ /dev/null @@ -1,78 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "reflect" - - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// EXTCOMMEntrySpec defines the dEXTCOMMred state of EXTCOMMEntry -type EXTCOMMEntrySpec struct { - // EXTCOMMIndex defines the EXTCOMM index for the EXTCOMM Claim - Index string `json:"index" yaml:"index" protobuf:"bytes,1,opt,name=index"` - // ClaimType defines the claimType of the EXTCOMM Entry - ClaimType backend.ClaimType `json:"claimType,omitempty" yaml:"claimType,omitempty" protobuf:"bytes,2,opt,name=claimType"` - // ID defines the id of the EXTCOMM entry in the tree - ID string `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,3,opt,name=id"` - // ClaimLabels define the user defined labels and selector labels used - // in resource claim - commonv1alpha1.ClaimLabels `json:",inline" yaml:",inline" protobuf:"bytes,4,opt,name=claimLabels"` - // Claim defines the name of the claim that is the origin of this entry - Claim string `json:"claim" yaml:"claim" protobuf:"bytes,5,opt,name=claim"` - // Owner defines the ownerReference of the EXTCOMMClaim - // Allow for different namesapces, hence it is part of the spec - Owner *commonv1alpha1.OwnerReference `json:"owner,omitempty" yaml:"owner,omitempty" protobuf:"bytes,6,opt,name=owner"` -} - -// EXTCOMMEntryStatus defines the observed state of EXTCOMMEntry -type EXTCOMMEntryStatus struct { - // ConditionedStatus provides the status of the EXTCOMMEntry using conditions - // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// EXTCOMMEntry is the Schema for the EXTCOMMentry API -// -// +k8s:openapi-gen=true -type EXTCOMMEntry struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - Spec EXTCOMMEntrySpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - Status EXTCOMMEntryStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// EXTCOMMEntryList contains a list of EXTCOMMEntries -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type EXTCOMMEntryList struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []EXTCOMMEntry `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` -} - -var ( - EXTCOMMEntryKind = reflect.TypeOf(EXTCOMMEntry{}).Name() - EXTCOMMEntryListKind = reflect.TypeOf(EXTCOMMEntryList{}).Name() -) diff --git a/apis/backend/extcomm/v1alpha1/extcommindex_interface.go b/apis/backend/extcomm/v1alpha1/extcommindex_interface.go deleted file mode 100644 index 3492621..0000000 --- a/apis/backend/extcomm/v1alpha1/extcommindex_interface.go +++ /dev/null @@ -1,376 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "crypto/sha1" - "encoding/json" - "fmt" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/apiserver-store/pkg/generic/registry" - "github.com/henderiw/idxtable/pkg/tree/gtree" - "github.com/henderiw/idxtable/pkg/tree/tree16" - "github.com/henderiw/idxtable/pkg/tree/tree32" - "github.com/henderiw/idxtable/pkg/tree/tree64" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" - "k8s.io/utils/ptr" -) - -const EXTCOMMIndexPlural = "extcommindices" -const EXTCOMMIndexSingular = "extcommindex" - -// +k8s:deepcopy-gen=false -var _ resource.Object = &EXTCOMMIndex{} -var _ resource.ObjectList = &EXTCOMMIndexList{} - -// GetListMeta returns the ListMeta -func (r *EXTCOMMIndexList) GetListMeta() *metav1.ListMeta { - return &r.ListMeta -} - -func (r *EXTCOMMIndex) GetSingularName() string { - return EXTCOMMIndexSingular -} - -func (EXTCOMMIndex) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Resource: EXTCOMMIndexPlural, - } -} - -// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. -// IsStorageVersion implements resource.Object. -func (EXTCOMMIndex) IsStorageVersion() bool { - return true -} - -// GetObjectMeta implements resource.Object -func (r *EXTCOMMIndex) GetObjectMeta() *metav1.ObjectMeta { - return &r.ObjectMeta -} - -// NamespaceScoped returns true to indicate Fortune is a namespaced resource. -// NamespaceScoped implements resource.Object. -func (EXTCOMMIndex) NamespaceScoped() bool { - return true -} - -// New implements resource.Object -func (EXTCOMMIndex) New() runtime.Object { - return &EXTCOMMIndex{} -} - -// NewList implements resource.Object -func (EXTCOMMIndex) NewList() runtime.Object { - return &EXTCOMMIndexList{} -} - -// GetCondition returns the condition based on the condition kind -func (r *EXTCOMMIndex) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { - return r.Status.GetCondition(t) -} - -// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions -// to be set at once -func (r *EXTCOMMIndex) SetConditions(c ...conditionv1alpha1.Condition) { - r.Status.SetConditions(c...) -} - -// EXTCOMMIndexConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for EXTCOMMIndex -func EXTCOMMIndexConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { - switch label { - case "metadata.name": - return label, value, nil - case "metadata.namespace": - return label, value, nil - default: - return "", "", fmt.Errorf("%q is not a known field selector", label) - } -} - -func (r *EXTCOMMIndexList) GetItems() []backend.Object { - objs := []backend.Object{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *EXTCOMMIndex) CalculateHash() ([sha1.Size]byte, error) { - // Convert the struct to JSON - jsonData, err := json.Marshal(r) - if err != nil { - return [sha1.Size]byte{}, err - } - - // Calculate SHA-1 hash - return sha1.Sum(jsonData), nil -} - -func (r *EXTCOMMIndex) GetNamespacedName() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.GetNamespace(), - Name: r.GetName(), - } -} - -func (r *EXTCOMMIndex) GetTree() gtree.GTree { - switch GetExtendedCommunityType(r.Spec.Type) { - case ExtendedCommunityType_IPv4Address, ExtendedCommunityType_4byteAS: - tree, err := tree16.New(16) - if err != nil { - return nil - } - return tree - case ExtendedCommunityType_2byteAS: - tree, err := tree32.New(32) - if err != nil { - return nil - } - return tree - case ExtendedCommunityType_Opaque: - tree, err := tree64.New(48) - if err != nil { - return nil - } - return tree - } - return nil -} - -func (r *EXTCOMMIndex) GetKey() store.Key { - return store.KeyFromNSN(r.GetNamespacedName()) -} - -func (r *EXTCOMMIndex) GetType() string { - return r.Spec.Type -} - -func (r *EXTCOMMIndex) GetOwnerReference() *commonv1alpha1.OwnerReference { - return &commonv1alpha1.OwnerReference{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Kind: EXTCOMMIndexKind, - Namespace: r.Namespace, - Name: r.Name, - } -} - -func (r *EXTCOMMIndex) ValidateSyntax(_ string) field.ErrorList { - var allErrs field.ErrorList - - if GetExtendedCommunityType(r.Spec.Type) == ExtendedCommunityType_Invalid { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.type"), - r, - fmt.Errorf("invalid EXTCOMM Type %s", r.Spec.Type).Error(), - )) - } - - if GetExtendedCommunitySubType(r.Spec.SubType) == ExtendedCommunitySubType_Invalid { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.subType"), - r, - fmt.Errorf("invalid EXTCOMM SubType %s", r.Spec.SubType).Error(), - )) - } - - if r.Spec.MinID != nil { - if err := validateEXTCOMMID(GetExtendedCommunityType(r.Spec.Type), *r.Spec.MinID); err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.minID"), - r, - fmt.Errorf("invalid EXTCOMM ID %d", *r.Spec.MinID).Error(), - )) - } - } - if r.Spec.MaxID != nil { - if err := validateEXTCOMMID(GetExtendedCommunityType(r.Spec.Type), *r.Spec.MaxID); err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.maxID"), - r, - fmt.Errorf("invalid EXTCOMM ID %d", *r.Spec.MaxID).Error(), - )) - } - } - if r.Spec.MinID != nil && r.Spec.MaxID != nil { - if *r.Spec.MinID > *r.Spec.MaxID { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.maxID"), - r, - fmt.Errorf("min EXTCOMM ID %d cannot be bigger than max EXTCOMM ID %d", *r.Spec.MinID, *r.Spec.MaxID).Error(), - )) - } - } - return allErrs -} - -func GetMinClaimRange(id int64) string { - return fmt.Sprintf("%d-%d", EXTCOMMID_Min, id-1) -} - -func GetMaxClaimRange(extCommType ExtendedCommunityType, id int64) string { - return fmt.Sprintf("%d-%d", id+1, EXTCOMMID_MaxValue[extCommType]) -} - -func (r *EXTCOMMIndex) GetMinID() *uint64 { - if r.Spec.MinID == nil { - return nil - } - return ptr.To[uint64](uint64(*r.Spec.MinID)) -} - -func (r *EXTCOMMIndex) GetMaxID() *uint64 { - if r.Spec.MaxID == nil { - return nil - } - return ptr.To[uint64](uint64(*r.Spec.MaxID)) -} - -func (r *EXTCOMMIndex) GetMinClaimNSN() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.Namespace, - Name: fmt.Sprintf("%s.%s", r.Name, backend.IndexReservedMinName), - } -} - -func (r *EXTCOMMIndex) GetMaxClaimNSN() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.Namespace, - Name: fmt.Sprintf("%s.%s", r.Name, backend.IndexReservedMaxName), - } -} - -func (r *EXTCOMMIndex) GetMinClaim() backend.ClaimObject { - return BuildEXTCOMMClaim( - metav1.ObjectMeta{ - Namespace: r.GetNamespace(), - Name: r.GetMinClaimNSN().Name, - }, - &EXTCOMMClaimSpec{ - Index: r.Name, - Range: ptr.To[string](GetMinClaimRange(*r.Spec.MinID)), - Owner: commonv1alpha1.GetOwnerReference(r), - }, - nil, - ) -} - -func (r *EXTCOMMIndex) GetMaxClaim() backend.ClaimObject { - return BuildEXTCOMMClaim( - metav1.ObjectMeta{ - Namespace: r.GetNamespace(), - Name: r.GetMaxClaimNSN().Name, - }, - &EXTCOMMClaimSpec{ - Index: r.Name, - Range: ptr.To[string](GetMaxClaimRange(GetExtendedCommunityType(r.Spec.Type), *r.Spec.MaxID)), - Owner: commonv1alpha1.GetOwnerReference(r), - }, - nil, - ) -} - -// BuildEXTCOMMIndex returns a reource from a client Object a Spec/Status -func BuildEXTCOMMIndex(meta metav1.ObjectMeta, spec *EXTCOMMIndexSpec, status *EXTCOMMIndexStatus) *EXTCOMMIndex { - aspec := EXTCOMMIndexSpec{} - if spec != nil { - aspec = *spec - } - astatus := EXTCOMMIndexStatus{} - if status != nil { - astatus = *status - } - return &EXTCOMMIndex{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: EXTCOMMIndexKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -func EXTCOMMIndexTableConvertor(gr schema.GroupResource) registry.TableConvertor { - return registry.TableConvertor{ - Resource: gr, - Cells: func(obj runtime.Object) []interface{} { - index, ok := obj.(*EXTCOMMIndex) - if !ok { - return nil - } - return []interface{}{ - index.GetName(), - index.GetCondition(conditionv1alpha1.ConditionTypeReady).Status, - index.Spec.Transitive, - index.Spec.Type, - index.Spec.SubType, - index.Spec.GlobalID, - index.GetMinID(), - index.GetMaxID(), - } - }, - Columns: []metav1.TableColumnDefinition{ - {Name: "Name", Type: "string"}, - {Name: "Ready", Type: "string"}, - {Name: "Transitive", Type: "boolean"}, - {Name: "Type", Type: "string"}, - {Name: "SubType", Type: "string"}, - {Name: "GlobalID", Type: "string"}, - {Name: "MinID", Type: "integer"}, - {Name: "MaxID", Type: "integer"}, - }, - } -} - -func (r *EXTCOMMIndex) GetSpec() any { - return r.Spec -} - -func (r *EXTCOMMIndex) SetSpec(s any) { - if spec, ok := s.(EXTCOMMIndexSpec); ok { - r.Spec = spec - } -} - -func (r *EXTCOMMIndex) NewObjList() backend.GenericObjectList { - return &EXTCOMMIndexList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: EXTCOMMIndexListKind}, - } -} - -func (r *EXTCOMMIndexList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} diff --git a/apis/backend/extcomm/v1alpha1/extcommindex_types.go b/apis/backend/extcomm/v1alpha1/extcommindex_types.go deleted file mode 100644 index 5294a18..0000000 --- a/apis/backend/extcomm/v1alpha1/extcommindex_types.go +++ /dev/null @@ -1,91 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "reflect" - - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// EXTCOMMIndexSpec defines the dEXTCOMMred state of EXTCOMMIndex -type EXTCOMMIndexSpec struct { - // MinID defines the min EXTCOMM ID the index supports - // +optional - MinID *int64 `json:"minID,omitempty" yaml:"minID,omitempty" protobuf:"bytes,1,opt,name=minID"` - // MaxID defines the max EXTCOMM ID the index supports - // +optional - MaxID *int64 `json:"maxID,omitempty" yaml:"maxID,omitempty" protobuf:"bytes,2,opt,name=maxID"` - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` - // Transitive defines the transative nature of the extended community - Transitive bool `json:"transitive,omitempty" yaml:"transitive,omitempty" protobuf:"bytes,4,opt,name=transitive"` - // Type defines the type of the extended community - // 2byteAS, 4byteAS, ipv4Address, opaque - Type string `json:"type" yaml:"type" protobuf:"bytes,5,opt,name=type"` - // SubType defines the subTyoe of the extended community - // routeTarget, routeOrigin; - SubType string `json:"subType" yaml:"subType" protobuf:"bytes,6,opt,name=subType"` - // GlobalID is interpreted dependeing on the type - // AS in case of 2byteAS, 4byteAS - // IPV4 addrress - // irrelevant for the opaque type - GlobalID string `json:"globalID,omitempty" yaml:"globalID,omitempty" protobuf:"bytes,7,opt,name=globalID"` -} - -// EXTCOMMIndexStatus defines the observed state of EXTCOMMIndex -type EXTCOMMIndexStatus struct { - // MinID defines the min EXTCOMM ID the index supports - // +optional - MinID *int64 `json:"minID,omitempty" yaml:"minID,omitempty" protobuf:"bytes,1,opt,name=minID"` - // MaxID defines the max EXTCOMM ID the index supports - // +optional - MaxID *int64 `json:"maxID,omitempty" yaml:"maxID,omitempty" protobuf:"bytes,2,opt,name=maxID"` - // ConditionedStatus provides the status of the EXTCOMMIndex using conditions - // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=conditionedStatus"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// EXTCOMMIndex is the Schema for the EXTCOMMIndex API -// -// +k8s:openapi-gen=true -type EXTCOMMIndex struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - Spec EXTCOMMIndexSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - Status EXTCOMMIndexStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// EXTCOMMIndexList contains a list of EXTCOMMIndexs -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type EXTCOMMIndexList struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []EXTCOMMIndex `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` -} - -var ( - EXTCOMMIndexKind = reflect.TypeOf(EXTCOMMIndex{}).Name() - EXTCOMMIndexListKind = reflect.TypeOf(EXTCOMMIndexList{}).Name() -) diff --git a/apis/backend/extcomm/v1alpha1/generated.pb.go b/apis/backend/extcomm/v1alpha1/generated.pb.go deleted file mode 100644 index 7ccb220..0000000 --- a/apis/backend/extcomm/v1alpha1/generated.pb.go +++ /dev/null @@ -1,3800 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 protoc-gen-gogo. DO NOT EDIT. -// source: github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1/generated.proto - -package v1alpha1 - -import ( - fmt "fmt" - - io "io" - - proto "github.com/gogo/protobuf/proto" - github_com_kuidio_kuid_apis_backend "github.com/kuidio/kuid/apis/backend" - v1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - - math "math" - math_bits "math/bits" - reflect "reflect" - strings "strings" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -func (m *EXTCOMMClaim) Reset() { *m = EXTCOMMClaim{} } -func (*EXTCOMMClaim) ProtoMessage() {} -func (*EXTCOMMClaim) Descriptor() ([]byte, []int) { - return fileDescriptor_0980e372dad85af9, []int{0} -} -func (m *EXTCOMMClaim) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EXTCOMMClaim) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EXTCOMMClaim) XXX_Merge(src proto.Message) { - xxx_messageInfo_EXTCOMMClaim.Merge(m, src) -} -func (m *EXTCOMMClaim) XXX_Size() int { - return m.Size() -} -func (m *EXTCOMMClaim) XXX_DiscardUnknown() { - xxx_messageInfo_EXTCOMMClaim.DiscardUnknown(m) -} - -var xxx_messageInfo_EXTCOMMClaim proto.InternalMessageInfo - -func (m *EXTCOMMClaimList) Reset() { *m = EXTCOMMClaimList{} } -func (*EXTCOMMClaimList) ProtoMessage() {} -func (*EXTCOMMClaimList) Descriptor() ([]byte, []int) { - return fileDescriptor_0980e372dad85af9, []int{1} -} -func (m *EXTCOMMClaimList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EXTCOMMClaimList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EXTCOMMClaimList) XXX_Merge(src proto.Message) { - xxx_messageInfo_EXTCOMMClaimList.Merge(m, src) -} -func (m *EXTCOMMClaimList) XXX_Size() int { - return m.Size() -} -func (m *EXTCOMMClaimList) XXX_DiscardUnknown() { - xxx_messageInfo_EXTCOMMClaimList.DiscardUnknown(m) -} - -var xxx_messageInfo_EXTCOMMClaimList proto.InternalMessageInfo - -func (m *EXTCOMMClaimSpec) Reset() { *m = EXTCOMMClaimSpec{} } -func (*EXTCOMMClaimSpec) ProtoMessage() {} -func (*EXTCOMMClaimSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_0980e372dad85af9, []int{2} -} -func (m *EXTCOMMClaimSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EXTCOMMClaimSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EXTCOMMClaimSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_EXTCOMMClaimSpec.Merge(m, src) -} -func (m *EXTCOMMClaimSpec) XXX_Size() int { - return m.Size() -} -func (m *EXTCOMMClaimSpec) XXX_DiscardUnknown() { - xxx_messageInfo_EXTCOMMClaimSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_EXTCOMMClaimSpec proto.InternalMessageInfo - -func (m *EXTCOMMClaimStatus) Reset() { *m = EXTCOMMClaimStatus{} } -func (*EXTCOMMClaimStatus) ProtoMessage() {} -func (*EXTCOMMClaimStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_0980e372dad85af9, []int{3} -} -func (m *EXTCOMMClaimStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EXTCOMMClaimStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EXTCOMMClaimStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_EXTCOMMClaimStatus.Merge(m, src) -} -func (m *EXTCOMMClaimStatus) XXX_Size() int { - return m.Size() -} -func (m *EXTCOMMClaimStatus) XXX_DiscardUnknown() { - xxx_messageInfo_EXTCOMMClaimStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_EXTCOMMClaimStatus proto.InternalMessageInfo - -func (m *EXTCOMMDynamicIDSyntaxValidator) Reset() { *m = EXTCOMMDynamicIDSyntaxValidator{} } -func (*EXTCOMMDynamicIDSyntaxValidator) ProtoMessage() {} -func (*EXTCOMMDynamicIDSyntaxValidator) Descriptor() ([]byte, []int) { - return fileDescriptor_0980e372dad85af9, []int{4} -} -func (m *EXTCOMMDynamicIDSyntaxValidator) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EXTCOMMDynamicIDSyntaxValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EXTCOMMDynamicIDSyntaxValidator) XXX_Merge(src proto.Message) { - xxx_messageInfo_EXTCOMMDynamicIDSyntaxValidator.Merge(m, src) -} -func (m *EXTCOMMDynamicIDSyntaxValidator) XXX_Size() int { - return m.Size() -} -func (m *EXTCOMMDynamicIDSyntaxValidator) XXX_DiscardUnknown() { - xxx_messageInfo_EXTCOMMDynamicIDSyntaxValidator.DiscardUnknown(m) -} - -var xxx_messageInfo_EXTCOMMDynamicIDSyntaxValidator proto.InternalMessageInfo - -func (m *EXTCOMMEntry) Reset() { *m = EXTCOMMEntry{} } -func (*EXTCOMMEntry) ProtoMessage() {} -func (*EXTCOMMEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_0980e372dad85af9, []int{5} -} -func (m *EXTCOMMEntry) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EXTCOMMEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EXTCOMMEntry) XXX_Merge(src proto.Message) { - xxx_messageInfo_EXTCOMMEntry.Merge(m, src) -} -func (m *EXTCOMMEntry) XXX_Size() int { - return m.Size() -} -func (m *EXTCOMMEntry) XXX_DiscardUnknown() { - xxx_messageInfo_EXTCOMMEntry.DiscardUnknown(m) -} - -var xxx_messageInfo_EXTCOMMEntry proto.InternalMessageInfo - -func (m *EXTCOMMEntryList) Reset() { *m = EXTCOMMEntryList{} } -func (*EXTCOMMEntryList) ProtoMessage() {} -func (*EXTCOMMEntryList) Descriptor() ([]byte, []int) { - return fileDescriptor_0980e372dad85af9, []int{6} -} -func (m *EXTCOMMEntryList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EXTCOMMEntryList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EXTCOMMEntryList) XXX_Merge(src proto.Message) { - xxx_messageInfo_EXTCOMMEntryList.Merge(m, src) -} -func (m *EXTCOMMEntryList) XXX_Size() int { - return m.Size() -} -func (m *EXTCOMMEntryList) XXX_DiscardUnknown() { - xxx_messageInfo_EXTCOMMEntryList.DiscardUnknown(m) -} - -var xxx_messageInfo_EXTCOMMEntryList proto.InternalMessageInfo - -func (m *EXTCOMMEntrySpec) Reset() { *m = EXTCOMMEntrySpec{} } -func (*EXTCOMMEntrySpec) ProtoMessage() {} -func (*EXTCOMMEntrySpec) Descriptor() ([]byte, []int) { - return fileDescriptor_0980e372dad85af9, []int{7} -} -func (m *EXTCOMMEntrySpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EXTCOMMEntrySpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EXTCOMMEntrySpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_EXTCOMMEntrySpec.Merge(m, src) -} -func (m *EXTCOMMEntrySpec) XXX_Size() int { - return m.Size() -} -func (m *EXTCOMMEntrySpec) XXX_DiscardUnknown() { - xxx_messageInfo_EXTCOMMEntrySpec.DiscardUnknown(m) -} - -var xxx_messageInfo_EXTCOMMEntrySpec proto.InternalMessageInfo - -func (m *EXTCOMMEntryStatus) Reset() { *m = EXTCOMMEntryStatus{} } -func (*EXTCOMMEntryStatus) ProtoMessage() {} -func (*EXTCOMMEntryStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_0980e372dad85af9, []int{8} -} -func (m *EXTCOMMEntryStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EXTCOMMEntryStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EXTCOMMEntryStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_EXTCOMMEntryStatus.Merge(m, src) -} -func (m *EXTCOMMEntryStatus) XXX_Size() int { - return m.Size() -} -func (m *EXTCOMMEntryStatus) XXX_DiscardUnknown() { - xxx_messageInfo_EXTCOMMEntryStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_EXTCOMMEntryStatus proto.InternalMessageInfo - -func (m *EXTCOMMIndex) Reset() { *m = EXTCOMMIndex{} } -func (*EXTCOMMIndex) ProtoMessage() {} -func (*EXTCOMMIndex) Descriptor() ([]byte, []int) { - return fileDescriptor_0980e372dad85af9, []int{9} -} -func (m *EXTCOMMIndex) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EXTCOMMIndex) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EXTCOMMIndex) XXX_Merge(src proto.Message) { - xxx_messageInfo_EXTCOMMIndex.Merge(m, src) -} -func (m *EXTCOMMIndex) XXX_Size() int { - return m.Size() -} -func (m *EXTCOMMIndex) XXX_DiscardUnknown() { - xxx_messageInfo_EXTCOMMIndex.DiscardUnknown(m) -} - -var xxx_messageInfo_EXTCOMMIndex proto.InternalMessageInfo - -func (m *EXTCOMMIndexList) Reset() { *m = EXTCOMMIndexList{} } -func (*EXTCOMMIndexList) ProtoMessage() {} -func (*EXTCOMMIndexList) Descriptor() ([]byte, []int) { - return fileDescriptor_0980e372dad85af9, []int{10} -} -func (m *EXTCOMMIndexList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EXTCOMMIndexList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EXTCOMMIndexList) XXX_Merge(src proto.Message) { - xxx_messageInfo_EXTCOMMIndexList.Merge(m, src) -} -func (m *EXTCOMMIndexList) XXX_Size() int { - return m.Size() -} -func (m *EXTCOMMIndexList) XXX_DiscardUnknown() { - xxx_messageInfo_EXTCOMMIndexList.DiscardUnknown(m) -} - -var xxx_messageInfo_EXTCOMMIndexList proto.InternalMessageInfo - -func (m *EXTCOMMIndexSpec) Reset() { *m = EXTCOMMIndexSpec{} } -func (*EXTCOMMIndexSpec) ProtoMessage() {} -func (*EXTCOMMIndexSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_0980e372dad85af9, []int{11} -} -func (m *EXTCOMMIndexSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EXTCOMMIndexSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EXTCOMMIndexSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_EXTCOMMIndexSpec.Merge(m, src) -} -func (m *EXTCOMMIndexSpec) XXX_Size() int { - return m.Size() -} -func (m *EXTCOMMIndexSpec) XXX_DiscardUnknown() { - xxx_messageInfo_EXTCOMMIndexSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_EXTCOMMIndexSpec proto.InternalMessageInfo - -func (m *EXTCOMMIndexStatus) Reset() { *m = EXTCOMMIndexStatus{} } -func (*EXTCOMMIndexStatus) ProtoMessage() {} -func (*EXTCOMMIndexStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_0980e372dad85af9, []int{12} -} -func (m *EXTCOMMIndexStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EXTCOMMIndexStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EXTCOMMIndexStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_EXTCOMMIndexStatus.Merge(m, src) -} -func (m *EXTCOMMIndexStatus) XXX_Size() int { - return m.Size() -} -func (m *EXTCOMMIndexStatus) XXX_DiscardUnknown() { - xxx_messageInfo_EXTCOMMIndexStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_EXTCOMMIndexStatus proto.InternalMessageInfo - -func (m *EXTCOMMRangeSyntaxValidator) Reset() { *m = EXTCOMMRangeSyntaxValidator{} } -func (*EXTCOMMRangeSyntaxValidator) ProtoMessage() {} -func (*EXTCOMMRangeSyntaxValidator) Descriptor() ([]byte, []int) { - return fileDescriptor_0980e372dad85af9, []int{13} -} -func (m *EXTCOMMRangeSyntaxValidator) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EXTCOMMRangeSyntaxValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EXTCOMMRangeSyntaxValidator) XXX_Merge(src proto.Message) { - xxx_messageInfo_EXTCOMMRangeSyntaxValidator.Merge(m, src) -} -func (m *EXTCOMMRangeSyntaxValidator) XXX_Size() int { - return m.Size() -} -func (m *EXTCOMMRangeSyntaxValidator) XXX_DiscardUnknown() { - xxx_messageInfo_EXTCOMMRangeSyntaxValidator.DiscardUnknown(m) -} - -var xxx_messageInfo_EXTCOMMRangeSyntaxValidator proto.InternalMessageInfo - -func (m *EXTCOMMStaticIDSyntaxValidator) Reset() { *m = EXTCOMMStaticIDSyntaxValidator{} } -func (*EXTCOMMStaticIDSyntaxValidator) ProtoMessage() {} -func (*EXTCOMMStaticIDSyntaxValidator) Descriptor() ([]byte, []int) { - return fileDescriptor_0980e372dad85af9, []int{14} -} -func (m *EXTCOMMStaticIDSyntaxValidator) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EXTCOMMStaticIDSyntaxValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EXTCOMMStaticIDSyntaxValidator) XXX_Merge(src proto.Message) { - xxx_messageInfo_EXTCOMMStaticIDSyntaxValidator.Merge(m, src) -} -func (m *EXTCOMMStaticIDSyntaxValidator) XXX_Size() int { - return m.Size() -} -func (m *EXTCOMMStaticIDSyntaxValidator) XXX_DiscardUnknown() { - xxx_messageInfo_EXTCOMMStaticIDSyntaxValidator.DiscardUnknown(m) -} - -var xxx_messageInfo_EXTCOMMStaticIDSyntaxValidator proto.InternalMessageInfo - -func init() { - proto.RegisterType((*EXTCOMMClaim)(nil), "github.com.kuidio.kuid.apis.backend.extcomm.v1alpha1.EXTCOMMClaim") - proto.RegisterType((*EXTCOMMClaimList)(nil), "github.com.kuidio.kuid.apis.backend.extcomm.v1alpha1.EXTCOMMClaimList") - proto.RegisterType((*EXTCOMMClaimSpec)(nil), "github.com.kuidio.kuid.apis.backend.extcomm.v1alpha1.EXTCOMMClaimSpec") - proto.RegisterType((*EXTCOMMClaimStatus)(nil), "github.com.kuidio.kuid.apis.backend.extcomm.v1alpha1.EXTCOMMClaimStatus") - proto.RegisterType((*EXTCOMMDynamicIDSyntaxValidator)(nil), "github.com.kuidio.kuid.apis.backend.extcomm.v1alpha1.EXTCOMMDynamicIDSyntaxValidator") - proto.RegisterType((*EXTCOMMEntry)(nil), "github.com.kuidio.kuid.apis.backend.extcomm.v1alpha1.EXTCOMMEntry") - proto.RegisterType((*EXTCOMMEntryList)(nil), "github.com.kuidio.kuid.apis.backend.extcomm.v1alpha1.EXTCOMMEntryList") - proto.RegisterType((*EXTCOMMEntrySpec)(nil), "github.com.kuidio.kuid.apis.backend.extcomm.v1alpha1.EXTCOMMEntrySpec") - proto.RegisterType((*EXTCOMMEntryStatus)(nil), "github.com.kuidio.kuid.apis.backend.extcomm.v1alpha1.EXTCOMMEntryStatus") - proto.RegisterType((*EXTCOMMIndex)(nil), "github.com.kuidio.kuid.apis.backend.extcomm.v1alpha1.EXTCOMMIndex") - proto.RegisterType((*EXTCOMMIndexList)(nil), "github.com.kuidio.kuid.apis.backend.extcomm.v1alpha1.EXTCOMMIndexList") - proto.RegisterType((*EXTCOMMIndexSpec)(nil), "github.com.kuidio.kuid.apis.backend.extcomm.v1alpha1.EXTCOMMIndexSpec") - proto.RegisterType((*EXTCOMMIndexStatus)(nil), "github.com.kuidio.kuid.apis.backend.extcomm.v1alpha1.EXTCOMMIndexStatus") - proto.RegisterType((*EXTCOMMRangeSyntaxValidator)(nil), "github.com.kuidio.kuid.apis.backend.extcomm.v1alpha1.EXTCOMMRangeSyntaxValidator") - proto.RegisterType((*EXTCOMMStaticIDSyntaxValidator)(nil), "github.com.kuidio.kuid.apis.backend.extcomm.v1alpha1.EXTCOMMStaticIDSyntaxValidator") -} - -func init() { - proto.RegisterFile("github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1/generated.proto", fileDescriptor_0980e372dad85af9) -} - -var fileDescriptor_0980e372dad85af9 = []byte{ - // 990 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x57, 0x4d, 0x6f, 0x1b, 0x45, - 0x18, 0xf6, 0xda, 0xb1, 0x13, 0x4f, 0x4a, 0x69, 0x06, 0x09, 0x99, 0x20, 0xd6, 0xc1, 0xbd, 0x14, - 0x89, 0xce, 0x92, 0x28, 0x42, 0x95, 0x2a, 0x55, 0x62, 0xe3, 0x00, 0x96, 0x88, 0x22, 0x4d, 0x02, - 0x42, 0x55, 0x0f, 0x1d, 0xef, 0x4e, 0xec, 0xc1, 0xde, 0x0f, 0xed, 0x8e, 0x83, 0x7d, 0xe3, 0x86, - 0x54, 0x09, 0x89, 0xbf, 0xc0, 0x91, 0x5f, 0xc1, 0x35, 0x07, 0x0e, 0x3d, 0x96, 0x4b, 0x44, 0xdc, - 0x7f, 0xc1, 0x09, 0xcd, 0x3b, 0x63, 0xef, 0x26, 0x6e, 0x82, 0x1b, 0x42, 0x68, 0x4e, 0xce, 0xbe, - 0x1f, 0xcf, 0xf3, 0x7e, 0xcc, 0x3c, 0xbb, 0x41, 0xcd, 0x8e, 0x90, 0xdd, 0x41, 0x9b, 0x78, 0x51, - 0xe0, 0xf4, 0x06, 0xc2, 0x17, 0x11, 0xfc, 0x38, 0x2c, 0x16, 0xa9, 0xd3, 0x66, 0x5e, 0x8f, 0x87, - 0xbe, 0xc3, 0x87, 0xd2, 0x8b, 0x82, 0xc0, 0x39, 0x5c, 0x67, 0xfd, 0xb8, 0xcb, 0xd6, 0x9d, 0x0e, - 0x0f, 0x79, 0xc2, 0x24, 0xf7, 0x49, 0x9c, 0x44, 0x32, 0xc2, 0x9b, 0x19, 0x0a, 0xd1, 0x28, 0xf0, - 0x43, 0x14, 0x0a, 0x31, 0x28, 0xc4, 0xa0, 0x90, 0x09, 0xca, 0xea, 0xfd, 0x1c, 0x77, 0x27, 0xea, - 0x44, 0x0e, 0x80, 0xb5, 0x07, 0x07, 0xf0, 0x04, 0x0f, 0xf0, 0x97, 0x26, 0x59, 0x7d, 0x78, 0x51, - 0xa9, 0x0a, 0x39, 0x0a, 0xcf, 0xad, 0x70, 0xf5, 0xd1, 0xc5, 0xc9, 0xa1, 0x2f, 0xa4, 0xb8, 0x28, - 0x7f, 0xb3, 0xf7, 0x20, 0x25, 0x22, 0x52, 0xf1, 0x01, 0xf3, 0xba, 0x22, 0xe4, 0xc9, 0xc8, 0x89, - 0x7b, 0x1d, 0x0d, 0x10, 0x70, 0xc9, 0x9c, 0xc3, 0xd9, 0xac, 0x4f, 0xcf, 0xcb, 0x4a, 0x06, 0xa1, - 0x14, 0x01, 0x77, 0x52, 0xaf, 0xcb, 0x03, 0x76, 0x36, 0xaf, 0xf1, 0x7b, 0x11, 0xdd, 0xda, 0xfe, - 0x76, 0x7f, 0x6b, 0x77, 0x67, 0x67, 0xab, 0xcf, 0x44, 0x80, 0x9f, 0xa2, 0x25, 0xc5, 0xe1, 0x33, - 0xc9, 0x6a, 0xd6, 0x9a, 0x75, 0x6f, 0x79, 0xe3, 0x13, 0xa2, 0xb1, 0x49, 0x1e, 0x9b, 0xc4, 0xbd, - 0x8e, 0x1e, 0xba, 0x8a, 0x26, 0x87, 0xeb, 0x64, 0xb7, 0xfd, 0x1d, 0xf7, 0xe4, 0x0e, 0x97, 0xcc, - 0xc5, 0x47, 0xc7, 0xf5, 0xc2, 0xf8, 0xb8, 0x8e, 0x32, 0x1b, 0x9d, 0xa2, 0xe2, 0x2e, 0x5a, 0x48, - 0x63, 0xee, 0xd5, 0x8a, 0x80, 0xfe, 0x39, 0xb9, 0xcc, 0x46, 0x49, 0xbe, 0xe6, 0xbd, 0x98, 0x7b, - 0xee, 0x2d, 0xc3, 0xb9, 0xa0, 0x9e, 0x28, 0x30, 0xe0, 0x18, 0x55, 0x52, 0xc9, 0xe4, 0x20, 0xad, - 0x95, 0x80, 0xeb, 0xcb, 0x2b, 0xe0, 0x02, 0x3c, 0xf7, 0xb6, 0x61, 0xab, 0xe8, 0x67, 0x6a, 0x78, - 0x1a, 0x7f, 0x58, 0xe8, 0x4e, 0x3e, 0xfc, 0x2b, 0x91, 0x4a, 0xfc, 0x64, 0x66, 0xa4, 0x64, 0xbe, - 0x91, 0xaa, 0x6c, 0x18, 0xe8, 0x1d, 0x43, 0xb7, 0x34, 0xb1, 0xe4, 0xc6, 0xd9, 0x41, 0x65, 0x21, - 0x79, 0x90, 0xd6, 0x8a, 0x6b, 0xa5, 0x7b, 0xcb, 0x1b, 0xee, 0xbf, 0xef, 0xd1, 0x7d, 0xcb, 0xd0, - 0x95, 0x5b, 0x0a, 0x98, 0x6a, 0xfc, 0xc6, 0x6f, 0xc5, 0xd3, 0xbd, 0xa9, 0x41, 0xe3, 0xbb, 0xa8, - 0x2c, 0x42, 0x9f, 0x0f, 0xa1, 0xb1, 0x6a, 0x2e, 0x53, 0x19, 0xa9, 0xf6, 0xe1, 0x77, 0x51, 0x51, - 0xf8, 0xb0, 0xef, 0x92, 0x5b, 0x19, 0x1f, 0xd7, 0x8b, 0xad, 0x26, 0x2d, 0x0a, 0x1f, 0xd7, 0x51, - 0x39, 0x61, 0x61, 0x87, 0xc3, 0x7a, 0xaa, 0x6e, 0x55, 0x25, 0x52, 0x65, 0xa0, 0xda, 0x8e, 0x23, - 0xb4, 0xec, 0xc1, 0x18, 0x59, 0x9b, 0xf7, 0xd3, 0xda, 0x02, 0x0c, 0xef, 0xc1, 0x85, 0x1d, 0xea, - 0xeb, 0x99, 0x35, 0xb6, 0x95, 0xe5, 0xbb, 0xef, 0x98, 0xea, 0x96, 0x73, 0x46, 0x9a, 0x67, 0xc0, - 0x4f, 0x50, 0x39, 0xfa, 0x3e, 0xe4, 0x49, 0xad, 0x0c, 0x54, 0x0f, 0x5f, 0x8b, 0x6a, 0x57, 0x65, - 0x52, 0x7e, 0xc0, 0x13, 0x1e, 0x7a, 0x5c, 0xb7, 0xa3, 0x6d, 0x1a, 0xb4, 0xf1, 0xac, 0x88, 0xf0, - 0xec, 0x61, 0xc2, 0xcf, 0x2c, 0xb4, 0x32, 0x15, 0x06, 0xee, 0x6b, 0xab, 0x39, 0x29, 0x9f, 0xfd, - 0x43, 0x05, 0x26, 0x2b, 0xd7, 0xef, 0x59, 0x20, 0xf7, 0x3d, 0xd3, 0xf5, 0xca, 0x8c, 0x8b, 0xce, - 0xd2, 0x5e, 0x7e, 0x57, 0x04, 0x21, 0x3e, 0x8c, 0x45, 0x32, 0xda, 0x17, 0x01, 0x87, 0x55, 0x55, - 0xdd, 0xdb, 0x4a, 0x04, 0xb6, 0xa7, 0x56, 0x9a, 0x8b, 0x68, 0x7c, 0x88, 0xea, 0x66, 0x16, 0xcd, - 0x51, 0xc8, 0x02, 0xe1, 0xb5, 0x9a, 0x7b, 0xa3, 0x50, 0xb2, 0xe1, 0x37, 0xac, 0x2f, 0x7c, 0x26, - 0xa3, 0x24, 0x2f, 0x4e, 0xdb, 0xa1, 0x4c, 0x46, 0x37, 0x4c, 0x9c, 0xa0, 0xe6, 0x6b, 0x12, 0x27, - 0xcd, 0x35, 0xb7, 0x38, 0x41, 0xf8, 0x4d, 0x13, 0x27, 0x28, 0xfa, 0x1c, 0x71, 0xfa, 0xb5, 0x74, - 0xba, 0xb7, 0xf9, 0xc5, 0xe9, 0x29, 0xaa, 0x82, 0x02, 0xec, 0x8f, 0x62, 0x0e, 0x6b, 0xaf, 0xba, - 0xae, 0x09, 0xac, 0x6e, 0x4d, 0x1c, 0x7f, 0x1d, 0xd7, 0xef, 0xcf, 0xf1, 0xfd, 0x42, 0xa6, 0x09, - 0x34, 0x03, 0xc5, 0xab, 0x70, 0xa5, 0xf4, 0xbd, 0x41, 0x06, 0x7a, 0x72, 0xad, 0xae, 0x5d, 0xe1, - 0xee, 0xa2, 0x32, 0x3c, 0x82, 0xc2, 0xe5, 0x66, 0x02, 0x09, 0x54, 0xfb, 0x32, 0x19, 0xac, 0xfc, - 0x17, 0x32, 0xf8, 0x8b, 0x35, 0x95, 0xc1, 0xdc, 0xb1, 0x7d, 0xa3, 0x64, 0x30, 0x2f, 0x3d, 0x2d, - 0x73, 0x4c, 0x6e, 0x92, 0xf4, 0x40, 0xcd, 0xd7, 0x24, 0x3d, 0x9a, 0x6b, 0x6e, 0xe9, 0x81, 0xf0, - 0x9b, 0x26, 0x3d, 0x50, 0xf4, 0x39, 0xd2, 0xf3, 0x53, 0xe9, 0x74, 0x6f, 0x20, 0x3d, 0x75, 0x54, - 0x0e, 0x44, 0xd8, 0x6a, 0x42, 0x63, 0x25, 0x7d, 0x09, 0x76, 0x94, 0x81, 0x6a, 0x3b, 0x04, 0xb0, - 0x61, 0xab, 0x69, 0x5e, 0xb5, 0x3a, 0x40, 0x19, 0xa8, 0xb6, 0xe3, 0x1f, 0x2d, 0xb4, 0x32, 0x48, - 0x79, 0xd2, 0xe4, 0x07, 0x22, 0xe4, 0xbe, 0x11, 0x08, 0xbd, 0xb0, 0x47, 0xaf, 0x75, 0x21, 0xbf, - 0x3e, 0x8b, 0x92, 0xdd, 0x85, 0x19, 0x17, 0x9d, 0xe5, 0xc4, 0x1b, 0x08, 0xc9, 0x84, 0x85, 0xa9, - 0x90, 0xe2, 0x50, 0xbf, 0xd9, 0x97, 0xb2, 0xa3, 0xbc, 0x3f, 0xf5, 0xd0, 0x5c, 0x14, 0x5e, 0x43, - 0x0b, 0x52, 0x09, 0xaa, 0x56, 0x99, 0xe9, 0x21, 0x04, 0x69, 0x04, 0x0f, 0xfe, 0x08, 0x2d, 0xa6, - 0x83, 0x36, 0xa8, 0x6e, 0x05, 0x82, 0xde, 0x36, 0x41, 0x8b, 0x7b, 0xda, 0x4c, 0x27, 0x7e, 0xfc, - 0x31, 0x5a, 0xea, 0xf4, 0xa3, 0x36, 0xeb, 0xb7, 0x9a, 0xb5, 0x45, 0x88, 0x9d, 0x2e, 0xfe, 0x0b, - 0x63, 0xa7, 0xd3, 0x88, 0xc6, 0xcb, 0x4c, 0x5e, 0x72, 0x47, 0xf3, 0x0a, 0x36, 0xf2, 0x6a, 0x81, - 0x2a, 0xfd, 0x3f, 0x02, 0xf5, 0x01, 0x7a, 0xdf, 0x34, 0x09, 0x5f, 0x61, 0x67, 0x3f, 0x9d, 0xd6, - 0x90, 0x6d, 0xdc, 0x2a, 0xfe, 0x15, 0x1f, 0x57, 0xee, 0xe3, 0xa3, 0x13, 0xbb, 0xf0, 0xfc, 0xc4, - 0x2e, 0xbc, 0x38, 0xb1, 0x0b, 0x3f, 0x8c, 0x6d, 0xeb, 0x68, 0x6c, 0x5b, 0xcf, 0xc7, 0xb6, 0xf5, - 0x62, 0x6c, 0x5b, 0x7f, 0x8e, 0x6d, 0xeb, 0xe7, 0x97, 0x76, 0xe1, 0xf1, 0xe6, 0x65, 0xfe, 0x6b, - 0xff, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x4e, 0xe2, 0x27, 0x34, 0xec, 0x0f, 0x00, 0x00, -} - -func (m *EXTCOMMClaim) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EXTCOMMClaim) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EXTCOMMClaim) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *EXTCOMMClaimList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EXTCOMMClaimList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EXTCOMMClaimList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *EXTCOMMClaimSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EXTCOMMClaimSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EXTCOMMClaimSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Owner != nil { - { - size, err := m.Owner.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - { - size, err := m.ClaimLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - if m.Range != nil { - i -= len(*m.Range) - copy(dAtA[i:], *m.Range) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Range))) - i-- - dAtA[i] = 0x1a - } - if m.ID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.ID)) - i-- - dAtA[i] = 0x10 - } - i -= len(m.Index) - copy(dAtA[i:], m.Index) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Index))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *EXTCOMMClaimStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EXTCOMMClaimStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EXTCOMMClaimStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ExpiryTime != nil { - i -= len(*m.ExpiryTime) - copy(dAtA[i:], *m.ExpiryTime) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ExpiryTime))) - i-- - dAtA[i] = 0x22 - } - if m.Range != nil { - i -= len(*m.Range) - copy(dAtA[i:], *m.Range) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Range))) - i-- - dAtA[i] = 0x1a - } - if m.ID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.ID)) - i-- - dAtA[i] = 0x10 - } - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *EXTCOMMDynamicIDSyntaxValidator) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EXTCOMMDynamicIDSyntaxValidator) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EXTCOMMDynamicIDSyntaxValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *EXTCOMMEntry) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EXTCOMMEntry) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EXTCOMMEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *EXTCOMMEntryList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EXTCOMMEntryList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EXTCOMMEntryList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *EXTCOMMEntrySpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EXTCOMMEntrySpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EXTCOMMEntrySpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Owner != nil { - { - size, err := m.Owner.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - i -= len(m.Claim) - copy(dAtA[i:], m.Claim) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Claim))) - i-- - dAtA[i] = 0x2a - { - size, err := m.ClaimLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - i -= len(m.ID) - copy(dAtA[i:], m.ID) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.ID))) - i-- - dAtA[i] = 0x1a - i -= len(m.ClaimType) - copy(dAtA[i:], m.ClaimType) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.ClaimType))) - i-- - dAtA[i] = 0x12 - i -= len(m.Index) - copy(dAtA[i:], m.Index) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Index))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *EXTCOMMEntryStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EXTCOMMEntryStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EXTCOMMEntryStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *EXTCOMMIndex) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EXTCOMMIndex) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EXTCOMMIndex) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *EXTCOMMIndexList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EXTCOMMIndexList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EXTCOMMIndexList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *EXTCOMMIndexSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EXTCOMMIndexSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EXTCOMMIndexSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.GlobalID) - copy(dAtA[i:], m.GlobalID) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.GlobalID))) - i-- - dAtA[i] = 0x3a - i -= len(m.SubType) - copy(dAtA[i:], m.SubType) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.SubType))) - i-- - dAtA[i] = 0x32 - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0x2a - i-- - if m.Transitive { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - { - size, err := m.UserDefinedLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if m.MaxID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MaxID)) - i-- - dAtA[i] = 0x10 - } - if m.MinID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MinID)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *EXTCOMMIndexStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EXTCOMMIndexStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EXTCOMMIndexStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if m.MaxID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MaxID)) - i-- - dAtA[i] = 0x10 - } - if m.MinID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MinID)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *EXTCOMMRangeSyntaxValidator) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EXTCOMMRangeSyntaxValidator) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EXTCOMMRangeSyntaxValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *EXTCOMMStaticIDSyntaxValidator) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EXTCOMMStaticIDSyntaxValidator) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EXTCOMMStaticIDSyntaxValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { - offset -= sovGenerated(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *EXTCOMMClaim) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *EXTCOMMClaimList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *EXTCOMMClaimSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Index) - n += 1 + l + sovGenerated(uint64(l)) - if m.ID != nil { - n += 1 + sovGenerated(uint64(*m.ID)) - } - if m.Range != nil { - l = len(*m.Range) - n += 1 + l + sovGenerated(uint64(l)) - } - l = m.ClaimLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.Owner != nil { - l = m.Owner.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *EXTCOMMClaimStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.ID != nil { - n += 1 + sovGenerated(uint64(*m.ID)) - } - if m.Range != nil { - l = len(*m.Range) - n += 1 + l + sovGenerated(uint64(l)) - } - if m.ExpiryTime != nil { - l = len(*m.ExpiryTime) - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *EXTCOMMDynamicIDSyntaxValidator) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *EXTCOMMEntry) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *EXTCOMMEntryList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *EXTCOMMEntrySpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Index) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.ClaimType) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.ID) - n += 1 + l + sovGenerated(uint64(l)) - l = m.ClaimLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Claim) - n += 1 + l + sovGenerated(uint64(l)) - if m.Owner != nil { - l = m.Owner.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *EXTCOMMEntryStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *EXTCOMMIndex) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *EXTCOMMIndexList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *EXTCOMMIndexSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MinID != nil { - n += 1 + sovGenerated(uint64(*m.MinID)) - } - if m.MaxID != nil { - n += 1 + sovGenerated(uint64(*m.MaxID)) - } - l = m.UserDefinedLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - n += 2 - l = len(m.Type) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.SubType) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.GlobalID) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *EXTCOMMIndexStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MinID != nil { - n += 1 + sovGenerated(uint64(*m.MinID)) - } - if m.MaxID != nil { - n += 1 + sovGenerated(uint64(*m.MaxID)) - } - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *EXTCOMMRangeSyntaxValidator) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *EXTCOMMStaticIDSyntaxValidator) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func sovGenerated(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenerated(x uint64) (n int) { - return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *EXTCOMMClaim) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&EXTCOMMClaim{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "EXTCOMMClaimSpec", "EXTCOMMClaimSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "EXTCOMMClaimStatus", "EXTCOMMClaimStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *EXTCOMMClaimList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]EXTCOMMClaim{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "EXTCOMMClaim", "EXTCOMMClaim", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&EXTCOMMClaimList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *EXTCOMMClaimSpec) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&EXTCOMMClaimSpec{`, - `Index:` + fmt.Sprintf("%v", this.Index) + `,`, - `ID:` + valueToStringGenerated(this.ID) + `,`, - `Range:` + valueToStringGenerated(this.Range) + `,`, - `ClaimLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ClaimLabels), "ClaimLabels", "v1alpha1.ClaimLabels", 1), `&`, ``, 1) + `,`, - `Owner:` + strings.Replace(fmt.Sprintf("%v", this.Owner), "OwnerReference", "v1alpha1.OwnerReference", 1) + `,`, - `}`, - }, "") - return s -} -func (this *EXTCOMMClaimStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&EXTCOMMClaimStatus{`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `ID:` + valueToStringGenerated(this.ID) + `,`, - `Range:` + valueToStringGenerated(this.Range) + `,`, - `ExpiryTime:` + valueToStringGenerated(this.ExpiryTime) + `,`, - `}`, - }, "") - return s -} -func (this *EXTCOMMDynamicIDSyntaxValidator) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&EXTCOMMDynamicIDSyntaxValidator{`, - `}`, - }, "") - return s -} -func (this *EXTCOMMEntry) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&EXTCOMMEntry{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "EXTCOMMEntrySpec", "EXTCOMMEntrySpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "EXTCOMMEntryStatus", "EXTCOMMEntryStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *EXTCOMMEntryList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]EXTCOMMEntry{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "EXTCOMMEntry", "EXTCOMMEntry", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&EXTCOMMEntryList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *EXTCOMMEntrySpec) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&EXTCOMMEntrySpec{`, - `Index:` + fmt.Sprintf("%v", this.Index) + `,`, - `ClaimType:` + fmt.Sprintf("%v", this.ClaimType) + `,`, - `ID:` + fmt.Sprintf("%v", this.ID) + `,`, - `ClaimLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ClaimLabels), "ClaimLabels", "v1alpha1.ClaimLabels", 1), `&`, ``, 1) + `,`, - `Claim:` + fmt.Sprintf("%v", this.Claim) + `,`, - `Owner:` + strings.Replace(fmt.Sprintf("%v", this.Owner), "OwnerReference", "v1alpha1.OwnerReference", 1) + `,`, - `}`, - }, "") - return s -} -func (this *EXTCOMMEntryStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&EXTCOMMEntryStatus{`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *EXTCOMMIndex) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&EXTCOMMIndex{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "EXTCOMMIndexSpec", "EXTCOMMIndexSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "EXTCOMMIndexStatus", "EXTCOMMIndexStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *EXTCOMMIndexList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]EXTCOMMIndex{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "EXTCOMMIndex", "EXTCOMMIndex", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&EXTCOMMIndexList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *EXTCOMMIndexSpec) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&EXTCOMMIndexSpec{`, - `MinID:` + valueToStringGenerated(this.MinID) + `,`, - `MaxID:` + valueToStringGenerated(this.MaxID) + `,`, - `UserDefinedLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.UserDefinedLabels), "UserDefinedLabels", "v1alpha1.UserDefinedLabels", 1), `&`, ``, 1) + `,`, - `Transitive:` + fmt.Sprintf("%v", this.Transitive) + `,`, - `Type:` + fmt.Sprintf("%v", this.Type) + `,`, - `SubType:` + fmt.Sprintf("%v", this.SubType) + `,`, - `GlobalID:` + fmt.Sprintf("%v", this.GlobalID) + `,`, - `}`, - }, "") - return s -} -func (this *EXTCOMMIndexStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&EXTCOMMIndexStatus{`, - `MinID:` + valueToStringGenerated(this.MinID) + `,`, - `MaxID:` + valueToStringGenerated(this.MaxID) + `,`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *EXTCOMMRangeSyntaxValidator) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&EXTCOMMRangeSyntaxValidator{`, - `}`, - }, "") - return s -} -func (this *EXTCOMMStaticIDSyntaxValidator) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&EXTCOMMStaticIDSyntaxValidator{`, - `}`, - }, "") - return s -} -func valueToStringGenerated(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *EXTCOMMClaim) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EXTCOMMClaim: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EXTCOMMClaim: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EXTCOMMClaimList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EXTCOMMClaimList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EXTCOMMClaimList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, EXTCOMMClaim{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EXTCOMMClaimSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EXTCOMMClaimSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EXTCOMMClaimSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Index = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ID = &v - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Range", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Range = &s - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ClaimLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Owner == nil { - m.Owner = &v1alpha1.OwnerReference{} - } - if err := m.Owner.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EXTCOMMClaimStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EXTCOMMClaimStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EXTCOMMClaimStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ID = &v - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Range", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Range = &s - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExpiryTime", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.ExpiryTime = &s - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EXTCOMMDynamicIDSyntaxValidator) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EXTCOMMDynamicIDSyntaxValidator: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EXTCOMMDynamicIDSyntaxValidator: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EXTCOMMEntry) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EXTCOMMEntry: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EXTCOMMEntry: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EXTCOMMEntryList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EXTCOMMEntryList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EXTCOMMEntryList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, EXTCOMMEntry{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EXTCOMMEntrySpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EXTCOMMEntrySpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EXTCOMMEntrySpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Index = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClaimType = github_com_kuidio_kuid_apis_backend.ClaimType(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ClaimLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Claim", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Claim = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Owner == nil { - m.Owner = &v1alpha1.OwnerReference{} - } - if err := m.Owner.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EXTCOMMEntryStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EXTCOMMEntryStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EXTCOMMEntryStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EXTCOMMIndex) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EXTCOMMIndex: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EXTCOMMIndex: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EXTCOMMIndexList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EXTCOMMIndexList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EXTCOMMIndexList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, EXTCOMMIndex{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EXTCOMMIndexSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EXTCOMMIndexSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EXTCOMMIndexSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinID", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MinID = &v - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxID", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MaxID = &v - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UserDefinedLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.UserDefinedLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Transitive", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Transitive = bool(v != 0) - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SubType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SubType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GlobalID", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.GlobalID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EXTCOMMIndexStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EXTCOMMIndexStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EXTCOMMIndexStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinID", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MinID = &v - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxID", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MaxID = &v - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EXTCOMMRangeSyntaxValidator) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EXTCOMMRangeSyntaxValidator: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EXTCOMMRangeSyntaxValidator: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EXTCOMMStaticIDSyntaxValidator) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EXTCOMMStaticIDSyntaxValidator: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EXTCOMMStaticIDSyntaxValidator: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenerated(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenerated - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenerated - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenerated - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") -) diff --git a/apis/backend/extcomm/v1alpha1/generated.proto b/apis/backend/extcomm/v1alpha1/generated.proto deleted file mode 100644 index a1c4c4f..0000000 --- a/apis/backend/extcomm/v1alpha1/generated.proto +++ /dev/null @@ -1,214 +0,0 @@ -/* -Copyright 2024 Nokia. - -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. -*/ -// This file was autogenerated by go-to-protobuf. Do not edit it manually! - -syntax = "proto2"; - -package github.com.kuidio.kuid.apis.backend.extcomm.v1alpha1; - -import "github.com/kuidio/kuid/apis/common/v1alpha1/generated.proto"; -import "github.com/kuidio/kuid/apis/condition/v1alpha1/generated.proto"; -import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; -import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; - -// Package-wide variables from generator "generated". -option go_package = "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1"; - -// EXTCOMMClaim is the Schema for the EXTCOMMClaim API -// -// +k8s:openapi-gen=true -message EXTCOMMClaim { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional EXTCOMMClaimSpec spec = 2; - - optional EXTCOMMClaimStatus status = 3; -} - -// EXTCOMMClaimList contains a list of EXTCOMMClaims -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message EXTCOMMClaimList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated EXTCOMMClaim items = 2; -} - -// EXTCOMMClaimSpec defines the dEXTCOMMred state of EXTCOMMClaim -message EXTCOMMClaimSpec { - // EXTCOMMIndex defines the EXTCOMM index for the EXTCOMM Claim - optional string index = 1; - - // EXTCOMMID defines the EXTCOMM for the EXTCOMM claim - optional int64 id = 2; - - // Range defines the EXTCOMM range for the EXTCOMM claim - // The following notation is used: start-end - - // the EXTCOMMs in the range must be consecutive - optional string range = 3; - - // ClaimLabels define the user defined labels and selector labels used - // in resource claim - optional github.com.kuidio.kuid.apis.common.v1alpha1.ClaimLabels claimLabels = 4; - - // Owner defines the ownerReference of the EXTCOMMClaim - // Allow for different namesapces, hence it is part of the spec - optional github.com.kuidio.kuid.apis.common.v1alpha1.OwnerReference owner = 5; -} - -// EXTCOMMClaimStatus defines the observed state of EXTCOMMClaim -message EXTCOMMClaimStatus { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 1; - - // EXTCOMMID defines the EXTCOMM for the EXTCOMM claim - // +optional - optional int64 id = 2; - - // EXTCOMMRange defines the EXTCOMM range for the EXTCOMM claim - // +optional - optional string range = 3; - - // ExpiryTime defines when the claim expires - // +kubebuilder:validation:Optional - // +optional - optional string expiryTime = 4; -} - -message EXTCOMMDynamicIDSyntaxValidator { -} - -// EXTCOMMEntry is the Schema for the EXTCOMMentry API -// -// +k8s:openapi-gen=true -message EXTCOMMEntry { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional EXTCOMMEntrySpec spec = 2; - - optional EXTCOMMEntryStatus status = 3; -} - -// EXTCOMMEntryList contains a list of EXTCOMMEntries -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message EXTCOMMEntryList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated EXTCOMMEntry items = 2; -} - -// EXTCOMMEntrySpec defines the dEXTCOMMred state of EXTCOMMEntry -message EXTCOMMEntrySpec { - // EXTCOMMIndex defines the EXTCOMM index for the EXTCOMM Claim - optional string index = 1; - - // ClaimType defines the claimType of the EXTCOMM Entry - optional string claimType = 2; - - // ID defines the id of the EXTCOMM entry in the tree - optional string id = 3; - - // ClaimLabels define the user defined labels and selector labels used - // in resource claim - optional github.com.kuidio.kuid.apis.common.v1alpha1.ClaimLabels claimLabels = 4; - - // Claim defines the name of the claim that is the origin of this entry - optional string claim = 5; - - // Owner defines the ownerReference of the EXTCOMMClaim - // Allow for different namesapces, hence it is part of the spec - optional github.com.kuidio.kuid.apis.common.v1alpha1.OwnerReference owner = 6; -} - -// EXTCOMMEntryStatus defines the observed state of EXTCOMMEntry -message EXTCOMMEntryStatus { - // ConditionedStatus provides the status of the EXTCOMMEntry using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 1; -} - -// EXTCOMMIndex is the Schema for the EXTCOMMIndex API -// -// +k8s:openapi-gen=true -message EXTCOMMIndex { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional EXTCOMMIndexSpec spec = 2; - - optional EXTCOMMIndexStatus status = 3; -} - -// EXTCOMMIndexList contains a list of EXTCOMMIndexs -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message EXTCOMMIndexList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated EXTCOMMIndex items = 2; -} - -// EXTCOMMIndexSpec defines the dEXTCOMMred state of EXTCOMMIndex -message EXTCOMMIndexSpec { - // MinID defines the min EXTCOMM ID the index supports - // +optional - optional int64 minID = 1; - - // MaxID defines the max EXTCOMM ID the index supports - // +optional - optional int64 maxID = 2; - - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - optional github.com.kuidio.kuid.apis.common.v1alpha1.UserDefinedLabels userDefinedLabels = 3; - - // Transitive defines the transative nature of the extended community - optional bool transitive = 4; - - // Type defines the type of the extended community - // 2byteAS, 4byteAS, ipv4Address, opaque - optional string type = 5; - - // SubType defines the subTyoe of the extended community - // routeTarget, routeOrigin; - optional string subType = 6; - - // GlobalID is interpreted dependeing on the type - // AS in case of 2byteAS, 4byteAS - // IPV4 addrress - // irrelevant for the opaque type - optional string globalID = 7; -} - -// EXTCOMMIndexStatus defines the observed state of EXTCOMMIndex -message EXTCOMMIndexStatus { - // MinID defines the min EXTCOMM ID the index supports - // +optional - optional int64 minID = 1; - - // MaxID defines the max EXTCOMM ID the index supports - // +optional - optional int64 maxID = 2; - - // ConditionedStatus provides the status of the EXTCOMMIndex using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 3; -} - -message EXTCOMMRangeSyntaxValidator { -} - -message EXTCOMMStaticIDSyntaxValidator { -} - diff --git a/apis/backend/extcomm/v1alpha1/register.go b/apis/backend/extcomm/v1alpha1/register.go deleted file mode 100644 index d54bc09..0000000 --- a/apis/backend/extcomm/v1alpha1/register.go +++ /dev/null @@ -1,69 +0,0 @@ -/* -Copyright 2024 Nokia. - -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. -*/ - -// +kubebuilder:object:generate=true -// +groupName=extcomm.be.kuid.dev -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -const ( - Group = "extcomm.be.kuid.dev" - Version = "v1alpha1" -) - -var ( - // SchemeGroupVersion contains the API group and version information for the types in this package. - SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version} - // AddToScheme applies all the stored functions to the scheme. A non-nil error - // indicates that one function failed and the attempt was abandoned. - //AddToScheme = (&runtime.SchemeBuilder{}).AddToScheme - AddToScheme = localSchemeBuilder.AddToScheme - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - schemeBuilder runtime.SchemeBuilder - localSchemeBuilder = &schemeBuilder -) - -// Resource takes an unqualified resource and returns a Group qualified GroupResource -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} - -func init() { - localSchemeBuilder.Register(addKnownTypes) -} - -// Adds the list of known types to the given scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - // +kubebuilder:scaffold:install - - scheme.AddKnownTypes(SchemeGroupVersion, - &EXTCOMMClaim{}, - &EXTCOMMClaimList{}, - &EXTCOMMEntry{}, - &EXTCOMMEntryList{}, - &EXTCOMMIndex{}, - &EXTCOMMIndexList{}, - ) - - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/apis/backend/extcomm/v1alpha1/zz_generated.deepcopy.go b/apis/backend/extcomm/v1alpha1/zz_generated.deepcopy.go deleted file mode 100644 index 48cd0cb..0000000 --- a/apis/backend/extcomm/v1alpha1/zz_generated.deepcopy.go +++ /dev/null @@ -1,414 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - 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 *EXTCOMMClaim) DeepCopyInto(out *EXTCOMMClaim) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMClaim. -func (in *EXTCOMMClaim) DeepCopy() *EXTCOMMClaim { - if in == nil { - return nil - } - out := new(EXTCOMMClaim) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *EXTCOMMClaim) 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 *EXTCOMMClaimList) DeepCopyInto(out *EXTCOMMClaimList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]EXTCOMMClaim, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMClaimList. -func (in *EXTCOMMClaimList) DeepCopy() *EXTCOMMClaimList { - if in == nil { - return nil - } - out := new(EXTCOMMClaimList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *EXTCOMMClaimList) 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 *EXTCOMMClaimSpec) DeepCopyInto(out *EXTCOMMClaimSpec) { - *out = *in - if in.ID != nil { - in, out := &in.ID, &out.ID - *out = new(int64) - **out = **in - } - if in.Range != nil { - in, out := &in.Range, &out.Range - *out = new(string) - **out = **in - } - in.ClaimLabels.DeepCopyInto(&out.ClaimLabels) - if in.Owner != nil { - in, out := &in.Owner, &out.Owner - *out = new(commonv1alpha1.OwnerReference) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMClaimSpec. -func (in *EXTCOMMClaimSpec) DeepCopy() *EXTCOMMClaimSpec { - if in == nil { - return nil - } - out := new(EXTCOMMClaimSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EXTCOMMClaimStatus) DeepCopyInto(out *EXTCOMMClaimStatus) { - *out = *in - in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) - if in.ID != nil { - in, out := &in.ID, &out.ID - *out = new(int64) - **out = **in - } - if in.Range != nil { - in, out := &in.Range, &out.Range - *out = new(string) - **out = **in - } - if in.ExpiryTime != nil { - in, out := &in.ExpiryTime, &out.ExpiryTime - *out = new(string) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMClaimStatus. -func (in *EXTCOMMClaimStatus) DeepCopy() *EXTCOMMClaimStatus { - if in == nil { - return nil - } - out := new(EXTCOMMClaimStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EXTCOMMDynamicIDSyntaxValidator) DeepCopyInto(out *EXTCOMMDynamicIDSyntaxValidator) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMDynamicIDSyntaxValidator. -func (in *EXTCOMMDynamicIDSyntaxValidator) DeepCopy() *EXTCOMMDynamicIDSyntaxValidator { - if in == nil { - return nil - } - out := new(EXTCOMMDynamicIDSyntaxValidator) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EXTCOMMEntry) DeepCopyInto(out *EXTCOMMEntry) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMEntry. -func (in *EXTCOMMEntry) DeepCopy() *EXTCOMMEntry { - if in == nil { - return nil - } - out := new(EXTCOMMEntry) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *EXTCOMMEntry) 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 *EXTCOMMEntryList) DeepCopyInto(out *EXTCOMMEntryList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]EXTCOMMEntry, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMEntryList. -func (in *EXTCOMMEntryList) DeepCopy() *EXTCOMMEntryList { - if in == nil { - return nil - } - out := new(EXTCOMMEntryList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *EXTCOMMEntryList) 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 *EXTCOMMEntrySpec) DeepCopyInto(out *EXTCOMMEntrySpec) { - *out = *in - in.ClaimLabels.DeepCopyInto(&out.ClaimLabels) - if in.Owner != nil { - in, out := &in.Owner, &out.Owner - *out = new(commonv1alpha1.OwnerReference) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMEntrySpec. -func (in *EXTCOMMEntrySpec) DeepCopy() *EXTCOMMEntrySpec { - if in == nil { - return nil - } - out := new(EXTCOMMEntrySpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EXTCOMMEntryStatus) DeepCopyInto(out *EXTCOMMEntryStatus) { - *out = *in - in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMEntryStatus. -func (in *EXTCOMMEntryStatus) DeepCopy() *EXTCOMMEntryStatus { - if in == nil { - return nil - } - out := new(EXTCOMMEntryStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EXTCOMMIndex) DeepCopyInto(out *EXTCOMMIndex) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMIndex. -func (in *EXTCOMMIndex) DeepCopy() *EXTCOMMIndex { - if in == nil { - return nil - } - out := new(EXTCOMMIndex) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *EXTCOMMIndex) 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 *EXTCOMMIndexList) DeepCopyInto(out *EXTCOMMIndexList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]EXTCOMMIndex, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMIndexList. -func (in *EXTCOMMIndexList) DeepCopy() *EXTCOMMIndexList { - if in == nil { - return nil - } - out := new(EXTCOMMIndexList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *EXTCOMMIndexList) 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 *EXTCOMMIndexSpec) DeepCopyInto(out *EXTCOMMIndexSpec) { - *out = *in - if in.MinID != nil { - in, out := &in.MinID, &out.MinID - *out = new(int64) - **out = **in - } - if in.MaxID != nil { - in, out := &in.MaxID, &out.MaxID - *out = new(int64) - **out = **in - } - in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMIndexSpec. -func (in *EXTCOMMIndexSpec) DeepCopy() *EXTCOMMIndexSpec { - if in == nil { - return nil - } - out := new(EXTCOMMIndexSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EXTCOMMIndexStatus) DeepCopyInto(out *EXTCOMMIndexStatus) { - *out = *in - if in.MinID != nil { - in, out := &in.MinID, &out.MinID - *out = new(int64) - **out = **in - } - if in.MaxID != nil { - in, out := &in.MaxID, &out.MaxID - *out = new(int64) - **out = **in - } - in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMIndexStatus. -func (in *EXTCOMMIndexStatus) DeepCopy() *EXTCOMMIndexStatus { - if in == nil { - return nil - } - out := new(EXTCOMMIndexStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EXTCOMMRangeSyntaxValidator) DeepCopyInto(out *EXTCOMMRangeSyntaxValidator) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMRangeSyntaxValidator. -func (in *EXTCOMMRangeSyntaxValidator) DeepCopy() *EXTCOMMRangeSyntaxValidator { - if in == nil { - return nil - } - out := new(EXTCOMMRangeSyntaxValidator) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EXTCOMMStaticIDSyntaxValidator) DeepCopyInto(out *EXTCOMMStaticIDSyntaxValidator) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMStaticIDSyntaxValidator. -func (in *EXTCOMMStaticIDSyntaxValidator) DeepCopy() *EXTCOMMStaticIDSyntaxValidator { - if in == nil { - return nil - } - out := new(EXTCOMMStaticIDSyntaxValidator) - in.DeepCopyInto(out) - return out -} diff --git a/apis/backend/genid/doc.go b/apis/backend/genid/doc.go deleted file mode 100644 index 64c17a6..0000000 --- a/apis/backend/genid/doc.go +++ /dev/null @@ -1,21 +0,0 @@ -/* -Copyright 2024 Nokia. - -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. -*/ - -// +k8s:deepcopy-gen=package,register -// +groupName=genid.be.kuid.dev - -// genid defines the genid api -package genid diff --git a/apis/backend/genid/v1alpha1/doc.go b/apis/backend/genid/v1alpha1/doc.go deleted file mode 100644 index c2009b3..0000000 --- a/apis/backend/genid/v1alpha1/doc.go +++ /dev/null @@ -1,28 +0,0 @@ -/* -Copyright 2024 Nokia. - -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. -*/ - -//go:generate deepcopy-gen -O zz_generated.deepcopy -i . -h ../../../../boilerplate.go.txt -//go:generate defaulter-gen -O zz_generated.defaults -i . -h ../../../../boilerplate.go.txt -//go:generate conversion-gen -O zz_generated.conversion -i . -h ../../../../boilerplate.go.txt - -// +k8s:openapi-gen=true -// +k8s:deepcopy-gen=package,register -// +k8s:conversion-gen=github.com/kuidio/kuid/apis/backend/genid -// +k8s:defaulter-gen=TypeMeta -// +groupName=genid.be.kuid.dev - -// Package v1alpha1 is the v1alpha1 version of the API. -package v1alpha1 // import "github.com/kuidio/kuid/apis/backend/genid/v1alpha1" diff --git a/apis/backend/genid/v1alpha1/generated.pb.go b/apis/backend/genid/v1alpha1/generated.pb.go deleted file mode 100644 index b5bf7d6..0000000 --- a/apis/backend/genid/v1alpha1/generated.pb.go +++ /dev/null @@ -1,3686 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 protoc-gen-gogo. DO NOT EDIT. -// source: github.com/kuidio/kuid/apis/backend/genid/v1alpha1/generated.proto - -package v1alpha1 - -import ( - fmt "fmt" - - io "io" - - proto "github.com/gogo/protobuf/proto" - github_com_kuidio_kuid_apis_backend "github.com/kuidio/kuid/apis/backend" - v1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - - math "math" - math_bits "math/bits" - reflect "reflect" - strings "strings" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -func (m *GENIDClaim) Reset() { *m = GENIDClaim{} } -func (*GENIDClaim) ProtoMessage() {} -func (*GENIDClaim) Descriptor() ([]byte, []int) { - return fileDescriptor_d30532fccb4b5b16, []int{0} -} -func (m *GENIDClaim) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GENIDClaim) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *GENIDClaim) XXX_Merge(src proto.Message) { - xxx_messageInfo_GENIDClaim.Merge(m, src) -} -func (m *GENIDClaim) XXX_Size() int { - return m.Size() -} -func (m *GENIDClaim) XXX_DiscardUnknown() { - xxx_messageInfo_GENIDClaim.DiscardUnknown(m) -} - -var xxx_messageInfo_GENIDClaim proto.InternalMessageInfo - -func (m *GENIDClaimList) Reset() { *m = GENIDClaimList{} } -func (*GENIDClaimList) ProtoMessage() {} -func (*GENIDClaimList) Descriptor() ([]byte, []int) { - return fileDescriptor_d30532fccb4b5b16, []int{1} -} -func (m *GENIDClaimList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GENIDClaimList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *GENIDClaimList) XXX_Merge(src proto.Message) { - xxx_messageInfo_GENIDClaimList.Merge(m, src) -} -func (m *GENIDClaimList) XXX_Size() int { - return m.Size() -} -func (m *GENIDClaimList) XXX_DiscardUnknown() { - xxx_messageInfo_GENIDClaimList.DiscardUnknown(m) -} - -var xxx_messageInfo_GENIDClaimList proto.InternalMessageInfo - -func (m *GENIDClaimSpec) Reset() { *m = GENIDClaimSpec{} } -func (*GENIDClaimSpec) ProtoMessage() {} -func (*GENIDClaimSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_d30532fccb4b5b16, []int{2} -} -func (m *GENIDClaimSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GENIDClaimSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *GENIDClaimSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_GENIDClaimSpec.Merge(m, src) -} -func (m *GENIDClaimSpec) XXX_Size() int { - return m.Size() -} -func (m *GENIDClaimSpec) XXX_DiscardUnknown() { - xxx_messageInfo_GENIDClaimSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_GENIDClaimSpec proto.InternalMessageInfo - -func (m *GENIDClaimStatus) Reset() { *m = GENIDClaimStatus{} } -func (*GENIDClaimStatus) ProtoMessage() {} -func (*GENIDClaimStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_d30532fccb4b5b16, []int{3} -} -func (m *GENIDClaimStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GENIDClaimStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *GENIDClaimStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_GENIDClaimStatus.Merge(m, src) -} -func (m *GENIDClaimStatus) XXX_Size() int { - return m.Size() -} -func (m *GENIDClaimStatus) XXX_DiscardUnknown() { - xxx_messageInfo_GENIDClaimStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_GENIDClaimStatus proto.InternalMessageInfo - -func (m *GENIDDynamicIDSyntaxValidator) Reset() { *m = GENIDDynamicIDSyntaxValidator{} } -func (*GENIDDynamicIDSyntaxValidator) ProtoMessage() {} -func (*GENIDDynamicIDSyntaxValidator) Descriptor() ([]byte, []int) { - return fileDescriptor_d30532fccb4b5b16, []int{4} -} -func (m *GENIDDynamicIDSyntaxValidator) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GENIDDynamicIDSyntaxValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *GENIDDynamicIDSyntaxValidator) XXX_Merge(src proto.Message) { - xxx_messageInfo_GENIDDynamicIDSyntaxValidator.Merge(m, src) -} -func (m *GENIDDynamicIDSyntaxValidator) XXX_Size() int { - return m.Size() -} -func (m *GENIDDynamicIDSyntaxValidator) XXX_DiscardUnknown() { - xxx_messageInfo_GENIDDynamicIDSyntaxValidator.DiscardUnknown(m) -} - -var xxx_messageInfo_GENIDDynamicIDSyntaxValidator proto.InternalMessageInfo - -func (m *GENIDEntry) Reset() { *m = GENIDEntry{} } -func (*GENIDEntry) ProtoMessage() {} -func (*GENIDEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_d30532fccb4b5b16, []int{5} -} -func (m *GENIDEntry) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GENIDEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *GENIDEntry) XXX_Merge(src proto.Message) { - xxx_messageInfo_GENIDEntry.Merge(m, src) -} -func (m *GENIDEntry) XXX_Size() int { - return m.Size() -} -func (m *GENIDEntry) XXX_DiscardUnknown() { - xxx_messageInfo_GENIDEntry.DiscardUnknown(m) -} - -var xxx_messageInfo_GENIDEntry proto.InternalMessageInfo - -func (m *GENIDEntryList) Reset() { *m = GENIDEntryList{} } -func (*GENIDEntryList) ProtoMessage() {} -func (*GENIDEntryList) Descriptor() ([]byte, []int) { - return fileDescriptor_d30532fccb4b5b16, []int{6} -} -func (m *GENIDEntryList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GENIDEntryList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *GENIDEntryList) XXX_Merge(src proto.Message) { - xxx_messageInfo_GENIDEntryList.Merge(m, src) -} -func (m *GENIDEntryList) XXX_Size() int { - return m.Size() -} -func (m *GENIDEntryList) XXX_DiscardUnknown() { - xxx_messageInfo_GENIDEntryList.DiscardUnknown(m) -} - -var xxx_messageInfo_GENIDEntryList proto.InternalMessageInfo - -func (m *GENIDEntrySpec) Reset() { *m = GENIDEntrySpec{} } -func (*GENIDEntrySpec) ProtoMessage() {} -func (*GENIDEntrySpec) Descriptor() ([]byte, []int) { - return fileDescriptor_d30532fccb4b5b16, []int{7} -} -func (m *GENIDEntrySpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GENIDEntrySpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *GENIDEntrySpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_GENIDEntrySpec.Merge(m, src) -} -func (m *GENIDEntrySpec) XXX_Size() int { - return m.Size() -} -func (m *GENIDEntrySpec) XXX_DiscardUnknown() { - xxx_messageInfo_GENIDEntrySpec.DiscardUnknown(m) -} - -var xxx_messageInfo_GENIDEntrySpec proto.InternalMessageInfo - -func (m *GENIDEntryStatus) Reset() { *m = GENIDEntryStatus{} } -func (*GENIDEntryStatus) ProtoMessage() {} -func (*GENIDEntryStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_d30532fccb4b5b16, []int{8} -} -func (m *GENIDEntryStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GENIDEntryStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *GENIDEntryStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_GENIDEntryStatus.Merge(m, src) -} -func (m *GENIDEntryStatus) XXX_Size() int { - return m.Size() -} -func (m *GENIDEntryStatus) XXX_DiscardUnknown() { - xxx_messageInfo_GENIDEntryStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_GENIDEntryStatus proto.InternalMessageInfo - -func (m *GENIDIndex) Reset() { *m = GENIDIndex{} } -func (*GENIDIndex) ProtoMessage() {} -func (*GENIDIndex) Descriptor() ([]byte, []int) { - return fileDescriptor_d30532fccb4b5b16, []int{9} -} -func (m *GENIDIndex) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GENIDIndex) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *GENIDIndex) XXX_Merge(src proto.Message) { - xxx_messageInfo_GENIDIndex.Merge(m, src) -} -func (m *GENIDIndex) XXX_Size() int { - return m.Size() -} -func (m *GENIDIndex) XXX_DiscardUnknown() { - xxx_messageInfo_GENIDIndex.DiscardUnknown(m) -} - -var xxx_messageInfo_GENIDIndex proto.InternalMessageInfo - -func (m *GENIDIndexList) Reset() { *m = GENIDIndexList{} } -func (*GENIDIndexList) ProtoMessage() {} -func (*GENIDIndexList) Descriptor() ([]byte, []int) { - return fileDescriptor_d30532fccb4b5b16, []int{10} -} -func (m *GENIDIndexList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GENIDIndexList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *GENIDIndexList) XXX_Merge(src proto.Message) { - xxx_messageInfo_GENIDIndexList.Merge(m, src) -} -func (m *GENIDIndexList) XXX_Size() int { - return m.Size() -} -func (m *GENIDIndexList) XXX_DiscardUnknown() { - xxx_messageInfo_GENIDIndexList.DiscardUnknown(m) -} - -var xxx_messageInfo_GENIDIndexList proto.InternalMessageInfo - -func (m *GENIDIndexSpec) Reset() { *m = GENIDIndexSpec{} } -func (*GENIDIndexSpec) ProtoMessage() {} -func (*GENIDIndexSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_d30532fccb4b5b16, []int{11} -} -func (m *GENIDIndexSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GENIDIndexSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *GENIDIndexSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_GENIDIndexSpec.Merge(m, src) -} -func (m *GENIDIndexSpec) XXX_Size() int { - return m.Size() -} -func (m *GENIDIndexSpec) XXX_DiscardUnknown() { - xxx_messageInfo_GENIDIndexSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_GENIDIndexSpec proto.InternalMessageInfo - -func (m *GENIDIndexStatus) Reset() { *m = GENIDIndexStatus{} } -func (*GENIDIndexStatus) ProtoMessage() {} -func (*GENIDIndexStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_d30532fccb4b5b16, []int{12} -} -func (m *GENIDIndexStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GENIDIndexStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *GENIDIndexStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_GENIDIndexStatus.Merge(m, src) -} -func (m *GENIDIndexStatus) XXX_Size() int { - return m.Size() -} -func (m *GENIDIndexStatus) XXX_DiscardUnknown() { - xxx_messageInfo_GENIDIndexStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_GENIDIndexStatus proto.InternalMessageInfo - -func (m *GENIDRangeSyntaxValidator) Reset() { *m = GENIDRangeSyntaxValidator{} } -func (*GENIDRangeSyntaxValidator) ProtoMessage() {} -func (*GENIDRangeSyntaxValidator) Descriptor() ([]byte, []int) { - return fileDescriptor_d30532fccb4b5b16, []int{13} -} -func (m *GENIDRangeSyntaxValidator) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GENIDRangeSyntaxValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *GENIDRangeSyntaxValidator) XXX_Merge(src proto.Message) { - xxx_messageInfo_GENIDRangeSyntaxValidator.Merge(m, src) -} -func (m *GENIDRangeSyntaxValidator) XXX_Size() int { - return m.Size() -} -func (m *GENIDRangeSyntaxValidator) XXX_DiscardUnknown() { - xxx_messageInfo_GENIDRangeSyntaxValidator.DiscardUnknown(m) -} - -var xxx_messageInfo_GENIDRangeSyntaxValidator proto.InternalMessageInfo - -func (m *GENIDStaticIDSyntaxValidator) Reset() { *m = GENIDStaticIDSyntaxValidator{} } -func (*GENIDStaticIDSyntaxValidator) ProtoMessage() {} -func (*GENIDStaticIDSyntaxValidator) Descriptor() ([]byte, []int) { - return fileDescriptor_d30532fccb4b5b16, []int{14} -} -func (m *GENIDStaticIDSyntaxValidator) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GENIDStaticIDSyntaxValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *GENIDStaticIDSyntaxValidator) XXX_Merge(src proto.Message) { - xxx_messageInfo_GENIDStaticIDSyntaxValidator.Merge(m, src) -} -func (m *GENIDStaticIDSyntaxValidator) XXX_Size() int { - return m.Size() -} -func (m *GENIDStaticIDSyntaxValidator) XXX_DiscardUnknown() { - xxx_messageInfo_GENIDStaticIDSyntaxValidator.DiscardUnknown(m) -} - -var xxx_messageInfo_GENIDStaticIDSyntaxValidator proto.InternalMessageInfo - -func init() { - proto.RegisterType((*GENIDClaim)(nil), "github.com.kuidio.kuid.apis.backend.genid.v1alpha1.GENIDClaim") - proto.RegisterType((*GENIDClaimList)(nil), "github.com.kuidio.kuid.apis.backend.genid.v1alpha1.GENIDClaimList") - proto.RegisterType((*GENIDClaimSpec)(nil), "github.com.kuidio.kuid.apis.backend.genid.v1alpha1.GENIDClaimSpec") - proto.RegisterType((*GENIDClaimStatus)(nil), "github.com.kuidio.kuid.apis.backend.genid.v1alpha1.GENIDClaimStatus") - proto.RegisterType((*GENIDDynamicIDSyntaxValidator)(nil), "github.com.kuidio.kuid.apis.backend.genid.v1alpha1.GENIDDynamicIDSyntaxValidator") - proto.RegisterType((*GENIDEntry)(nil), "github.com.kuidio.kuid.apis.backend.genid.v1alpha1.GENIDEntry") - proto.RegisterType((*GENIDEntryList)(nil), "github.com.kuidio.kuid.apis.backend.genid.v1alpha1.GENIDEntryList") - proto.RegisterType((*GENIDEntrySpec)(nil), "github.com.kuidio.kuid.apis.backend.genid.v1alpha1.GENIDEntrySpec") - proto.RegisterType((*GENIDEntryStatus)(nil), "github.com.kuidio.kuid.apis.backend.genid.v1alpha1.GENIDEntryStatus") - proto.RegisterType((*GENIDIndex)(nil), "github.com.kuidio.kuid.apis.backend.genid.v1alpha1.GENIDIndex") - proto.RegisterType((*GENIDIndexList)(nil), "github.com.kuidio.kuid.apis.backend.genid.v1alpha1.GENIDIndexList") - proto.RegisterType((*GENIDIndexSpec)(nil), "github.com.kuidio.kuid.apis.backend.genid.v1alpha1.GENIDIndexSpec") - proto.RegisterType((*GENIDIndexStatus)(nil), "github.com.kuidio.kuid.apis.backend.genid.v1alpha1.GENIDIndexStatus") - proto.RegisterType((*GENIDRangeSyntaxValidator)(nil), "github.com.kuidio.kuid.apis.backend.genid.v1alpha1.GENIDRangeSyntaxValidator") - proto.RegisterType((*GENIDStaticIDSyntaxValidator)(nil), "github.com.kuidio.kuid.apis.backend.genid.v1alpha1.GENIDStaticIDSyntaxValidator") -} - -func init() { - proto.RegisterFile("github.com/kuidio/kuid/apis/backend/genid/v1alpha1/generated.proto", fileDescriptor_d30532fccb4b5b16) -} - -var fileDescriptor_d30532fccb4b5b16 = []byte{ - // 923 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x57, 0x4f, 0x6f, 0x1b, 0x45, - 0x14, 0xf7, 0xae, 0xb3, 0x51, 0x3d, 0x81, 0xa8, 0x59, 0x24, 0xe4, 0x06, 0x58, 0x47, 0xee, 0xa5, - 0x97, 0xce, 0x92, 0x08, 0xa1, 0x4a, 0x95, 0x22, 0xb1, 0xd9, 0x08, 0x59, 0xa2, 0x54, 0x9a, 0x16, - 0x84, 0x50, 0x0f, 0x1d, 0xef, 0x4e, 0x9c, 0xc1, 0xde, 0x3f, 0xda, 0x1d, 0x87, 0xf8, 0xc6, 0x0d, - 0xc4, 0x89, 0x6f, 0xc0, 0x91, 0x4f, 0xc1, 0x85, 0x53, 0x8e, 0x95, 0xb8, 0xf4, 0x64, 0x61, 0xf3, - 0x2d, 0x38, 0x20, 0x34, 0x6f, 0xc6, 0xde, 0xc5, 0xae, 0x8d, 0x4d, 0x20, 0xe0, 0x93, 0x33, 0x6f, - 0xde, 0xfb, 0xfd, 0xe6, 0xbd, 0x79, 0xef, 0xb7, 0x13, 0xe4, 0x75, 0xb8, 0x38, 0xef, 0xb7, 0x71, - 0x90, 0x44, 0x6e, 0xb7, 0xcf, 0x43, 0x9e, 0xc0, 0x8f, 0x4b, 0x53, 0x9e, 0xbb, 0x6d, 0x1a, 0x74, - 0x59, 0x1c, 0xba, 0x1d, 0x16, 0xf3, 0xd0, 0xbd, 0x38, 0xa4, 0xbd, 0xf4, 0x9c, 0x1e, 0xca, 0x25, - 0xcb, 0xa8, 0x60, 0x21, 0x4e, 0xb3, 0x44, 0x24, 0xf6, 0x51, 0x81, 0x81, 0x15, 0x06, 0xfc, 0x60, - 0x89, 0x81, 0x35, 0x06, 0x06, 0x0c, 0x3c, 0xc1, 0xd8, 0xbf, 0x5f, 0xe2, 0xed, 0x24, 0x9d, 0xc4, - 0x05, 0xa8, 0x76, 0xff, 0x0c, 0x56, 0xb0, 0x80, 0xbf, 0x14, 0xc5, 0xfe, 0xc3, 0x65, 0xc7, 0x0c, - 0x92, 0x28, 0x4a, 0xe2, 0x85, 0xe7, 0xdb, 0x3f, 0x5e, 0x1e, 0x1c, 0x87, 0x5c, 0xf0, 0x65, 0xf1, - 0xef, 0x75, 0x1f, 0xe4, 0x98, 0x27, 0xd2, 0x3f, 0xa2, 0xc1, 0x39, 0x8f, 0x59, 0x36, 0x70, 0xd3, - 0x6e, 0x47, 0x01, 0x44, 0x4c, 0x50, 0xf7, 0x62, 0x3e, 0xea, 0xfd, 0x45, 0x51, 0x59, 0x3f, 0x16, - 0x3c, 0x62, 0x6e, 0x1e, 0x9c, 0xb3, 0x88, 0xce, 0xc6, 0x35, 0x7f, 0x32, 0x11, 0xfa, 0xf0, 0xf4, - 0xe3, 0x96, 0x7f, 0xd2, 0xa3, 0x3c, 0xb2, 0x9f, 0xa3, 0x5b, 0x92, 0x21, 0xa4, 0x82, 0xd6, 0x8d, - 0x03, 0xe3, 0xde, 0xce, 0xd1, 0xbb, 0x58, 0x21, 0xe3, 0x32, 0x32, 0x4e, 0xbb, 0x1d, 0x55, 0x70, - 0xe9, 0x8d, 0x2f, 0x0e, 0xf1, 0xe3, 0xf6, 0x17, 0x2c, 0x10, 0x8f, 0x98, 0xa0, 0x9e, 0x7d, 0x35, - 0x6c, 0x54, 0xc6, 0xc3, 0x06, 0x2a, 0x6c, 0x64, 0x8a, 0x6a, 0x87, 0x68, 0x2b, 0x4f, 0x59, 0x50, - 0x37, 0x01, 0xdd, 0xc3, 0xeb, 0xdf, 0x26, 0x2e, 0xce, 0xfb, 0x24, 0x65, 0x81, 0xf7, 0x9a, 0xe6, - 0xdb, 0x92, 0x2b, 0x02, 0xe8, 0x76, 0x0f, 0x6d, 0xe7, 0x82, 0x8a, 0x7e, 0x5e, 0xaf, 0x02, 0x8f, - 0x7f, 0x4d, 0x1e, 0xc0, 0xf2, 0x76, 0x35, 0xd3, 0xb6, 0x5a, 0x13, 0xcd, 0xd1, 0xfc, 0xd9, 0x40, - 0xbb, 0x85, 0xf3, 0x47, 0x3c, 0x17, 0xf6, 0xb3, 0xb9, 0x42, 0xe2, 0xd5, 0x0a, 0x29, 0xa3, 0xa1, - 0x8c, 0xb7, 0x35, 0xd9, 0xad, 0x89, 0xa5, 0x54, 0xc4, 0x00, 0x59, 0x5c, 0xb0, 0x28, 0xaf, 0x9b, - 0x07, 0xd5, 0x7b, 0x3b, 0x47, 0xc7, 0xd7, 0xcb, 0xce, 0x7b, 0x5d, 0x53, 0x59, 0x2d, 0x09, 0x4a, - 0x14, 0x76, 0xf3, 0x47, 0xb3, 0x9c, 0x95, 0x2c, 0xae, 0x7d, 0x17, 0x59, 0x3c, 0x0e, 0xd9, 0x25, - 0xa4, 0x54, 0x2b, 0xc5, 0x49, 0x23, 0x51, 0x7b, 0xf6, 0x9b, 0xc8, 0xe4, 0x21, 0xdc, 0x6f, 0xd5, - 0xdb, 0x1e, 0x0f, 0x1b, 0x66, 0xcb, 0x27, 0x26, 0x0f, 0xed, 0x06, 0xb2, 0x32, 0x1a, 0x77, 0x18, - 0x5c, 0x49, 0xcd, 0xab, 0xc9, 0x40, 0x22, 0x0d, 0x44, 0xd9, 0xed, 0x04, 0xed, 0x04, 0x50, 0x40, - 0xda, 0x66, 0xbd, 0xbc, 0xbe, 0x05, 0x65, 0x7b, 0xb0, 0x34, 0x37, 0x35, 0x8c, 0x45, 0x52, 0x27, - 0x45, 0xbc, 0xf7, 0x86, 0x3e, 0xdd, 0x4e, 0xc9, 0x48, 0xca, 0x0c, 0xf6, 0x33, 0x64, 0x25, 0x5f, - 0xc6, 0x2c, 0xab, 0x5b, 0x40, 0xf5, 0x70, 0x2d, 0xaa, 0xc7, 0x32, 0x92, 0xb0, 0x33, 0x96, 0xb1, - 0x38, 0x60, 0x2a, 0x1d, 0x65, 0x53, 0xa0, 0xcd, 0x6f, 0x4c, 0x74, 0x7b, 0xb6, 0x85, 0xec, 0x6f, - 0x0d, 0xb4, 0x37, 0x15, 0x01, 0x16, 0x2a, 0xab, 0xee, 0x90, 0x0f, 0xfe, 0x82, 0x5f, 0x47, 0x95, - 0xb2, 0x9d, 0x05, 0xf2, 0xee, 0xe8, 0x9c, 0xf7, 0xe6, 0xb6, 0xc8, 0x3c, 0xed, 0xdf, 0xbf, 0x29, - 0x8c, 0x10, 0xbb, 0x4c, 0x79, 0x36, 0x78, 0xca, 0x23, 0x06, 0x17, 0x55, 0xf3, 0x76, 0xe5, 0xc8, - 0x9f, 0x4e, 0xad, 0xa4, 0xe4, 0xd1, 0x6c, 0xa0, 0x77, 0xa0, 0x12, 0xfe, 0x20, 0xa6, 0x11, 0x0f, - 0x5a, 0xfe, 0x93, 0x41, 0x2c, 0xe8, 0xe5, 0xa7, 0xb4, 0xc7, 0x43, 0x2a, 0x92, 0xac, 0x90, 0xa1, - 0xd3, 0x58, 0x64, 0x83, 0x0d, 0x92, 0x21, 0x38, 0xef, 0x0d, 0xc8, 0x90, 0xe2, 0x59, 0x51, 0x86, - 0xc0, 0x79, 0x93, 0x64, 0x08, 0x0e, 0xbc, 0x40, 0x86, 0x7e, 0xa8, 0x96, 0xb3, 0x5a, 0x5d, 0x86, - 0x9e, 0xa3, 0x1a, 0xcc, 0xfa, 0xd3, 0x41, 0xca, 0xe0, 0x9a, 0x6b, 0x9e, 0xa7, 0x1d, 0x6b, 0x27, - 0x93, 0x8d, 0xdf, 0x86, 0x8d, 0xfb, 0x2b, 0xbc, 0x49, 0xf0, 0x34, 0x80, 0x14, 0xa0, 0xf6, 0x3e, - 0x8c, 0x8f, 0x9a, 0x11, 0xa4, 0xa1, 0x27, 0x23, 0x74, 0xe3, 0x5a, 0x76, 0x17, 0x59, 0xb0, 0x04, - 0x2d, 0x2b, 0xd5, 0x04, 0x02, 0x88, 0xda, 0x2b, 0x04, 0x6f, 0xfb, 0xdf, 0x10, 0xbc, 0xef, 0x0d, - 0x2d, 0x78, 0xa5, 0x66, 0xfd, 0x5f, 0x09, 0x5e, 0x21, 0x33, 0x2d, 0xdd, 0x22, 0x9b, 0x22, 0x33, - 0x70, 0xde, 0x1b, 0x90, 0x19, 0xc5, 0xb3, 0xa2, 0xcc, 0x80, 0xf3, 0x26, 0xc9, 0x0c, 0x1c, 0x78, - 0x81, 0xcc, 0xfc, 0xfe, 0xa7, 0xac, 0x40, 0x66, 0x1a, 0xc8, 0x8a, 0x78, 0xdc, 0xf2, 0x21, 0xa5, - 0xaa, 0x6a, 0xf8, 0x47, 0xd2, 0x40, 0x94, 0x1d, 0x1c, 0xe8, 0x65, 0xcb, 0xd7, 0x9f, 0x50, 0xe5, - 0x20, 0x0d, 0x44, 0xd9, 0xed, 0xaf, 0x0d, 0xb4, 0xd7, 0xcf, 0x59, 0xe6, 0xb3, 0x33, 0x1e, 0xb3, - 0x50, 0x8b, 0x81, 0xba, 0xa4, 0xe3, 0xb5, 0x86, 0xef, 0x93, 0x59, 0x94, 0xa2, 0xf3, 0xe7, 0xb6, - 0xc8, 0x3c, 0xa7, 0x7d, 0x80, 0xb6, 0x84, 0x14, 0x42, 0xf5, 0xad, 0x9e, 0x36, 0x11, 0x48, 0x1a, - 0xec, 0x34, 0x47, 0x93, 0xe9, 0x2d, 0xf5, 0xc0, 0x3f, 0x50, 0x82, 0x57, 0xcf, 0x7f, 0xf5, 0xbf, - 0x99, 0xff, 0xb7, 0xd0, 0x1d, 0x48, 0x11, 0x1e, 0x33, 0xb3, 0x6f, 0x10, 0x07, 0xbd, 0x0d, 0x9b, - 0xd2, 0xf7, 0x15, 0x6f, 0x14, 0xef, 0xb3, 0xab, 0x91, 0x53, 0x79, 0x31, 0x72, 0x2a, 0x2f, 0x47, - 0x4e, 0xe5, 0xab, 0xb1, 0x63, 0x5c, 0x8d, 0x1d, 0xe3, 0xc5, 0xd8, 0x31, 0x5e, 0x8e, 0x1d, 0xe3, - 0x97, 0xb1, 0x63, 0x7c, 0xf7, 0xab, 0x53, 0xf9, 0xfc, 0x68, 0xfd, 0x7f, 0x71, 0xff, 0x08, 0x00, - 0x00, 0xff, 0xff, 0x5e, 0x80, 0xc7, 0x61, 0x17, 0x0f, 0x00, 0x00, -} - -func (m *GENIDClaim) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GENIDClaim) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GENIDClaim) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *GENIDClaimList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GENIDClaimList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GENIDClaimList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *GENIDClaimSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GENIDClaimSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GENIDClaimSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Owner != nil { - { - size, err := m.Owner.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - { - size, err := m.ClaimLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - if m.Range != nil { - i -= len(*m.Range) - copy(dAtA[i:], *m.Range) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Range))) - i-- - dAtA[i] = 0x1a - } - if m.ID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.ID)) - i-- - dAtA[i] = 0x10 - } - i -= len(m.Index) - copy(dAtA[i:], m.Index) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Index))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *GENIDClaimStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GENIDClaimStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GENIDClaimStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ExpiryTime != nil { - i -= len(*m.ExpiryTime) - copy(dAtA[i:], *m.ExpiryTime) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ExpiryTime))) - i-- - dAtA[i] = 0x22 - } - if m.Range != nil { - i -= len(*m.Range) - copy(dAtA[i:], *m.Range) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Range))) - i-- - dAtA[i] = 0x1a - } - if m.ID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.ID)) - i-- - dAtA[i] = 0x10 - } - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *GENIDDynamicIDSyntaxValidator) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GENIDDynamicIDSyntaxValidator) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GENIDDynamicIDSyntaxValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *GENIDEntry) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GENIDEntry) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GENIDEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *GENIDEntryList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GENIDEntryList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GENIDEntryList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *GENIDEntrySpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GENIDEntrySpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GENIDEntrySpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Owner != nil { - { - size, err := m.Owner.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - i -= len(m.Claim) - copy(dAtA[i:], m.Claim) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Claim))) - i-- - dAtA[i] = 0x2a - { - size, err := m.ClaimLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - i -= len(m.ID) - copy(dAtA[i:], m.ID) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.ID))) - i-- - dAtA[i] = 0x1a - i -= len(m.ClaimType) - copy(dAtA[i:], m.ClaimType) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.ClaimType))) - i-- - dAtA[i] = 0x12 - i -= len(m.Index) - copy(dAtA[i:], m.Index) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Index))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *GENIDEntryStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GENIDEntryStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GENIDEntryStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *GENIDIndex) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GENIDIndex) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GENIDIndex) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *GENIDIndexList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GENIDIndexList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GENIDIndexList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *GENIDIndexSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GENIDIndexSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GENIDIndexSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0x22 - { - size, err := m.UserDefinedLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if m.MaxID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MaxID)) - i-- - dAtA[i] = 0x10 - } - if m.MinID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MinID)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *GENIDIndexStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GENIDIndexStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GENIDIndexStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if m.MaxID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MaxID)) - i-- - dAtA[i] = 0x10 - } - if m.MinID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MinID)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *GENIDRangeSyntaxValidator) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GENIDRangeSyntaxValidator) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GENIDRangeSyntaxValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *GENIDStaticIDSyntaxValidator) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GENIDStaticIDSyntaxValidator) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GENIDStaticIDSyntaxValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { - offset -= sovGenerated(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *GENIDClaim) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *GENIDClaimList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *GENIDClaimSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Index) - n += 1 + l + sovGenerated(uint64(l)) - if m.ID != nil { - n += 1 + sovGenerated(uint64(*m.ID)) - } - if m.Range != nil { - l = len(*m.Range) - n += 1 + l + sovGenerated(uint64(l)) - } - l = m.ClaimLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.Owner != nil { - l = m.Owner.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *GENIDClaimStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.ID != nil { - n += 1 + sovGenerated(uint64(*m.ID)) - } - if m.Range != nil { - l = len(*m.Range) - n += 1 + l + sovGenerated(uint64(l)) - } - if m.ExpiryTime != nil { - l = len(*m.ExpiryTime) - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *GENIDDynamicIDSyntaxValidator) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *GENIDEntry) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *GENIDEntryList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *GENIDEntrySpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Index) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.ClaimType) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.ID) - n += 1 + l + sovGenerated(uint64(l)) - l = m.ClaimLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Claim) - n += 1 + l + sovGenerated(uint64(l)) - if m.Owner != nil { - l = m.Owner.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *GENIDEntryStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *GENIDIndex) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *GENIDIndexList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *GENIDIndexSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MinID != nil { - n += 1 + sovGenerated(uint64(*m.MinID)) - } - if m.MaxID != nil { - n += 1 + sovGenerated(uint64(*m.MaxID)) - } - l = m.UserDefinedLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Type) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *GENIDIndexStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MinID != nil { - n += 1 + sovGenerated(uint64(*m.MinID)) - } - if m.MaxID != nil { - n += 1 + sovGenerated(uint64(*m.MaxID)) - } - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *GENIDRangeSyntaxValidator) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *GENIDStaticIDSyntaxValidator) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func sovGenerated(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenerated(x uint64) (n int) { - return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *GENIDClaim) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&GENIDClaim{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "GENIDClaimSpec", "GENIDClaimSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "GENIDClaimStatus", "GENIDClaimStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *GENIDClaimList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]GENIDClaim{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "GENIDClaim", "GENIDClaim", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&GENIDClaimList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *GENIDClaimSpec) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&GENIDClaimSpec{`, - `Index:` + fmt.Sprintf("%v", this.Index) + `,`, - `ID:` + valueToStringGenerated(this.ID) + `,`, - `Range:` + valueToStringGenerated(this.Range) + `,`, - `ClaimLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ClaimLabels), "ClaimLabels", "v1alpha1.ClaimLabels", 1), `&`, ``, 1) + `,`, - `Owner:` + strings.Replace(fmt.Sprintf("%v", this.Owner), "OwnerReference", "v1alpha1.OwnerReference", 1) + `,`, - `}`, - }, "") - return s -} -func (this *GENIDClaimStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&GENIDClaimStatus{`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `ID:` + valueToStringGenerated(this.ID) + `,`, - `Range:` + valueToStringGenerated(this.Range) + `,`, - `ExpiryTime:` + valueToStringGenerated(this.ExpiryTime) + `,`, - `}`, - }, "") - return s -} -func (this *GENIDDynamicIDSyntaxValidator) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&GENIDDynamicIDSyntaxValidator{`, - `}`, - }, "") - return s -} -func (this *GENIDEntry) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&GENIDEntry{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "GENIDEntrySpec", "GENIDEntrySpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "GENIDEntryStatus", "GENIDEntryStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *GENIDEntryList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]GENIDEntry{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "GENIDEntry", "GENIDEntry", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&GENIDEntryList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *GENIDEntrySpec) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&GENIDEntrySpec{`, - `Index:` + fmt.Sprintf("%v", this.Index) + `,`, - `ClaimType:` + fmt.Sprintf("%v", this.ClaimType) + `,`, - `ID:` + fmt.Sprintf("%v", this.ID) + `,`, - `ClaimLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ClaimLabels), "ClaimLabels", "v1alpha1.ClaimLabels", 1), `&`, ``, 1) + `,`, - `Claim:` + fmt.Sprintf("%v", this.Claim) + `,`, - `Owner:` + strings.Replace(fmt.Sprintf("%v", this.Owner), "OwnerReference", "v1alpha1.OwnerReference", 1) + `,`, - `}`, - }, "") - return s -} -func (this *GENIDEntryStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&GENIDEntryStatus{`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *GENIDIndex) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&GENIDIndex{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "GENIDIndexSpec", "GENIDIndexSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "GENIDIndexStatus", "GENIDIndexStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *GENIDIndexList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]GENIDIndex{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "GENIDIndex", "GENIDIndex", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&GENIDIndexList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *GENIDIndexSpec) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&GENIDIndexSpec{`, - `MinID:` + valueToStringGenerated(this.MinID) + `,`, - `MaxID:` + valueToStringGenerated(this.MaxID) + `,`, - `UserDefinedLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.UserDefinedLabels), "UserDefinedLabels", "v1alpha1.UserDefinedLabels", 1), `&`, ``, 1) + `,`, - `Type:` + fmt.Sprintf("%v", this.Type) + `,`, - `}`, - }, "") - return s -} -func (this *GENIDIndexStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&GENIDIndexStatus{`, - `MinID:` + valueToStringGenerated(this.MinID) + `,`, - `MaxID:` + valueToStringGenerated(this.MaxID) + `,`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *GENIDRangeSyntaxValidator) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&GENIDRangeSyntaxValidator{`, - `}`, - }, "") - return s -} -func (this *GENIDStaticIDSyntaxValidator) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&GENIDStaticIDSyntaxValidator{`, - `}`, - }, "") - return s -} -func valueToStringGenerated(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *GENIDClaim) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GENIDClaim: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GENIDClaim: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GENIDClaimList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GENIDClaimList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GENIDClaimList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, GENIDClaim{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GENIDClaimSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GENIDClaimSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GENIDClaimSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Index = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ID = &v - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Range", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Range = &s - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ClaimLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Owner == nil { - m.Owner = &v1alpha1.OwnerReference{} - } - if err := m.Owner.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GENIDClaimStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GENIDClaimStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GENIDClaimStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ID = &v - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Range", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Range = &s - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExpiryTime", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.ExpiryTime = &s - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GENIDDynamicIDSyntaxValidator) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GENIDDynamicIDSyntaxValidator: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GENIDDynamicIDSyntaxValidator: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GENIDEntry) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GENIDEntry: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GENIDEntry: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GENIDEntryList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GENIDEntryList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GENIDEntryList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, GENIDEntry{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GENIDEntrySpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GENIDEntrySpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GENIDEntrySpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Index = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClaimType = github_com_kuidio_kuid_apis_backend.ClaimType(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ClaimLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Claim", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Claim = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Owner == nil { - m.Owner = &v1alpha1.OwnerReference{} - } - if err := m.Owner.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GENIDEntryStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GENIDEntryStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GENIDEntryStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GENIDIndex) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GENIDIndex: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GENIDIndex: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GENIDIndexList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GENIDIndexList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GENIDIndexList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, GENIDIndex{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GENIDIndexSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GENIDIndexSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GENIDIndexSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinID", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MinID = &v - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxID", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MaxID = &v - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UserDefinedLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.UserDefinedLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GENIDIndexStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GENIDIndexStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GENIDIndexStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinID", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MinID = &v - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxID", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MaxID = &v - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GENIDRangeSyntaxValidator) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GENIDRangeSyntaxValidator: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GENIDRangeSyntaxValidator: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GENIDStaticIDSyntaxValidator) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GENIDStaticIDSyntaxValidator: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GENIDStaticIDSyntaxValidator: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenerated(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenerated - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenerated - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenerated - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") -) diff --git a/apis/backend/genid/v1alpha1/generated.proto b/apis/backend/genid/v1alpha1/generated.proto deleted file mode 100644 index 667648e..0000000 --- a/apis/backend/genid/v1alpha1/generated.proto +++ /dev/null @@ -1,201 +0,0 @@ -/* -Copyright 2024 Nokia. - -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. -*/ -// This file was autogenerated by go-to-protobuf. Do not edit it manually! - -syntax = "proto2"; - -package github.com.kuidio.kuid.apis.backend.genid.v1alpha1; - -import "github.com/kuidio/kuid/apis/common/v1alpha1/generated.proto"; -import "github.com/kuidio/kuid/apis/condition/v1alpha1/generated.proto"; -import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; -import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; - -// Package-wide variables from generator "generated". -option go_package = "github.com/kuidio/kuid/apis/backend/genid/v1alpha1"; - -// GENIDClaim is the Schema for the GENIDClaim API -// -// +k8s:openapi-gen=true -message GENIDClaim { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional GENIDClaimSpec spec = 2; - - optional GENIDClaimStatus status = 3; -} - -// GENIDClaimList contains a list of GENIDClaims -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message GENIDClaimList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated GENIDClaim items = 2; -} - -// GENIDClaimSpec defines the dGENIDred state of GENIDClaim -message GENIDClaimSpec { - // GENIDIndex defines the GENID index for the GENID Claim - optional string index = 1; - - // GENIDID defines the GENID for the GENID claim - optional int64 id = 2; - - // Range defines the GENID range for the GENID claim - // The following notation is used: start-end - - // the GENIDs in the range must be consecutive - optional string range = 3; - - // ClaimLabels define the user defined labels and selector labels used - // in resource claim - optional github.com.kuidio.kuid.apis.common.v1alpha1.ClaimLabels claimLabels = 4; - - // Owner defines the ownerReference of the GENIDClaim - // Allow for different namesapces, hence it is part of the spec - optional github.com.kuidio.kuid.apis.common.v1alpha1.OwnerReference owner = 5; -} - -// GENIDClaimStatus defines the observed state of GENIDClaim -message GENIDClaimStatus { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 1; - - // GENIDID defines the GENID for the GENID claim - // +optional - optional int64 id = 2; - - // GENIDRange defines the GENID range for the GENID claim - // +optional - optional string range = 3; - - // ExpiryTime defines when the claim expires - // +kubebuilder:validation:Optional - // +optional - optional string expiryTime = 4; -} - -message GENIDDynamicIDSyntaxValidator { -} - -// GENIDEntry is the Schema for the GENIDentry API -// -// +k8s:openapi-gen=true -message GENIDEntry { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional GENIDEntrySpec spec = 2; - - optional GENIDEntryStatus status = 3; -} - -// GENIDEntryList contains a list of GENIDEntries -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message GENIDEntryList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated GENIDEntry items = 2; -} - -// GENIDEntrySpec defines the dGENIDred state of GENIDEntry -message GENIDEntrySpec { - // GENIDIndex defines the GENID index for the GENID Claim - optional string index = 1; - - // ClaimType defines the claimType of the GENID Entry - optional string claimType = 2; - - // ID defines the id of the GENID entry in the tree - optional string id = 3; - - // ClaimLabels define the user defined labels and selector labels used - // in resource claim - optional github.com.kuidio.kuid.apis.common.v1alpha1.ClaimLabels claimLabels = 4; - - // Claim defines the name of the claim that is the origin of this entry - optional string claim = 5; - - // Owner defines the ownerReference of the GENIDClaim - // Allow for different namesapces, hence it is part of the spec - optional github.com.kuidio.kuid.apis.common.v1alpha1.OwnerReference owner = 6; -} - -// GENIDEntryStatus defines the observed state of GENIDEntry -message GENIDEntryStatus { - // ConditionedStatus provides the status of the GENIDEntry using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 1; -} - -// GENIDIndex is the Schema for the GENIDIndex API -// -// +k8s:openapi-gen=true -message GENIDIndex { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional GENIDIndexSpec spec = 2; - - optional GENIDIndexStatus status = 3; -} - -// GENIDIndexList contains a list of GENIDIndexs -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message GENIDIndexList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated GENIDIndex items = 2; -} - -// GENIDIndexSpec defines the dGENIDred state of GENIDIndex -message GENIDIndexSpec { - // MinID defines the min GENID ID the index supports - // +optional - optional int64 minID = 1; - - // MaxID defines the max GENID ID the index supports - // +optional - optional int64 maxID = 2; - - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - optional github.com.kuidio.kuid.apis.common.v1alpha1.UserDefinedLabels userDefinedLabels = 3; - - // Type defines the type of the GENID - // 16bit, 32bit, 48bit, 64bit - optional string type = 4; -} - -// GENIDIndexStatus defines the observed state of GENIDIndex -message GENIDIndexStatus { - // MinID defines the min GENID ID the index supports - // +optional - optional int64 minID = 1; - - // MaxID defines the max GENID ID the index supports - // +optional - optional int64 maxID = 2; - - // ConditionedStatus provides the status of the GENIDIndex using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 3; -} - -message GENIDRangeSyntaxValidator { -} - -message GENIDStaticIDSyntaxValidator { -} - diff --git a/apis/backend/genid/v1alpha1/genid_types.go b/apis/backend/genid/v1alpha1/genid_types.go deleted file mode 100644 index 4390f69..0000000 --- a/apis/backend/genid/v1alpha1/genid_types.go +++ /dev/null @@ -1,42 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -type GENIDType string - -const ( - GENIDType_Invalid GENIDType = "invalid" - GENIDType_16bit GENIDType = "16bit" - GENIDType_32bit GENIDType = "32bit" - GENIDType_48bit GENIDType = "48bit" - GENIDType_64bit GENIDType = "64bit" -) - -func GetGenIDType(s string) GENIDType { - switch s { - case string(GENIDType_16bit): - return GENIDType_16bit - case string(GENIDType_32bit): - return GENIDType_32bit - case string(GENIDType_48bit): - return GENIDType_48bit - case string(GENIDType_64bit): - return GENIDType_64bit - default: - return GENIDType_Invalid - } -} diff --git a/apis/backend/genid/v1alpha1/genidclaim_interface.go b/apis/backend/genid/v1alpha1/genidclaim_interface.go deleted file mode 100644 index 27e3a8c..0000000 --- a/apis/backend/genid/v1alpha1/genidclaim_interface.go +++ /dev/null @@ -1,594 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "crypto/sha1" - "encoding/json" - "errors" - "fmt" - "strconv" - "strings" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/idxtable/pkg/table" - "github.com/henderiw/idxtable/pkg/table/table16" - "github.com/henderiw/idxtable/pkg/table/table32" - "github.com/henderiw/idxtable/pkg/table/table64" - "github.com/henderiw/idxtable/pkg/tree" - "github.com/henderiw/idxtable/pkg/tree/id16" - "github.com/henderiw/idxtable/pkg/tree/id32" - "github.com/henderiw/idxtable/pkg/tree/id64" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/selection" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" - "k8s.io/utils/ptr" -) - -const GENIDClaimPlural = "genidclaims" -const GENIDClaimSingular = "genidclaim" -const GENIDID_Min = 0 - -var GENIDID_MaxBits = map[GENIDType]int{ - GENIDType_Invalid: 0, - GENIDType_16bit: 16, - GENIDType_32bit: 32, - GENIDType_48bit: 48, - GENIDType_64bit: 63, // workaround for apiserver issue with uint64 -} - -var GENIDID_MaxValue = map[GENIDType]int64{ - GENIDType_Invalid: 0, - GENIDType_16bit: 1< 1 { - return backend.ClaimType_Invalid - } - if count == 0 { - return backend.ClaimType_DynamicID - } - return claimType -} - -func (r *GENIDClaim) ValidateGENIDClaimType() error { - var sb strings.Builder - count := 0 - if r.Spec.ID != nil { - sb.WriteString(fmt.Sprintf("id: %d", *r.Spec.ID)) - count++ - - } - if r.Spec.Range != nil { - if count > 0 { - sb.WriteString(", ") - } - sb.WriteString(fmt.Sprintf("range: %s", *r.Spec.Range)) - count++ - - } - if count > 1 { - return fmt.Errorf("a claim can only have 1 type, got %s", sb.String()) - } - return nil -} - -func validateGENIDID(genidType GENIDType, id int64) error { - if id < GENIDID_Min { - return fmt.Errorf("invalid id, got %d", id) - } - if id > GENIDID_MaxValue[genidType] { - return fmt.Errorf("invalid id, got %d", id) - } - return nil -} - -func (r *GENIDClaim) ValidateGENIDID(genidType GENIDType) error { - if r.Spec.ID == nil { - return fmt.Errorf("no id provided") - } - if err := validateGENIDID(genidType, *r.Spec.ID); err != nil { - return fmt.Errorf("invalid id err %s", err.Error()) - } - return nil -} - -func (r *GENIDClaim) GetGENIDRange() (int, int) { - if r.Spec.Range == nil { - return 0, 0 - } - parts := strings.SplitN(*r.Spec.Range, "-", 2) - if len(parts) != 2 { - return 0, 0 - } - start, err := strconv.Atoi(parts[0]) - if err != nil { - return 0, 0 - } - end, err := strconv.Atoi(parts[1]) - if err != nil { - return 0, 0 - } - return start, end -} - -func (r *GENIDClaim) ValidateGENIDRange(genidType GENIDType) error { - if r.Spec.Range == nil { - return fmt.Errorf("no GENID range provided") - } - parts := strings.SplitN(*r.Spec.Range, "-", 2) - if len(parts) != 2 { - return fmt.Errorf("invalid GENID range, expected -, got: %s", *r.Spec.Range) - } - var errm error - start, err := strconv.Atoi(parts[0]) - if err != nil { - errm = errors.Join(errm, fmt.Errorf("invalid GENID range start, got: %s, err: %s", *r.Spec.Range, err.Error())) - } - end, err := strconv.Atoi(parts[1]) - if err != nil { - errm = errors.Join(errm, fmt.Errorf("invalid GENID range end, got: %s, err: %s", *r.Spec.Range, err.Error())) - } - if errm != nil { - return errm - } - if start > end { - errm = errors.Join(errm, fmt.Errorf("invalid GENID range start > end %s", *r.Spec.Range)) - } - if err := validateGENIDID(genidType, int64(start)); err != nil { - errm = errors.Join(errm, fmt.Errorf("invalid GENID start err %s", err.Error())) - } - if err := validateGENIDID(genidType, int64(end)); err != nil { - errm = errors.Join(errm, fmt.Errorf("invalid GENID end err %s", err.Error())) - } - return errm -} - -func (r *GENIDClaim) ValidateSyntax(s string) field.ErrorList { - var allErrs field.ErrorList - - gv, err := schema.ParseGroupVersion(r.APIVersion) - if err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("apiVersion"), - r, - fmt.Errorf("invalid apiVersion: err: %s", err.Error()).Error(), - )) - return allErrs - } - - // this is for user convenience - if r.Spec.Owner == nil { - r.Spec.Owner = &commonv1alpha1.OwnerReference{ - Group: gv.Group, - Version: gv.Version, - Kind: r.Kind, - Namespace: r.Namespace, - Name: r.Name, - } - } - - if err := r.ValidateGENIDClaimType(); err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath(""), - r, - err.Error(), - )) - return allErrs - } - var v SyntaxValidator - claimType := r.GetClaimType() - switch claimType { - case backend.ClaimType_DynamicID: - v = &GENIDDynamicIDSyntaxValidator{name: string(claimType)} - case backend.ClaimType_StaticID: - v = &GENIDStaticIDSyntaxValidator{name: string(claimType)} - case backend.ClaimType_Range: - v = &GENIDRangeSyntaxValidator{name: string(claimType)} - default: - return allErrs - } - return v.Validate(r, GetGenIDType(s)) -} - -func (r *GENIDClaim) ValidateOwner(labels labels.Set) error { - routeClaimName := labels[backend.KuidClaimNameKey] - routeOwner := commonv1alpha1.OwnerReference{ - Group: labels[backend.KuidOwnerGroupKey], - Version: labels[backend.KuidOwnerVersionKey], - Kind: labels[backend.KuidOwnerKindKey], - Namespace: labels[backend.KuidOwnerNamespaceKey], - Name: labels[backend.KuidOwnerNameKey], - } - if (r.Spec.Owner != nil && *r.Spec.Owner != routeOwner) || r.Name != routeClaimName { - return fmt.Errorf("route owned by different claim got name %s/%s owner %s/%s", - r.Name, - routeClaimName, - r.Spec.Owner.String(), - routeOwner.String(), - ) - } - return nil -} - -// GetLabelSelector returns a labels selector based on the label selector -func (r *GENIDClaim) GetLabelSelector() (labels.Selector, error) { - return r.Spec.GetLabelSelector() -} - -func (r *GENIDClaim) GetClaimLabels() labels.Set { - labels := r.Spec.GetUserDefinedLabels() - // system defined labels - labels[backend.KuidClaimTypeKey] = string(r.GetClaimType()) - labels[backend.KuidClaimNameKey] = r.Name - labels[backend.KuidOwnerGroupKey] = r.Spec.Owner.Group - labels[backend.KuidOwnerVersionKey] = r.Spec.Owner.Version - labels[backend.KuidOwnerKindKey] = r.Spec.Owner.Kind - labels[backend.KuidOwnerNamespaceKey] = r.Spec.Owner.Namespace - labels[backend.KuidOwnerNameKey] = r.Spec.Owner.Name - return labels -} - -// GetOwnerSelector returns a label selector to select the owner of the claim in the backend -func (r *GENIDClaim) GetOwnerSelector() (labels.Selector, error) { - l := map[string]string{ - backend.KuidOwnerGroupKey: r.Spec.Owner.Group, - backend.KuidOwnerVersionKey: r.Spec.Owner.Version, - backend.KuidOwnerKindKey: r.Spec.Owner.Kind, - backend.KuidOwnerNamespaceKey: r.Spec.Owner.Namespace, - backend.KuidOwnerNameKey: r.Spec.Owner.Name, - backend.KuidClaimNameKey: r.Name, - } - - fullselector := labels.NewSelector() - for k, v := range l { - req, err := labels.NewRequirement(k, selection.Equals, []string{v}) - if err != nil { - return nil, err - } - fullselector = fullselector.Add(*req) - } - return fullselector, nil -} - -// BuildGENIDClaim returns a reource from a client Object a Spec/Status -func BuildGENIDClaim(meta metav1.ObjectMeta, spec *GENIDClaimSpec, status *GENIDClaimStatus) *GENIDClaim { - aspec := GENIDClaimSpec{} - if spec != nil { - aspec = *spec - } - astatus := GENIDClaimStatus{} - if status != nil { - astatus = *status - } - return &GENIDClaim{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: GENIDClaimKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -func (r *GENIDClaim) SetStatusRange(s *string) { - r.Status.Range = s -} - -func (r *GENIDClaim) SetStatusID(s *uint64) { - if s == nil { - r.Status.ID = nil - return - } - r.Status.ID = ptr.To[int64](int64(*s)) -} - -func (r *GENIDClaim) GetStatusID() *uint64 { - if r.Status.ID == nil { - return nil - } - return ptr.To[uint64](uint64(*r.Status.ID)) -} - -func (r *GENIDClaim) GetSpec() any { - return r.Spec -} - -func (r *GENIDClaim) SetSpec(s any) { - if spec, ok := s.(GENIDClaimSpec); ok { - r.Spec = spec - } -} - -func (r *GENIDClaim) NewObjList() backend.GenericObjectList { - return &GENIDClaimList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: GENIDClaimListKind}, - } -} - -func (r *GENIDClaimList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} diff --git a/apis/backend/genid/v1alpha1/genidclaim_syntaxvalidator.go b/apis/backend/genid/v1alpha1/genidclaim_syntaxvalidator.go deleted file mode 100644 index a23fbe4..0000000 --- a/apis/backend/genid/v1alpha1/genidclaim_syntaxvalidator.go +++ /dev/null @@ -1,68 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - fmt "fmt" - - "k8s.io/apimachinery/pkg/util/validation/field" -) - -type SyntaxValidator interface { - Validate(claim *GENIDClaim, genidType GENIDType) field.ErrorList -} - -type GENIDRangeSyntaxValidator struct { - name string -} - -func (r *GENIDRangeSyntaxValidator) Validate(claim *GENIDClaim, genidType GENIDType) field.ErrorList { - var allErrs field.ErrorList - if err := claim.ValidateGENIDRange(genidType); err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.range"), - claim, - fmt.Errorf("invalid GENID range %s", r.name).Error(), - )) - } - return allErrs -} - -type GENIDDynamicIDSyntaxValidator struct { - name string -} - -func (r *GENIDDynamicIDSyntaxValidator) Validate(claim *GENIDClaim, genidType GENIDType) field.ErrorList { - var allErrs field.ErrorList - return allErrs -} - -type GENIDStaticIDSyntaxValidator struct { - name string -} - -func (r *GENIDStaticIDSyntaxValidator) Validate(claim *GENIDClaim, genidType GENIDType) field.ErrorList { - var allErrs field.ErrorList - if err := claim.ValidateGENIDID(genidType); err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.id"), - claim, - fmt.Errorf("invalid GENID id %s", r.name).Error(), - )) - } - return allErrs -} diff --git a/apis/backend/genid/v1alpha1/genidclaim_types.go b/apis/backend/genid/v1alpha1/genidclaim_types.go deleted file mode 100644 index b823367..0000000 --- a/apis/backend/genid/v1alpha1/genidclaim_types.go +++ /dev/null @@ -1,87 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "reflect" - - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// GENIDClaimSpec defines the dGENIDred state of GENIDClaim -type GENIDClaimSpec struct { - // GENIDIndex defines the GENID index for the GENID Claim - Index string `json:"index" yaml:"index" protobuf:"bytes,1,opt,name=index"` - // GENIDID defines the GENID for the GENID claim - ID *int64 `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,2,opt,name=id"` - // Range defines the GENID range for the GENID claim - // The following notation is used: start-end - - // the GENIDs in the range must be consecutive - Range *string `json:"range,omitempty" yaml:"range,omitempty" protobuf:"bytes,3,opt,name=range"` - // ClaimLabels define the user defined labels and selector labels used - // in resource claim - commonv1alpha1.ClaimLabels `json:",inline" yaml:",inline" protobuf:"bytes,4,opt,name=claimLabels"` - // Owner defines the ownerReference of the GENIDClaim - // Allow for different namesapces, hence it is part of the spec - Owner *commonv1alpha1.OwnerReference `json:"owner,omitempty" yaml:"owner,omitempty" protobuf:"bytes,5,opt,name=owner"` -} - -// GENIDClaimStatus defines the observed state of GENIDClaim -type GENIDClaimStatus struct { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` - // GENIDID defines the GENID for the GENID claim - // +optional - ID *int64 `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,2,opt,name=id"` - // GENIDRange defines the GENID range for the GENID claim - // +optional - Range *string `json:"range,omitempty" yaml:"range,omitempty" protobuf:"bytes,3,opt,name=range"` - // ExpiryTime defines when the claim expires - // +kubebuilder:validation:Optional - // +optional - ExpiryTime *string `json:"expiryTime,omitempty" yaml:"expiryTime,omitempty" protobuf:"bytes,4,opt,name=expiryTime"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// GENIDClaim is the Schema for the GENIDClaim API -// -// +k8s:openapi-gen=true -type GENIDClaim struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - Spec GENIDClaimSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - Status GENIDClaimStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// GENIDClaimList contains a list of GENIDClaims -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type GENIDClaimList struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []GENIDClaim `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` -} - -var ( - GENIDClaimKind = reflect.TypeOf(GENIDClaim{}).Name() - GENIDClaimListKind = reflect.TypeOf(GENIDClaimList{}).Name() -) diff --git a/apis/backend/genid/v1alpha1/genidentry_interface.go b/apis/backend/genid/v1alpha1/genidentry_interface.go deleted file mode 100644 index 2681ad2..0000000 --- a/apis/backend/genid/v1alpha1/genidentry_interface.go +++ /dev/null @@ -1,274 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "crypto/sha1" - "encoding/json" - "fmt" - strings "strings" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" -) - -const GENIDEntryPlural = "genidentries" -const GENIDEntrySingular = "genidentry" - -// +k8s:deepcopy-gen=false -var _ resource.Object = &GENIDEntry{} -var _ resource.ObjectList = &GENIDEntryList{} - -// GetListMeta returns the ListMeta -func (r *GENIDEntryList) GetListMeta() *metav1.ListMeta { - return &r.ListMeta -} - -func (r *GENIDEntryList) GetItems() []backend.Object { - entries := make([]backend.Object, 0, len(r.Items)) - for _, entry := range r.Items { - entries = append(entries, &entry) - } - return entries -} - -func (r *GENIDEntry) GetSingularName() string { - return GENIDEntrySingular -} - -func (GENIDEntry) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Resource: GENIDEntryPlural, - } -} - -// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. -// IsStorageVersion implements resource.Object. -func (GENIDEntry) IsStorageVersion() bool { - return true -} - -// GetObjectMeta implements resource.Object -func (r *GENIDEntry) GetObjectMeta() *metav1.ObjectMeta { - return &r.ObjectMeta -} - -// NamespaceScoped returns true to indicate Fortune is a namespaced resource. -// NamespaceScoped implements resource.Object. -func (GENIDEntry) NamespaceScoped() bool { - return true -} - -// New implements resource.Object -func (GENIDEntry) New() runtime.Object { - return &GENIDEntry{} -} - -// NewList implements resource.Object -func (GENIDEntry) NewList() runtime.Object { - return &GENIDEntryList{} -} - -// GetCondition returns the condition based on the condition kind -func (r *GENIDEntry) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { - return r.Status.GetCondition(t) -} - -// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions -// to be set at once -func (r *GENIDEntry) SetConditions(c ...conditionv1alpha1.Condition) { - r.Status.SetConditions(c...) -} - -// GENIDEntryConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for GENIDEntry -func GENIDEntryConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { - switch label { - case "metadata.name": - return label, value, nil - case "metadata.namespace": - return label, value, nil - case "spec.index": - return label, value, nil - default: - return "", "", fmt.Errorf("%q is not a known field selector", label) - } -} - -func (r *GENIDEntry) CalculateHash() ([sha1.Size]byte, error) { - // Convert the struct to JSON - jsonData, err := json.Marshal(r) - if err != nil { - return [sha1.Size]byte{}, err - } - - // Calculate SHA-1 hash - return sha1.Sum(jsonData), nil -} - -func (r *GENIDEntry) GetNamespacedName() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.GetNamespace(), - Name: r.GetName(), - } -} - -func (r *GENIDEntry) GetOwnerReference() *commonv1alpha1.OwnerReference { - return r.Spec.Owner -} - -func (r *GENIDEntry) GetClaimName() string { - return r.Spec.Claim -} - -func (r *GENIDEntry) GetClaimType() backend.ClaimType { - return r.Spec.ClaimType -} - -func (r *GENIDEntry) GetKey() store.Key { - return store.KeyFromNSN(types.NamespacedName{Namespace: r.Namespace, Name: r.Spec.Index}) -} - -func (r *GENIDEntry) GetIndex() string { - return r.Spec.Index -} - -func (r *GENIDEntry) GetOwnerGVK() schema.GroupVersionKind { - return schema.GroupVersionKind{ - Group: r.Spec.Owner.Group, - Version: r.Spec.Owner.Version, - Kind: r.Spec.Owner.Kind, - } -} - -func (r *GENIDEntry) GetOwnerNSN() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.Spec.Owner.Namespace, - Name: r.Spec.Owner.Name, - } -} - -func (r *GENIDEntry) GetSpec() any { - return r.Spec -} - -func (r *GENIDEntry) GetSpecID() string { - return r.Spec.ID -} - -func (r *GENIDEntry) SetSpec(s any) { - if spec, ok := s.(GENIDEntrySpec); ok { - r.Spec = spec - } -} - -func GetGENIDEntry(k store.Key, vrange, id string, labels map[string]string) backend.EntryObject { - //log := log.FromContext(ctx) - - index := k.Name - ns := k.Namespace - - spec := &GENIDEntrySpec{ - Index: index, - ClaimType: backend.GetClaimTypeFromString(labels[backend.KuidClaimTypeKey]), - Claim: labels[backend.KuidClaimNameKey], - ID: id, - Owner: &commonv1alpha1.OwnerReference{ - Group: labels[backend.KuidOwnerGroupKey], - Version: labels[backend.KuidOwnerVersionKey], - Kind: labels[backend.KuidOwnerKindKey], - Namespace: labels[backend.KuidOwnerNamespaceKey], - Name: labels[backend.KuidOwnerNameKey], - }, - } - // filter the system defined labels from the labels to prepare for the user defined labels - udLabels := map[string]string{} - for k, v := range labels { - if !backend.BackendSystemKeys.Has(k) { - udLabels[k] = v - } - } - spec.UserDefinedLabels.Labels = udLabels - - status := &GENIDEntryStatus{} - status.SetConditions(conditionv1alpha1.Ready()) - - id = strings.ReplaceAll(id, "/", "-") - name := fmt.Sprintf("%s.%s", index, id) - if vrange != "" { - name = fmt.Sprintf("%s.%s", vrange, id) - } - - return BuildGENIDEntry( - metav1.ObjectMeta{ - Name: name, - Namespace: ns, - }, - spec, - status, - ) -} - -// BuildGENIDEntry returns a reource from a client Object a Spec/Status -func BuildGENIDEntry(meta metav1.ObjectMeta, spec *GENIDEntrySpec, status *GENIDEntryStatus) *GENIDEntry { - aspec := GENIDEntrySpec{} - if spec != nil { - aspec = *spec - } - astatus := GENIDEntryStatus{} - if status != nil { - astatus = *status - } - return &GENIDEntry{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: GENIDEntryKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -func (r *GENIDEntry) ValidateSyntax(_ string) field.ErrorList { - var allErrs field.ErrorList - return allErrs -} - -func (r *GENIDEntry) NewObjList() backend.GenericObjectList { - return &GENIDEntryList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: GENIDEntryListKind}, - } -} - -func (r *GENIDEntryList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} diff --git a/apis/backend/genid/v1alpha1/genidentry_types.go b/apis/backend/genid/v1alpha1/genidentry_types.go deleted file mode 100644 index 541c061..0000000 --- a/apis/backend/genid/v1alpha1/genidentry_types.go +++ /dev/null @@ -1,78 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "reflect" - - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// GENIDEntrySpec defines the dGENIDred state of GENIDEntry -type GENIDEntrySpec struct { - // GENIDIndex defines the GENID index for the GENID Claim - Index string `json:"index" yaml:"index" protobuf:"bytes,1,opt,name=index"` - // ClaimType defines the claimType of the GENID Entry - ClaimType backend.ClaimType `json:"claimType,omitempty" yaml:"claimType,omitempty" protobuf:"bytes,2,opt,name=claimType"` - // ID defines the id of the GENID entry in the tree - ID string `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,3,opt,name=id"` - // ClaimLabels define the user defined labels and selector labels used - // in resource claim - commonv1alpha1.ClaimLabels `json:",inline" yaml:",inline" protobuf:"bytes,4,opt,name=claimLabels"` - // Claim defines the name of the claim that is the origin of this entry - Claim string `json:"claim" yaml:"claim" protobuf:"bytes,5,opt,name=claim"` - // Owner defines the ownerReference of the GENIDClaim - // Allow for different namesapces, hence it is part of the spec - Owner *commonv1alpha1.OwnerReference `json:"owner,omitempty" yaml:"owner,omitempty" protobuf:"bytes,6,opt,name=owner"` -} - -// GENIDEntryStatus defines the observed state of GENIDEntry -type GENIDEntryStatus struct { - // ConditionedStatus provides the status of the GENIDEntry using conditions - // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// GENIDEntry is the Schema for the GENIDentry API -// -// +k8s:openapi-gen=true -type GENIDEntry struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - Spec GENIDEntrySpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - Status GENIDEntryStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// GENIDEntryList contains a list of GENIDEntries -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type GENIDEntryList struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []GENIDEntry `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` -} - -var ( - GENIDEntryKind = reflect.TypeOf(GENIDEntry{}).Name() - GENIDEntryListKind = reflect.TypeOf(GENIDEntryList{}).Name() -) diff --git a/apis/backend/genid/v1alpha1/genidindex_interface.go b/apis/backend/genid/v1alpha1/genidindex_interface.go deleted file mode 100644 index bb0626c..0000000 --- a/apis/backend/genid/v1alpha1/genidindex_interface.go +++ /dev/null @@ -1,371 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "crypto/sha1" - "encoding/json" - "fmt" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/apiserver-store/pkg/generic/registry" - "github.com/henderiw/idxtable/pkg/tree/gtree" - "github.com/henderiw/idxtable/pkg/tree/tree16" - "github.com/henderiw/idxtable/pkg/tree/tree32" - "github.com/henderiw/idxtable/pkg/tree/tree64" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" - "k8s.io/utils/ptr" -) - -const GENIDIndexPlural = "genidindices" -const GENIDIndexSingular = "genidindex" - -// +k8s:deepcopy-gen=false -var _ resource.Object = &GENIDIndex{} -var _ resource.ObjectList = &GENIDIndexList{} - -// GetListMeta returns the ListMeta -func (r *GENIDIndexList) GetListMeta() *metav1.ListMeta { - return &r.ListMeta -} - -func (r *GENIDIndex) GetSingularName() string { - return GENIDIndexSingular -} - -func (GENIDIndex) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Resource: GENIDIndexPlural, - } -} - -// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. -// IsStorageVersion implements resource.Object. -func (GENIDIndex) IsStorageVersion() bool { - return true -} - -// GetObjectMeta implements resource.Object -func (r *GENIDIndex) GetObjectMeta() *metav1.ObjectMeta { - return &r.ObjectMeta -} - -// NamespaceScoped returns true to indicate Fortune is a namespaced resource. -// NamespaceScoped implements resource.Object. -func (GENIDIndex) NamespaceScoped() bool { - return true -} - -// New implements resource.Object -func (GENIDIndex) New() runtime.Object { - return &GENIDIndex{} -} - -// NewList implements resource.Object -func (GENIDIndex) NewList() runtime.Object { - return &GENIDIndexList{} -} - -// GetCondition returns the condition based on the condition kind -func (r *GENIDIndex) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { - return r.Status.GetCondition(t) -} - -// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions -// to be set at once -func (r *GENIDIndex) SetConditions(c ...conditionv1alpha1.Condition) { - r.Status.SetConditions(c...) -} - -// GENIDIndexConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for GENIDIndex -func GENIDIndexConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { - switch label { - case "metadata.name": - return label, value, nil - case "metadata.namespace": - return label, value, nil - default: - return "", "", fmt.Errorf("%q is not a known field selector", label) - } -} - -func (r *GENIDIndexList) GetItems() []backend.Object { - objs := []backend.Object{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *GENIDIndex) CalculateHash() ([sha1.Size]byte, error) { - // Convert the struct to JSON - jsonData, err := json.Marshal(r) - if err != nil { - return [sha1.Size]byte{}, err - } - - // Calculate SHA-1 hash - return sha1.Sum(jsonData), nil -} - -func (r *GENIDIndex) GetNamespacedName() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.GetNamespace(), - Name: r.GetName(), - } -} - -func (r *GENIDIndex) GetTree() gtree.GTree { - switch GetGenIDType(r.Spec.Type) { - case GENIDType_16bit: - tree, err := tree16.New(16) - if err != nil { - return nil - } - return tree - case GENIDType_32bit: - tree, err := tree32.New(32) - if err != nil { - return nil - } - return tree - case GENIDType_48bit: - tree, err := tree64.New(48) - if err != nil { - return nil - } - return tree - case GENIDType_64bit: - tree, err := tree64.New(64) - if err != nil { - return nil - } - return tree - default: - return nil - } -} - -func (r *GENIDIndex) GetKey() store.Key { - return store.KeyFromNSN(r.GetNamespacedName()) -} - -func (r *GENIDIndex) GetType() string { - return r.Spec.Type -} - -func (r *GENIDIndex) GetOwnerReference() *commonv1alpha1.OwnerReference { - return &commonv1alpha1.OwnerReference{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Kind: GENIDIndexKind, - Namespace: r.Namespace, - Name: r.Name, - } -} - -func (r *GENIDIndex) ValidateSyntax(_ string) field.ErrorList { - var allErrs field.ErrorList - - if GetGenIDType(r.Spec.Type) == GENIDType_Invalid { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.type"), - r, - fmt.Errorf("invalid GENID Type %s", r.Spec.Type).Error(), - )) - } - - if r.Spec.MinID != nil { - if err := validateGENIDID(GetGenIDType(r.Spec.Type), *r.Spec.MinID); err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.minID"), - r, - fmt.Errorf("invalid GENID ID %d", *r.Spec.MinID).Error(), - )) - } - } - if r.Spec.MaxID != nil { - if err := validateGENIDID(GetGenIDType(r.Spec.Type), *r.Spec.MaxID); err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.maxID"), - r, - fmt.Errorf("invalid GENID ID %d", *r.Spec.MaxID).Error(), - )) - } - } - if r.Spec.MinID != nil && r.Spec.MaxID != nil { - if *r.Spec.MinID > *r.Spec.MaxID { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.maxID"), - r, - fmt.Errorf("min GENID ID %d cannot be bigger than max GENID ID %d", *r.Spec.MinID, *r.Spec.MaxID).Error(), - )) - } - } - return allErrs -} - -func GetMinClaimRange(id int64) string { - return fmt.Sprintf("%d-%d", GENIDID_Min, id-1) -} - -func GetMaxClaimRange(genidType GENIDType, id int64) string { - return fmt.Sprintf("%d-%d", id+1, GENIDID_MaxValue[genidType]) -} - -func (r *GENIDIndex) GetMinID() *uint64 { - if r.Spec.MinID == nil { - return nil - } - return ptr.To[uint64](uint64(*r.Spec.MinID)) -} - -func (r *GENIDIndex) GetMaxID() *uint64 { - if r.Spec.MaxID == nil { - return nil - } - return ptr.To[uint64](uint64(*r.Spec.MaxID)) -} - -func (r *GENIDIndex) GetMinClaimNSN() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.Namespace, - Name: fmt.Sprintf("%s.%s", r.Name, backend.IndexReservedMinName), - } -} - -func (r *GENIDIndex) GetMaxClaimNSN() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.Namespace, - Name: fmt.Sprintf("%s.%s", r.Name, backend.IndexReservedMaxName), - } -} - -func (r *GENIDIndex) GetMinClaim() backend.ClaimObject { - return BuildGENIDClaim( - metav1.ObjectMeta{ - Namespace: r.GetNamespace(), - Name: r.GetMinClaimNSN().Name, - }, - &GENIDClaimSpec{ - Index: r.Name, - Range: ptr.To[string](GetMinClaimRange(*r.Spec.MinID)), - Owner: commonv1alpha1.GetOwnerReference(r), - }, - nil, - ) -} - -func (r *GENIDIndex) GetMaxClaim() backend.ClaimObject { - return BuildGENIDClaim( - metav1.ObjectMeta{ - Namespace: r.GetNamespace(), - Name: r.GetMaxClaimNSN().Name, - }, - &GENIDClaimSpec{ - Index: r.Name, - Range: ptr.To[string](GetMaxClaimRange(GetGenIDType(r.Spec.Type), *r.Spec.MaxID)), - Owner: commonv1alpha1.GetOwnerReference(r), - }, - nil, - ) -} - -// BuildGENIDIndex returns a reource from a client Object a Spec/Status -func BuildGENIDIndex(meta metav1.ObjectMeta, spec *GENIDIndexSpec, status *GENIDIndexStatus) *GENIDIndex { - aspec := GENIDIndexSpec{} - if spec != nil { - aspec = *spec - } - astatus := GENIDIndexStatus{} - if status != nil { - astatus = *status - } - return &GENIDIndex{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: GENIDIndexKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -func GENIDIndexTableConvertor(gr schema.GroupResource) registry.TableConvertor { - return registry.TableConvertor{ - Resource: gr, - Cells: func(obj runtime.Object) []interface{} { - index, ok := obj.(*GENIDIndex) - if !ok { - return nil - } - return []interface{}{ - index.GetName(), - index.GetCondition(conditionv1alpha1.ConditionTypeReady).Status, - index.Spec.Type, - index.GetMinID(), - index.GetMaxID(), - } - }, - Columns: []metav1.TableColumnDefinition{ - {Name: "Name", Type: "string"}, - {Name: "Ready", Type: "string"}, - {Name: "Type", Type: "string"}, - {Name: "MinID", Type: "integer"}, - {Name: "MaxID", Type: "integer"}, - }, - } -} - -func (r *GENIDIndex) GetSpec() any { - return r.Spec -} - -func (r *GENIDIndex) SetSpec(s any) { - if spec, ok := s.(GENIDIndexSpec); ok { - r.Spec = spec - } -} - -func (r *GENIDIndex) NewObjList() backend.GenericObjectList { - return &GENIDIndexList{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: GENIDIndexListKind}, - } -} - -func (r *GENIDIndexList) GetObjects() []backend.GenericObject { - objs := make([]backend.GenericObject, 0, len(r.Items)) - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} diff --git a/apis/backend/genid/v1alpha1/genidindex_types.go b/apis/backend/genid/v1alpha1/genidindex_types.go deleted file mode 100644 index 09d31d8..0000000 --- a/apis/backend/genid/v1alpha1/genidindex_types.go +++ /dev/null @@ -1,81 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "reflect" - - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// GENIDIndexSpec defines the dGENIDred state of GENIDIndex -type GENIDIndexSpec struct { - // MinID defines the min GENID ID the index supports - // +optional - MinID *int64 `json:"minID,omitempty" yaml:"minID,omitempty" protobuf:"bytes,1,opt,name=minID"` - // MaxID defines the max GENID ID the index supports - // +optional - MaxID *int64 `json:"maxID,omitempty" yaml:"maxID,omitempty" protobuf:"bytes,2,opt,name=maxID"` - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` - // Type defines the type of the GENID - // 16bit, 32bit, 48bit, 64bit - Type string `json:"type,omitempty" yaml:"type,omitempty" protobuf:"bytes,4,opt,name=type"` -} - -// GENIDIndexStatus defines the observed state of GENIDIndex -type GENIDIndexStatus struct { - // MinID defines the min GENID ID the index supports - // +optional - MinID *int64 `json:"minID,omitempty" yaml:"minID,omitempty" protobuf:"bytes,1,opt,name=minID"` - // MaxID defines the max GENID ID the index supports - // +optional - MaxID *int64 `json:"maxID,omitempty" yaml:"maxID,omitempty" protobuf:"bytes,2,opt,name=maxID"` - // ConditionedStatus provides the status of the GENIDIndex using conditions - // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=conditionedStatus"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// GENIDIndex is the Schema for the GENIDIndex API -// -// +k8s:openapi-gen=true -type GENIDIndex struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - Spec GENIDIndexSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - Status GENIDIndexStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// GENIDIndexList contains a list of GENIDIndexs -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type GENIDIndexList struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []GENIDIndex `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` -} - -var ( - GENIDIndexKind = reflect.TypeOf(GENIDIndex{}).Name() - GENIDIndexListKind = reflect.TypeOf(GENIDIndexList{}).Name() -) diff --git a/apis/backend/genid/v1alpha1/register.go b/apis/backend/genid/v1alpha1/register.go deleted file mode 100644 index dcd907f..0000000 --- a/apis/backend/genid/v1alpha1/register.go +++ /dev/null @@ -1,69 +0,0 @@ -/* -Copyright 2024 Nokia. - -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. -*/ - -// +kubebuilder:object:generate=true -// +groupName=genid.be.kuid.dev -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -const ( - Group = "genid.be.kuid.dev" - Version = "v1alpha1" -) - -var ( - // SchemeGroupVersion contains the API group and version information for the types in this package. - SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version} - // AddToScheme applies all the stored functions to the scheme. A non-nil error - // indicates that one function failed and the attempt was abandoned. - //AddToScheme = (&runtime.SchemeBuilder{}).AddToScheme - AddToScheme = localSchemeBuilder.AddToScheme - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - schemeBuilder runtime.SchemeBuilder - localSchemeBuilder = &schemeBuilder -) - -// Resource takes an unqualified resource and returns a Group qualified GroupResource -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} - -func init() { - localSchemeBuilder.Register(addKnownTypes) -} - -// Adds the list of known types to the given scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - // +kubebuilder:scaffold:install - - scheme.AddKnownTypes(SchemeGroupVersion, - &GENIDClaim{}, - &GENIDClaimList{}, - &GENIDEntry{}, - &GENIDEntryList{}, - &GENIDIndex{}, - &GENIDIndexList{}, - ) - - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/apis/backend/genid/v1alpha1/zz_generated.deepcopy.go b/apis/backend/genid/v1alpha1/zz_generated.deepcopy.go deleted file mode 100644 index 7c6eb9e..0000000 --- a/apis/backend/genid/v1alpha1/zz_generated.deepcopy.go +++ /dev/null @@ -1,414 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - 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 *GENIDClaim) DeepCopyInto(out *GENIDClaim) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDClaim. -func (in *GENIDClaim) DeepCopy() *GENIDClaim { - if in == nil { - return nil - } - out := new(GENIDClaim) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *GENIDClaim) 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 *GENIDClaimList) DeepCopyInto(out *GENIDClaimList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]GENIDClaim, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDClaimList. -func (in *GENIDClaimList) DeepCopy() *GENIDClaimList { - if in == nil { - return nil - } - out := new(GENIDClaimList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *GENIDClaimList) 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 *GENIDClaimSpec) DeepCopyInto(out *GENIDClaimSpec) { - *out = *in - if in.ID != nil { - in, out := &in.ID, &out.ID - *out = new(int64) - **out = **in - } - if in.Range != nil { - in, out := &in.Range, &out.Range - *out = new(string) - **out = **in - } - in.ClaimLabels.DeepCopyInto(&out.ClaimLabels) - if in.Owner != nil { - in, out := &in.Owner, &out.Owner - *out = new(commonv1alpha1.OwnerReference) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDClaimSpec. -func (in *GENIDClaimSpec) DeepCopy() *GENIDClaimSpec { - if in == nil { - return nil - } - out := new(GENIDClaimSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GENIDClaimStatus) DeepCopyInto(out *GENIDClaimStatus) { - *out = *in - in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) - if in.ID != nil { - in, out := &in.ID, &out.ID - *out = new(int64) - **out = **in - } - if in.Range != nil { - in, out := &in.Range, &out.Range - *out = new(string) - **out = **in - } - if in.ExpiryTime != nil { - in, out := &in.ExpiryTime, &out.ExpiryTime - *out = new(string) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDClaimStatus. -func (in *GENIDClaimStatus) DeepCopy() *GENIDClaimStatus { - if in == nil { - return nil - } - out := new(GENIDClaimStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GENIDDynamicIDSyntaxValidator) DeepCopyInto(out *GENIDDynamicIDSyntaxValidator) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDDynamicIDSyntaxValidator. -func (in *GENIDDynamicIDSyntaxValidator) DeepCopy() *GENIDDynamicIDSyntaxValidator { - if in == nil { - return nil - } - out := new(GENIDDynamicIDSyntaxValidator) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GENIDEntry) DeepCopyInto(out *GENIDEntry) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDEntry. -func (in *GENIDEntry) DeepCopy() *GENIDEntry { - if in == nil { - return nil - } - out := new(GENIDEntry) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *GENIDEntry) 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 *GENIDEntryList) DeepCopyInto(out *GENIDEntryList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]GENIDEntry, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDEntryList. -func (in *GENIDEntryList) DeepCopy() *GENIDEntryList { - if in == nil { - return nil - } - out := new(GENIDEntryList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *GENIDEntryList) 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 *GENIDEntrySpec) DeepCopyInto(out *GENIDEntrySpec) { - *out = *in - in.ClaimLabels.DeepCopyInto(&out.ClaimLabels) - if in.Owner != nil { - in, out := &in.Owner, &out.Owner - *out = new(commonv1alpha1.OwnerReference) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDEntrySpec. -func (in *GENIDEntrySpec) DeepCopy() *GENIDEntrySpec { - if in == nil { - return nil - } - out := new(GENIDEntrySpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GENIDEntryStatus) DeepCopyInto(out *GENIDEntryStatus) { - *out = *in - in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDEntryStatus. -func (in *GENIDEntryStatus) DeepCopy() *GENIDEntryStatus { - if in == nil { - return nil - } - out := new(GENIDEntryStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GENIDIndex) DeepCopyInto(out *GENIDIndex) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDIndex. -func (in *GENIDIndex) DeepCopy() *GENIDIndex { - if in == nil { - return nil - } - out := new(GENIDIndex) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *GENIDIndex) 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 *GENIDIndexList) DeepCopyInto(out *GENIDIndexList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]GENIDIndex, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDIndexList. -func (in *GENIDIndexList) DeepCopy() *GENIDIndexList { - if in == nil { - return nil - } - out := new(GENIDIndexList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *GENIDIndexList) 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 *GENIDIndexSpec) DeepCopyInto(out *GENIDIndexSpec) { - *out = *in - if in.MinID != nil { - in, out := &in.MinID, &out.MinID - *out = new(int64) - **out = **in - } - if in.MaxID != nil { - in, out := &in.MaxID, &out.MaxID - *out = new(int64) - **out = **in - } - in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDIndexSpec. -func (in *GENIDIndexSpec) DeepCopy() *GENIDIndexSpec { - if in == nil { - return nil - } - out := new(GENIDIndexSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GENIDIndexStatus) DeepCopyInto(out *GENIDIndexStatus) { - *out = *in - if in.MinID != nil { - in, out := &in.MinID, &out.MinID - *out = new(int64) - **out = **in - } - if in.MaxID != nil { - in, out := &in.MaxID, &out.MaxID - *out = new(int64) - **out = **in - } - in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDIndexStatus. -func (in *GENIDIndexStatus) DeepCopy() *GENIDIndexStatus { - if in == nil { - return nil - } - out := new(GENIDIndexStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GENIDRangeSyntaxValidator) DeepCopyInto(out *GENIDRangeSyntaxValidator) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDRangeSyntaxValidator. -func (in *GENIDRangeSyntaxValidator) DeepCopy() *GENIDRangeSyntaxValidator { - if in == nil { - return nil - } - out := new(GENIDRangeSyntaxValidator) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GENIDStaticIDSyntaxValidator) DeepCopyInto(out *GENIDStaticIDSyntaxValidator) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDStaticIDSyntaxValidator. -func (in *GENIDStaticIDSyntaxValidator) DeepCopy() *GENIDStaticIDSyntaxValidator { - if in == nil { - return nil - } - out := new(GENIDStaticIDSyntaxValidator) - in.DeepCopyInto(out) - return out -} diff --git a/apis/backend/infra/doc.go b/apis/backend/infra/doc.go deleted file mode 100644 index 8d18880..0000000 --- a/apis/backend/infra/doc.go +++ /dev/null @@ -1,21 +0,0 @@ -/* -Copyright 2024 Nokia. - -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. -*/ - -// +k8s:deepcopy-gen=package,register -// +groupName=infra.be.kuid.dev - -// infra defines the infra api -package infra diff --git a/apis/backend/infra/v1alpha1/bfd_types.go b/apis/backend/infra/v1alpha1/bfd_types.go deleted file mode 100644 index f9424b7..0000000 --- a/apis/backend/infra/v1alpha1/bfd_types.go +++ /dev/null @@ -1,40 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -type BFDLinkParameters struct { - // Disabled defines if bfd is disabled or not - // +optional - Enabled *bool `json:"enabled,omitempty" yaml:"enabled,,omitempty" protobuf:"bytes,1,opt,name=enabled"` - // MinTx defines the desired minimal interval for sending BFD packets, in msec. - // +optional - MinTx *uint32 `json:"minTx,omitempty" yaml:"minTx,,omitempty" protobuf:"bytes,2,opt,name=minTx"` - // MinTx defines the required minimal interval for receiving BFD packets, in msec. - // +optional - MinRx *uint32 `json:"minRx,omitempty" yaml:"minRx,,omitempty" protobuf:"bytes,3,opt,name=minRx"` - // MinEchoRx defines the echo function timer, in msec. - // +optional - MinEchoRx *uint32 `json:"minEchoRx,omitempty" yaml:"minEchoRx,,omitempty" protobuf:"bytes,4,opt,name=minEchoRx"` - // Multiplier defines the number of missed packets before the session is considered down - // +optional - Multiplier *uint32 `json:"multiplier,omitempty" yaml:"multiplier,,omitempty" protobuf:"bytes,5,opt,name=multiplier"` - // TTL defines the time to live on the outgoing BFD packet - // +kubebuilder:validation:Maximum:=255 - // +kubebuilder:validation:Minimum:=2 - // +optional - TTL *uint32 `json:"ttl,omitempty" yaml:"ttl,,omitempty" protobuf:"bytes,6,opt,name=ttl"` -} diff --git a/apis/backend/infra/v1alpha1/cluster_interface.go b/apis/backend/infra/v1alpha1/cluster_interface.go deleted file mode 100644 index 0a24c39..0000000 --- a/apis/backend/infra/v1alpha1/cluster_interface.go +++ /dev/null @@ -1,329 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "crypto/sha1" - "encoding/json" - "fmt" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/apiserver-store/pkg/generic/registry" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - apierrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/fields" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/selection" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" - genericapirequest "k8s.io/apiserver/pkg/endpoints/request" -) - -const ClusterPlural = "clusters" -const ClusterSingular = "cluster" - -// +k8s:deepcopy-gen=false -var _ resource.Object = &Cluster{} -var _ resource.ObjectList = &ClusterList{} -var _ backend.ObjectList = &ClusterList{} -var _ backend.GenericObject = &Cluster{} -var _ backend.GenericObjectList = &ClusterList{} - -// GetListMeta returns the ListMeta -func (r *ClusterList) GetListMeta() *metav1.ListMeta { - return &r.ListMeta -} - -func (r *Cluster) GetSingularName() string { - return ClusterSingular -} - -func (Cluster) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Resource: ClusterPlural, - } -} - -// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. -// IsStorageVersion implements resource.Object. -func (Cluster) IsStorageVersion() bool { - return true -} - -// GetObjectMeta implements resource.Object -func (r *Cluster) GetObjectMeta() *metav1.ObjectMeta { - return &r.ObjectMeta -} - -// NamespaceScoped returns true to indicate Fortune is a namespaced resource. -// NamespaceScoped implements resource.Object. -func (Cluster) NamespaceScoped() bool { - return true -} - -// New implements resource.Object -func (Cluster) New() runtime.Object { - return &Cluster{} -} - -// NewList implements resource.Object -func (Cluster) NewList() runtime.Object { - return &ClusterList{} -} - -func (r *Cluster) NewObjList() backend.GenericObjectList { - return &ClusterList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: ClusterKindList}, - } -} - -func (r *Cluster) SchemaGroupVersionKind() schema.GroupVersionKind { - return SchemeGroupVersion.WithKind(ClusterKind) -} - -// GetCondition returns the condition based on the condition kind -func (r *Cluster) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { - return r.Status.GetCondition(t) -} - -// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions -// to be set at once -func (r *Cluster) SetConditions(c ...conditionv1alpha1.Condition) { - r.Status.SetConditions(c...) -} - -// ClusterConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for Cluster -func ClusterConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { - switch label { - case "metadata.name": - return label, value, nil - case "metadata.namespace": - return label, value, nil - default: - return "", "", fmt.Errorf("%q is not a known field selector", label) - } -} - -func (r *ClusterList) GetItems() []backend.Object { - objs := []backend.Object{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *ClusterList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *Cluster) CalculateHash() ([sha1.Size]byte, error) { - // Convert the struct to JSON - jsonData, err := json.Marshal(r) - if err != nil { - return [sha1.Size]byte{}, err - } - - // Calculate SHA-1 hash - return sha1.Sum(jsonData), nil -} - -func (r *Cluster) GetNamespacedName() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.GetNamespace(), - Name: r.GetName(), - } -} - -func (r *Cluster) GetKey() store.Key { - return store.KeyFromNSN(r.GetNamespacedName()) -} - -func (r *Cluster) GetOwnerReference() *commonv1alpha1.OwnerReference { - return &commonv1alpha1.OwnerReference{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Kind: ClusterKind, - Namespace: r.Namespace, - Name: r.Name, - } -} - -func (r *Cluster) ValidateSyntax(_ string) field.ErrorList { - var allErrs field.ErrorList - - /* - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.type"), - r, - fmt.Errorf("invalid GENID Type %s", r.Spec.Type).Error(), - )) - } - */ - return allErrs -} - -func (r *Cluster) GetSpec() any { - return r.Spec -} - -func (r *Cluster) SetSpec(s any) { - if spec, ok := s.(ClusterSpec); ok { - r.Spec = spec - } -} - -// BuildCluster returns a reource from a client Object a Spec/Status -func BuildCluster(meta metav1.ObjectMeta, spec *ClusterSpec, status *ClusterStatus) *Cluster { - aspec := ClusterSpec{} - if spec != nil { - aspec = *spec - } - astatus := ClusterStatus{} - if status != nil { - astatus = *status - } - return &Cluster{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: ClusterKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -func ClusterTableConvertor(gr schema.GroupResource) registry.TableConvertor { - return registry.TableConvertor{ - Resource: gr, - Cells: func(obj runtime.Object) []interface{} { - r, ok := obj.(*Cluster) - if !ok { - return nil - } - return []interface{}{ - r.GetName(), - r.GetCondition(conditionv1alpha1.ConditionTypeReady).Status, - r.Spec.NodeGroup, - r.Spec.Provider, - } - }, - Columns: []metav1.TableColumnDefinition{ - {Name: "Name", Type: "string"}, - {Name: "Ready", Type: "string"}, - {Name: "Domain", Type: "string"}, - {Name: "Provider", Type: "string"}, - }, - } -} - -func ClusterParseFieldSelector(ctx context.Context, fieldSelector fields.Selector) (backend.Filter, error) { - var filter *ClusterFilter - - // add the namespace to the list - namespace, ok := genericapirequest.NamespaceFrom(ctx) - if fieldSelector == nil { - if ok { - return &ClusterFilter{Namespace: namespace}, nil - } - return filter, nil - } - requirements := fieldSelector.Requirements() - for _, requirement := range requirements { - filter = &ClusterFilter{} - switch requirement.Operator { - case selection.Equals, selection.DoesNotExist: - if requirement.Value == "" { - return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) - } - default: - return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) - } - - switch requirement.Field { - case "metadata.name": - filter.Name = requirement.Value - case "metadata.namespace": - filter.Namespace = requirement.Value - default: - return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) - } - } - // add namespace to the filter selector if specified - if ok { - if filter != nil { - filter.Namespace = namespace - } else { - filter = &ClusterFilter{Namespace: namespace} - } - } - - return &ClusterFilter{}, nil -} - -type ClusterFilter struct { - // Name filters by the name of the objects - Name string `protobuf:"bytes,1,opt,name=name"` - - // Namespace filters by the namespace of the objects - Namespace string `protobuf:"bytes,2,opt,name=namespace"` -} - -func (r *ClusterFilter) Filter(ctx context.Context, obj runtime.Object) bool { - f := false // result of the previous filter - o, ok := obj.(*Cluster) - if !ok { - return f - } - if r.Name != "" { - if o.GetName() == r.Name { - f = false - } else { - f = true - } - } - if r.Namespace != "" { - if o.GetNamespace() == r.Namespace { - f = false - } else { - f = true - } - } - return f -} - -func (r *Cluster) GetUserDefinedLabels() map[string]string { - return r.Spec.GetUserDefinedLabels() -} - -func (r *Cluster) GetProvider() string { - return r.Spec.Provider -} diff --git a/apis/backend/infra/v1alpha1/cluster_types.go b/apis/backend/infra/v1alpha1/cluster_types.go deleted file mode 100644 index 7ff102f..0000000 --- a/apis/backend/infra/v1alpha1/cluster_types.go +++ /dev/null @@ -1,75 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "reflect" - - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// ClusterSpec defines the desired state of Cluster -type ClusterSpec struct { - // NodeGroup defines the node group the resource belongs to. - NodeGroup string `json:"nodeGroup" yaml:"nodeGroup" protobuf:"bytes,1,opt,name=nodeGroup"` - // Provider defines the provider implementing this resource. - Provider string `json:"provider" yaml:"provider" protobuf:"bytes,2,opt,name=provider"` - // Location defines the location information where this resource is located - // in lon/lat coordinates - Location *Location `json:"location,omitempty" yaml:"location,omitempty" protobuf:"bytes,3,opt,name=location"` - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,4,opt,name=userDefinedLabels"` - // ParametersRef points to a provider specific configuration of the resource - // +optional - //ParametersRef *ObjectReference `json:"parametersRef,omitempty" yaml:"parametersRef,omitempty" protobuf:"bytes,5,opt,name=parametersRef"` -} - -// ClusterStatus defines the observed state of Cluster -type ClusterStatus struct { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// A Cluster represents a kubernetes cluster and is typically used as a nodeGroup identifier. -// +k8s:openapi-gen=true -type Cluster struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - Spec ClusterSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - Status ClusterStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// ClusterList contains a list of Clusters -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type ClusterList struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []Cluster `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` -} - -var ( - ClusterKind = reflect.TypeOf(Cluster{}).Name() - ClusterKindList = reflect.TypeOf(ClusterList{}).Name() -) diff --git a/apis/backend/infra/v1alpha1/doc.go b/apis/backend/infra/v1alpha1/doc.go deleted file mode 100644 index 936ebb9..0000000 --- a/apis/backend/infra/v1alpha1/doc.go +++ /dev/null @@ -1,28 +0,0 @@ -/* -Copyright 2024 Nokia. - -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. -*/ - -//go:generate deepcopy-gen -O zz_generated.deepcopy -i . -h ../../../../boilerplate.go.txt -//go:generate defaulter-gen -O zz_generated.defaults -i . -h ../../../../boilerplate.go.txt -//go:generate conversion-gen -O zz_generated.conversion -i . -h ../../../../boilerplate.go.txt - -// +k8s:openapi-gen=true -// +k8s:deepcopy-gen=package,register -// +k8s:conversion-gen=github.com/kuidio/kuid/apis/backend/infra -// +k8s:defaulter-gen=TypeMeta -// +groupName=infra.be.kuid.dev - -// Package v1alpha1 is the v1alpha1 version of the API. -package v1alpha1 // import "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" diff --git a/apis/backend/infra/v1alpha1/endpoint_interface.go b/apis/backend/infra/v1alpha1/endpoint_interface.go deleted file mode 100644 index 335c4b2..0000000 --- a/apis/backend/infra/v1alpha1/endpoint_interface.go +++ /dev/null @@ -1,442 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "crypto/sha1" - "encoding/json" - "fmt" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/apiserver-store/pkg/generic/registry" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - apierrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/fields" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/selection" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" - genericapirequest "k8s.io/apiserver/pkg/endpoints/request" - "sigs.k8s.io/controller-runtime/pkg/client" -) - -const EndpointPlural = "endpoints" -const EndpointSingular = "endpoint" - -// +k8s:deepcopy-gen=false -var _ resource.Object = &Endpoint{} -var _ resource.ObjectList = &EndpointList{} -var _ backend.ObjectList = &EndpointList{} -var _ backend.GenericObject = &Endpoint{} -var _ backend.GenericObjectList = &EndpointList{} - -// GetListMeta returns the ListMeta -func (r *EndpointList) GetListMeta() *metav1.ListMeta { - return &r.ListMeta -} - -func (r *Endpoint) GetSingularName() string { - return EndpointSingular -} - -func (Endpoint) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Resource: EndpointPlural, - } -} - -// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. -// IsStorageVersion implements resource.Object. -func (Endpoint) IsStorageVersion() bool { - return true -} - -// GetObjectMeta implements resource.Object -func (r *Endpoint) GetObjectMeta() *metav1.ObjectMeta { - return &r.ObjectMeta -} - -// NamespaceScoped returns true to indicate Fortune is a namespaced resource. -// NamespaceScoped implements resource.Object. -func (Endpoint) NamespaceScoped() bool { - return true -} - -// New implements resource.Object -func (Endpoint) New() runtime.Object { - return &Endpoint{} -} - -// NewList implements resource.Object -func (Endpoint) NewList() runtime.Object { - return &EndpointList{} -} - -func (r *Endpoint) NewObjList() backend.GenericObjectList { - return &EndpointList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: EndpointKindList}, - } -} - -func (r *Endpoint) SchemaGroupVersionKind() schema.GroupVersionKind { - return SchemeGroupVersion.WithKind(EndpointKind) -} - -// GetCondition returns the condition based on the condition kind -func (r *Endpoint) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { - return r.Status.GetCondition(t) -} - -// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions -// to be set at once -func (r *Endpoint) SetConditions(c ...conditionv1alpha1.Condition) { - r.Status.SetConditions(c...) -} - -// EndpointConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for Endpoint -func EndpointConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { - switch label { - case "metadata.name": - return label, value, nil - case "metadata.namespace": - return label, value, nil - default: - return "", "", fmt.Errorf("%q is not a known field selector", label) - } -} - -func (r *EndpointList) GetItems() []backend.Object { - objs := []backend.Object{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *EndpointList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *Endpoint) CalculateHash() ([sha1.Size]byte, error) { - // Convert the struct to JSON - jsonData, err := json.Marshal(r) - if err != nil { - return [sha1.Size]byte{}, err - } - - // Calculate SHA-1 hash - return sha1.Sum(jsonData), nil -} - -func (r *Endpoint) GetNamespacedName() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.GetNamespace(), - Name: r.GetName(), - } -} - -func (r *Endpoint) GetKey() store.Key { - return store.KeyFromNSN(r.GetNamespacedName()) -} - -func (r *Endpoint) GetRegion() string { - return r.Spec.Region -} - -func (r *Endpoint) GetSite() string { - return r.Spec.Site -} - -func (r *Endpoint) GetNodeGroupNodeID() NodeGroupNodeID { - return NodeGroupNodeID{ - NodeGroup: r.Spec.NodeGroup, - NodeID: r.Spec.NodeID, - } -} - -func (r *Endpoint) GetNodeID() NodeID { - return r.Spec.NodeID -} - -func (r *Endpoint) GetEndpointID() EndpointID { - return EndpointID{ - NodeID: r.GetNodeID(), - Endpoint: r.Name, - } -} - -func (r *Endpoint) GetOwnerReference() *commonv1alpha1.OwnerReference { - return &commonv1alpha1.OwnerReference{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Kind: EndpointKind, - Namespace: r.Namespace, - Name: r.Name, - } -} - -func (r *Endpoint) ValidateSyntax(_ string) field.ErrorList { - var allErrs field.ErrorList - - /* - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.type"), - r, - fmt.Errorf("invalid GENID Type %s", r.Spec.Type).Error(), - )) - } - */ - return allErrs -} - -func (r *Endpoint) GetSpec() any { - return r.Spec -} - -func (r *Endpoint) SetSpec(s any) { - if spec, ok := s.(EndpointSpec); ok { - r.Spec = spec - } -} - -// BuildEndpoint returns a reource from a client Object a Spec/Status -func BuildEndpoint(meta metav1.ObjectMeta, spec *EndpointSpec, status *EndpointStatus) *Endpoint { - aspec := EndpointSpec{} - if spec != nil { - aspec = *spec - } - astatus := EndpointStatus{} - if status != nil { - astatus = *status - } - return &Endpoint{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: EndpointKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -func EndpointTableConvertor(gr schema.GroupResource) registry.TableConvertor { - return registry.TableConvertor{ - Resource: gr, - Cells: func(obj runtime.Object) []interface{} { - r, ok := obj.(*Endpoint) - if !ok { - return nil - } - return []interface{}{ - r.GetName(), - r.GetCondition(conditionv1alpha1.ConditionTypeReady).Status, - r.Spec.NodeGroup, - r.Spec.Region, - r.Spec.Site, - r.Spec.Node, - } - }, - Columns: []metav1.TableColumnDefinition{ - {Name: "Name", Type: "string"}, - {Name: "Ready", Type: "string"}, - {Name: "Topology", Type: "string"}, - {Name: "Region", Type: "string"}, - {Name: "Site", Type: "string"}, - {Name: "Node", Type: "string"}, - }, - } -} - -func EndpointParseFieldSelector(ctx context.Context, fieldSelector fields.Selector) (backend.Filter, error) { - var filter *EndpointFilter - - // add the namespace to the list - namespace, ok := genericapirequest.NamespaceFrom(ctx) - if fieldSelector == nil { - if ok { - return &EndpointFilter{Namespace: namespace}, nil - } - return filter, nil - } - requirements := fieldSelector.Requirements() - for _, requirement := range requirements { - filter = &EndpointFilter{} - switch requirement.Operator { - case selection.Equals, selection.DoesNotExist: - if requirement.Value == "" { - return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) - } - default: - return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) - } - - switch requirement.Field { - case "metadata.name": - filter.Name = requirement.Value - case "metadata.namespace": - filter.Namespace = requirement.Value - default: - return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) - } - } - // add namespace to the filter selector if specified - if ok { - if filter != nil { - filter.Namespace = namespace - } else { - filter = &EndpointFilter{Namespace: namespace} - } - } - - return &EndpointFilter{}, nil -} - -type EndpointFilter struct { - // Name filters by the name of the objects - Name string `protobuf:"bytes,1,opt,name=name"` - - // Namespace filters by the namespace of the objects - Namespace string `protobuf:"bytes,2,opt,name=namespace"` -} - -func (r *EndpointFilter) Filter(ctx context.Context, obj runtime.Object) bool { - f := false // result of the previous filter - o, ok := obj.(*Endpoint) - if !ok { - return f - } - if r.Name != "" { - if o.GetName() == r.Name { - f = false - } else { - f = true - } - } - if r.Namespace != "" { - if o.GetNamespace() == r.Namespace { - f = false - } else { - f = true - } - } - return f -} - -func (r *Endpoint) GetUserDefinedLabels() map[string]string { - return r.Spec.GetUserDefinedLabels() -} - -func (r *Endpoint) GetProvider() string { - return "" -} - -type OwnerStatus int - -const ( - Free OwnerStatus = iota - Owned - Claimed -) - -func (r *Endpoint) IsClaimed(cr client.Object) (OwnerStatus, *metav1.OwnerReference) { - refs := r.GetOwnerReferences() - for _, ref := range refs { - if ref.APIVersion == cr.GetObjectKind().GroupVersionKind().GroupVersion().String() && - ref.Kind == cr.GetObjectKind().GroupVersionKind().Kind { - if ref.UID == cr.GetUID() && ref.Name == cr.GetName() { - return Owned, nil - } else { - return Claimed, &ref - } - } - } - return Free, nil -} - -func (r *Endpoint) IsOwnedBy(cr client.Object) bool { - refs := r.GetOwnerReferences() - for _, ref := range refs { - if ref.APIVersion == cr.GetObjectKind().GroupVersionKind().GroupVersion().String() && - ref.Kind == cr.GetObjectKind().GroupVersionKind().Kind { - if ref.UID == cr.GetUID() && ref.Name == cr.GetName() { - return true - } - } - } - return false -} - -func (r *Endpoint) Claim(cr client.Object) { - refs := r.GetOwnerReferences() - if len(refs) == 0 { - refs = []metav1.OwnerReference{} - } - found := false - for _, ref := range refs { - if ref.APIVersion == cr.GetObjectKind().GroupVersionKind().GroupVersion().String() && - ref.Kind == cr.GetObjectKind().GroupVersionKind().Kind && - ref.Name == cr.GetName() && - ref.UID == cr.GetUID() { - found = true - break - } - } - if !found { - refs = append(refs, metav1.OwnerReference{ - APIVersion: cr.GetObjectKind().GroupVersionKind().GroupVersion().String(), - Kind: cr.GetObjectKind().GroupVersionKind().Kind, - Name: cr.GetName(), - UID: cr.GetUID(), - }) - } - r.SetOwnerReferences(refs) -} - -func (r *Endpoint) Release(cr client.Object) { - refs := r.GetOwnerReferences() - found := false - idx := 0 - for i, ref := range refs { - if ref.APIVersion == cr.GetObjectKind().GroupVersionKind().GroupVersion().String() && - ref.Kind == cr.GetObjectKind().GroupVersionKind().Kind && - ref.Name == cr.GetName() && - ref.UID == cr.GetUID() { - found = true - idx = i - break - } - } - if found { - refs = append(refs[:idx], refs[idx+1:]...) - r.SetOwnerReferences(refs) - } -} diff --git a/apis/backend/infra/v1alpha1/endpoint_types.go b/apis/backend/infra/v1alpha1/endpoint_types.go deleted file mode 100644 index cf27147..0000000 --- a/apis/backend/infra/v1alpha1/endpoint_types.go +++ /dev/null @@ -1,82 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "reflect" - - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// Claims can be expressed in 3 ways -// OnwerReference, Finalizer or Status with reference to the claim onwer -> finalizer seem the best option for this - -// EndpointSpec defines the desired state of Endpoint -type EndpointSpec struct { - // NodeGroupEndpointID identifies the endpoint identity this resource belongs to - NodeGroupEndpointID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeGroupEndpointID"` - // Module define the module to which the Endpoint belongs - // +optional - Module *string `json:"module,omitempty" yaml:"module,omitempty" protobuf:"bytes,2,opt,name=module"` - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` - // (Gbps) - Speed *string `json:"speed,omitempty" yaml:"speed,omitempty" protobuf:"bytes,4,opt,name=speed"` - // VLANTagging defines if VLAN tagging is enabled or disabled on the interface - VLANTagging bool `json:"vlanTagging,omitempty" yaml:"vlanTagging,omitempty" protobuf:"bytes,5,opt,name=vlanTagging"` - // Provider defines the provider implementing this resource. - Provider string `json:"provider" yaml:"provider" protobuf:"bytes,6,opt,name=provider"` -} - -// EndpointStatus defines the observed state of Endpoint -type EndpointStatus struct { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// An Endpoint represents a communication interface or connection point within a Node, -// facilitating network communication and data transfer between different components -// or systems within the environment. `Endpoints` serve as gateways for transmitting and -// receiving data, enabling seamless communication between Nodes. -// +k8s:openapi-gen=true -type Endpoint struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - Spec EndpointSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - Status EndpointStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// EndpointList contains a list of Endpoints -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type EndpointList struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []Endpoint `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` -} - -var ( - EndpointKind = reflect.TypeOf(Endpoint{}).Name() - EndpointKindList = reflect.TypeOf(EndpointList{}).Name() -) diff --git a/apis/backend/infra/v1alpha1/endpointset_interface.go b/apis/backend/infra/v1alpha1/endpointset_interface.go deleted file mode 100644 index a5d2f5f..0000000 --- a/apis/backend/infra/v1alpha1/endpointset_interface.go +++ /dev/null @@ -1,329 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "crypto/sha1" - "encoding/json" - "fmt" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/apiserver-store/pkg/generic/registry" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - apierrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/fields" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/selection" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" - genericapirequest "k8s.io/apiserver/pkg/endpoints/request" -) - -const EndpointSetPlural = "endpointsets" -const EndpointSetSingular = "endpointset" - -// +k8s:deepcopy-gen=false -var _ resource.Object = &EndpointSet{} -var _ resource.ObjectList = &EndpointSetList{} -var _ backend.ObjectList = &EndpointSetList{} -var _ backend.GenericObject = &EndpointSet{} -var _ backend.GenericObjectList = &EndpointSetList{} - -// GetListMeta returns the ListMeta -func (r *EndpointSetList) GetListMeta() *metav1.ListMeta { - return &r.ListMeta -} - -func (r *EndpointSet) GetSingularName() string { - return EndpointSetSingular -} - -func (EndpointSet) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Resource: EndpointSetPlural, - } -} - -// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. -// IsStorageVersion implements resource.Object. -func (EndpointSet) IsStorageVersion() bool { - return true -} - -// GetObjectMeta implements resource.Object -func (r *EndpointSet) GetObjectMeta() *metav1.ObjectMeta { - return &r.ObjectMeta -} - -// NamespaceScoped returns true to indicate Fortune is a namespaced resource. -// NamespaceScoped implements resource.Object. -func (EndpointSet) NamespaceScoped() bool { - return true -} - -// New implements resource.Object -func (EndpointSet) New() runtime.Object { - return &EndpointSet{} -} - -// NewList implements resource.Object -func (EndpointSet) NewList() runtime.Object { - return &EndpointSetList{} -} - -func (r *EndpointSet) NewObjList() backend.GenericObjectList { - return &EndpointSetList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: EndpointSetKindList}, - } -} - -func (r *EndpointSet) SchemaGroupVersionKind() schema.GroupVersionKind { - return SchemeGroupVersion.WithKind(EndpointSetKind) -} - -// GetCondition returns the condition based on the condition kind -func (r *EndpointSet) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { - return r.Status.GetCondition(t) -} - -// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions -// to be set at once -func (r *EndpointSet) SetConditions(c ...conditionv1alpha1.Condition) { - r.Status.SetConditions(c...) -} - -// EndpointSetConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for EndpointSet -func EndpointSetConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { - switch label { - case "metadata.name": - return label, value, nil - case "metadata.namespace": - return label, value, nil - default: - return "", "", fmt.Errorf("%q is not a known field selector", label) - } -} - -func (r *EndpointSetList) GetItems() []backend.Object { - objs := []backend.Object{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *EndpointSetList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *EndpointSet) CalculateHash() ([sha1.Size]byte, error) { - // Convert the struct to JSON - jsonData, err := json.Marshal(r) - if err != nil { - return [sha1.Size]byte{}, err - } - - // Calculate SHA-1 hash - return sha1.Sum(jsonData), nil -} - -func (r *EndpointSet) GetNamespacedName() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.GetNamespace(), - Name: r.GetName(), - } -} - -func (r *EndpointSet) GetKey() store.Key { - return store.KeyFromNSN(r.GetNamespacedName()) -} - -func (r *EndpointSet) GetEndpointSet() string { - return r.Name -} - -func (r *EndpointSet) GetOwnerReference() *commonv1alpha1.OwnerReference { - return &commonv1alpha1.OwnerReference{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Kind: EndpointSetKind, - Namespace: r.Namespace, - Name: r.Name, - } -} - -func (r *EndpointSet) ValidateSyntax(_ string) field.ErrorList { - var allErrs field.ErrorList - - /* - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.type"), - r, - fmt.Errorf("invalid GENID Type %s", r.Spec.Type).Error(), - )) - } - */ - return allErrs -} - -func (r *EndpointSet) GetSpec() any { - return r.Spec -} - -func (r *EndpointSet) SetSpec(s any) { - if spec, ok := s.(EndpointSetSpec); ok { - r.Spec = spec - } -} - -// BuildEndpointSet returns a reource from a client Object a Spec/Status -func BuildEndpointSet(meta metav1.ObjectMeta, spec *EndpointSetSpec, status *EndpointSetStatus) *EndpointSet { - aspec := EndpointSetSpec{} - if spec != nil { - aspec = *spec - } - astatus := EndpointSetStatus{} - if status != nil { - astatus = *status - } - return &EndpointSet{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: EndpointSetKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -func EndpointSetTableConvertor(gr schema.GroupResource) registry.TableConvertor { - return registry.TableConvertor{ - Resource: gr, - Cells: func(obj runtime.Object) []interface{} { - r, ok := obj.(*EndpointSet) - if !ok { - return nil - } - return []interface{}{ - r.GetName(), - r.GetCondition(conditionv1alpha1.ConditionTypeReady).Status, - } - }, - Columns: []metav1.TableColumnDefinition{ - {Name: "Name", Type: "string"}, - {Name: "Ready", Type: "string"}, - }, - } -} - -func EndpointSetParseFieldSelector(ctx context.Context, fieldSelector fields.Selector) (backend.Filter, error) { - var filter *EndpointSetFilter - - // add the namespace to the list - namespace, ok := genericapirequest.NamespaceFrom(ctx) - if fieldSelector == nil { - if ok { - return &EndpointSetFilter{Namespace: namespace}, nil - } - return filter, nil - } - requirements := fieldSelector.Requirements() - for _, requirement := range requirements { - filter = &EndpointSetFilter{} - switch requirement.Operator { - case selection.Equals, selection.DoesNotExist: - if requirement.Value == "" { - return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) - } - default: - return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) - } - - switch requirement.Field { - case "metadata.name": - filter.Name = requirement.Value - case "metadata.namespace": - filter.Namespace = requirement.Value - default: - return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) - } - } - // add namespace to the filter selector if specified - if ok { - if filter != nil { - filter.Namespace = namespace - } else { - filter = &EndpointSetFilter{Namespace: namespace} - } - } - - return &EndpointSetFilter{}, nil -} - -type EndpointSetFilter struct { - // Name filters by the name of the objects - Name string `protobuf:"bytes,1,opt,name=name"` - - // Namespace filters by the namespace of the objects - Namespace string `protobuf:"bytes,2,opt,name=namespace"` -} - -func (r *EndpointSetFilter) Filter(ctx context.Context, obj runtime.Object) bool { - f := false // result of the previous filter - o, ok := obj.(*EndpointSet) - if !ok { - return f - } - if r.Name != "" { - if o.GetName() == r.Name { - f = false - } else { - f = true - } - } - if r.Namespace != "" { - if o.GetNamespace() == r.Namespace { - f = false - } else { - f = true - } - } - return f -} - -func (r *EndpointSet) GetUserDefinedLabels() map[string]string { - return r.Spec.GetUserDefinedLabels() -} - -func (r *EndpointSet) GetProvider() string { - return "" -} diff --git a/apis/backend/infra/v1alpha1/endpointset_types.go b/apis/backend/infra/v1alpha1/endpointset_types.go deleted file mode 100644 index 4659517..0000000 --- a/apis/backend/infra/v1alpha1/endpointset_types.go +++ /dev/null @@ -1,85 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "reflect" - - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// EndpointSetSpec defines the desired state of EndpointSet -// An EndpointSet can be a LAG (single Homed) or ESI (multiHomed). The EndpointSet -// can only belong to a single NodeGroup -type EndpointSetSpec struct { - // Endpoints defines the Endpoints that are part of the EndpointSet - // Min 1, Max 16 - Endpoints []*EndpointID `json:"endpoints" yaml:"endpoints" protobuf:"bytes,1,opt,name=endpoints"` - // Lacp defines if the lag enabled LACP - // +optional - Lacp *bool `json:"lacp,omitempty" yaml:"lacp,omitempty" protobuf:"bytes,2,opt,name=lacp"` - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` -} - -// EndpointSetStatus defines the observed state of EndpointSet -type EndpointSetStatus struct { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` - // ESI defines the ethernet segment identifier of the logical link - // if set this is a multi-homed logical endpoint - // the ESI is a global unique identifier within the administrative domain - // +optional - ESI *uint32 `json:"esi,omitempty" yaml:"esi,omitempty" protobuf:"bytes,2,opt,name=esi"` - // LagId defines the lag id for the logical single-homed or multi-homed - // endpoint - // +optional - LagId *uint32 `json:"lagID,omitempty" yaml:"lagID,omitempty" protobuf:"bytes,3,opt,name=lagID"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// A EndpointSet represents a set of endpoints that belong together within a nodeGroup. -// E.g. it can be used to model a logical Link Aggregation group within -// a node or it can be used to represent a logical multi-homing construction -// between a set of nodes belonging to a single nodeGroup. -// +k8s:openapi-gen=true -type EndpointSet struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - Spec EndpointSetSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - Status EndpointSetStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// EndpointSetList contains a list of EndpointSets -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type EndpointSetList struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []EndpointSet `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` -} - -var ( - EndpointSetKind = reflect.TypeOf(EndpointSet{}).Name() - EndpointSetKindList = reflect.TypeOf(EndpointSetList{}).Name() -) diff --git a/apis/backend/infra/v1alpha1/generated.pb.go b/apis/backend/infra/v1alpha1/generated.pb.go deleted file mode 100644 index c07b268..0000000 --- a/apis/backend/infra/v1alpha1/generated.pb.go +++ /dev/null @@ -1,18591 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 protoc-gen-gogo. DO NOT EDIT. -// source: github.com/kuidio/kuid/apis/backend/infra/v1alpha1/generated.proto - -package v1alpha1 - -import ( - fmt "fmt" - - io "io" - - proto "github.com/gogo/protobuf/proto" - - math "math" - math_bits "math/bits" - reflect "reflect" - strings "strings" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -func (m *BFDLinkParameters) Reset() { *m = BFDLinkParameters{} } -func (*BFDLinkParameters) ProtoMessage() {} -func (*BFDLinkParameters) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{0} -} -func (m *BFDLinkParameters) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BFDLinkParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *BFDLinkParameters) XXX_Merge(src proto.Message) { - xxx_messageInfo_BFDLinkParameters.Merge(m, src) -} -func (m *BFDLinkParameters) XXX_Size() int { - return m.Size() -} -func (m *BFDLinkParameters) XXX_DiscardUnknown() { - xxx_messageInfo_BFDLinkParameters.DiscardUnknown(m) -} - -var xxx_messageInfo_BFDLinkParameters proto.InternalMessageInfo - -func (m *BGPLinkParameters) Reset() { *m = BGPLinkParameters{} } -func (*BGPLinkParameters) ProtoMessage() {} -func (*BGPLinkParameters) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{1} -} -func (m *BGPLinkParameters) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BGPLinkParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *BGPLinkParameters) XXX_Merge(src proto.Message) { - xxx_messageInfo_BGPLinkParameters.Merge(m, src) -} -func (m *BGPLinkParameters) XXX_Size() int { - return m.Size() -} -func (m *BGPLinkParameters) XXX_DiscardUnknown() { - xxx_messageInfo_BGPLinkParameters.DiscardUnknown(m) -} - -var xxx_messageInfo_BGPLinkParameters proto.InternalMessageInfo - -func (m *Cluster) Reset() { *m = Cluster{} } -func (*Cluster) ProtoMessage() {} -func (*Cluster) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{2} -} -func (m *Cluster) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Cluster) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Cluster) XXX_Merge(src proto.Message) { - xxx_messageInfo_Cluster.Merge(m, src) -} -func (m *Cluster) XXX_Size() int { - return m.Size() -} -func (m *Cluster) XXX_DiscardUnknown() { - xxx_messageInfo_Cluster.DiscardUnknown(m) -} - -var xxx_messageInfo_Cluster proto.InternalMessageInfo - -func (m *ClusterFilter) Reset() { *m = ClusterFilter{} } -func (*ClusterFilter) ProtoMessage() {} -func (*ClusterFilter) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{3} -} -func (m *ClusterFilter) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ClusterFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ClusterFilter) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClusterFilter.Merge(m, src) -} -func (m *ClusterFilter) XXX_Size() int { - return m.Size() -} -func (m *ClusterFilter) XXX_DiscardUnknown() { - xxx_messageInfo_ClusterFilter.DiscardUnknown(m) -} - -var xxx_messageInfo_ClusterFilter proto.InternalMessageInfo - -func (m *ClusterList) Reset() { *m = ClusterList{} } -func (*ClusterList) ProtoMessage() {} -func (*ClusterList) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{4} -} -func (m *ClusterList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ClusterList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ClusterList) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClusterList.Merge(m, src) -} -func (m *ClusterList) XXX_Size() int { - return m.Size() -} -func (m *ClusterList) XXX_DiscardUnknown() { - xxx_messageInfo_ClusterList.DiscardUnknown(m) -} - -var xxx_messageInfo_ClusterList proto.InternalMessageInfo - -func (m *ClusterSpec) Reset() { *m = ClusterSpec{} } -func (*ClusterSpec) ProtoMessage() {} -func (*ClusterSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{5} -} -func (m *ClusterSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ClusterSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ClusterSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClusterSpec.Merge(m, src) -} -func (m *ClusterSpec) XXX_Size() int { - return m.Size() -} -func (m *ClusterSpec) XXX_DiscardUnknown() { - xxx_messageInfo_ClusterSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_ClusterSpec proto.InternalMessageInfo - -func (m *ClusterStatus) Reset() { *m = ClusterStatus{} } -func (*ClusterStatus) ProtoMessage() {} -func (*ClusterStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{6} -} -func (m *ClusterStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ClusterStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ClusterStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClusterStatus.Merge(m, src) -} -func (m *ClusterStatus) XXX_Size() int { - return m.Size() -} -func (m *ClusterStatus) XXX_DiscardUnknown() { - xxx_messageInfo_ClusterStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_ClusterStatus proto.InternalMessageInfo - -func (m *Endpoint) Reset() { *m = Endpoint{} } -func (*Endpoint) ProtoMessage() {} -func (*Endpoint) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{7} -} -func (m *Endpoint) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Endpoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Endpoint) XXX_Merge(src proto.Message) { - xxx_messageInfo_Endpoint.Merge(m, src) -} -func (m *Endpoint) XXX_Size() int { - return m.Size() -} -func (m *Endpoint) XXX_DiscardUnknown() { - xxx_messageInfo_Endpoint.DiscardUnknown(m) -} - -var xxx_messageInfo_Endpoint proto.InternalMessageInfo - -func (m *EndpointFilter) Reset() { *m = EndpointFilter{} } -func (*EndpointFilter) ProtoMessage() {} -func (*EndpointFilter) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{8} -} -func (m *EndpointFilter) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EndpointFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EndpointFilter) XXX_Merge(src proto.Message) { - xxx_messageInfo_EndpointFilter.Merge(m, src) -} -func (m *EndpointFilter) XXX_Size() int { - return m.Size() -} -func (m *EndpointFilter) XXX_DiscardUnknown() { - xxx_messageInfo_EndpointFilter.DiscardUnknown(m) -} - -var xxx_messageInfo_EndpointFilter proto.InternalMessageInfo - -func (m *EndpointID) Reset() { *m = EndpointID{} } -func (*EndpointID) ProtoMessage() {} -func (*EndpointID) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{9} -} -func (m *EndpointID) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EndpointID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EndpointID) XXX_Merge(src proto.Message) { - xxx_messageInfo_EndpointID.Merge(m, src) -} -func (m *EndpointID) XXX_Size() int { - return m.Size() -} -func (m *EndpointID) XXX_DiscardUnknown() { - xxx_messageInfo_EndpointID.DiscardUnknown(m) -} - -var xxx_messageInfo_EndpointID proto.InternalMessageInfo - -func (m *EndpointList) Reset() { *m = EndpointList{} } -func (*EndpointList) ProtoMessage() {} -func (*EndpointList) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{10} -} -func (m *EndpointList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EndpointList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EndpointList) XXX_Merge(src proto.Message) { - xxx_messageInfo_EndpointList.Merge(m, src) -} -func (m *EndpointList) XXX_Size() int { - return m.Size() -} -func (m *EndpointList) XXX_DiscardUnknown() { - xxx_messageInfo_EndpointList.DiscardUnknown(m) -} - -var xxx_messageInfo_EndpointList proto.InternalMessageInfo - -func (m *EndpointSet) Reset() { *m = EndpointSet{} } -func (*EndpointSet) ProtoMessage() {} -func (*EndpointSet) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{11} -} -func (m *EndpointSet) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EndpointSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EndpointSet) XXX_Merge(src proto.Message) { - xxx_messageInfo_EndpointSet.Merge(m, src) -} -func (m *EndpointSet) XXX_Size() int { - return m.Size() -} -func (m *EndpointSet) XXX_DiscardUnknown() { - xxx_messageInfo_EndpointSet.DiscardUnknown(m) -} - -var xxx_messageInfo_EndpointSet proto.InternalMessageInfo - -func (m *EndpointSetFilter) Reset() { *m = EndpointSetFilter{} } -func (*EndpointSetFilter) ProtoMessage() {} -func (*EndpointSetFilter) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{12} -} -func (m *EndpointSetFilter) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EndpointSetFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EndpointSetFilter) XXX_Merge(src proto.Message) { - xxx_messageInfo_EndpointSetFilter.Merge(m, src) -} -func (m *EndpointSetFilter) XXX_Size() int { - return m.Size() -} -func (m *EndpointSetFilter) XXX_DiscardUnknown() { - xxx_messageInfo_EndpointSetFilter.DiscardUnknown(m) -} - -var xxx_messageInfo_EndpointSetFilter proto.InternalMessageInfo - -func (m *EndpointSetList) Reset() { *m = EndpointSetList{} } -func (*EndpointSetList) ProtoMessage() {} -func (*EndpointSetList) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{13} -} -func (m *EndpointSetList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EndpointSetList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EndpointSetList) XXX_Merge(src proto.Message) { - xxx_messageInfo_EndpointSetList.Merge(m, src) -} -func (m *EndpointSetList) XXX_Size() int { - return m.Size() -} -func (m *EndpointSetList) XXX_DiscardUnknown() { - xxx_messageInfo_EndpointSetList.DiscardUnknown(m) -} - -var xxx_messageInfo_EndpointSetList proto.InternalMessageInfo - -func (m *EndpointSetSpec) Reset() { *m = EndpointSetSpec{} } -func (*EndpointSetSpec) ProtoMessage() {} -func (*EndpointSetSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{14} -} -func (m *EndpointSetSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EndpointSetSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EndpointSetSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_EndpointSetSpec.Merge(m, src) -} -func (m *EndpointSetSpec) XXX_Size() int { - return m.Size() -} -func (m *EndpointSetSpec) XXX_DiscardUnknown() { - xxx_messageInfo_EndpointSetSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_EndpointSetSpec proto.InternalMessageInfo - -func (m *EndpointSetStatus) Reset() { *m = EndpointSetStatus{} } -func (*EndpointSetStatus) ProtoMessage() {} -func (*EndpointSetStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{15} -} -func (m *EndpointSetStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EndpointSetStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EndpointSetStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_EndpointSetStatus.Merge(m, src) -} -func (m *EndpointSetStatus) XXX_Size() int { - return m.Size() -} -func (m *EndpointSetStatus) XXX_DiscardUnknown() { - xxx_messageInfo_EndpointSetStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_EndpointSetStatus proto.InternalMessageInfo - -func (m *EndpointSpec) Reset() { *m = EndpointSpec{} } -func (*EndpointSpec) ProtoMessage() {} -func (*EndpointSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{16} -} -func (m *EndpointSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EndpointSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EndpointSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_EndpointSpec.Merge(m, src) -} -func (m *EndpointSpec) XXX_Size() int { - return m.Size() -} -func (m *EndpointSpec) XXX_DiscardUnknown() { - xxx_messageInfo_EndpointSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_EndpointSpec proto.InternalMessageInfo - -func (m *EndpointStatus) Reset() { *m = EndpointStatus{} } -func (*EndpointStatus) ProtoMessage() {} -func (*EndpointStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{17} -} -func (m *EndpointStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EndpointStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EndpointStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_EndpointStatus.Merge(m, src) -} -func (m *EndpointStatus) XXX_Size() int { - return m.Size() -} -func (m *EndpointStatus) XXX_DiscardUnknown() { - xxx_messageInfo_EndpointStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_EndpointStatus proto.InternalMessageInfo - -func (m *IGPLinkParameters) Reset() { *m = IGPLinkParameters{} } -func (*IGPLinkParameters) ProtoMessage() {} -func (*IGPLinkParameters) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{18} -} -func (m *IGPLinkParameters) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *IGPLinkParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *IGPLinkParameters) XXX_Merge(src proto.Message) { - xxx_messageInfo_IGPLinkParameters.Merge(m, src) -} -func (m *IGPLinkParameters) XXX_Size() int { - return m.Size() -} -func (m *IGPLinkParameters) XXX_DiscardUnknown() { - xxx_messageInfo_IGPLinkParameters.DiscardUnknown(m) -} - -var xxx_messageInfo_IGPLinkParameters proto.InternalMessageInfo - -func (m *ISISLinkParameters) Reset() { *m = ISISLinkParameters{} } -func (*ISISLinkParameters) ProtoMessage() {} -func (*ISISLinkParameters) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{19} -} -func (m *ISISLinkParameters) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ISISLinkParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ISISLinkParameters) XXX_Merge(src proto.Message) { - xxx_messageInfo_ISISLinkParameters.Merge(m, src) -} -func (m *ISISLinkParameters) XXX_Size() int { - return m.Size() -} -func (m *ISISLinkParameters) XXX_DiscardUnknown() { - xxx_messageInfo_ISISLinkParameters.DiscardUnknown(m) -} - -var xxx_messageInfo_ISISLinkParameters proto.InternalMessageInfo - -func (m *Link) Reset() { *m = Link{} } -func (*Link) ProtoMessage() {} -func (*Link) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{20} -} -func (m *Link) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Link) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Link) XXX_Merge(src proto.Message) { - xxx_messageInfo_Link.Merge(m, src) -} -func (m *Link) XXX_Size() int { - return m.Size() -} -func (m *Link) XXX_DiscardUnknown() { - xxx_messageInfo_Link.DiscardUnknown(m) -} - -var xxx_messageInfo_Link proto.InternalMessageInfo - -func (m *LinkFilter) Reset() { *m = LinkFilter{} } -func (*LinkFilter) ProtoMessage() {} -func (*LinkFilter) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{21} -} -func (m *LinkFilter) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LinkFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *LinkFilter) XXX_Merge(src proto.Message) { - xxx_messageInfo_LinkFilter.Merge(m, src) -} -func (m *LinkFilter) XXX_Size() int { - return m.Size() -} -func (m *LinkFilter) XXX_DiscardUnknown() { - xxx_messageInfo_LinkFilter.DiscardUnknown(m) -} - -var xxx_messageInfo_LinkFilter proto.InternalMessageInfo - -func (m *LinkList) Reset() { *m = LinkList{} } -func (*LinkList) ProtoMessage() {} -func (*LinkList) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{22} -} -func (m *LinkList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LinkList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *LinkList) XXX_Merge(src proto.Message) { - xxx_messageInfo_LinkList.Merge(m, src) -} -func (m *LinkList) XXX_Size() int { - return m.Size() -} -func (m *LinkList) XXX_DiscardUnknown() { - xxx_messageInfo_LinkList.DiscardUnknown(m) -} - -var xxx_messageInfo_LinkList proto.InternalMessageInfo - -func (m *LinkSet) Reset() { *m = LinkSet{} } -func (*LinkSet) ProtoMessage() {} -func (*LinkSet) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{23} -} -func (m *LinkSet) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LinkSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *LinkSet) XXX_Merge(src proto.Message) { - xxx_messageInfo_LinkSet.Merge(m, src) -} -func (m *LinkSet) XXX_Size() int { - return m.Size() -} -func (m *LinkSet) XXX_DiscardUnknown() { - xxx_messageInfo_LinkSet.DiscardUnknown(m) -} - -var xxx_messageInfo_LinkSet proto.InternalMessageInfo - -func (m *LinkSetFilter) Reset() { *m = LinkSetFilter{} } -func (*LinkSetFilter) ProtoMessage() {} -func (*LinkSetFilter) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{24} -} -func (m *LinkSetFilter) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LinkSetFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *LinkSetFilter) XXX_Merge(src proto.Message) { - xxx_messageInfo_LinkSetFilter.Merge(m, src) -} -func (m *LinkSetFilter) XXX_Size() int { - return m.Size() -} -func (m *LinkSetFilter) XXX_DiscardUnknown() { - xxx_messageInfo_LinkSetFilter.DiscardUnknown(m) -} - -var xxx_messageInfo_LinkSetFilter proto.InternalMessageInfo - -func (m *LinkSetList) Reset() { *m = LinkSetList{} } -func (*LinkSetList) ProtoMessage() {} -func (*LinkSetList) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{25} -} -func (m *LinkSetList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LinkSetList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *LinkSetList) XXX_Merge(src proto.Message) { - xxx_messageInfo_LinkSetList.Merge(m, src) -} -func (m *LinkSetList) XXX_Size() int { - return m.Size() -} -func (m *LinkSetList) XXX_DiscardUnknown() { - xxx_messageInfo_LinkSetList.DiscardUnknown(m) -} - -var xxx_messageInfo_LinkSetList proto.InternalMessageInfo - -func (m *LinkSetSpec) Reset() { *m = LinkSetSpec{} } -func (*LinkSetSpec) ProtoMessage() {} -func (*LinkSetSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{26} -} -func (m *LinkSetSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LinkSetSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *LinkSetSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_LinkSetSpec.Merge(m, src) -} -func (m *LinkSetSpec) XXX_Size() int { - return m.Size() -} -func (m *LinkSetSpec) XXX_DiscardUnknown() { - xxx_messageInfo_LinkSetSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_LinkSetSpec proto.InternalMessageInfo - -func (m *LinkSetStatus) Reset() { *m = LinkSetStatus{} } -func (*LinkSetStatus) ProtoMessage() {} -func (*LinkSetStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{27} -} -func (m *LinkSetStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LinkSetStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *LinkSetStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_LinkSetStatus.Merge(m, src) -} -func (m *LinkSetStatus) XXX_Size() int { - return m.Size() -} -func (m *LinkSetStatus) XXX_DiscardUnknown() { - xxx_messageInfo_LinkSetStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_LinkSetStatus proto.InternalMessageInfo - -func (m *LinkSpec) Reset() { *m = LinkSpec{} } -func (*LinkSpec) ProtoMessage() {} -func (*LinkSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{28} -} -func (m *LinkSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LinkSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *LinkSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_LinkSpec.Merge(m, src) -} -func (m *LinkSpec) XXX_Size() int { - return m.Size() -} -func (m *LinkSpec) XXX_DiscardUnknown() { - xxx_messageInfo_LinkSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_LinkSpec proto.InternalMessageInfo - -func (m *LinkStatus) Reset() { *m = LinkStatus{} } -func (*LinkStatus) ProtoMessage() {} -func (*LinkStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{29} -} -func (m *LinkStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LinkStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *LinkStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_LinkStatus.Merge(m, src) -} -func (m *LinkStatus) XXX_Size() int { - return m.Size() -} -func (m *LinkStatus) XXX_DiscardUnknown() { - xxx_messageInfo_LinkStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_LinkStatus proto.InternalMessageInfo - -func (m *Location) Reset() { *m = Location{} } -func (*Location) ProtoMessage() {} -func (*Location) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{30} -} -func (m *Location) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Location) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Location) XXX_Merge(src proto.Message) { - xxx_messageInfo_Location.Merge(m, src) -} -func (m *Location) XXX_Size() int { - return m.Size() -} -func (m *Location) XXX_DiscardUnknown() { - xxx_messageInfo_Location.DiscardUnknown(m) -} - -var xxx_messageInfo_Location proto.InternalMessageInfo - -func (m *Module) Reset() { *m = Module{} } -func (*Module) ProtoMessage() {} -func (*Module) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{31} -} -func (m *Module) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Module) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Module) XXX_Merge(src proto.Message) { - xxx_messageInfo_Module.Merge(m, src) -} -func (m *Module) XXX_Size() int { - return m.Size() -} -func (m *Module) XXX_DiscardUnknown() { - xxx_messageInfo_Module.DiscardUnknown(m) -} - -var xxx_messageInfo_Module proto.InternalMessageInfo - -func (m *ModuleBay) Reset() { *m = ModuleBay{} } -func (*ModuleBay) ProtoMessage() {} -func (*ModuleBay) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{32} -} -func (m *ModuleBay) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ModuleBay) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ModuleBay) XXX_Merge(src proto.Message) { - xxx_messageInfo_ModuleBay.Merge(m, src) -} -func (m *ModuleBay) XXX_Size() int { - return m.Size() -} -func (m *ModuleBay) XXX_DiscardUnknown() { - xxx_messageInfo_ModuleBay.DiscardUnknown(m) -} - -var xxx_messageInfo_ModuleBay proto.InternalMessageInfo - -func (m *ModuleBayFilter) Reset() { *m = ModuleBayFilter{} } -func (*ModuleBayFilter) ProtoMessage() {} -func (*ModuleBayFilter) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{33} -} -func (m *ModuleBayFilter) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ModuleBayFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ModuleBayFilter) XXX_Merge(src proto.Message) { - xxx_messageInfo_ModuleBayFilter.Merge(m, src) -} -func (m *ModuleBayFilter) XXX_Size() int { - return m.Size() -} -func (m *ModuleBayFilter) XXX_DiscardUnknown() { - xxx_messageInfo_ModuleBayFilter.DiscardUnknown(m) -} - -var xxx_messageInfo_ModuleBayFilter proto.InternalMessageInfo - -func (m *ModuleBayList) Reset() { *m = ModuleBayList{} } -func (*ModuleBayList) ProtoMessage() {} -func (*ModuleBayList) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{34} -} -func (m *ModuleBayList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ModuleBayList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ModuleBayList) XXX_Merge(src proto.Message) { - xxx_messageInfo_ModuleBayList.Merge(m, src) -} -func (m *ModuleBayList) XXX_Size() int { - return m.Size() -} -func (m *ModuleBayList) XXX_DiscardUnknown() { - xxx_messageInfo_ModuleBayList.DiscardUnknown(m) -} - -var xxx_messageInfo_ModuleBayList proto.InternalMessageInfo - -func (m *ModuleBaySpec) Reset() { *m = ModuleBaySpec{} } -func (*ModuleBaySpec) ProtoMessage() {} -func (*ModuleBaySpec) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{35} -} -func (m *ModuleBaySpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ModuleBaySpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ModuleBaySpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_ModuleBaySpec.Merge(m, src) -} -func (m *ModuleBaySpec) XXX_Size() int { - return m.Size() -} -func (m *ModuleBaySpec) XXX_DiscardUnknown() { - xxx_messageInfo_ModuleBaySpec.DiscardUnknown(m) -} - -var xxx_messageInfo_ModuleBaySpec proto.InternalMessageInfo - -func (m *ModuleBayStatus) Reset() { *m = ModuleBayStatus{} } -func (*ModuleBayStatus) ProtoMessage() {} -func (*ModuleBayStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{36} -} -func (m *ModuleBayStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ModuleBayStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ModuleBayStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_ModuleBayStatus.Merge(m, src) -} -func (m *ModuleBayStatus) XXX_Size() int { - return m.Size() -} -func (m *ModuleBayStatus) XXX_DiscardUnknown() { - xxx_messageInfo_ModuleBayStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_ModuleBayStatus proto.InternalMessageInfo - -func (m *ModuleFilter) Reset() { *m = ModuleFilter{} } -func (*ModuleFilter) ProtoMessage() {} -func (*ModuleFilter) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{37} -} -func (m *ModuleFilter) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ModuleFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ModuleFilter) XXX_Merge(src proto.Message) { - xxx_messageInfo_ModuleFilter.Merge(m, src) -} -func (m *ModuleFilter) XXX_Size() int { - return m.Size() -} -func (m *ModuleFilter) XXX_DiscardUnknown() { - xxx_messageInfo_ModuleFilter.DiscardUnknown(m) -} - -var xxx_messageInfo_ModuleFilter proto.InternalMessageInfo - -func (m *ModuleList) Reset() { *m = ModuleList{} } -func (*ModuleList) ProtoMessage() {} -func (*ModuleList) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{38} -} -func (m *ModuleList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ModuleList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ModuleList) XXX_Merge(src proto.Message) { - xxx_messageInfo_ModuleList.Merge(m, src) -} -func (m *ModuleList) XXX_Size() int { - return m.Size() -} -func (m *ModuleList) XXX_DiscardUnknown() { - xxx_messageInfo_ModuleList.DiscardUnknown(m) -} - -var xxx_messageInfo_ModuleList proto.InternalMessageInfo - -func (m *ModuleSpec) Reset() { *m = ModuleSpec{} } -func (*ModuleSpec) ProtoMessage() {} -func (*ModuleSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{39} -} -func (m *ModuleSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ModuleSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ModuleSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_ModuleSpec.Merge(m, src) -} -func (m *ModuleSpec) XXX_Size() int { - return m.Size() -} -func (m *ModuleSpec) XXX_DiscardUnknown() { - xxx_messageInfo_ModuleSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_ModuleSpec proto.InternalMessageInfo - -func (m *ModuleStatus) Reset() { *m = ModuleStatus{} } -func (*ModuleStatus) ProtoMessage() {} -func (*ModuleStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{40} -} -func (m *ModuleStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ModuleStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ModuleStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_ModuleStatus.Merge(m, src) -} -func (m *ModuleStatus) XXX_Size() int { - return m.Size() -} -func (m *ModuleStatus) XXX_DiscardUnknown() { - xxx_messageInfo_ModuleStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_ModuleStatus proto.InternalMessageInfo - -func (m *Node) Reset() { *m = Node{} } -func (*Node) ProtoMessage() {} -func (*Node) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{41} -} -func (m *Node) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Node) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Node) XXX_Merge(src proto.Message) { - xxx_messageInfo_Node.Merge(m, src) -} -func (m *Node) XXX_Size() int { - return m.Size() -} -func (m *Node) XXX_DiscardUnknown() { - xxx_messageInfo_Node.DiscardUnknown(m) -} - -var xxx_messageInfo_Node proto.InternalMessageInfo - -func (m *NodeFilter) Reset() { *m = NodeFilter{} } -func (*NodeFilter) ProtoMessage() {} -func (*NodeFilter) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{42} -} -func (m *NodeFilter) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NodeFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NodeFilter) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeFilter.Merge(m, src) -} -func (m *NodeFilter) XXX_Size() int { - return m.Size() -} -func (m *NodeFilter) XXX_DiscardUnknown() { - xxx_messageInfo_NodeFilter.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeFilter proto.InternalMessageInfo - -func (m *NodeGroup) Reset() { *m = NodeGroup{} } -func (*NodeGroup) ProtoMessage() {} -func (*NodeGroup) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{43} -} -func (m *NodeGroup) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NodeGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NodeGroup) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeGroup.Merge(m, src) -} -func (m *NodeGroup) XXX_Size() int { - return m.Size() -} -func (m *NodeGroup) XXX_DiscardUnknown() { - xxx_messageInfo_NodeGroup.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeGroup proto.InternalMessageInfo - -func (m *NodeGroupEndpointID) Reset() { *m = NodeGroupEndpointID{} } -func (*NodeGroupEndpointID) ProtoMessage() {} -func (*NodeGroupEndpointID) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{44} -} -func (m *NodeGroupEndpointID) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NodeGroupEndpointID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NodeGroupEndpointID) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeGroupEndpointID.Merge(m, src) -} -func (m *NodeGroupEndpointID) XXX_Size() int { - return m.Size() -} -func (m *NodeGroupEndpointID) XXX_DiscardUnknown() { - xxx_messageInfo_NodeGroupEndpointID.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeGroupEndpointID proto.InternalMessageInfo - -func (m *NodeGroupFilter) Reset() { *m = NodeGroupFilter{} } -func (*NodeGroupFilter) ProtoMessage() {} -func (*NodeGroupFilter) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{45} -} -func (m *NodeGroupFilter) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NodeGroupFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NodeGroupFilter) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeGroupFilter.Merge(m, src) -} -func (m *NodeGroupFilter) XXX_Size() int { - return m.Size() -} -func (m *NodeGroupFilter) XXX_DiscardUnknown() { - xxx_messageInfo_NodeGroupFilter.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeGroupFilter proto.InternalMessageInfo - -func (m *NodeGroupList) Reset() { *m = NodeGroupList{} } -func (*NodeGroupList) ProtoMessage() {} -func (*NodeGroupList) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{46} -} -func (m *NodeGroupList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NodeGroupList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NodeGroupList) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeGroupList.Merge(m, src) -} -func (m *NodeGroupList) XXX_Size() int { - return m.Size() -} -func (m *NodeGroupList) XXX_DiscardUnknown() { - xxx_messageInfo_NodeGroupList.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeGroupList proto.InternalMessageInfo - -func (m *NodeGroupNodeID) Reset() { *m = NodeGroupNodeID{} } -func (*NodeGroupNodeID) ProtoMessage() {} -func (*NodeGroupNodeID) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{47} -} -func (m *NodeGroupNodeID) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NodeGroupNodeID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NodeGroupNodeID) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeGroupNodeID.Merge(m, src) -} -func (m *NodeGroupNodeID) XXX_Size() int { - return m.Size() -} -func (m *NodeGroupNodeID) XXX_DiscardUnknown() { - xxx_messageInfo_NodeGroupNodeID.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeGroupNodeID proto.InternalMessageInfo - -func (m *NodeGroupSpec) Reset() { *m = NodeGroupSpec{} } -func (*NodeGroupSpec) ProtoMessage() {} -func (*NodeGroupSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{48} -} -func (m *NodeGroupSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NodeGroupSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NodeGroupSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeGroupSpec.Merge(m, src) -} -func (m *NodeGroupSpec) XXX_Size() int { - return m.Size() -} -func (m *NodeGroupSpec) XXX_DiscardUnknown() { - xxx_messageInfo_NodeGroupSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeGroupSpec proto.InternalMessageInfo - -func (m *NodeGroupStatus) Reset() { *m = NodeGroupStatus{} } -func (*NodeGroupStatus) ProtoMessage() {} -func (*NodeGroupStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{49} -} -func (m *NodeGroupStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NodeGroupStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NodeGroupStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeGroupStatus.Merge(m, src) -} -func (m *NodeGroupStatus) XXX_Size() int { - return m.Size() -} -func (m *NodeGroupStatus) XXX_DiscardUnknown() { - xxx_messageInfo_NodeGroupStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeGroupStatus proto.InternalMessageInfo - -func (m *NodeID) Reset() { *m = NodeID{} } -func (*NodeID) ProtoMessage() {} -func (*NodeID) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{50} -} -func (m *NodeID) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NodeID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NodeID) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeID.Merge(m, src) -} -func (m *NodeID) XXX_Size() int { - return m.Size() -} -func (m *NodeID) XXX_DiscardUnknown() { - xxx_messageInfo_NodeID.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeID proto.InternalMessageInfo - -func (m *NodeItem) Reset() { *m = NodeItem{} } -func (*NodeItem) ProtoMessage() {} -func (*NodeItem) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{51} -} -func (m *NodeItem) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NodeItem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NodeItem) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeItem.Merge(m, src) -} -func (m *NodeItem) XXX_Size() int { - return m.Size() -} -func (m *NodeItem) XXX_DiscardUnknown() { - xxx_messageInfo_NodeItem.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeItem proto.InternalMessageInfo - -func (m *NodeItemFilter) Reset() { *m = NodeItemFilter{} } -func (*NodeItemFilter) ProtoMessage() {} -func (*NodeItemFilter) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{52} -} -func (m *NodeItemFilter) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NodeItemFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NodeItemFilter) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeItemFilter.Merge(m, src) -} -func (m *NodeItemFilter) XXX_Size() int { - return m.Size() -} -func (m *NodeItemFilter) XXX_DiscardUnknown() { - xxx_messageInfo_NodeItemFilter.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeItemFilter proto.InternalMessageInfo - -func (m *NodeItemList) Reset() { *m = NodeItemList{} } -func (*NodeItemList) ProtoMessage() {} -func (*NodeItemList) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{53} -} -func (m *NodeItemList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NodeItemList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NodeItemList) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeItemList.Merge(m, src) -} -func (m *NodeItemList) XXX_Size() int { - return m.Size() -} -func (m *NodeItemList) XXX_DiscardUnknown() { - xxx_messageInfo_NodeItemList.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeItemList proto.InternalMessageInfo - -func (m *NodeItemSpec) Reset() { *m = NodeItemSpec{} } -func (*NodeItemSpec) ProtoMessage() {} -func (*NodeItemSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{54} -} -func (m *NodeItemSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NodeItemSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NodeItemSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeItemSpec.Merge(m, src) -} -func (m *NodeItemSpec) XXX_Size() int { - return m.Size() -} -func (m *NodeItemSpec) XXX_DiscardUnknown() { - xxx_messageInfo_NodeItemSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeItemSpec proto.InternalMessageInfo - -func (m *NodeItemStatus) Reset() { *m = NodeItemStatus{} } -func (*NodeItemStatus) ProtoMessage() {} -func (*NodeItemStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{55} -} -func (m *NodeItemStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NodeItemStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NodeItemStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeItemStatus.Merge(m, src) -} -func (m *NodeItemStatus) XXX_Size() int { - return m.Size() -} -func (m *NodeItemStatus) XXX_DiscardUnknown() { - xxx_messageInfo_NodeItemStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeItemStatus proto.InternalMessageInfo - -func (m *NodeList) Reset() { *m = NodeList{} } -func (*NodeList) ProtoMessage() {} -func (*NodeList) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{56} -} -func (m *NodeList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NodeList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NodeList) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeList.Merge(m, src) -} -func (m *NodeList) XXX_Size() int { - return m.Size() -} -func (m *NodeList) XXX_DiscardUnknown() { - xxx_messageInfo_NodeList.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeList proto.InternalMessageInfo - -func (m *NodeSet) Reset() { *m = NodeSet{} } -func (*NodeSet) ProtoMessage() {} -func (*NodeSet) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{57} -} -func (m *NodeSet) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NodeSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NodeSet) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeSet.Merge(m, src) -} -func (m *NodeSet) XXX_Size() int { - return m.Size() -} -func (m *NodeSet) XXX_DiscardUnknown() { - xxx_messageInfo_NodeSet.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeSet proto.InternalMessageInfo - -func (m *NodeSetFilter) Reset() { *m = NodeSetFilter{} } -func (*NodeSetFilter) ProtoMessage() {} -func (*NodeSetFilter) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{58} -} -func (m *NodeSetFilter) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NodeSetFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NodeSetFilter) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeSetFilter.Merge(m, src) -} -func (m *NodeSetFilter) XXX_Size() int { - return m.Size() -} -func (m *NodeSetFilter) XXX_DiscardUnknown() { - xxx_messageInfo_NodeSetFilter.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeSetFilter proto.InternalMessageInfo - -func (m *NodeSetList) Reset() { *m = NodeSetList{} } -func (*NodeSetList) ProtoMessage() {} -func (*NodeSetList) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{59} -} -func (m *NodeSetList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NodeSetList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NodeSetList) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeSetList.Merge(m, src) -} -func (m *NodeSetList) XXX_Size() int { - return m.Size() -} -func (m *NodeSetList) XXX_DiscardUnknown() { - xxx_messageInfo_NodeSetList.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeSetList proto.InternalMessageInfo - -func (m *NodeSetSpec) Reset() { *m = NodeSetSpec{} } -func (*NodeSetSpec) ProtoMessage() {} -func (*NodeSetSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{60} -} -func (m *NodeSetSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NodeSetSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NodeSetSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeSetSpec.Merge(m, src) -} -func (m *NodeSetSpec) XXX_Size() int { - return m.Size() -} -func (m *NodeSetSpec) XXX_DiscardUnknown() { - xxx_messageInfo_NodeSetSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeSetSpec proto.InternalMessageInfo - -func (m *NodeSetStatus) Reset() { *m = NodeSetStatus{} } -func (*NodeSetStatus) ProtoMessage() {} -func (*NodeSetStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{61} -} -func (m *NodeSetStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NodeSetStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NodeSetStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeSetStatus.Merge(m, src) -} -func (m *NodeSetStatus) XXX_Size() int { - return m.Size() -} -func (m *NodeSetStatus) XXX_DiscardUnknown() { - xxx_messageInfo_NodeSetStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeSetStatus proto.InternalMessageInfo - -func (m *NodeSpec) Reset() { *m = NodeSpec{} } -func (*NodeSpec) ProtoMessage() {} -func (*NodeSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{62} -} -func (m *NodeSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NodeSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NodeSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeSpec.Merge(m, src) -} -func (m *NodeSpec) XXX_Size() int { - return m.Size() -} -func (m *NodeSpec) XXX_DiscardUnknown() { - xxx_messageInfo_NodeSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeSpec proto.InternalMessageInfo - -func (m *NodeStatus) Reset() { *m = NodeStatus{} } -func (*NodeStatus) ProtoMessage() {} -func (*NodeStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{63} -} -func (m *NodeStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NodeStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *NodeStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeStatus.Merge(m, src) -} -func (m *NodeStatus) XXX_Size() int { - return m.Size() -} -func (m *NodeStatus) XXX_DiscardUnknown() { - xxx_messageInfo_NodeStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeStatus proto.InternalMessageInfo - -func (m *OSPFLinkParameters) Reset() { *m = OSPFLinkParameters{} } -func (*OSPFLinkParameters) ProtoMessage() {} -func (*OSPFLinkParameters) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{64} -} -func (m *OSPFLinkParameters) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *OSPFLinkParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *OSPFLinkParameters) XXX_Merge(src proto.Message) { - xxx_messageInfo_OSPFLinkParameters.Merge(m, src) -} -func (m *OSPFLinkParameters) XXX_Size() int { - return m.Size() -} -func (m *OSPFLinkParameters) XXX_DiscardUnknown() { - xxx_messageInfo_OSPFLinkParameters.DiscardUnknown(m) -} - -var xxx_messageInfo_OSPFLinkParameters proto.InternalMessageInfo - -func (m *Rack) Reset() { *m = Rack{} } -func (*Rack) ProtoMessage() {} -func (*Rack) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{65} -} -func (m *Rack) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Rack) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Rack) XXX_Merge(src proto.Message) { - xxx_messageInfo_Rack.Merge(m, src) -} -func (m *Rack) XXX_Size() int { - return m.Size() -} -func (m *Rack) XXX_DiscardUnknown() { - xxx_messageInfo_Rack.DiscardUnknown(m) -} - -var xxx_messageInfo_Rack proto.InternalMessageInfo - -func (m *RackFilter) Reset() { *m = RackFilter{} } -func (*RackFilter) ProtoMessage() {} -func (*RackFilter) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{66} -} -func (m *RackFilter) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RackFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *RackFilter) XXX_Merge(src proto.Message) { - xxx_messageInfo_RackFilter.Merge(m, src) -} -func (m *RackFilter) XXX_Size() int { - return m.Size() -} -func (m *RackFilter) XXX_DiscardUnknown() { - xxx_messageInfo_RackFilter.DiscardUnknown(m) -} - -var xxx_messageInfo_RackFilter proto.InternalMessageInfo - -func (m *RackList) Reset() { *m = RackList{} } -func (*RackList) ProtoMessage() {} -func (*RackList) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{67} -} -func (m *RackList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RackList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *RackList) XXX_Merge(src proto.Message) { - xxx_messageInfo_RackList.Merge(m, src) -} -func (m *RackList) XXX_Size() int { - return m.Size() -} -func (m *RackList) XXX_DiscardUnknown() { - xxx_messageInfo_RackList.DiscardUnknown(m) -} - -var xxx_messageInfo_RackList proto.InternalMessageInfo - -func (m *RackSpec) Reset() { *m = RackSpec{} } -func (*RackSpec) ProtoMessage() {} -func (*RackSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{68} -} -func (m *RackSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RackSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *RackSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_RackSpec.Merge(m, src) -} -func (m *RackSpec) XXX_Size() int { - return m.Size() -} -func (m *RackSpec) XXX_DiscardUnknown() { - xxx_messageInfo_RackSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_RackSpec proto.InternalMessageInfo - -func (m *RackStatus) Reset() { *m = RackStatus{} } -func (*RackStatus) ProtoMessage() {} -func (*RackStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{69} -} -func (m *RackStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RackStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *RackStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_RackStatus.Merge(m, src) -} -func (m *RackStatus) XXX_Size() int { - return m.Size() -} -func (m *RackStatus) XXX_DiscardUnknown() { - xxx_messageInfo_RackStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_RackStatus proto.InternalMessageInfo - -func (m *Region) Reset() { *m = Region{} } -func (*Region) ProtoMessage() {} -func (*Region) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{70} -} -func (m *Region) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Region) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Region) XXX_Merge(src proto.Message) { - xxx_messageInfo_Region.Merge(m, src) -} -func (m *Region) XXX_Size() int { - return m.Size() -} -func (m *Region) XXX_DiscardUnknown() { - xxx_messageInfo_Region.DiscardUnknown(m) -} - -var xxx_messageInfo_Region proto.InternalMessageInfo - -func (m *RegionFilter) Reset() { *m = RegionFilter{} } -func (*RegionFilter) ProtoMessage() {} -func (*RegionFilter) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{71} -} -func (m *RegionFilter) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RegionFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *RegionFilter) XXX_Merge(src proto.Message) { - xxx_messageInfo_RegionFilter.Merge(m, src) -} -func (m *RegionFilter) XXX_Size() int { - return m.Size() -} -func (m *RegionFilter) XXX_DiscardUnknown() { - xxx_messageInfo_RegionFilter.DiscardUnknown(m) -} - -var xxx_messageInfo_RegionFilter proto.InternalMessageInfo - -func (m *RegionList) Reset() { *m = RegionList{} } -func (*RegionList) ProtoMessage() {} -func (*RegionList) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{72} -} -func (m *RegionList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RegionList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *RegionList) XXX_Merge(src proto.Message) { - xxx_messageInfo_RegionList.Merge(m, src) -} -func (m *RegionList) XXX_Size() int { - return m.Size() -} -func (m *RegionList) XXX_DiscardUnknown() { - xxx_messageInfo_RegionList.DiscardUnknown(m) -} - -var xxx_messageInfo_RegionList proto.InternalMessageInfo - -func (m *RegionSpec) Reset() { *m = RegionSpec{} } -func (*RegionSpec) ProtoMessage() {} -func (*RegionSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{73} -} -func (m *RegionSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RegionSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *RegionSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_RegionSpec.Merge(m, src) -} -func (m *RegionSpec) XXX_Size() int { - return m.Size() -} -func (m *RegionSpec) XXX_DiscardUnknown() { - xxx_messageInfo_RegionSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_RegionSpec proto.InternalMessageInfo - -func (m *RegionStatus) Reset() { *m = RegionStatus{} } -func (*RegionStatus) ProtoMessage() {} -func (*RegionStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{74} -} -func (m *RegionStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RegionStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *RegionStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_RegionStatus.Merge(m, src) -} -func (m *RegionStatus) XXX_Size() int { - return m.Size() -} -func (m *RegionStatus) XXX_DiscardUnknown() { - xxx_messageInfo_RegionStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_RegionStatus proto.InternalMessageInfo - -func (m *Site) Reset() { *m = Site{} } -func (*Site) ProtoMessage() {} -func (*Site) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{75} -} -func (m *Site) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Site) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Site) XXX_Merge(src proto.Message) { - xxx_messageInfo_Site.Merge(m, src) -} -func (m *Site) XXX_Size() int { - return m.Size() -} -func (m *Site) XXX_DiscardUnknown() { - xxx_messageInfo_Site.DiscardUnknown(m) -} - -var xxx_messageInfo_Site proto.InternalMessageInfo - -func (m *SiteFilter) Reset() { *m = SiteFilter{} } -func (*SiteFilter) ProtoMessage() {} -func (*SiteFilter) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{76} -} -func (m *SiteFilter) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SiteFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *SiteFilter) XXX_Merge(src proto.Message) { - xxx_messageInfo_SiteFilter.Merge(m, src) -} -func (m *SiteFilter) XXX_Size() int { - return m.Size() -} -func (m *SiteFilter) XXX_DiscardUnknown() { - xxx_messageInfo_SiteFilter.DiscardUnknown(m) -} - -var xxx_messageInfo_SiteFilter proto.InternalMessageInfo - -func (m *SiteID) Reset() { *m = SiteID{} } -func (*SiteID) ProtoMessage() {} -func (*SiteID) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{77} -} -func (m *SiteID) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SiteID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *SiteID) XXX_Merge(src proto.Message) { - xxx_messageInfo_SiteID.Merge(m, src) -} -func (m *SiteID) XXX_Size() int { - return m.Size() -} -func (m *SiteID) XXX_DiscardUnknown() { - xxx_messageInfo_SiteID.DiscardUnknown(m) -} - -var xxx_messageInfo_SiteID proto.InternalMessageInfo - -func (m *SiteList) Reset() { *m = SiteList{} } -func (*SiteList) ProtoMessage() {} -func (*SiteList) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{78} -} -func (m *SiteList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SiteList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *SiteList) XXX_Merge(src proto.Message) { - xxx_messageInfo_SiteList.Merge(m, src) -} -func (m *SiteList) XXX_Size() int { - return m.Size() -} -func (m *SiteList) XXX_DiscardUnknown() { - xxx_messageInfo_SiteList.DiscardUnknown(m) -} - -var xxx_messageInfo_SiteList proto.InternalMessageInfo - -func (m *SiteSpec) Reset() { *m = SiteSpec{} } -func (*SiteSpec) ProtoMessage() {} -func (*SiteSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{79} -} -func (m *SiteSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SiteSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *SiteSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_SiteSpec.Merge(m, src) -} -func (m *SiteSpec) XXX_Size() int { - return m.Size() -} -func (m *SiteSpec) XXX_DiscardUnknown() { - xxx_messageInfo_SiteSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_SiteSpec proto.InternalMessageInfo - -func (m *SiteStatus) Reset() { *m = SiteStatus{} } -func (*SiteStatus) ProtoMessage() {} -func (*SiteStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_4799f6fc4127511d, []int{80} -} -func (m *SiteStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SiteStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *SiteStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_SiteStatus.Merge(m, src) -} -func (m *SiteStatus) XXX_Size() int { - return m.Size() -} -func (m *SiteStatus) XXX_DiscardUnknown() { - xxx_messageInfo_SiteStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_SiteStatus proto.InternalMessageInfo - -func init() { - proto.RegisterType((*BFDLinkParameters)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.BFDLinkParameters") - proto.RegisterType((*BGPLinkParameters)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.BGPLinkParameters") - proto.RegisterType((*Cluster)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.Cluster") - proto.RegisterType((*ClusterFilter)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.ClusterFilter") - proto.RegisterType((*ClusterList)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.ClusterList") - proto.RegisterType((*ClusterSpec)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.ClusterSpec") - proto.RegisterType((*ClusterStatus)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.ClusterStatus") - proto.RegisterType((*Endpoint)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.Endpoint") - proto.RegisterType((*EndpointFilter)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.EndpointFilter") - proto.RegisterType((*EndpointID)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.EndpointID") - proto.RegisterType((*EndpointList)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.EndpointList") - proto.RegisterType((*EndpointSet)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.EndpointSet") - proto.RegisterType((*EndpointSetFilter)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.EndpointSetFilter") - proto.RegisterType((*EndpointSetList)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.EndpointSetList") - proto.RegisterType((*EndpointSetSpec)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.EndpointSetSpec") - proto.RegisterType((*EndpointSetStatus)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.EndpointSetStatus") - proto.RegisterType((*EndpointSpec)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.EndpointSpec") - proto.RegisterType((*EndpointStatus)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.EndpointStatus") - proto.RegisterType((*IGPLinkParameters)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.IGPLinkParameters") - proto.RegisterType((*ISISLinkParameters)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.ISISLinkParameters") - proto.RegisterType((*Link)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.Link") - proto.RegisterType((*LinkFilter)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.LinkFilter") - proto.RegisterType((*LinkList)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.LinkList") - proto.RegisterType((*LinkSet)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.LinkSet") - proto.RegisterType((*LinkSetFilter)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.LinkSetFilter") - proto.RegisterType((*LinkSetList)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.LinkSetList") - proto.RegisterType((*LinkSetSpec)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.LinkSetSpec") - proto.RegisterType((*LinkSetStatus)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.LinkSetStatus") - proto.RegisterType((*LinkSpec)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.LinkSpec") - proto.RegisterType((*LinkStatus)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.LinkStatus") - proto.RegisterType((*Location)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.Location") - proto.RegisterType((*Module)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.Module") - proto.RegisterType((*ModuleBay)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.ModuleBay") - proto.RegisterType((*ModuleBayFilter)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.ModuleBayFilter") - proto.RegisterType((*ModuleBayList)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.ModuleBayList") - proto.RegisterType((*ModuleBaySpec)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.ModuleBaySpec") - proto.RegisterType((*ModuleBayStatus)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.ModuleBayStatus") - proto.RegisterType((*ModuleFilter)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.ModuleFilter") - proto.RegisterType((*ModuleList)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.ModuleList") - proto.RegisterType((*ModuleSpec)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.ModuleSpec") - proto.RegisterType((*ModuleStatus)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.ModuleStatus") - proto.RegisterType((*Node)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.Node") - proto.RegisterType((*NodeFilter)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.NodeFilter") - proto.RegisterType((*NodeGroup)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.NodeGroup") - proto.RegisterType((*NodeGroupEndpointID)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.NodeGroupEndpointID") - proto.RegisterType((*NodeGroupFilter)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.NodeGroupFilter") - proto.RegisterType((*NodeGroupList)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.NodeGroupList") - proto.RegisterType((*NodeGroupNodeID)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.NodeGroupNodeID") - proto.RegisterType((*NodeGroupSpec)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.NodeGroupSpec") - proto.RegisterType((*NodeGroupStatus)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.NodeGroupStatus") - proto.RegisterType((*NodeID)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.NodeID") - proto.RegisterType((*NodeItem)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.NodeItem") - proto.RegisterType((*NodeItemFilter)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.NodeItemFilter") - proto.RegisterType((*NodeItemList)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.NodeItemList") - proto.RegisterType((*NodeItemSpec)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.NodeItemSpec") - proto.RegisterType((*NodeItemStatus)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.NodeItemStatus") - proto.RegisterType((*NodeList)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.NodeList") - proto.RegisterType((*NodeSet)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.NodeSet") - proto.RegisterType((*NodeSetFilter)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.NodeSetFilter") - proto.RegisterType((*NodeSetList)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.NodeSetList") - proto.RegisterType((*NodeSetSpec)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.NodeSetSpec") - proto.RegisterType((*NodeSetStatus)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.NodeSetStatus") - proto.RegisterType((*NodeSpec)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.NodeSpec") - proto.RegisterType((*NodeStatus)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.NodeStatus") - proto.RegisterType((*OSPFLinkParameters)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.OSPFLinkParameters") - proto.RegisterType((*Rack)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.Rack") - proto.RegisterType((*RackFilter)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.RackFilter") - proto.RegisterType((*RackList)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.RackList") - proto.RegisterType((*RackSpec)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.RackSpec") - proto.RegisterType((*RackStatus)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.RackStatus") - proto.RegisterType((*Region)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.Region") - proto.RegisterType((*RegionFilter)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.RegionFilter") - proto.RegisterType((*RegionList)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.RegionList") - proto.RegisterType((*RegionSpec)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.RegionSpec") - proto.RegisterType((*RegionStatus)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.RegionStatus") - proto.RegisterType((*Site)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.Site") - proto.RegisterType((*SiteFilter)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.SiteFilter") - proto.RegisterType((*SiteID)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.SiteID") - proto.RegisterType((*SiteList)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.SiteList") - proto.RegisterType((*SiteSpec)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.SiteSpec") - proto.RegisterType((*SiteStatus)(nil), "github.com.kuidio.kuid.apis.backend.infra.v1alpha1.SiteStatus") -} - -func init() { - proto.RegisterFile("github.com/kuidio/kuid/apis/backend/infra/v1alpha1/generated.proto", fileDescriptor_4799f6fc4127511d) -} - -var fileDescriptor_4799f6fc4127511d = []byte{ - // 2434 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x5c, 0xdd, 0x6f, 0x23, 0x57, - 0x15, 0xdf, 0x6b, 0x3b, 0x59, 0xfb, 0x38, 0xd9, 0x92, 0x59, 0x09, 0xb2, 0xcb, 0xca, 0x59, 0x8c, - 0x40, 0x11, 0x1f, 0x36, 0x1b, 0x01, 0x5a, 0xb5, 0x65, 0xbb, 0x99, 0x4d, 0xb2, 0x58, 0x4a, 0xd2, - 0xe8, 0x26, 0x7c, 0x08, 0x01, 0xdd, 0x6b, 0xcf, 0x8d, 0x33, 0xb5, 0xe7, 0x43, 0x33, 0xe3, 0x74, - 0x23, 0x24, 0xc4, 0x03, 0x12, 0x12, 0x0f, 0x15, 0x4f, 0x95, 0x4a, 0x69, 0x9f, 0x10, 0x2f, 0x08, - 0xa9, 0x4f, 0x45, 0x05, 0x24, 0x1e, 0x10, 0xea, 0x4a, 0x08, 0xb5, 0x7d, 0x40, 0x5a, 0x09, 0x14, - 0xb1, 0xe6, 0x3f, 0x40, 0x3c, 0x55, 0x3c, 0x54, 0xf7, 0x63, 0xbe, 0xec, 0x8c, 0xdd, 0xd8, 0x1d, - 0xc7, 0x7e, 0xca, 0xde, 0x73, 0xcf, 0x9c, 0x73, 0xee, 0xb9, 0xe7, 0x9e, 0xf3, 0xbb, 0x1f, 0x5e, - 0x50, 0x9b, 0xba, 0x77, 0xd4, 0xa9, 0x57, 0x1a, 0x96, 0x51, 0x6d, 0x75, 0x74, 0x4d, 0xb7, 0xf8, - 0x9f, 0x2a, 0xb1, 0x75, 0xb7, 0x5a, 0x27, 0x8d, 0x16, 0x35, 0xb5, 0xaa, 0x6e, 0x1e, 0x3a, 0xa4, - 0x7a, 0x7c, 0x8b, 0xb4, 0xed, 0x23, 0x72, 0xab, 0xda, 0xa4, 0x26, 0x75, 0x88, 0x47, 0xb5, 0x8a, - 0xed, 0x58, 0x9e, 0xa5, 0xac, 0x85, 0x32, 0x2a, 0x42, 0x06, 0xff, 0x53, 0x61, 0x32, 0x2a, 0x52, - 0x46, 0x85, 0xcb, 0xa8, 0xf8, 0x32, 0xae, 0x7f, 0x39, 0xa2, 0xb7, 0x69, 0x35, 0xad, 0x2a, 0x17, - 0x55, 0xef, 0x1c, 0xf2, 0x16, 0x6f, 0xf0, 0x7f, 0x09, 0x15, 0xd7, 0x9f, 0x19, 0x64, 0x66, 0xc3, - 0x32, 0x0c, 0xcb, 0x4c, 0xb4, 0xef, 0xfa, 0x9d, 0xc1, 0x1f, 0x9b, 0x9a, 0xee, 0xe9, 0x83, 0xbe, - 0xff, 0x6a, 0xeb, 0xb6, 0x5b, 0xd1, 0x2d, 0xc6, 0x6f, 0x90, 0xc6, 0x91, 0x6e, 0x52, 0xe7, 0xa4, - 0x6a, 0xb7, 0x9a, 0x42, 0x80, 0x41, 0x3d, 0xe6, 0x9b, 0xbe, 0xaf, 0xbe, 0x9e, 0xf4, 0x95, 0xd3, - 0x31, 0x3d, 0xdd, 0xa0, 0x55, 0xb7, 0x71, 0x44, 0x0d, 0xd2, 0xfb, 0x5d, 0xf9, 0x7f, 0x08, 0x96, - 0xd4, 0xad, 0x8d, 0x6d, 0xdd, 0x6c, 0xed, 0x11, 0x87, 0x18, 0xd4, 0xa3, 0x8e, 0xab, 0x7c, 0x0e, - 0x2e, 0x53, 0x93, 0xd4, 0xdb, 0x54, 0x5b, 0x46, 0x37, 0xd1, 0x6a, 0x5e, 0x2d, 0x76, 0x4f, 0x57, - 0x2e, 0x6f, 0x0a, 0x12, 0xf6, 0xfb, 0x94, 0x15, 0x98, 0x33, 0x74, 0xf3, 0xe0, 0xe1, 0x72, 0xe6, - 0x26, 0x5a, 0x5d, 0x54, 0x0b, 0xdd, 0xd3, 0x95, 0xb9, 0x1d, 0x46, 0xc0, 0x82, 0x2e, 0x19, 0xf0, - 0xc3, 0xe5, 0x6c, 0x8c, 0x01, 0x0b, 0x06, 0xfc, 0x50, 0xf9, 0x22, 0x14, 0x0c, 0xdd, 0xdc, 0x6c, - 0x1c, 0x59, 0xf8, 0xe1, 0x72, 0x8e, 0x33, 0x2d, 0x76, 0x4f, 0x57, 0x0a, 0x3b, 0x3e, 0x11, 0x87, - 0xfd, 0x4a, 0x05, 0xc0, 0xe8, 0xb4, 0x3d, 0xdd, 0x6e, 0xeb, 0xd4, 0x59, 0x9e, 0xe3, 0xdc, 0x57, - 0xba, 0xa7, 0x2b, 0xb0, 0x13, 0x50, 0x71, 0x84, 0x43, 0xb9, 0x06, 0x59, 0xcf, 0x6b, 0x2f, 0xcf, - 0x73, 0xc6, 0xcb, 0xdd, 0xd3, 0x95, 0xec, 0xc1, 0xc1, 0x36, 0x66, 0xb4, 0x72, 0x05, 0x96, 0xd4, - 0xfb, 0x7b, 0x3d, 0xa3, 0xbe, 0x06, 0xd9, 0xfa, 0xa1, 0x3f, 0x62, 0xce, 0xaf, 0x6e, 0x6d, 0x60, - 0x46, 0x2b, 0xbf, 0x9d, 0x81, 0xcb, 0xf7, 0xda, 0x1d, 0xd7, 0xa3, 0x8e, 0xf2, 0x00, 0xf2, 0x6c, - 0x16, 0x34, 0xe2, 0x11, 0xce, 0x5b, 0x5c, 0xfb, 0x4a, 0x45, 0x78, 0xbf, 0x12, 0xf5, 0x7e, 0xc5, - 0x6e, 0x35, 0x45, 0x50, 0x32, 0xee, 0xca, 0xf1, 0xad, 0xca, 0xf3, 0xf5, 0x17, 0x69, 0xc3, 0xdb, - 0xa1, 0x1e, 0x51, 0x95, 0x47, 0xa7, 0x2b, 0x97, 0x98, 0xe9, 0x21, 0x0d, 0x07, 0x52, 0x15, 0x02, - 0x39, 0xd7, 0xa6, 0x0d, 0xee, 0xd6, 0xe2, 0xda, 0x73, 0x95, 0xf3, 0x47, 0x7c, 0x45, 0x1a, 0xbb, - 0x6f, 0xd3, 0x86, 0xba, 0x20, 0x95, 0xe5, 0x58, 0x0b, 0x73, 0xd1, 0x8a, 0x0e, 0xf3, 0xae, 0x47, - 0xbc, 0x8e, 0xcb, 0xa7, 0xa6, 0xb8, 0xb6, 0x3e, 0x8e, 0x12, 0x2e, 0x48, 0xbd, 0x22, 0xd5, 0xcc, - 0x8b, 0x36, 0x96, 0x0a, 0xca, 0x75, 0x58, 0x94, 0x8c, 0x5b, 0x7a, 0x9b, 0x39, 0xf0, 0x26, 0xe4, - 0x4c, 0x62, 0x50, 0xee, 0xbc, 0x42, 0x68, 0xdd, 0x2e, 0x31, 0x28, 0xe6, 0x3d, 0x4a, 0x15, 0x0a, - 0xec, 0xaf, 0x6b, 0x93, 0x06, 0xe5, 0x5e, 0x28, 0xa8, 0x4b, 0x92, 0xad, 0xb0, 0xeb, 0x77, 0xe0, - 0x90, 0xa7, 0xfc, 0x77, 0x04, 0x45, 0xa9, 0x64, 0x5b, 0x77, 0x3d, 0xe5, 0xfb, 0x7d, 0x73, 0x54, - 0xf9, 0x68, 0x73, 0xc4, 0xbe, 0xe6, 0x33, 0xf4, 0x09, 0xa9, 0x2f, 0xef, 0x53, 0x22, 0xf3, 0xf3, - 0x00, 0xe6, 0x74, 0x8f, 0x1a, 0xee, 0x72, 0xe6, 0x66, 0x76, 0xb5, 0xb8, 0xf6, 0xcc, 0x18, 0xbe, - 0x53, 0x17, 0xa5, 0x9e, 0xb9, 0x1a, 0x93, 0x88, 0x85, 0xe0, 0xf2, 0x69, 0x26, 0x18, 0x0f, 0x9b, - 0x34, 0xee, 0x10, 0x4b, 0xa3, 0xf7, 0x1d, 0xab, 0x63, 0x4b, 0xbf, 0x85, 0x0e, 0xf1, 0x3b, 0x70, - 0xc8, 0xa3, 0x7c, 0x09, 0xf2, 0xb6, 0x63, 0x1d, 0xeb, 0x1a, 0x75, 0xa4, 0x03, 0x83, 0x01, 0xed, - 0x49, 0x3a, 0x0e, 0x38, 0x94, 0x43, 0xc8, 0xb7, 0xad, 0x06, 0x61, 0x89, 0x49, 0xc6, 0xc3, 0xb3, - 0xa3, 0x8c, 0x69, 0x5b, 0xca, 0x50, 0x17, 0xb8, 0xe3, 0x64, 0x0b, 0x07, 0xb2, 0x95, 0x9f, 0x21, - 0x58, 0xea, 0xb8, 0xd4, 0xd9, 0xa0, 0x87, 0xba, 0x49, 0xb5, 0x6d, 0x52, 0xa7, 0x6d, 0x97, 0xaf, - 0xfb, 0xe2, 0xda, 0x9d, 0x81, 0x1a, 0x45, 0xd6, 0x0d, 0x55, 0x7d, 0xab, 0x57, 0x8a, 0x7a, 0x4d, - 0x8e, 0x6f, 0xa9, 0xaf, 0x0b, 0xf7, 0xeb, 0x2c, 0xff, 0x0a, 0x05, 0x51, 0x29, 0xc2, 0x55, 0xf9, - 0x39, 0x82, 0xa5, 0x20, 0x3d, 0x53, 0x4d, 0x50, 0x65, 0xf0, 0xac, 0x0f, 0xb1, 0x4d, 0x7e, 0x15, - 0x99, 0xdd, 0x5e, 0x41, 0xa1, 0x79, 0x7d, 0x5d, 0xb8, 0x5f, 0x6d, 0xf9, 0x4f, 0x19, 0xc8, 0x6f, - 0x9a, 0x9a, 0x6d, 0xe9, 0xa6, 0x37, 0x81, 0x84, 0x53, 0x8f, 0x25, 0x9c, 0xbb, 0xa3, 0xcc, 0xbd, - 0x6f, 0x6d, 0x62, 0xc6, 0x79, 0xb1, 0x27, 0xe3, 0xa8, 0x63, 0x69, 0x19, 0x9c, 0x72, 0x1a, 0x70, - 0xc5, 0xe7, 0x4c, 0x2f, 0xe7, 0xbc, 0x81, 0x00, 0x7c, 0x2d, 0xb5, 0x0d, 0xa5, 0x0e, 0xf3, 0x6c, - 0xf9, 0xd5, 0x36, 0x78, 0xc1, 0x29, 0xae, 0x3d, 0x3d, 0xca, 0xf8, 0x76, 0xb9, 0x84, 0x70, 0x5c, - 0xa2, 0x8d, 0xa5, 0x64, 0xb6, 0xaa, 0xa9, 0xd4, 0xc8, 0xeb, 0x5f, 0x64, 0x55, 0xfb, 0x96, 0xe0, - 0x80, 0xa3, 0xfc, 0x2e, 0x82, 0x05, 0x9f, 0x3c, 0x81, 0xac, 0x48, 0xe2, 0x59, 0xf1, 0xd9, 0x71, - 0xe6, 0x37, 0x21, 0x2d, 0xfe, 0x35, 0x03, 0xc5, 0x20, 0x04, 0xe8, 0x24, 0x56, 0x06, 0x8d, 0xad, - 0x8c, 0x7b, 0x63, 0xc5, 0x2c, 0x4d, 0x5e, 0x1c, 0x46, 0xcf, 0xe2, 0xd8, 0x1c, 0x57, 0xd1, 0xe0, - 0xf5, 0x71, 0x08, 0x4b, 0x11, 0xe6, 0xf4, 0x96, 0xc8, 0x3f, 0x10, 0x3c, 0x15, 0x51, 0x34, 0x81, - 0x20, 0xd4, 0xe2, 0x41, 0xf8, 0xdc, 0x98, 0x7e, 0x4c, 0x88, 0xc3, 0xdf, 0x64, 0x62, 0xe3, 0xe2, - 0x25, 0xba, 0x05, 0x05, 0x7f, 0xe5, 0xb1, 0xb2, 0x91, 0x1d, 0x5a, 0xd2, 0x86, 0x68, 0xaf, 0x6d, - 0x08, 0x28, 0xec, 0xb7, 0x5d, 0x1c, 0xca, 0x57, 0x6e, 0x40, 0xae, 0x4d, 0x1a, 0x36, 0x9f, 0x84, - 0xbc, 0x9a, 0x67, 0xf3, 0xb4, 0x4d, 0x1a, 0x36, 0xe6, 0xd4, 0x84, 0x32, 0x9b, 0xbd, 0x80, 0x32, - 0xfb, 0x2f, 0x14, 0x8b, 0xb4, 0x29, 0x2c, 0xb5, 0x0c, 0xf5, 0x53, 0x57, 0x97, 0x5b, 0x18, 0x8e, - 0xfa, 0x37, 0xf7, 0x6b, 0x98, 0xd1, 0xd8, 0xf6, 0xa5, 0x4d, 0x9a, 0xb5, 0x8d, 0xe8, 0xf6, 0x65, - 0x9b, 0x34, 0x6b, 0x1a, 0x16, 0xf4, 0xf2, 0x3f, 0xb3, 0x61, 0x86, 0xe5, 0x41, 0xf0, 0x0a, 0x82, - 0xab, 0x01, 0x08, 0x0b, 0x67, 0x52, 0x8e, 0xed, 0xfe, 0xa8, 0x25, 0xa1, 0x47, 0x9c, 0xfa, 0x69, - 0x39, 0xc2, 0xab, 0x67, 0x74, 0xe2, 0xb3, 0x0c, 0x50, 0xca, 0x30, 0x6f, 0x58, 0x5a, 0xa7, 0xed, - 0xaf, 0x5b, 0x60, 0x59, 0x61, 0x87, 0x53, 0xb0, 0xec, 0x99, 0x9e, 0xb0, 0x61, 0x8e, 0x77, 0x6d, - 0x4a, 0x35, 0x0e, 0x0d, 0x0b, 0xc2, 0xf1, 0xfb, 0x8c, 0x80, 0x05, 0x5d, 0xf9, 0x1a, 0x14, 0x8f, - 0xdb, 0xc4, 0x3c, 0x20, 0xcd, 0xa6, 0x6e, 0x36, 0x79, 0x2d, 0xcc, 0xab, 0x57, 0xa5, 0x8e, 0xe2, - 0xb7, 0xb7, 0xd7, 0x77, 0x65, 0x17, 0x8e, 0xf2, 0xc5, 0x50, 0xf1, 0xfc, 0x30, 0x54, 0x5c, 0x7e, - 0x1d, 0x85, 0x30, 0x62, 0x1a, 0x41, 0xe2, 0xef, 0x11, 0x2c, 0xd5, 0xfa, 0x76, 0xb1, 0x77, 0xa1, - 0x68, 0x52, 0xef, 0x25, 0xcb, 0x69, 0x1d, 0x9c, 0xd8, 0x7e, 0x36, 0x2f, 0x31, 0xb7, 0xec, 0x86, - 0xe4, 0x0f, 0xe2, 0x4d, 0x1c, 0xfd, 0x44, 0xf9, 0x4c, 0x74, 0x5b, 0x2f, 0xf7, 0xfe, 0x7b, 0xc4, - 0x75, 0xf5, 0x63, 0xea, 0x6f, 0xec, 0xe5, 0x56, 0x39, 0xdb, 0xbf, 0x55, 0xe6, 0x91, 0x46, 0x3d, - 0x47, 0x6f, 0xc8, 0xfd, 0xbc, 0x88, 0x34, 0x4e, 0xc1, 0xb2, 0xa7, 0xfc, 0x3e, 0x02, 0xa5, 0xb6, - 0x5f, 0xdb, 0xef, 0x31, 0xfd, 0x65, 0x04, 0x4b, 0x7a, 0xd3, 0x8e, 0x53, 0xa5, 0x77, 0x47, 0xaa, - 0x88, 0x7d, 0xde, 0x09, 0x3d, 0xdc, 0xd7, 0x85, 0xfb, 0x55, 0x2b, 0x5f, 0x80, 0x1c, 0x71, 0x28, - 0x91, 0x6b, 0xe6, 0x93, 0x7c, 0xfd, 0xd3, 0x63, 0xda, 0xfe, 0xe0, 0x74, 0xa5, 0xc0, 0xed, 0x67, - 0x0d, 0xcc, 0x79, 0xca, 0x6f, 0x66, 0x20, 0xc7, 0x3e, 0x9f, 0x00, 0x28, 0xf9, 0x61, 0x0c, 0x94, - 0x8c, 0xb6, 0x55, 0xd3, 0xcd, 0x56, 0x22, 0x1a, 0x39, 0xec, 0x41, 0x23, 0x77, 0x46, 0xd6, 0x30, - 0x18, 0x86, 0xbc, 0x00, 0xc0, 0xb8, 0xd2, 0xc3, 0x1f, 0xef, 0x20, 0xc8, 0x33, 0x0d, 0x13, 0x00, - 0x1e, 0x3f, 0x88, 0x03, 0x8f, 0xdb, 0xa3, 0xba, 0x2c, 0x01, 0x71, 0xbc, 0x9d, 0x81, 0xcb, 0xdc, - 0xa3, 0x13, 0x41, 0xbd, 0x1f, 0xc3, 0x01, 0x94, 0x34, 0x36, 0xdd, 0x03, 0x28, 0x5f, 0xc9, 0xd0, - 0x03, 0x28, 0xc9, 0x98, 0xee, 0x01, 0x94, 0x54, 0x32, 0x23, 0x07, 0x50, 0xd2, 0xda, 0x84, 0x78, - 0xfb, 0x69, 0x26, 0x18, 0xcf, 0xe4, 0xd1, 0xed, 0xd9, 0x40, 0x24, 0x73, 0x01, 0xf8, 0xf5, 0x31, - 0x0a, 0x62, 0x67, 0x36, 0xb1, 0xab, 0x96, 0x80, 0x5d, 0xb5, 0xf2, 0x2f, 0xe7, 0x44, 0x6e, 0xe4, - 0xd3, 0xeb, 0xf5, 0x4f, 0xef, 0xc7, 0x06, 0x56, 0x67, 0x60, 0x9e, 0x95, 0x07, 0x21, 0x9e, 0x19, - 0x11, 0x6a, 0xf4, 0x5d, 0xa2, 0xf4, 0xc0, 0x22, 0x0d, 0x72, 0x96, 0x6b, 0x1f, 0xca, 0xc3, 0xce, - 0xad, 0x51, 0x54, 0x3c, 0xbf, 0xbf, 0xb7, 0xd5, 0xa3, 0x83, 0xef, 0xfc, 0x18, 0x1d, 0x73, 0xe9, - 0x4c, 0x8b, 0xee, 0xea, 0x2e, 0x07, 0xc4, 0x23, 0x6a, 0xe9, 0xc7, 0x65, 0x42, 0x0b, 0xa3, 0x63, - 0x2e, 0x9d, 0x7b, 0xab, 0x69, 0xcb, 0x73, 0xae, 0xd1, 0xbc, 0xd5, 0x07, 0xcc, 0x84, 0xb7, 0xee, - 0xef, 0x61, 0x26, 0xba, 0xfc, 0x2a, 0x12, 0xd0, 0x60, 0x1a, 0x61, 0xb7, 0x0e, 0xc1, 0xd1, 0x36, - 0xdb, 0x50, 0xb4, 0x89, 0xa7, 0x7b, 0x1d, 0xcd, 0xaf, 0x26, 0x61, 0xda, 0x96, 0x74, 0x1c, 0x70, - 0xb0, 0xaa, 0xd2, 0xb6, 0xcc, 0xa6, 0x60, 0xef, 0xa9, 0x2a, 0xdb, 0x7e, 0x07, 0x0e, 0x79, 0xca, - 0x6f, 0x65, 0x40, 0x6e, 0xd2, 0x26, 0x50, 0xf4, 0x1f, 0xc4, 0x8a, 0xfe, 0x48, 0xd9, 0x5d, 0xd8, - 0x9a, 0x58, 0xf3, 0x8f, 0x7a, 0x6a, 0xfe, 0xdd, 0x31, 0x74, 0x0c, 0x2e, 0xf9, 0x7f, 0xce, 0x40, - 0x41, 0x30, 0xaa, 0xe4, 0x64, 0x02, 0xbe, 0x6b, 0xc4, 0x7c, 0xb7, 0x3e, 0xfa, 0xb8, 0x54, 0x72, - 0x92, 0xe8, 0xbe, 0x56, 0x8f, 0xfb, 0xee, 0x8d, 0xa7, 0x66, 0xb0, 0x07, 0x35, 0x78, 0x2a, 0x60, - 0x4d, 0x0f, 0x36, 0xbd, 0x8f, 0x60, 0x31, 0x50, 0x33, 0x01, 0xe0, 0x54, 0x8f, 0x03, 0xa7, 0x6f, - 0x8c, 0xe5, 0xc1, 0x04, 0xe8, 0xf4, 0xdb, 0x4c, 0x64, 0x4c, 0xbc, 0xba, 0x86, 0x57, 0x03, 0x28, - 0xcd, 0xab, 0x01, 0xdb, 0xb5, 0x78, 0xa6, 0xea, 0xbb, 0xf0, 0xb3, 0x5c, 0x5d, 0x5c, 0xc4, 0xf9, - 0x1c, 0x53, 0x74, 0x42, 0xf8, 0x06, 0x8a, 0x04, 0xda, 0x34, 0xa6, 0x7b, 0x02, 0x0b, 0xc2, 0xbe, - 0xf4, 0x56, 0xc1, 0xdf, 0x10, 0x80, 0xd0, 0x31, 0x81, 0x25, 0xf0, 0x42, 0x7c, 0x09, 0x3c, 0x3d, - 0xc6, 0x12, 0x48, 0x8c, 0x7f, 0x08, 0x0b, 0xc1, 0x44, 0x82, 0xbf, 0x0a, 0x05, 0xc3, 0x8f, 0xa1, - 0x5e, 0x8f, 0x07, 0xc1, 0x85, 0x43, 0x9e, 0x29, 0x8a, 0xff, 0xd7, 0x90, 0x1f, 0x5f, 0xd3, 0x18, - 0xfc, 0x6f, 0x66, 0x20, 0xc7, 0x7c, 0x3d, 0x1b, 0x87, 0x5a, 0xcc, 0xd2, 0x74, 0x0f, 0xb5, 0xb8, - 0x86, 0xa1, 0x87, 0x5a, 0x8c, 0x2b, 0xbd, 0x6c, 0xc1, 0xb0, 0x4d, 0xb0, 0xcf, 0x9a, 0x0d, 0x6c, - 0x13, 0x98, 0x9b, 0x2e, 0xb6, 0x09, 0xd5, 0x0c, 0x9e, 0xa2, 0x3f, 0x20, 0x38, 0xeb, 0xe6, 0xe4, - 0xfc, 0xaf, 0x6c, 0x1c, 0x00, 0x1a, 0x5e, 0xf2, 0x8c, 0x01, 0x9c, 0x23, 0xdb, 0xe5, 0x60, 0x32, - 0x22, 0x57, 0x3a, 0x11, 0x2d, 0x0c, 0x98, 0x05, 0xb6, 0xa4, 0x0b, 0xcc, 0x02, 0x35, 0x33, 0x02, - 0xcc, 0x02, 0x7b, 0x93, 0x6e, 0x6d, 0x51, 0xc4, 0x75, 0xbb, 0x41, 0xe5, 0x38, 0xdf, 0x94, 0x87, - 0xe5, 0x2c, 0x93, 0x56, 0x39, 0x63, 0xbb, 0xdf, 0xc5, 0xd8, 0x92, 0x49, 0xa8, 0x57, 0xe8, 0x82, - 0xf0, 0x5a, 0xcf, 0x3a, 0x9b, 0xae, 0x92, 0xf5, 0x32, 0x02, 0xe9, 0x4f, 0x36, 0x57, 0xae, 0xee, - 0x8d, 0x09, 0x3d, 0xf6, 0xb9, 0x84, 0x48, 0x2e, 0xe1, 0x6d, 0x2c, 0x25, 0xf3, 0xb5, 0x67, 0x05, - 0xdb, 0xf9, 0x70, 0xed, 0x59, 0x1a, 0x5b, 0x7b, 0x96, 0x46, 0xf9, 0x5b, 0x2e, 0x6e, 0x90, 0x47, - 0x8d, 0xd9, 0x78, 0xcb, 0xe5, 0x5b, 0x9b, 0xee, 0x5b, 0xae, 0x40, 0xcb, 0xd0, 0xb7, 0x5c, 0x3e, - 0x67, 0x7a, 0xe9, 0xee, 0x5d, 0x04, 0x0b, 0xbe, 0x96, 0x19, 0x79, 0x2a, 0xe5, 0x9b, 0x9b, 0x90, - 0xec, 0xfe, 0x1f, 0x19, 0xd1, 0xc4, 0x70, 0xf8, 0xf4, 0x1c, 0xdc, 0xbf, 0x8e, 0xc2, 0xb0, 0x99, - 0xc6, 0x2c, 0xf5, 0x0e, 0x12, 0x49, 0x61, 0x46, 0x6e, 0x26, 0x99, 0xa9, 0x03, 0x6e, 0x26, 0x39, - 0x2c, 0x9e, 0x95, 0x9b, 0x49, 0x69, 0x6c, 0xba, 0x37, 0x93, 0xbe, 0x92, 0xa1, 0x37, 0x93, 0x92, - 0x31, 0xdd, 0x9b, 0x49, 0xa9, 0x64, 0x46, 0x6e, 0x26, 0xa5, 0xb5, 0x09, 0xf1, 0xf6, 0xc7, 0x70, - 0x3c, 0xa3, 0x3d, 0x8d, 0xff, 0x51, 0x72, 0x8e, 0xba, 0x7d, 0xae, 0x1c, 0x75, 0xaf, 0x4d, 0x74, - 0x43, 0x66, 0xa7, 0xe0, 0xed, 0x51, 0x84, 0x98, 0xf4, 0xee, 0x3c, 0x16, 0x1b, 0xd3, 0x95, 0x96, - 0xfe, 0x9b, 0x15, 0x69, 0x89, 0x7b, 0xf6, 0xc7, 0x50, 0x0c, 0xbc, 0x16, 0x94, 0x8d, 0xf1, 0x36, - 0x66, 0xb2, 0x7e, 0x7c, 0x4a, 0x1a, 0xd5, 0x0b, 0xc7, 0x71, 0x54, 0xa1, 0x72, 0x03, 0x72, 0x0e, - 0x69, 0xb4, 0x64, 0x94, 0xf3, 0x4b, 0x28, 0x4c, 0x1a, 0x2d, 0xcc, 0xa9, 0xca, 0x2a, 0xe4, 0x6d, - 0x79, 0xb0, 0xc9, 0x17, 0x6a, 0x41, 0xfc, 0xea, 0x20, 0x72, 0xd8, 0x29, 0xff, 0x15, 0xfb, 0x75, - 0x43, 0x2e, 0xc5, 0x5f, 0x37, 0x44, 0x5f, 0x97, 0xcd, 0x0d, 0xfd, 0xcd, 0xc5, 0xd9, 0xb5, 0x72, - 0xfe, 0x02, 0x6a, 0xe5, 0x5f, 0x90, 0x38, 0xb2, 0x98, 0xc6, 0x1b, 0xee, 0x55, 0xc8, 0xbb, 0x27, - 0xae, 0x47, 0x0d, 0xb9, 0xe1, 0x92, 0xb3, 0xbc, 0x2f, 0x69, 0x38, 0xe8, 0x65, 0xa3, 0x50, 0xfa, - 0x6f, 0x48, 0xa7, 0xef, 0x4d, 0xd9, 0x8d, 0xd8, 0x9b, 0x32, 0x1e, 0xd5, 0xeb, 0x0e, 0x25, 0x91, - 0x57, 0x64, 0x2c, 0xc8, 0x67, 0xe3, 0xc0, 0x8d, 0x59, 0x9a, 0xee, 0x81, 0x1b, 0xd7, 0x30, 0xf4, - 0xc0, 0x8d, 0x71, 0xa5, 0xfb, 0x8a, 0x8c, 0x69, 0x98, 0x11, 0xac, 0xc6, 0x4c, 0x4d, 0xa8, 0x9d, - 0xbf, 0xcb, 0x8a, 0x91, 0xf8, 0x1b, 0x82, 0xd4, 0x77, 0xc7, 0xd1, 0xd4, 0x9b, 0x49, 0x31, 0xf5, - 0x7e, 0x1e, 0xe6, 0x8f, 0xa8, 0xde, 0x3c, 0xf2, 0x64, 0x29, 0x08, 0xec, 0xf9, 0x26, 0xa7, 0x62, - 0xd9, 0xab, 0x7c, 0x16, 0xe6, 0x5e, 0xd2, 0x35, 0xef, 0x48, 0x3e, 0x2c, 0x0e, 0xbc, 0xf4, 0x1d, - 0x46, 0xc4, 0xa2, 0x2f, 0x21, 0x33, 0xcf, 0x5d, 0x40, 0x66, 0x7e, 0x15, 0x89, 0xd8, 0x9e, 0x46, - 0xa8, 0xf0, 0x56, 0x06, 0xe6, 0x31, 0x6d, 0x32, 0xef, 0xcf, 0xc4, 0xdb, 0x04, 0x61, 0x6b, 0xba, - 0x6f, 0x13, 0xa4, 0x8e, 0xc1, 0xf9, 0x8a, 0xc0, 0x82, 0xe0, 0x4b, 0xf7, 0x42, 0x51, 0xe8, 0x98, - 0x91, 0x0b, 0x45, 0x61, 0x6c, 0x42, 0xd6, 0x7a, 0x25, 0x18, 0xcd, 0x94, 0x9d, 0x85, 0xbe, 0x86, - 0xfc, 0xa9, 0x9c, 0xd6, 0xbb, 0x3b, 0x96, 0x8e, 0x67, 0x03, 0x4a, 0x30, 0x4b, 0xd3, 0x85, 0x12, - 0x5c, 0xc3, 0x50, 0x28, 0xc1, 0xb8, 0xd2, 0x5b, 0x98, 0x18, 0x64, 0x85, 0x64, 0x15, 0xcb, 0xe1, - 0xa1, 0x23, 0xc5, 0x07, 0x26, 0x89, 0x80, 0xc2, 0xb2, 0x97, 0x19, 0xc1, 0x6a, 0x69, 0xef, 0xf9, - 0x32, 0x93, 0x82, 0x79, 0x0f, 0x87, 0x27, 0xac, 0x39, 0x23, 0xf0, 0x84, 0x99, 0x9a, 0xb0, 0xd0, - 0x7f, 0x9d, 0x11, 0x23, 0xe1, 0xcb, 0xfc, 0xa3, 0x3a, 0x68, 0x52, 0x10, 0x63, 0x7a, 0x9e, 0x0c, - 0x30, 0x54, 0x10, 0x06, 0xf3, 0x54, 0x25, 0x1d, 0xf5, 0xbb, 0x8f, 0x9e, 0x94, 0x2e, 0xbd, 0xf7, - 0xa4, 0x74, 0xe9, 0xf1, 0x93, 0xd2, 0xa5, 0x9f, 0x74, 0x4b, 0xe8, 0x51, 0xb7, 0x84, 0xde, 0xeb, - 0x96, 0xd0, 0xe3, 0x6e, 0x09, 0xfd, 0xbb, 0x5b, 0x42, 0xbf, 0xf8, 0x4f, 0xe9, 0xd2, 0xf7, 0xd6, - 0xce, 0xff, 0xff, 0xc0, 0x7c, 0x18, 0x00, 0x00, 0xff, 0xff, 0x6f, 0x38, 0x4b, 0xa3, 0x3c, 0x46, - 0x00, 0x00, -} - -func (m *BFDLinkParameters) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BFDLinkParameters) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BFDLinkParameters) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.TTL != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.TTL)) - i-- - dAtA[i] = 0x30 - } - if m.Multiplier != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.Multiplier)) - i-- - dAtA[i] = 0x28 - } - if m.MinEchoRx != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MinEchoRx)) - i-- - dAtA[i] = 0x20 - } - if m.MinRx != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MinRx)) - i-- - dAtA[i] = 0x18 - } - if m.MinTx != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MinTx)) - i-- - dAtA[i] = 0x10 - } - if m.Enabled != nil { - i-- - if *m.Enabled { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *BGPLinkParameters) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BGPLinkParameters) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BGPLinkParameters) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.BFD != nil { - i-- - if *m.BFD { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Cluster) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Cluster) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Cluster) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ClusterFilter) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ClusterFilter) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ClusterFilter) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Namespace) - copy(dAtA[i:], m.Namespace) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Namespace))) - i-- - dAtA[i] = 0x12 - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ClusterList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ClusterList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ClusterList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ClusterSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ClusterSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ClusterSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.UserDefinedLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - if m.Location != nil { - { - size, err := m.Location.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - i -= len(m.Provider) - copy(dAtA[i:], m.Provider) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Provider))) - i-- - dAtA[i] = 0x12 - i -= len(m.NodeGroup) - copy(dAtA[i:], m.NodeGroup) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.NodeGroup))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ClusterStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ClusterStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ClusterStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Endpoint) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Endpoint) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Endpoint) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *EndpointFilter) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EndpointFilter) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EndpointFilter) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Namespace) - copy(dAtA[i:], m.Namespace) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Namespace))) - i-- - dAtA[i] = 0x12 - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *EndpointID) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EndpointID) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EndpointID) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.NodeID.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - i -= len(m.Endpoint) - copy(dAtA[i:], m.Endpoint) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Endpoint))) - i-- - dAtA[i] = 0x2a - return len(dAtA) - i, nil -} - -func (m *EndpointList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EndpointList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EndpointList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *EndpointSet) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EndpointSet) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EndpointSet) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *EndpointSetFilter) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EndpointSetFilter) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EndpointSetFilter) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Namespace) - copy(dAtA[i:], m.Namespace) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Namespace))) - i-- - dAtA[i] = 0x12 - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *EndpointSetList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EndpointSetList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EndpointSetList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *EndpointSetSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EndpointSetSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EndpointSetSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.UserDefinedLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if m.Lacp != nil { - i-- - if *m.Lacp { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if len(m.Endpoints) > 0 { - for iNdEx := len(m.Endpoints) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Endpoints[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *EndpointSetStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EndpointSetStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EndpointSetStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.LagId != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.LagId)) - i-- - dAtA[i] = 0x18 - } - if m.ESI != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.ESI)) - i-- - dAtA[i] = 0x10 - } - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *EndpointSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EndpointSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EndpointSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Provider) - copy(dAtA[i:], m.Provider) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Provider))) - i-- - dAtA[i] = 0x32 - i-- - if m.VLANTagging { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x28 - if m.Speed != nil { - i -= len(*m.Speed) - copy(dAtA[i:], *m.Speed) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Speed))) - i-- - dAtA[i] = 0x22 - } - { - size, err := m.UserDefinedLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if m.Module != nil { - i -= len(*m.Module) - copy(dAtA[i:], *m.Module) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Module))) - i-- - dAtA[i] = 0x12 - } - { - size, err := m.NodeGroupEndpointID.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *EndpointStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EndpointStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EndpointStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *IGPLinkParameters) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *IGPLinkParameters) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *IGPLinkParameters) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Metric != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.Metric)) - i-- - dAtA[i] = 0x20 - } - if m.BFD != nil { - i-- - if *m.BFD { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if m.Passive != nil { - i-- - if *m.Passive { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if m.NetworkType != nil { - i -= len(*m.NetworkType) - copy(dAtA[i:], *m.NetworkType) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.NetworkType))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ISISLinkParameters) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ISISLinkParameters) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ISISLinkParameters) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Level != nil { - i -= len(*m.Level) - copy(dAtA[i:], *m.Level) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Level))) - i-- - dAtA[i] = 0x12 - } - { - size, err := m.IGPLinkParameters.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Link) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Link) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Link) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *LinkFilter) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LinkFilter) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LinkFilter) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Namespace) - copy(dAtA[i:], m.Namespace) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Namespace))) - i-- - dAtA[i] = 0x12 - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *LinkList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LinkList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LinkList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *LinkSet) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LinkSet) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LinkSet) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *LinkSetFilter) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LinkSetFilter) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LinkSetFilter) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Namespace) - copy(dAtA[i:], m.Namespace) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Namespace))) - i-- - dAtA[i] = 0x12 - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *LinkSetList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LinkSetList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LinkSetList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *LinkSetSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LinkSetSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LinkSetSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.UserDefinedLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Endpoints) > 0 { - for iNdEx := len(m.Endpoints) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Endpoints[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *LinkSetStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LinkSetStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LinkSetStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.LagId != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.LagId)) - i-- - dAtA[i] = 0x18 - } - if m.ESI != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.ESI)) - i-- - dAtA[i] = 0x10 - } - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *LinkSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LinkSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LinkSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.BGP != nil { - { - size, err := m.BGP.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - if m.ISIS != nil { - { - size, err := m.ISIS.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - if m.OSPF != nil { - { - size, err := m.OSPF.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if m.BFD != nil { - { - size, err := m.BFD.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - { - size, err := m.UserDefinedLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Endpoints) > 0 { - for iNdEx := len(m.Endpoints) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Endpoints[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *LinkStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LinkStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LinkStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Location) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Location) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Location) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Longitude) - copy(dAtA[i:], m.Longitude) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Longitude))) - i-- - dAtA[i] = 0x12 - i -= len(m.Latitude) - copy(dAtA[i:], m.Latitude) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Latitude))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Module) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Module) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Module) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ModuleBay) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ModuleBay) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ModuleBay) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ModuleBayFilter) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ModuleBayFilter) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ModuleBayFilter) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Namespace) - copy(dAtA[i:], m.Namespace) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Namespace))) - i-- - dAtA[i] = 0x12 - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ModuleBayList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ModuleBayList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ModuleBayList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ModuleBaySpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ModuleBaySpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ModuleBaySpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.UserDefinedLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - i -= len(m.Position) - copy(dAtA[i:], m.Position) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Position))) - i-- - dAtA[i] = 0x12 - { - size, err := m.NodeID.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ModuleBayStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ModuleBayStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ModuleBayStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ModuleFilter) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ModuleFilter) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ModuleFilter) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Namespace) - copy(dAtA[i:], m.Namespace) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Namespace))) - i-- - dAtA[i] = 0x12 - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ModuleList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ModuleList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ModuleList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ModuleSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ModuleSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ModuleSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.UserDefinedLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - i -= len(m.ModuleBay) - copy(dAtA[i:], m.ModuleBay) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.ModuleBay))) - i-- - dAtA[i] = 0x12 - { - size, err := m.NodeID.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ModuleStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ModuleStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ModuleStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Node) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Node) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Node) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *NodeFilter) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeFilter) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NodeFilter) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Namespace) - copy(dAtA[i:], m.Namespace) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Namespace))) - i-- - dAtA[i] = 0x12 - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *NodeGroup) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeGroup) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NodeGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *NodeGroupEndpointID) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeGroupEndpointID) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NodeGroupEndpointID) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.EndpointID.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - i -= len(m.NodeGroup) - copy(dAtA[i:], m.NodeGroup) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.NodeGroup))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *NodeGroupFilter) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeGroupFilter) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NodeGroupFilter) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Namespace) - copy(dAtA[i:], m.Namespace) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Namespace))) - i-- - dAtA[i] = 0x12 - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *NodeGroupList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeGroupList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NodeGroupList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *NodeGroupNodeID) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeGroupNodeID) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NodeGroupNodeID) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.NodeID.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - i -= len(m.NodeGroup) - copy(dAtA[i:], m.NodeGroup) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.NodeGroup))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *NodeGroupSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeGroupSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NodeGroupSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.UserDefinedLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *NodeGroupStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeGroupStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NodeGroupStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *NodeID) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeID) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NodeID) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Node) - copy(dAtA[i:], m.Node) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Node))) - i-- - dAtA[i] = 0x12 - { - size, err := m.SiteID.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *NodeItem) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeItem) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NodeItem) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *NodeItemFilter) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeItemFilter) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NodeItemFilter) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Namespace) - copy(dAtA[i:], m.Namespace) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Namespace))) - i-- - dAtA[i] = 0x12 - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *NodeItemList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeItemList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NodeItemList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *NodeItemSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeItemSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NodeItemSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.UserDefinedLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.NodeID.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *NodeItemStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeItemStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NodeItemStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *NodeList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NodeList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *NodeSet) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeSet) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NodeSet) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *NodeSetFilter) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeSetFilter) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NodeSetFilter) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Namespace) - copy(dAtA[i:], m.Namespace) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Namespace))) - i-- - dAtA[i] = 0x12 - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *NodeSetList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeSetList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NodeSetList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *NodeSetSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeSetSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NodeSetSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.ClaimLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - i -= len(m.NodeGroup) - copy(dAtA[i:], m.NodeGroup) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.NodeGroup))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *NodeSetStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeSetStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NodeSetStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *NodeSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NodeSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.UserDefinedLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - i -= len(m.Provider) - copy(dAtA[i:], m.Provider) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Provider))) - i-- - dAtA[i] = 0x2a - if m.Location != nil { - { - size, err := m.Location.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if m.Position != nil { - i -= len(*m.Position) - copy(dAtA[i:], *m.Position) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Position))) - i-- - dAtA[i] = 0x1a - } - if m.Rack != nil { - i -= len(*m.Rack) - copy(dAtA[i:], *m.Rack) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Rack))) - i-- - dAtA[i] = 0x12 - } - { - size, err := m.NodeGroupNodeID.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *NodeStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NodeStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.SystemID != nil { - i -= len(*m.SystemID) - copy(dAtA[i:], *m.SystemID) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.SystemID))) - i-- - dAtA[i] = 0x12 - } - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *OSPFLinkParameters) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *OSPFLinkParameters) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *OSPFLinkParameters) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Area != nil { - i -= len(*m.Area) - copy(dAtA[i:], *m.Area) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Area))) - i-- - dAtA[i] = 0x12 - } - { - size, err := m.IGPLinkParameters.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Rack) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Rack) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Rack) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *RackFilter) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RackFilter) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RackFilter) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Namespace) - copy(dAtA[i:], m.Namespace) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Namespace))) - i-- - dAtA[i] = 0x12 - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *RackList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RackList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RackList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *RackSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RackSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RackSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.UserDefinedLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - i -= len(m.Width) - copy(dAtA[i:], m.Width) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Width))) - i-- - dAtA[i] = 0x22 - i -= len(m.Height) - copy(dAtA[i:], m.Height) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Height))) - i-- - dAtA[i] = 0x1a - if m.Location != nil { - { - size, err := m.Location.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - { - size, err := m.SiteID.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *RackStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RackStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RackStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Region) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Region) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Region) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *RegionFilter) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RegionFilter) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RegionFilter) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Namespace) - copy(dAtA[i:], m.Namespace) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Namespace))) - i-- - dAtA[i] = 0x12 - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *RegionList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RegionList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RegionList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *RegionSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RegionSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RegionSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.UserDefinedLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *RegionStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RegionStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RegionStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Site) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Site) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Site) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *SiteFilter) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SiteFilter) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SiteFilter) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Namespace) - copy(dAtA[i:], m.Namespace) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Namespace))) - i-- - dAtA[i] = 0x12 - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *SiteID) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SiteID) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SiteID) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Site) - copy(dAtA[i:], m.Site) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Site))) - i-- - dAtA[i] = 0x12 - i -= len(m.Region) - copy(dAtA[i:], m.Region) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Region))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *SiteList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SiteList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SiteList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *SiteSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SiteSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SiteSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.UserDefinedLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if m.Location != nil { - { - size, err := m.Location.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - i -= len(m.Region) - copy(dAtA[i:], m.Region) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Region))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *SiteStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SiteStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SiteStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { - offset -= sovGenerated(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *BFDLinkParameters) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Enabled != nil { - n += 2 - } - if m.MinTx != nil { - n += 1 + sovGenerated(uint64(*m.MinTx)) - } - if m.MinRx != nil { - n += 1 + sovGenerated(uint64(*m.MinRx)) - } - if m.MinEchoRx != nil { - n += 1 + sovGenerated(uint64(*m.MinEchoRx)) - } - if m.Multiplier != nil { - n += 1 + sovGenerated(uint64(*m.Multiplier)) - } - if m.TTL != nil { - n += 1 + sovGenerated(uint64(*m.TTL)) - } - return n -} - -func (m *BGPLinkParameters) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.BFD != nil { - n += 2 - } - return n -} - -func (m *Cluster) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ClusterFilter) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Namespace) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ClusterList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *ClusterSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.NodeGroup) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Provider) - n += 1 + l + sovGenerated(uint64(l)) - if m.Location != nil { - l = m.Location.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - l = m.UserDefinedLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ClusterStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *Endpoint) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *EndpointFilter) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Namespace) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *EndpointID) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Endpoint) - n += 1 + l + sovGenerated(uint64(l)) - l = m.NodeID.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *EndpointList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *EndpointSet) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *EndpointSetFilter) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Namespace) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *EndpointSetList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *EndpointSetSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Endpoints) > 0 { - for _, e := range m.Endpoints { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - if m.Lacp != nil { - n += 2 - } - l = m.UserDefinedLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *EndpointSetStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.ESI != nil { - n += 1 + sovGenerated(uint64(*m.ESI)) - } - if m.LagId != nil { - n += 1 + sovGenerated(uint64(*m.LagId)) - } - return n -} - -func (m *EndpointSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.NodeGroupEndpointID.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.Module != nil { - l = len(*m.Module) - n += 1 + l + sovGenerated(uint64(l)) - } - l = m.UserDefinedLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.Speed != nil { - l = len(*m.Speed) - n += 1 + l + sovGenerated(uint64(l)) - } - n += 2 - l = len(m.Provider) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *EndpointStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *IGPLinkParameters) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.NetworkType != nil { - l = len(*m.NetworkType) - n += 1 + l + sovGenerated(uint64(l)) - } - if m.Passive != nil { - n += 2 - } - if m.BFD != nil { - n += 2 - } - if m.Metric != nil { - n += 1 + sovGenerated(uint64(*m.Metric)) - } - return n -} - -func (m *ISISLinkParameters) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.IGPLinkParameters.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.Level != nil { - l = len(*m.Level) - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *Link) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *LinkFilter) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Namespace) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *LinkList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *LinkSet) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *LinkSetFilter) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Namespace) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *LinkSetList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *LinkSetSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Endpoints) > 0 { - for _, e := range m.Endpoints { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - l = m.UserDefinedLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *LinkSetStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.ESI != nil { - n += 1 + sovGenerated(uint64(*m.ESI)) - } - if m.LagId != nil { - n += 1 + sovGenerated(uint64(*m.LagId)) - } - return n -} - -func (m *LinkSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Endpoints) > 0 { - for _, e := range m.Endpoints { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - l = m.UserDefinedLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.BFD != nil { - l = m.BFD.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.OSPF != nil { - l = m.OSPF.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.ISIS != nil { - l = m.ISIS.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.BGP != nil { - l = m.BGP.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *LinkStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *Location) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Latitude) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Longitude) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *Module) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ModuleBay) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ModuleBayFilter) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Namespace) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ModuleBayList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *ModuleBaySpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.NodeID.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Position) - n += 1 + l + sovGenerated(uint64(l)) - l = m.UserDefinedLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ModuleBayStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ModuleFilter) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Namespace) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ModuleList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *ModuleSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.NodeID.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.ModuleBay) - n += 1 + l + sovGenerated(uint64(l)) - l = m.UserDefinedLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ModuleStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *Node) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *NodeFilter) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Namespace) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *NodeGroup) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *NodeGroupEndpointID) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.NodeGroup) - n += 1 + l + sovGenerated(uint64(l)) - l = m.EndpointID.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *NodeGroupFilter) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Namespace) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *NodeGroupList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *NodeGroupNodeID) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.NodeGroup) - n += 1 + l + sovGenerated(uint64(l)) - l = m.NodeID.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *NodeGroupSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.UserDefinedLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *NodeGroupStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *NodeID) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.SiteID.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Node) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *NodeItem) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *NodeItemFilter) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Namespace) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *NodeItemList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *NodeItemSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.NodeID.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.UserDefinedLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *NodeItemStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *NodeList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *NodeSet) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *NodeSetFilter) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Namespace) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *NodeSetList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *NodeSetSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.NodeGroup) - n += 1 + l + sovGenerated(uint64(l)) - l = m.ClaimLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *NodeSetStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *NodeSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.NodeGroupNodeID.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.Rack != nil { - l = len(*m.Rack) - n += 1 + l + sovGenerated(uint64(l)) - } - if m.Position != nil { - l = len(*m.Position) - n += 1 + l + sovGenerated(uint64(l)) - } - if m.Location != nil { - l = m.Location.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - l = len(m.Provider) - n += 1 + l + sovGenerated(uint64(l)) - l = m.UserDefinedLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *NodeStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.SystemID != nil { - l = len(*m.SystemID) - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *OSPFLinkParameters) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.IGPLinkParameters.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.Area != nil { - l = len(*m.Area) - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *Rack) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *RackFilter) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Namespace) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *RackList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *RackSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.SiteID.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.Location != nil { - l = m.Location.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - l = len(m.Height) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Width) - n += 1 + l + sovGenerated(uint64(l)) - l = m.UserDefinedLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *RackStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *Region) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *RegionFilter) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Namespace) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *RegionList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *RegionSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.UserDefinedLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *RegionStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *Site) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *SiteFilter) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Namespace) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *SiteID) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Region) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Site) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *SiteList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *SiteSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Region) - n += 1 + l + sovGenerated(uint64(l)) - if m.Location != nil { - l = m.Location.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - l = m.UserDefinedLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *SiteStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func sovGenerated(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenerated(x uint64) (n int) { - return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *BFDLinkParameters) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&BFDLinkParameters{`, - `Enabled:` + valueToStringGenerated(this.Enabled) + `,`, - `MinTx:` + valueToStringGenerated(this.MinTx) + `,`, - `MinRx:` + valueToStringGenerated(this.MinRx) + `,`, - `MinEchoRx:` + valueToStringGenerated(this.MinEchoRx) + `,`, - `Multiplier:` + valueToStringGenerated(this.Multiplier) + `,`, - `TTL:` + valueToStringGenerated(this.TTL) + `,`, - `}`, - }, "") - return s -} -func (this *BGPLinkParameters) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&BGPLinkParameters{`, - `BFD:` + valueToStringGenerated(this.BFD) + `,`, - `}`, - }, "") - return s -} -func (this *Cluster) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Cluster{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "ClusterSpec", "ClusterSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "ClusterStatus", "ClusterStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *ClusterFilter) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ClusterFilter{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`, - `}`, - }, "") - return s -} -func (this *ClusterList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]Cluster{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "Cluster", "Cluster", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&ClusterList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *ClusterSpec) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ClusterSpec{`, - `NodeGroup:` + fmt.Sprintf("%v", this.NodeGroup) + `,`, - `Provider:` + fmt.Sprintf("%v", this.Provider) + `,`, - `Location:` + strings.Replace(this.Location.String(), "Location", "Location", 1) + `,`, - `UserDefinedLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.UserDefinedLabels), "UserDefinedLabels", "v1alpha1.UserDefinedLabels", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *ClusterStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ClusterStatus{`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *Endpoint) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Endpoint{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "EndpointSpec", "EndpointSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "EndpointStatus", "EndpointStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *EndpointFilter) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&EndpointFilter{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`, - `}`, - }, "") - return s -} -func (this *EndpointID) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&EndpointID{`, - `Endpoint:` + fmt.Sprintf("%v", this.Endpoint) + `,`, - `NodeID:` + strings.Replace(strings.Replace(this.NodeID.String(), "NodeID", "NodeID", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *EndpointList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]Endpoint{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "Endpoint", "Endpoint", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&EndpointList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *EndpointSet) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&EndpointSet{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "EndpointSetSpec", "EndpointSetSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "EndpointSetStatus", "EndpointSetStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *EndpointSetFilter) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&EndpointSetFilter{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`, - `}`, - }, "") - return s -} -func (this *EndpointSetList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]EndpointSet{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "EndpointSet", "EndpointSet", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&EndpointSetList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *EndpointSetSpec) String() string { - if this == nil { - return "nil" - } - repeatedStringForEndpoints := "[]*EndpointID{" - for _, f := range this.Endpoints { - repeatedStringForEndpoints += strings.Replace(f.String(), "EndpointID", "EndpointID", 1) + "," - } - repeatedStringForEndpoints += "}" - s := strings.Join([]string{`&EndpointSetSpec{`, - `Endpoints:` + repeatedStringForEndpoints + `,`, - `Lacp:` + valueToStringGenerated(this.Lacp) + `,`, - `UserDefinedLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.UserDefinedLabels), "UserDefinedLabels", "v1alpha1.UserDefinedLabels", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *EndpointSetStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&EndpointSetStatus{`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `ESI:` + valueToStringGenerated(this.ESI) + `,`, - `LagId:` + valueToStringGenerated(this.LagId) + `,`, - `}`, - }, "") - return s -} -func (this *EndpointSpec) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&EndpointSpec{`, - `NodeGroupEndpointID:` + strings.Replace(strings.Replace(this.NodeGroupEndpointID.String(), "NodeGroupEndpointID", "NodeGroupEndpointID", 1), `&`, ``, 1) + `,`, - `Module:` + valueToStringGenerated(this.Module) + `,`, - `UserDefinedLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.UserDefinedLabels), "UserDefinedLabels", "v1alpha1.UserDefinedLabels", 1), `&`, ``, 1) + `,`, - `Speed:` + valueToStringGenerated(this.Speed) + `,`, - `VLANTagging:` + fmt.Sprintf("%v", this.VLANTagging) + `,`, - `Provider:` + fmt.Sprintf("%v", this.Provider) + `,`, - `}`, - }, "") - return s -} -func (this *EndpointStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&EndpointStatus{`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *IGPLinkParameters) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&IGPLinkParameters{`, - `NetworkType:` + valueToStringGenerated(this.NetworkType) + `,`, - `Passive:` + valueToStringGenerated(this.Passive) + `,`, - `BFD:` + valueToStringGenerated(this.BFD) + `,`, - `Metric:` + valueToStringGenerated(this.Metric) + `,`, - `}`, - }, "") - return s -} -func (this *ISISLinkParameters) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ISISLinkParameters{`, - `IGPLinkParameters:` + strings.Replace(strings.Replace(this.IGPLinkParameters.String(), "IGPLinkParameters", "IGPLinkParameters", 1), `&`, ``, 1) + `,`, - `Level:` + valueToStringGenerated(this.Level) + `,`, - `}`, - }, "") - return s -} -func (this *Link) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Link{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "LinkSpec", "LinkSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "LinkStatus", "LinkStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *LinkFilter) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&LinkFilter{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`, - `}`, - }, "") - return s -} -func (this *LinkList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]Link{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "Link", "Link", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&LinkList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *LinkSet) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&LinkSet{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "LinkSetSpec", "LinkSetSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "LinkSetStatus", "LinkSetStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *LinkSetFilter) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&LinkSetFilter{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`, - `}`, - }, "") - return s -} -func (this *LinkSetList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]LinkSet{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "LinkSet", "LinkSet", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&LinkSetList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *LinkSetSpec) String() string { - if this == nil { - return "nil" - } - repeatedStringForEndpoints := "[]*EndpointID{" - for _, f := range this.Endpoints { - repeatedStringForEndpoints += strings.Replace(f.String(), "EndpointID", "EndpointID", 1) + "," - } - repeatedStringForEndpoints += "}" - s := strings.Join([]string{`&LinkSetSpec{`, - `Endpoints:` + repeatedStringForEndpoints + `,`, - `UserDefinedLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.UserDefinedLabels), "UserDefinedLabels", "v1alpha1.UserDefinedLabels", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *LinkSetStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&LinkSetStatus{`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `ESI:` + valueToStringGenerated(this.ESI) + `,`, - `LagId:` + valueToStringGenerated(this.LagId) + `,`, - `}`, - }, "") - return s -} -func (this *LinkSpec) String() string { - if this == nil { - return "nil" - } - repeatedStringForEndpoints := "[]*NodeGroupEndpointID{" - for _, f := range this.Endpoints { - repeatedStringForEndpoints += strings.Replace(f.String(), "NodeGroupEndpointID", "NodeGroupEndpointID", 1) + "," - } - repeatedStringForEndpoints += "}" - s := strings.Join([]string{`&LinkSpec{`, - `Endpoints:` + repeatedStringForEndpoints + `,`, - `UserDefinedLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.UserDefinedLabels), "UserDefinedLabels", "v1alpha1.UserDefinedLabels", 1), `&`, ``, 1) + `,`, - `BFD:` + strings.Replace(this.BFD.String(), "BFDLinkParameters", "BFDLinkParameters", 1) + `,`, - `OSPF:` + strings.Replace(this.OSPF.String(), "OSPFLinkParameters", "OSPFLinkParameters", 1) + `,`, - `ISIS:` + strings.Replace(this.ISIS.String(), "ISISLinkParameters", "ISISLinkParameters", 1) + `,`, - `BGP:` + strings.Replace(this.BGP.String(), "BGPLinkParameters", "BGPLinkParameters", 1) + `,`, - `}`, - }, "") - return s -} -func (this *LinkStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&LinkStatus{`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *Location) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Location{`, - `Latitude:` + fmt.Sprintf("%v", this.Latitude) + `,`, - `Longitude:` + fmt.Sprintf("%v", this.Longitude) + `,`, - `}`, - }, "") - return s -} -func (this *Module) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Module{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "ModuleSpec", "ModuleSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "ModuleStatus", "ModuleStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *ModuleBay) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ModuleBay{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "ModuleBaySpec", "ModuleBaySpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "ModuleBayStatus", "ModuleBayStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *ModuleBayFilter) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ModuleBayFilter{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`, - `}`, - }, "") - return s -} -func (this *ModuleBayList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]ModuleBay{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "ModuleBay", "ModuleBay", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&ModuleBayList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *ModuleBaySpec) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ModuleBaySpec{`, - `NodeID:` + strings.Replace(strings.Replace(this.NodeID.String(), "NodeID", "NodeID", 1), `&`, ``, 1) + `,`, - `Position:` + fmt.Sprintf("%v", this.Position) + `,`, - `UserDefinedLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.UserDefinedLabels), "UserDefinedLabels", "v1alpha1.UserDefinedLabels", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *ModuleBayStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ModuleBayStatus{`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *ModuleFilter) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ModuleFilter{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`, - `}`, - }, "") - return s -} -func (this *ModuleList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]Module{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "Module", "Module", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&ModuleList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *ModuleSpec) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ModuleSpec{`, - `NodeID:` + strings.Replace(strings.Replace(this.NodeID.String(), "NodeID", "NodeID", 1), `&`, ``, 1) + `,`, - `ModuleBay:` + fmt.Sprintf("%v", this.ModuleBay) + `,`, - `UserDefinedLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.UserDefinedLabels), "UserDefinedLabels", "v1alpha1.UserDefinedLabels", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *ModuleStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ModuleStatus{`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *Node) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Node{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "NodeSpec", "NodeSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "NodeStatus", "NodeStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *NodeFilter) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&NodeFilter{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`, - `}`, - }, "") - return s -} -func (this *NodeGroup) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&NodeGroup{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "NodeGroupSpec", "NodeGroupSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "NodeGroupStatus", "NodeGroupStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *NodeGroupEndpointID) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&NodeGroupEndpointID{`, - `NodeGroup:` + fmt.Sprintf("%v", this.NodeGroup) + `,`, - `EndpointID:` + strings.Replace(strings.Replace(this.EndpointID.String(), "EndpointID", "EndpointID", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *NodeGroupFilter) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&NodeGroupFilter{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`, - `}`, - }, "") - return s -} -func (this *NodeGroupList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]NodeGroup{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "NodeGroup", "NodeGroup", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&NodeGroupList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *NodeGroupNodeID) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&NodeGroupNodeID{`, - `NodeGroup:` + fmt.Sprintf("%v", this.NodeGroup) + `,`, - `NodeID:` + strings.Replace(strings.Replace(this.NodeID.String(), "NodeID", "NodeID", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *NodeGroupSpec) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&NodeGroupSpec{`, - `UserDefinedLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.UserDefinedLabels), "UserDefinedLabels", "v1alpha1.UserDefinedLabels", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *NodeGroupStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&NodeGroupStatus{`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *NodeID) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&NodeID{`, - `SiteID:` + strings.Replace(strings.Replace(this.SiteID.String(), "SiteID", "SiteID", 1), `&`, ``, 1) + `,`, - `Node:` + fmt.Sprintf("%v", this.Node) + `,`, - `}`, - }, "") - return s -} -func (this *NodeItem) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&NodeItem{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "NodeItemSpec", "NodeItemSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "NodeItemStatus", "NodeItemStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *NodeItemFilter) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&NodeItemFilter{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`, - `}`, - }, "") - return s -} -func (this *NodeItemList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]NodeItem{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "NodeItem", "NodeItem", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&NodeItemList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *NodeItemSpec) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&NodeItemSpec{`, - `NodeID:` + strings.Replace(strings.Replace(this.NodeID.String(), "NodeID", "NodeID", 1), `&`, ``, 1) + `,`, - `UserDefinedLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.UserDefinedLabels), "UserDefinedLabels", "v1alpha1.UserDefinedLabels", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *NodeItemStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&NodeItemStatus{`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *NodeList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]Node{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "Node", "Node", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&NodeList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *NodeSet) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&NodeSet{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "NodeSetSpec", "NodeSetSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "NodeSetStatus", "NodeSetStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *NodeSetFilter) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&NodeSetFilter{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`, - `}`, - }, "") - return s -} -func (this *NodeSetList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]NodeSet{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "NodeSet", "NodeSet", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&NodeSetList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *NodeSetSpec) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&NodeSetSpec{`, - `NodeGroup:` + fmt.Sprintf("%v", this.NodeGroup) + `,`, - `ClaimLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ClaimLabels), "ClaimLabels", "v1alpha1.ClaimLabels", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *NodeSetStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&NodeSetStatus{`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *NodeSpec) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&NodeSpec{`, - `NodeGroupNodeID:` + strings.Replace(strings.Replace(this.NodeGroupNodeID.String(), "NodeGroupNodeID", "NodeGroupNodeID", 1), `&`, ``, 1) + `,`, - `Rack:` + valueToStringGenerated(this.Rack) + `,`, - `Position:` + valueToStringGenerated(this.Position) + `,`, - `Location:` + strings.Replace(this.Location.String(), "Location", "Location", 1) + `,`, - `Provider:` + fmt.Sprintf("%v", this.Provider) + `,`, - `UserDefinedLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.UserDefinedLabels), "UserDefinedLabels", "v1alpha1.UserDefinedLabels", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *NodeStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&NodeStatus{`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `SystemID:` + valueToStringGenerated(this.SystemID) + `,`, - `}`, - }, "") - return s -} -func (this *OSPFLinkParameters) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&OSPFLinkParameters{`, - `IGPLinkParameters:` + strings.Replace(strings.Replace(this.IGPLinkParameters.String(), "IGPLinkParameters", "IGPLinkParameters", 1), `&`, ``, 1) + `,`, - `Area:` + valueToStringGenerated(this.Area) + `,`, - `}`, - }, "") - return s -} -func (this *Rack) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Rack{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "RackSpec", "RackSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "RackStatus", "RackStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *RackFilter) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&RackFilter{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`, - `}`, - }, "") - return s -} -func (this *RackList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]Rack{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "Rack", "Rack", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&RackList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *RackSpec) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&RackSpec{`, - `SiteID:` + strings.Replace(strings.Replace(this.SiteID.String(), "SiteID", "SiteID", 1), `&`, ``, 1) + `,`, - `Location:` + strings.Replace(this.Location.String(), "Location", "Location", 1) + `,`, - `Height:` + fmt.Sprintf("%v", this.Height) + `,`, - `Width:` + fmt.Sprintf("%v", this.Width) + `,`, - `UserDefinedLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.UserDefinedLabels), "UserDefinedLabels", "v1alpha1.UserDefinedLabels", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *RackStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&RackStatus{`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *Region) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Region{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "RegionSpec", "RegionSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "RegionStatus", "RegionStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *RegionFilter) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&RegionFilter{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`, - `}`, - }, "") - return s -} -func (this *RegionList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]Region{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "Region", "Region", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&RegionList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *RegionSpec) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&RegionSpec{`, - `UserDefinedLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.UserDefinedLabels), "UserDefinedLabels", "v1alpha1.UserDefinedLabels", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *RegionStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&RegionStatus{`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *Site) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Site{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "SiteSpec", "SiteSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "SiteStatus", "SiteStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *SiteFilter) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&SiteFilter{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`, - `}`, - }, "") - return s -} -func (this *SiteID) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&SiteID{`, - `Region:` + fmt.Sprintf("%v", this.Region) + `,`, - `Site:` + fmt.Sprintf("%v", this.Site) + `,`, - `}`, - }, "") - return s -} -func (this *SiteList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]Site{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "Site", "Site", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&SiteList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *SiteSpec) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&SiteSpec{`, - `Region:` + fmt.Sprintf("%v", this.Region) + `,`, - `Location:` + strings.Replace(this.Location.String(), "Location", "Location", 1) + `,`, - `UserDefinedLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.UserDefinedLabels), "UserDefinedLabels", "v1alpha1.UserDefinedLabels", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *SiteStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&SiteStatus{`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func valueToStringGenerated(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *BFDLinkParameters) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BFDLinkParameters: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BFDLinkParameters: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.Enabled = &b - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinTx", wireType) - } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MinTx = &v - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinRx", wireType) - } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MinRx = &v - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinEchoRx", wireType) - } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MinEchoRx = &v - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Multiplier", wireType) - } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Multiplier = &v - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) - } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.TTL = &v - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *BGPLinkParameters) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BGPLinkParameters: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BGPLinkParameters: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BFD", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.BFD = &b - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Cluster) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Cluster: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Cluster: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ClusterFilter) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ClusterFilter: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ClusterFilter: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Namespace = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ClusterList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ClusterList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ClusterList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, Cluster{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ClusterSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ClusterSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ClusterSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeGroup", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NodeGroup = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Provider", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Provider = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Location", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Location == nil { - m.Location = &Location{} - } - if err := m.Location.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UserDefinedLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.UserDefinedLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ClusterStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ClusterStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ClusterStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Endpoint) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Endpoint: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Endpoint: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EndpointFilter) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EndpointFilter: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EndpointFilter: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Namespace = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EndpointID) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EndpointID: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EndpointID: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Endpoint", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Endpoint = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeID", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.NodeID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EndpointList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EndpointList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EndpointList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, Endpoint{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EndpointSet) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EndpointSet: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EndpointSet: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EndpointSetFilter) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EndpointSetFilter: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EndpointSetFilter: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Namespace = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EndpointSetList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EndpointSetList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EndpointSetList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, EndpointSet{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EndpointSetSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EndpointSetSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EndpointSetSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Endpoints", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Endpoints = append(m.Endpoints, &EndpointID{}) - if err := m.Endpoints[len(m.Endpoints)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Lacp", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.Lacp = &b - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UserDefinedLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.UserDefinedLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EndpointSetStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EndpointSetStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EndpointSetStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ESI", wireType) - } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ESI = &v - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LagId", wireType) - } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.LagId = &v - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EndpointSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EndpointSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EndpointSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeGroupEndpointID", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.NodeGroupEndpointID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Module", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Module = &s - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UserDefinedLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.UserDefinedLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Speed", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Speed = &s - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field VLANTagging", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.VLANTagging = bool(v != 0) - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Provider", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Provider = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EndpointStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EndpointStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EndpointStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *IGPLinkParameters) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: IGPLinkParameters: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IGPLinkParameters: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NetworkType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := NetworkType(dAtA[iNdEx:postIndex]) - m.NetworkType = &s - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Passive", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.Passive = &b - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BFD", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.BFD = &b - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Metric", wireType) - } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Metric = &v - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ISISLinkParameters) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ISISLinkParameters: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ISISLinkParameters: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IGPLinkParameters", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.IGPLinkParameters.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Level", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := ISISLevel(dAtA[iNdEx:postIndex]) - m.Level = &s - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Link) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Link: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Link: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LinkFilter) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LinkFilter: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LinkFilter: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Namespace = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LinkList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LinkList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LinkList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, Link{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LinkSet) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LinkSet: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LinkSet: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LinkSetFilter) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LinkSetFilter: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LinkSetFilter: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Namespace = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LinkSetList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LinkSetList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LinkSetList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, LinkSet{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LinkSetSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LinkSetSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LinkSetSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Endpoints", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Endpoints = append(m.Endpoints, &EndpointID{}) - if err := m.Endpoints[len(m.Endpoints)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UserDefinedLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.UserDefinedLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LinkSetStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LinkSetStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LinkSetStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ESI", wireType) - } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ESI = &v - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LagId", wireType) - } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.LagId = &v - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LinkSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LinkSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LinkSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Endpoints", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Endpoints = append(m.Endpoints, &NodeGroupEndpointID{}) - if err := m.Endpoints[len(m.Endpoints)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UserDefinedLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.UserDefinedLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BFD", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.BFD == nil { - m.BFD = &BFDLinkParameters{} - } - if err := m.BFD.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OSPF", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.OSPF == nil { - m.OSPF = &OSPFLinkParameters{} - } - if err := m.OSPF.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ISIS", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ISIS == nil { - m.ISIS = &ISISLinkParameters{} - } - if err := m.ISIS.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BGP", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.BGP == nil { - m.BGP = &BGPLinkParameters{} - } - if err := m.BGP.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LinkStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LinkStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LinkStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Location) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Location: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Location: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Latitude", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Latitude = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Longitude", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Longitude = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Module) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Module: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ModuleBay) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ModuleBay: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ModuleBay: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ModuleBayFilter) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ModuleBayFilter: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ModuleBayFilter: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Namespace = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ModuleBayList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ModuleBayList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ModuleBayList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, ModuleBay{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ModuleBaySpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ModuleBaySpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ModuleBaySpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeID", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.NodeID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Position", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Position = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UserDefinedLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.UserDefinedLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ModuleBayStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ModuleBayStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ModuleBayStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ModuleFilter) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ModuleFilter: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ModuleFilter: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Namespace = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ModuleList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ModuleList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ModuleList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, Module{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ModuleSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ModuleSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ModuleSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeID", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.NodeID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ModuleBay", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ModuleBay = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UserDefinedLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.UserDefinedLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ModuleStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ModuleStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ModuleStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Node) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Node: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Node: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NodeFilter) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NodeFilter: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeFilter: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Namespace = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NodeGroup) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NodeGroup: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeGroup: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NodeGroupEndpointID) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NodeGroupEndpointID: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeGroupEndpointID: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeGroup", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NodeGroup = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EndpointID", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.EndpointID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NodeGroupFilter) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NodeGroupFilter: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeGroupFilter: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Namespace = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NodeGroupList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NodeGroupList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeGroupList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, NodeGroup{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NodeGroupNodeID) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NodeGroupNodeID: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeGroupNodeID: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeGroup", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NodeGroup = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeID", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.NodeID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NodeGroupSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NodeGroupSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeGroupSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UserDefinedLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.UserDefinedLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NodeGroupStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NodeGroupStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeGroupStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NodeID) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NodeID: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeID: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SiteID", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.SiteID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Node", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Node = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NodeItem) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NodeItem: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeItem: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NodeItemFilter) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NodeItemFilter: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeItemFilter: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Namespace = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NodeItemList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NodeItemList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeItemList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, NodeItem{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NodeItemSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NodeItemSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeItemSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeID", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.NodeID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UserDefinedLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.UserDefinedLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NodeItemStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NodeItemStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeItemStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NodeList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NodeList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, Node{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NodeSet) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NodeSet: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeSet: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NodeSetFilter) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NodeSetFilter: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeSetFilter: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Namespace = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NodeSetList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NodeSetList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeSetList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, NodeSet{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NodeSetSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NodeSetSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeSetSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeGroup", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NodeGroup = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ClaimLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NodeSetStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NodeSetStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeSetStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NodeSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NodeSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeGroupNodeID", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.NodeGroupNodeID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Rack", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Rack = &s - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Position", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Position = &s - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Location", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Location == nil { - m.Location = &Location{} - } - if err := m.Location.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Provider", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Provider = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UserDefinedLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.UserDefinedLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NodeStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NodeStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SystemID", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.SystemID = &s - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *OSPFLinkParameters) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: OSPFLinkParameters: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: OSPFLinkParameters: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IGPLinkParameters", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.IGPLinkParameters.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Area", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Area = &s - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Rack) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Rack: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Rack: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RackFilter) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RackFilter: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RackFilter: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Namespace = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RackList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RackList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RackList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, Rack{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RackSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RackSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RackSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SiteID", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.SiteID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Location", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Location == nil { - m.Location = &Location{} - } - if err := m.Location.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Height = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Width", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Width = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UserDefinedLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.UserDefinedLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RackStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RackStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RackStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Region) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Region: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Region: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RegionFilter) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RegionFilter: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RegionFilter: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Namespace = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RegionList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RegionList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RegionList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, Region{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RegionSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RegionSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RegionSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UserDefinedLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.UserDefinedLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RegionStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RegionStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RegionStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Site) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Site: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Site: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SiteFilter) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SiteFilter: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SiteFilter: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Namespace = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SiteID) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SiteID: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SiteID: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Region", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Region = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Site", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Site = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SiteList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SiteList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SiteList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, Site{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SiteSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SiteSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SiteSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Region", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Region = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Location", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Location == nil { - m.Location = &Location{} - } - if err := m.Location.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UserDefinedLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.UserDefinedLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SiteStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SiteStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SiteStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenerated(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenerated - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenerated - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenerated - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") -) diff --git a/apis/backend/infra/v1alpha1/generated.proto b/apis/backend/infra/v1alpha1/generated.proto deleted file mode 100644 index 8c51fa5..0000000 --- a/apis/backend/infra/v1alpha1/generated.proto +++ /dev/null @@ -1,889 +0,0 @@ -/* -Copyright 2024 Nokia. - -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. -*/ -// This file was autogenerated by go-to-protobuf. Do not edit it manually! - -syntax = "proto2"; - -package github.com.kuidio.kuid.apis.backend.infra.v1alpha1; - -import "github.com/kuidio/kuid/apis/common/v1alpha1/generated.proto"; -import "github.com/kuidio/kuid/apis/condition/v1alpha1/generated.proto"; -import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; -import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; - -// Package-wide variables from generator "generated". -option go_package = "github.com/kuidio/kuid/apis/backend/infra/v1alpha1"; - -message BFDLinkParameters { - // Disabled defines if bfd is disabled or not - // +optional - optional bool enabled = 1; - - // MinTx defines the desired minimal interval for sending BFD packets, in msec. - // +optional - optional uint32 minTx = 2; - - // MinTx defines the required minimal interval for receiving BFD packets, in msec. - // +optional - optional uint32 minRx = 3; - - // MinEchoRx defines the echo function timer, in msec. - // +optional - optional uint32 minEchoRx = 4; - - // Multiplier defines the number of missed packets before the session is considered down - // +optional - optional uint32 multiplier = 5; - - // TTL defines the time to live on the outgoing BFD packet - // +kubebuilder:validation:Maximum:=255 - // +kubebuilder:validation:Minimum:=2 - // +optional - optional uint32 ttl = 6; -} - -message BGPLinkParameters { - // BFD defines if BFD is enabled for the EGP on this interface - // +kubebuilder:default:=true - // +optional - optional bool bfd = 1; -} - -// A Cluster represents a kubernetes cluster and is typically used as a nodeGroup identifier. -// +k8s:openapi-gen=true -message Cluster { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional ClusterSpec spec = 2; - - optional ClusterStatus status = 3; -} - -message ClusterFilter { - // Name filters by the name of the objects - optional string name = 1; - - // Namespace filters by the namespace of the objects - optional string namespace = 2; -} - -// ClusterList contains a list of Clusters -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message ClusterList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated Cluster items = 2; -} - -// ClusterSpec defines the desired state of Cluster -message ClusterSpec { - // NodeGroup defines the node group the resource belongs to. - optional string nodeGroup = 1; - - // Provider defines the provider implementing this resource. - optional string provider = 2; - - // Location defines the location information where this resource is located - // in lon/lat coordinates - optional Location location = 3; - - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - optional github.com.kuidio.kuid.apis.common.v1alpha1.UserDefinedLabels userDefinedLabels = 4; -} - -// ClusterStatus defines the observed state of Cluster -message ClusterStatus { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 1; -} - -// An Endpoint represents a communication interface or connection point within a Node, -// facilitating network communication and data transfer between different components -// or systems within the environment. `Endpoints` serve as gateways for transmitting and -// receiving data, enabling seamless communication between Nodes. -// +k8s:openapi-gen=true -message Endpoint { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional EndpointSpec spec = 2; - - optional EndpointStatus status = 3; -} - -message EndpointFilter { - // Name filters by the name of the objects - optional string name = 1; - - // Namespace filters by the namespace of the objects - optional string namespace = 2; -} - -message EndpointID { - optional NodeID nodeID = 6; - - // Endpoint defines the name of the endpoint - optional string endpoint = 5; -} - -// EndpointList contains a list of Endpoints -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message EndpointList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated Endpoint items = 2; -} - -// A EndpointSet represents a set of endpoints that belong together within a nodeGroup. -// E.g. it can be used to model a logical Link Aggregation group within -// a node or it can be used to represent a logical multi-homing construction -// between a set of nodes belonging to a single nodeGroup. -// +k8s:openapi-gen=true -message EndpointSet { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional EndpointSetSpec spec = 2; - - optional EndpointSetStatus status = 3; -} - -message EndpointSetFilter { - // Name filters by the name of the objects - optional string name = 1; - - // Namespace filters by the namespace of the objects - optional string namespace = 2; -} - -// EndpointSetList contains a list of EndpointSets -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message EndpointSetList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated EndpointSet items = 2; -} - -// EndpointSetSpec defines the desired state of EndpointSet -// An EndpointSet can be a LAG (single Homed) or ESI (multiHomed). The EndpointSet -// can only belong to a single NodeGroup -message EndpointSetSpec { - // Endpoints defines the Endpoints that are part of the EndpointSet - // Min 1, Max 16 - repeated EndpointID endpoints = 1; - - // Lacp defines if the lag enabled LACP - // +optional - optional bool lacp = 2; - - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - optional github.com.kuidio.kuid.apis.common.v1alpha1.UserDefinedLabels userDefinedLabels = 3; -} - -// EndpointSetStatus defines the observed state of EndpointSet -message EndpointSetStatus { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 1; - - // ESI defines the ethernet segment identifier of the logical link - // if set this is a multi-homed logical endpoint - // the ESI is a global unique identifier within the administrative domain - // +optional - optional uint32 esi = 2; - - // LagId defines the lag id for the logical single-homed or multi-homed - // endpoint - // +optional - optional uint32 lagID = 3; -} - -// EndpointSpec defines the desired state of Endpoint -message EndpointSpec { - // NodeGroupEndpointID identifies the endpoint identity this resource belongs to - optional NodeGroupEndpointID nodeGroupEndpointID = 1; - - // Module define the module to which the Endpoint belongs - // +optional - optional string module = 2; - - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - optional github.com.kuidio.kuid.apis.common.v1alpha1.UserDefinedLabels userDefinedLabels = 3; - - // (Gbps) - optional string speed = 4; - - // VLANTagging defines if VLAN tagging is enabled or disabled on the interface - optional bool vlanTagging = 5; - - // Provider defines the provider implementing this resource. - optional string provider = 6; -} - -// EndpointStatus defines the observed state of Endpoint -message EndpointStatus { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 1; -} - -message IGPLinkParameters { - // Type defines the type of network - // +kubebuilder:validation:Enum=`pointToPoint`;`broadcast`; - // +kubebuilder:default=pointToPoint - // +optional - optional string networkType = 1; - - // Passive defines if this interface is passive - // +optional - optional bool minTx = 2; - - // BFD defines if BFD is enabled for the IGP on this interface - // +kubebuilder:default:=true - // +optional - optional bool bfd = 3; - - // Metric defines the interface metric associated with the native routing topology - // +optional - optional uint32 metric = 4; -} - -message ISISLinkParameters { - // Generic IGP Link Parameters - // +optional - optional IGPLinkParameters igpLinkParameters = 1; - - // Defines the ISIS level the link is assocaited with - // +optional - optional string area = 2; -} - -// A link represents a physical/logical connection that enables communication and data transfer -// between 2 endpoints of a node. -// +k8s:openapi-gen=true -message Link { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional LinkSpec spec = 2; - - optional LinkStatus status = 3; -} - -message LinkFilter { - // Name filters by the name of the objects - optional string name = 1; - - // Namespace filters by the namespace of the objects - optional string namespace = 2; -} - -// LinkList contains a list of Links -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message LinkList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated Link items = 2; -} - -// A linkSet represents a set of links that belong together within a node group or accross nodeGroups. -// E.g. it can be used to model a logical Link Aggregation group between 2 nodes or -// it can be used to represent a logical multi-homing construction between a set of nodes -// belonging to 1 or multiple nodeGroups/Topologies. -// +k8s:openapi-gen=true -message LinkSet { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional LinkSetSpec spec = 2; - - optional LinkSetStatus status = 3; -} - -message LinkSetFilter { - // Name filters by the name of the objects - optional string name = 1; - - // Namespace filters by the namespace of the objects - optional string namespace = 2; -} - -// LinkSetList contains a list of LinkSets -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message LinkSetList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated LinkSet items = 2; -} - -// LinkSetSpec defines the desired state of LinkSet -message LinkSetSpec { - // Endpoints define the endpoint identifiers of the LinkSet - repeated EndpointID endpoints = 1; - - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - optional github.com.kuidio.kuid.apis.common.v1alpha1.UserDefinedLabels userDefinedLabels = 2; -} - -// LinkSetStatus defines the observed state of LinkSet -message LinkSetStatus { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 1; - - // ESI defines the ethernet segment identifier of the logical link - // if set this is a multi-homed linkset - // the ESI is a global unique identifier within the administrative domain/topology - optional uint32 esi = 2; - - // LagId defines the lag id for the logical single-homed or multi-homed - // endpoint - optional uint32 lagId = 3; -} - -// LinkSpec defines the desired state of Link -message LinkSpec { - // Endpoints define the 2 endpoint identifiers of the link - // Can only have 2 endpoints - repeated NodeGroupEndpointID endpoints = 1; - - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - optional github.com.kuidio.kuid.apis.common.v1alpha1.UserDefinedLabels userDefinedLabels = 2; - - // BFD defines the BFD specific parameters on the link - // +optional - optional BFDLinkParameters bfd = 3; - - // OSPF defines the OSPF specific parameters on the link - // +optional - optional OSPFLinkParameters ospf = 4; - - // ISIS defines the ISIS specific parameters on the link - // +optional - optional ISISLinkParameters isis = 5; - - // BGP defines the BGP specific parameters on the link - // +optional - optional BGPLinkParameters bgp = 6; -} - -// LinkStatus defines the observed state of Link -message LinkStatus { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 1; -} - -message Location { - optional string latitude = 1; - - optional string longitude = 2; -} - -// A module refers to a hardware component or expansion module that can be installed within a ModuleBay of a Node. -// Modules provide additional functionality and capabilities to the infrastructure environment, -// allowing users to enhance and customize their deployments according to specific requirements. -// +k8s:openapi-gen=true -message Module { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional ModuleSpec spec = 2; - - optional ModuleStatus status = 3; -} - -// A ModuleBay serves as a modular slot or enclosure within a Node, designed to accommodate additional modules. -// ModuleBays provide a flexible and scalable approach to extending the capabilities of Nodes, -// allowing users to customize and enhance their infrastructure deployments according to specific requirements. -// +k8s:openapi-gen=true -message ModuleBay { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional ModuleBaySpec spec = 2; - - optional ModuleBayStatus status = 3; -} - -message ModuleBayFilter { - // Name filters by the name of the objects - optional string name = 1; - - // Namespace filters by the namespace of the objects - optional string namespace = 2; -} - -// ModuleBayList contains a list of ModuleBays -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message ModuleBayList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated ModuleBay items = 2; -} - -// ModuleBaySpec defines the desired state of ModuleBay -message ModuleBaySpec { - // NodeID identifies the node identity this resource belongs to - optional NodeID nodeID = 1; - - // Position defines the position in the node the moduleBay is deployed - optional string psoition = 2; - - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - optional github.com.kuidio.kuid.apis.common.v1alpha1.UserDefinedLabels userDefinedLabels = 3; -} - -// ModuleBayStatus defines the observed state of ModuleBay -message ModuleBayStatus { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 1; -} - -message ModuleFilter { - // Name filters by the name of the objects - optional string name = 1; - - // Namespace filters by the namespace of the objects - optional string namespace = 2; -} - -// ModuleList contains a list of Modules -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message ModuleList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated Module items = 2; -} - -// ModuleSpec defines the desired state of Module -message ModuleSpec { - // NodeID identifies the node identity this resource belongs to - optional NodeID nodeID = 1; - - // ModuelBay defines the bay in which the module is deployed - optional string moduleBay = 2; - - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - optional github.com.kuidio.kuid.apis.common.v1alpha1.UserDefinedLabels userDefinedLabels = 3; -} - -// ModuleStatus defines the observed state of Module -message ModuleStatus { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 1; -} - -// A Node represents a fundamental unit that implements compute, storage, and/or networking within your environment. -// Nodes can embody physical, virtual, or containerized entities, offering versatility in deployment options to suit -// diverse infrastructure requirements. -// Nodes are logically organized within racks and sites/regions, establishing a hierarchical structure for efficient -// resource management and organization. Additionally, Nodes are associated with nodeGroups, facilitating centralized -// management and control within defined administrative boundaries. -// Each Node is assigned a provider, representing the entity responsible for implementing the specifics of the Node. -// +k8s:openapi-gen=true -message Node { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional NodeSpec spec = 2; - - optional NodeStatus status = 3; -} - -message NodeFilter { - // Name filters by the name of the objects - optional string name = 1; - - // Namespace filters by the namespace of the objects - optional string namespace = 2; -} - -// A NodeGrouo represents a logical grouping of infrastructure resources managed by a single -// administrative entity or organization. NodeGroups serve as administrative boundaries within the environment, -// providing a structured framework for organizing and managing resources based on administrative ownership -// or responsibility. E.g. A NodeGroup on one hand, can be used to represent a topology that spans multiple -// sites and regions, but a NodeGroup can also be used to group all nodes of a NodeGroup together. -// +k8s:openapi-gen=true -message NodeGroup { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional NodeGroupSpec spec = 2; - - optional NodeGroupStatus status = 3; -} - -message NodeGroupEndpointID { - // NodeGroup defines the node group the resource belongs to. - optional string nodeGroup = 1; - - // EndpointID defines the endpointID - optional EndpointID endpointID = 2; -} - -message NodeGroupFilter { - // Name filters by the name of the objects - optional string name = 1; - - // Namespace filters by the namespace of the objects - optional string namespace = 2; -} - -// NodeGroupList contains a list of NodeGroups -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message NodeGroupList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated NodeGroup items = 2; -} - -message NodeGroupNodeID { - // NodeGroup defines the node group the resource belongs to. - optional string nodeGroup = 1; - - // NodeID defines the nodeID - optional NodeID nodeID = 2; -} - -// NodeGroupSpec defines the desired state of NodeGroup -// E.g. A nodeGroup can be a NodeGroup -// E.g. A nodeGroup can be a topology like a DC fabric (frontend and backend could be a different nodeGroup) -// A Node Group is a global unique identifier within the system e.g. representing a topology, a NodeGroup or -// another set of elements that are managed together by a single entity -message NodeGroupSpec { - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - optional github.com.kuidio.kuid.apis.common.v1alpha1.UserDefinedLabels userDefinedLabels = 1; -} - -// NodeGroupStatus defines the observed state of NodeGroup -message NodeGroupStatus { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 1; -} - -message NodeID { - optional SiteID siteID = 1; - - // Node defines the node the resource belongs to. - optional string node = 2; -} - -// A NodeItem represents a specific hardware component or accessory associated with a Node. -// NodeItems represent a wide range of hardware elements, e.g Fan(s), PowerUnit(s), CPU(s), -// and other peripheral devices essential for the operation of the Node. -// NodeItem is used to represent the modular components of a node. -// +k8s:openapi-gen=true -message NodeItem { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional NodeItemSpec spec = 2; - - optional NodeItemStatus status = 3; -} - -message NodeItemFilter { - // Name filters by the name of the objects - optional string name = 1; - - // Namespace filters by the namespace of the objects - optional string namespace = 2; -} - -// NodeItemList contains a list of NodeItems -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message NodeItemList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated NodeItem items = 2; -} - -// NodeItemSpec defines the desired state of NodeItem -message NodeItemSpec { - // NodeID identifies the node identity this resource belongs to - optional NodeID nodeID = 1; - - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - optional github.com.kuidio.kuid.apis.common.v1alpha1.UserDefinedLabels userDefinedLabels = 2; -} - -// NodeItemStatus defines the observed state of NodeItem -message NodeItemStatus { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 1; -} - -// NodeList contains a list of Nodes -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message NodeList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated Node items = 2; -} - -// A NodeSet represents a set of nodes. -// E.g. it can be used to model a set of nodes in a NodeSet that share the same -// charecteristics wrt, Numa, interfaces, etc. -// Another usage of NodeSet is the representation of a virtual Node that consists of multiple nodes. -// +k8s:openapi-gen=true -message NodeSet { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional NodeSetSpec spec = 2; - - optional NodeSetStatus status = 3; -} - -message NodeSetFilter { - // Name filters by the name of the objects - optional string name = 1; - - // Namespace filters by the namespace of the objects - optional string namespace = 2; -} - -// NodeSetList contains a list of NodeSets -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message NodeSetList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated NodeSet items = 2; -} - -// NodeSetSetSpec defines the desired state of NodeSet -message NodeSetSpec { - // NodeGroupName identifies the nodeGroup this resource belongs to - // E.g. a NodeSet in a NodeSet belongs to a nodeGroup where the name of the nodeGroup is the NodeSet - // E.g. a Virtual Node, belongs to a nodeGroup where the name of the nodeGroup represents the topology this node is deployed in - optional string nodeGroup = 1; - - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - optional github.com.kuidio.kuid.apis.common.v1alpha1.ClaimLabels userDefinedLabels = 2; -} - -// NodeSetStatus defines the observed state of NodeSet -message NodeSetStatus { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 1; -} - -// NodeSpec defines the desired state of Node -message NodeSpec { - // NodeGroupNodeID identifies the nodeGroup identity this resource belongs to - optional NodeGroupNodeID nodeGroupID = 1; - - // Rack defines the rack in which the node is deployed - // +optional - optional string rack = 2; - - // relative position in the rack - // +optional - optional string position = 3; - - // Location defines the location information where this resource is located - // in lon/lat coordinates - // +optional - optional Location location = 4; - - // Provider defines the provider implementing this resource. - optional string provider = 5; - - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - optional github.com.kuidio.kuid.apis.common.v1alpha1.UserDefinedLabels userDefinedLabels = 6; -} - -// NodeStatus defines the observed state of Node -message NodeStatus { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 1; - - // System ID define the unique system id of the node - // +optional - optional string systemID = 2; -} - -message OSPFLinkParameters { - // Generic IGP Link Parameters - // +optional - optional IGPLinkParameters igpLinkParameters = 1; - - // Defines the OSPF area the link is assocaited with - // +optional - optional string area = 2; -} - -// A rack represents a physical equipment rack within your environment. Each rack is designed to accommodate -// the installation of devices and equipment. -// +k8s:openapi-gen=true -message Rack { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional RackSpec spec = 2; - - optional RackStatus status = 3; -} - -message RackFilter { - // Name filters by the name of the objects - optional string name = 1; - - // Namespace filters by the namespace of the objects - optional string namespace = 2; -} - -// RackList contains a list of Racks -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message RackList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated Rack items = 2; -} - -// RackSpec defines the desired state of Rack -message RackSpec { - // SiteID identifies the siteID this resource belongs to - optional SiteID siteID = 1; - - // Location defines the location information where this resource is located - // in lon/lat coordinates - optional Location location = 2; - - // The height of the rack, measured in units. - optional string height = 3; - - // The canonical distance between the two vertical rails on a face. In inch - optional string width = 4; - - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined label - optional github.com.kuidio.kuid.apis.common.v1alpha1.UserDefinedLabels userDefinedLabels = 5; -} - -// RackStatus defines the observed state of Rack -message RackStatus { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 1; -} - -// A region represent a geography in which multiple infrastructure resources are grouped -// A region might represent a continent, country, city, campus, or other area depending on your environment. -// +k8s:openapi-gen=true -message Region { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional RegionSpec spec = 2; - - optional RegionStatus status = 3; -} - -message RegionFilter { - // Name filters by the name of the objects - optional string name = 1; - - // Namespace filters by the namespace of the objects - optional string namespace = 2; -} - -// RegionList contains a list of Regions -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message RegionList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated Region items = 2; -} - -// RegionSpec defines the desired state of Region -message RegionSpec { - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - optional github.com.kuidio.kuid.apis.common.v1alpha1.UserDefinedLabels userDefinedLabels = 1; -} - -// RegionStatus defines the observed state of Region -message RegionStatus { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 1; -} - -// A site serves as a fundamental organizational unit for managing infrastructure resources within your environment. -// The utilization of sites may vary based on the organizational structure and requirements, -// but in essence, each site typically corresponds to a distinct building or campus. -// +k8s:openapi-gen=true -message Site { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional SiteSpec spec = 2; - - optional SiteStatus status = 3; -} - -message SiteFilter { - // Name filters by the name of the objects - optional string name = 1; - - // Namespace filters by the namespace of the objects - optional string namespace = 2; -} - -message SiteID { - // Region defines the region this sites belongs to - optional string region = 1; - - // Site defines the site in which the node is deployed - optional string site = 2; -} - -// SiteList contains a list of Sites -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message SiteList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated Site items = 2; -} - -// SiteSpec defines the desired state of Site -message SiteSpec { - // Region defines the region this sites belongs to - optional string region = 1; - - // Location defines the location information where this resource is located - // in lon/lat coordinates - optional Location location = 2; - - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - optional github.com.kuidio.kuid.apis.common.v1alpha1.UserDefinedLabels userDefinedLabels = 3; -} - -// SiteStatus defines the observed state of Site -message SiteStatus { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 1; -} - diff --git a/apis/backend/infra/v1alpha1/id.go b/apis/backend/infra/v1alpha1/id.go deleted file mode 100644 index fd9a1af..0000000 --- a/apis/backend/infra/v1alpha1/id.go +++ /dev/null @@ -1,132 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "fmt" - "strings" -) - -type SiteID struct { - // Region defines the region this sites belongs to - Region string `json:"region" yaml:"region" protobuf:"bytes,1,opt,name=region"` - // Site defines the site in which the node is deployed - Site string `json:"site" yaml:"site" protobuf:"bytes,2,opt,name=site"` -} - -type NodeID struct { - SiteID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=siteID"` - // Node defines the node the resource belongs to. - Node string `json:"node" yaml:"node" protobuf:"bytes,2,opt,name=node"` -} - -type EndpointID struct { - NodeID `json:",inline" yaml:",inline" protobuf:"bytes,6,opt,name=nodeID"` - // Endpoint defines the name of the endpoint - Endpoint string `json:"endpoint" yaml:"endpoint" protobuf:"bytes,5,opt,name=endpoint"` -} - -type NodeGroupNodeID struct { - // NodeGroup defines the node group the resource belongs to. - NodeGroup string `json:"nodeGroup" yaml:"nodeGroup" protobuf:"bytes,1,opt,name=nodeGroup"` - // NodeID defines the nodeID - NodeID `json:",inline" yaml:",inline" protobuf:"bytes,2,opt,name=nodeID"` -} - -type NodeGroupEndpointID struct { - // NodeGroup defines the node group the resource belongs to. - NodeGroup string `json:"nodeGroup" yaml:"nodeGroup" protobuf:"bytes,1,opt,name=nodeGroup"` - // EndpointID defines the endpointID - EndpointID `json:",inline" yaml:",inline" protobuf:"bytes,2,opt,name=endpointID"` -} - -func (r SiteID) KuidString() string { - return fmt.Sprintf( - "%s.%s", - r.Region, - r.Site, - ) -} - -func (r NodeID) KuidString() string { - return fmt.Sprintf( - "%s.%s", - r.SiteID.KuidString(), - r.Node, - ) -} - -func (r EndpointID) KuidString() string { - return fmt.Sprintf( - "%s.%s", - r.NodeID.KuidString(), - r.Endpoint, - ) -} - -func (r NodeGroupNodeID) KuidString() string { - return fmt.Sprintf( - "%s.%s", - r.NodeGroup, - r.NodeID.KuidString(), - ) -} - -func (r NodeGroupEndpointID) KuidString() string { - return fmt.Sprintf( - "%s.%s", - r.NodeGroup, - r.EndpointID.KuidString(), - ) -} - -func String2NodeGroupNodeID(s string) *NodeGroupNodeID { - parts := strings.Split(s, ".") - if len(parts) != 4 { - return nil - } - return &NodeGroupNodeID{ - NodeGroup: parts[0], - NodeID: NodeID{ - Node: parts[3], - SiteID: SiteID{ - Region: parts[1], - Site: parts[2], - }, - }, - } -} - -func String2NodeGroupEndpointID(s string) *NodeGroupEndpointID { - parts := strings.Split(s, ".") - if len(parts) != 5 { - return nil - } - return &NodeGroupEndpointID{ - NodeGroup: parts[0], - EndpointID: EndpointID{ - Endpoint: parts[4], - NodeID: NodeID{ - Node: parts[3], - SiteID: SiteID{ - Region: parts[1], - Site: parts[2], - }, - }, - }, - } -} diff --git a/apis/backend/infra/v1alpha1/igp_types.go b/apis/backend/infra/v1alpha1/igp_types.go deleted file mode 100644 index 6b0b1b0..0000000 --- a/apis/backend/infra/v1alpha1/igp_types.go +++ /dev/null @@ -1,92 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -type NetworkType string - -const ( - NetworkTypeP2P NetworkType = "pointToPoint" - NetworkTypeBroadcast NetworkType = "broadcast" - NetworkTypeUnknown NetworkType = "unknown" -) - -type ISISLevel string - -const ( - ISISLevelL1 ISISLevel = "L1" - ISISLevelL2 ISISLevel = "L2" - ISISLevelL1L2 ISISLevel = "L1L2" - ISISLevelUnknown ISISLevel = "unknown" -) - -type ISISMetricStyle string - -const ( - ISISMetricStyleNarrow ISISMetricStyle = "narrow" - ISISMetricStyleWide ISISMetricStyle = "wide" -) - -type OSPFVersion string - -const ( - OSPFVersionV2 OSPFVersion = "v2" - OSPFVersionV3 OSPFVersion = "v3" - OSPFVersionUnknown OSPFVersion = "unknown" -) - -type IGPLinkParameters struct { - // Type defines the type of network - //+kubebuilder:validation:Enum=`pointToPoint`;`broadcast`; - // +kubebuilder:default=pointToPoint - // +optional - NetworkType *NetworkType `json:"networkType,omitempty" yaml:"networkType,,omitempty" protobuf:"bytes,1,opt,name=networkType"` - // Passive defines if this interface is passive - // +optional - Passive *bool `json:"minTx,omitempty" yaml:"minTx,omitempty" protobuf:"bytes,2,opt,name=minTx"` - // BFD defines if BFD is enabled for the IGP on this interface - // +kubebuilder:default:=true - // +optional - BFD *bool `json:"bfd,omitempty" yaml:"bfd,omitempty" protobuf:"bytes,3,opt,name=bfd"` - // Metric defines the interface metric associated with the native routing topology - // +optional - Metric *uint32 `json:"metric,omitempty" yaml:"metric,omitempty" protobuf:"bytes,4,opt,name=metric"` -} - -type OSPFLinkParameters struct { - // Generic IGP Link Parameters - // +optional - IGPLinkParameters `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=igpLinkParameters"` - // Defines the OSPF area the link is assocaited with - // +optional - Area *string `json:"area,omitempty" yaml:"area,omitempty" protobuf:"bytes,2,opt,name=area"` -} - -type ISISLinkParameters struct { - // Generic IGP Link Parameters - // +optional - IGPLinkParameters `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=igpLinkParameters"` - // Defines the ISIS level the link is assocaited with - // +optional - Level *ISISLevel `json:"area,omitempty" yaml:"area,omitempty" protobuf:"bytes,2,opt,name=area"` -} - -type BGPLinkParameters struct { - // BFD defines if BFD is enabled for the EGP on this interface - // +kubebuilder:default:=true - // +optional - BFD *bool `json:"bfd,omitempty" yaml:"bfd,omitempty" protobuf:"bytes,1,opt,name=bfd"` -} diff --git a/apis/backend/infra/v1alpha1/link_interface.go b/apis/backend/infra/v1alpha1/link_interface.go deleted file mode 100644 index df15f61..0000000 --- a/apis/backend/infra/v1alpha1/link_interface.go +++ /dev/null @@ -1,440 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "crypto/sha1" - "encoding/json" - "fmt" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/apiserver-store/pkg/generic/registry" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - apierrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/fields" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/selection" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" - genericapirequest "k8s.io/apiserver/pkg/endpoints/request" -) - -const LinkPlural = "links" -const LinkSingular = "link" - -// +k8s:deepcopy-gen=false -var _ resource.Object = &Link{} -var _ resource.ObjectList = &LinkList{} -var _ backend.ObjectList = &LinkList{} -var _ backend.GenericObject = &Link{} -var _ backend.GenericObjectList = &LinkList{} - -// GetListMeta returns the ListMeta -func (r *LinkList) GetListMeta() *metav1.ListMeta { - return &r.ListMeta -} - -func (r *Link) GetSingularName() string { - return LinkSingular -} - -func (Link) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Resource: LinkPlural, - } -} - -// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. -// IsStorageVersion implements resource.Object. -func (Link) IsStorageVersion() bool { - return true -} - -// GetObjectMeta implements resource.Object -func (r *Link) GetObjectMeta() *metav1.ObjectMeta { - return &r.ObjectMeta -} - -// NamespaceScoped returns true to indicate Fortune is a namespaced resource. -// NamespaceScoped implements resource.Object. -func (Link) NamespaceScoped() bool { - return true -} - -// New implements resource.Object -func (Link) New() runtime.Object { - return &Link{} -} - -// NewList implements resource.Object -func (Link) NewList() runtime.Object { - return &LinkList{} -} - -func (r *Link) NewObjList() backend.GenericObjectList { - return &LinkList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: LinkKindList}, - } -} - -func (r *Link) SchemaGroupVersionKind() schema.GroupVersionKind { - return SchemeGroupVersion.WithKind(LinkKind) -} - -// GetCondition returns the condition based on the condition kind -func (r *Link) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { - return r.Status.GetCondition(t) -} - -// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions -// to be set at once -func (r *Link) SetConditions(c ...conditionv1alpha1.Condition) { - r.Status.SetConditions(c...) -} - -// LinkConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for Link -func LinkConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { - switch label { - case "metadata.name": - return label, value, nil - case "metadata.namespace": - return label, value, nil - default: - return "", "", fmt.Errorf("%q is not a known field selector", label) - } -} - -func (r *LinkList) GetItems() []backend.Object { - objs := []backend.Object{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *LinkList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *LinkList) GetLinks() []*Link { - objs := []*Link{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *Link) CalculateHash() ([sha1.Size]byte, error) { - // Convert the struct to JSON - jsonData, err := json.Marshal(r) - if err != nil { - return [sha1.Size]byte{}, err - } - - // Calculate SHA-1 hash - return sha1.Sum(jsonData), nil -} - -func (r *Link) GetNamespacedName() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.GetNamespace(), - Name: r.GetName(), - } -} - -func (r *Link) GetKey() store.Key { - return store.KeyFromNSN(r.GetNamespacedName()) -} - -func (r *Link) GetEndPointIDA() *NodeGroupEndpointID { - if len(r.Spec.Endpoints) != 2 { - return nil - } - return r.Spec.Endpoints[0] -} - -func (r *Link) GetEndPointIDB() *NodeGroupEndpointID { - if len(r.Spec.Endpoints) != 2 { - return nil - } - return r.Spec.Endpoints[1] -} - -func (r *Link) GetOwnerReference() *commonv1alpha1.OwnerReference { - return &commonv1alpha1.OwnerReference{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Kind: LinkKind, - Namespace: r.Namespace, - Name: r.Name, - } -} - -func (r *Link) ValidateSyntax(_ string) field.ErrorList { - var allErrs field.ErrorList - - if len(r.Spec.Endpoints) != 2 { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.endpoints"), - r, - fmt.Errorf("a link always need 2 endpoints got %d", len(r.Spec.Endpoints)).Error(), - )) - } - - return allErrs -} - -func (r *Link) GetSpec() any { - return r.Spec -} - -func (r *Link) SetSpec(s any) { - if spec, ok := s.(LinkSpec); ok { - r.Spec = spec - } -} - -// BuildLink returns a reource from a client Object a Spec/Status -func BuildLink(meta metav1.ObjectMeta, spec *LinkSpec, status *LinkStatus) *Link { - aspec := LinkSpec{} - if spec != nil { - aspec = *spec - } - astatus := LinkStatus{} - if status != nil { - astatus = *status - } - return &Link{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: LinkKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -func LinkTableConvertor(gr schema.GroupResource) registry.TableConvertor { - return registry.TableConvertor{ - Resource: gr, - Cells: func(obj runtime.Object) []interface{} { - r, ok := obj.(*Link) - if !ok { - return nil - } - return []interface{}{ - r.GetName(), - r.GetCondition(conditionv1alpha1.ConditionTypeReady).Status, - r.GetEndPointIDA().KuidString(), - r.GetEndPointIDB().KuidString(), - } - }, - Columns: []metav1.TableColumnDefinition{ - {Name: "Name", Type: "string"}, - {Name: "Ready", Type: "string"}, - {Name: "EPA", Type: "string"}, - {Name: "EPB", Type: "string"}, - }, - } -} - -func LinkParseFieldSelector(ctx context.Context, fieldSelector fields.Selector) (backend.Filter, error) { - var filter *LinkFilter - - // add the namespace to the list - namespace, ok := genericapirequest.NamespaceFrom(ctx) - if fieldSelector == nil { - if ok { - return &LinkFilter{Namespace: namespace}, nil - } - return filter, nil - } - requirements := fieldSelector.Requirements() - for _, requirement := range requirements { - filter = &LinkFilter{} - switch requirement.Operator { - case selection.Equals, selection.DoesNotExist: - if requirement.Value == "" { - return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) - } - default: - return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) - } - - switch requirement.Field { - case "metadata.name": - filter.Name = requirement.Value - case "metadata.namespace": - filter.Namespace = requirement.Value - default: - return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) - } - } - // add namespace to the filter selector if specified - if ok { - if filter != nil { - filter.Namespace = namespace - } else { - filter = &LinkFilter{Namespace: namespace} - } - } - - return &LinkFilter{}, nil -} - -type LinkFilter struct { - // Name filters by the name of the objects - Name string `protobuf:"bytes,1,opt,name=name"` - - // Namespace filters by the namespace of the objects - Namespace string `protobuf:"bytes,2,opt,name=namespace"` -} - -func (r *LinkFilter) Filter(ctx context.Context, obj runtime.Object) bool { - f := false // result of the previous filter - o, ok := obj.(*Link) - if !ok { - return f - } - if r.Name != "" { - if o.GetName() == r.Name { - f = false - } else { - f = true - } - } - if r.Namespace != "" { - if o.GetNamespace() == r.Namespace { - f = false - } else { - f = true - } - } - return f -} - -func (r *Link) GetUserDefinedLabels() map[string]string { - return r.Spec.GetUserDefinedLabels() -} - -func (r *Link) GetProvider() string { - return "" -} - -func (r *Link) GetISISLevel() ISISLevel { - if r.Spec.ISIS != nil && - r.Spec.ISIS.Level != nil { - return *r.Spec.ISIS.Level - } - return ISISLevelUnknown -} - -func (r *Link) GetISISNetworkType() NetworkType { - if r.Spec.ISIS != nil && - r.Spec.ISIS.NetworkType != nil { - return *r.Spec.ISIS.NetworkType - } - return NetworkTypeUnknown -} - -func (r *Link) GetISISPassive() bool { - if r.Spec.ISIS != nil && - r.Spec.ISIS.Passive != nil { - return *r.Spec.ISIS.Passive - } - return false -} - -func (r *Link) GetISISBFD() bool { - if r.Spec.ISIS != nil && - r.Spec.ISIS.BFD != nil { - return *r.Spec.ISIS.BFD - } - return false -} - -func (r *Link) GetISISMetric() uint32 { - if r.Spec.ISIS != nil && - r.Spec.ISIS.Metric != nil { - return *r.Spec.ISIS.Metric - } - return 0 -} - -func (r *Link) GetOSPFArea() string { - if r.Spec.OSPF != nil && - r.Spec.OSPF.Area != nil { - return *r.Spec.OSPF.Area - } - return "" -} - -func (r *Link) GetOSPFNetworkType() NetworkType { - if r.Spec.OSPF != nil && - r.Spec.OSPF.NetworkType != nil { - return *r.Spec.OSPF.NetworkType - } - return NetworkTypeUnknown -} - -func (r *Link) GetOSPFPassive() bool { - if r.Spec.OSPF != nil && - r.Spec.OSPF.Passive != nil { - return *r.Spec.OSPF.Passive - } - return false -} - -func (r *Link) GetOSPFBFD() bool { - if r.Spec.OSPF != nil && - r.Spec.OSPF.BFD != nil { - return *r.Spec.OSPF.BFD - } - return false -} - -func (r *Link) GetOSPFMetric() uint32 { - if r.Spec.OSPF != nil && - r.Spec.OSPF.Metric != nil { - return *r.Spec.OSPF.Metric - } - return 0 -} - -func (r *Link) GetBGPBFD() bool { - if r.Spec.BGP != nil && - r.Spec.BGP.BFD != nil { - return *r.Spec.BGP.BFD - } - return false -} diff --git a/apis/backend/infra/v1alpha1/link_types.go b/apis/backend/infra/v1alpha1/link_types.go deleted file mode 100644 index d5530b8..0000000 --- a/apis/backend/infra/v1alpha1/link_types.go +++ /dev/null @@ -1,81 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "reflect" - - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// LinkSpec defines the desired state of Link -type LinkSpec struct { - // Endpoints define the 2 endpoint identifiers of the link - // Can only have 2 endpoints - Endpoints []*NodeGroupEndpointID `json:"endpoints" yaml:"endpoints" protobuf:"bytes,1,opt,name=endpoints"` - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,2,opt,name=userDefinedLabels"` - // BFD defines the BFD specific parameters on the link - // +optional - BFD *BFDLinkParameters `json:"bfd,omitempty" yaml:"bfd,omitempty" protobuf:"bytes,3,opt,name=bfd"` - // OSPF defines the OSPF specific parameters on the link - // +optional - OSPF *OSPFLinkParameters `json:"ospf,omitempty" yaml:"ospf,omitempty" protobuf:"bytes,4,opt,name=ospf"` - // ISIS defines the ISIS specific parameters on the link - // +optional - ISIS *ISISLinkParameters `json:"isis,omitempty" yaml:"isis,omitempty" protobuf:"bytes,5,opt,name=isis"` - // BGP defines the BGP specific parameters on the link - // +optional - BGP *BGPLinkParameters `json:"bgp,omitempty" yaml:"bgp,omitempty" protobuf:"bytes,6,opt,name=bgp"` -} - -// LinkStatus defines the observed state of Link -type LinkStatus struct { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// A link represents a physical/logical connection that enables communication and data transfer -// between 2 endpoints of a node. -// +k8s:openapi-gen=true -type Link struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - Spec LinkSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - Status LinkStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// LinkList contains a list of Links -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type LinkList struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []Link `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` -} - -var ( - LinkKind = reflect.TypeOf(Link{}).Name() - LinkKindList = reflect.TypeOf(LinkList{}).Name() -) diff --git a/apis/backend/infra/v1alpha1/linkset_interface.go b/apis/backend/infra/v1alpha1/linkset_interface.go deleted file mode 100644 index d965bc4..0000000 --- a/apis/backend/infra/v1alpha1/linkset_interface.go +++ /dev/null @@ -1,325 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "crypto/sha1" - "encoding/json" - "fmt" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/apiserver-store/pkg/generic/registry" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - apierrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/fields" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/selection" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" - genericapirequest "k8s.io/apiserver/pkg/endpoints/request" -) - -const LinkSetPlural = "linksets" -const LinkSetSingular = "linkset" - -// +k8s:deepcopy-gen=false -var _ resource.Object = &LinkSet{} -var _ resource.ObjectList = &LinkSetList{} -var _ backend.ObjectList = &LinkSetList{} -var _ backend.GenericObject = &LinkSet{} -var _ backend.GenericObjectList = &LinkSetList{} - -// GetListMeta returns the ListMeta -func (r *LinkSetList) GetListMeta() *metav1.ListMeta { - return &r.ListMeta -} - -func (r *LinkSet) GetSingularName() string { - return LinkSetSingular -} - -func (LinkSet) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Resource: LinkSetPlural, - } -} - -// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. -// IsStorageVersion implements resource.Object. -func (LinkSet) IsStorageVersion() bool { - return true -} - -// GetObjectMeta implements resource.Object -func (r *LinkSet) GetObjectMeta() *metav1.ObjectMeta { - return &r.ObjectMeta -} - -// NamespaceScoped returns true to indicate Fortune is a namespaced resource. -// NamespaceScoped implements resource.Object. -func (LinkSet) NamespaceScoped() bool { - return true -} - -// New implements resource.Object -func (LinkSet) New() runtime.Object { - return &LinkSet{} -} - -// NewList implements resource.Object -func (LinkSet) NewList() runtime.Object { - return &LinkSetList{} -} - -func (r *LinkSet) NewObjList() backend.GenericObjectList { - return &LinkSetList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: LinkSetKindList}, - } -} - -func (r *LinkSet) SchemaGroupVersionKind() schema.GroupVersionKind { - return SchemeGroupVersion.WithKind(LinkSetKind) -} - -// GetCondition returns the condition based on the condition kind -func (r *LinkSet) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { - return r.Status.GetCondition(t) -} - -// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions -// to be set at once -func (r *LinkSet) SetConditions(c ...conditionv1alpha1.Condition) { - r.Status.SetConditions(c...) -} - -// LinkSetConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for LinkSet -func LinkSetConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { - switch label { - case "metadata.name": - return label, value, nil - case "metadata.namespace": - return label, value, nil - default: - return "", "", fmt.Errorf("%q is not a known field selector", label) - } -} - -func (r *LinkSetList) GetItems() []backend.Object { - objs := []backend.Object{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *LinkSetList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *LinkSet) CalculateHash() ([sha1.Size]byte, error) { - // Convert the struct to JSON - jsonData, err := json.Marshal(r) - if err != nil { - return [sha1.Size]byte{}, err - } - - // Calculate SHA-1 hash - return sha1.Sum(jsonData), nil -} - -func (r *LinkSet) GetNamespacedName() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.GetNamespace(), - Name: r.GetName(), - } -} - -func (r *LinkSet) GetKey() store.Key { - return store.KeyFromNSN(r.GetNamespacedName()) -} - -func (r *LinkSet) GetOwnerReference() *commonv1alpha1.OwnerReference { - return &commonv1alpha1.OwnerReference{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Kind: LinkSetKind, - Namespace: r.Namespace, - Name: r.Name, - } -} - -func (r *LinkSet) ValidateSyntax(_ string) field.ErrorList { - var allErrs field.ErrorList - - /* - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.type"), - r, - fmt.Errorf("invalid GENID Type %s", r.Spec.Type).Error(), - )) - } - */ - return allErrs -} - -func (r *LinkSet) GetSpec() any { - return r.Spec -} - -func (r *LinkSet) SetSpec(s any) { - if spec, ok := s.(LinkSetSpec); ok { - r.Spec = spec - } -} - -// BuildLinkSet returns a reource from a client Object a Spec/Status -func BuildLinkSet(meta metav1.ObjectMeta, spec *LinkSetSpec, status *LinkSetStatus) *LinkSet { - aspec := LinkSetSpec{} - if spec != nil { - aspec = *spec - } - astatus := LinkSetStatus{} - if status != nil { - astatus = *status - } - return &LinkSet{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: LinkSetKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -func LinkSetTableConvertor(gr schema.GroupResource) registry.TableConvertor { - return registry.TableConvertor{ - Resource: gr, - Cells: func(obj runtime.Object) []interface{} { - r, ok := obj.(*LinkSet) - if !ok { - return nil - } - return []interface{}{ - r.GetName(), - r.GetCondition(conditionv1alpha1.ConditionTypeReady).Status, - } - }, - Columns: []metav1.TableColumnDefinition{ - {Name: "Name", Type: "string"}, - {Name: "Ready", Type: "string"}, - }, - } -} - -func LinkSetParseFieldSelector(ctx context.Context, fieldSelector fields.Selector) (backend.Filter, error) { - var filter *LinkSetFilter - - // add the namespace to the list - namespace, ok := genericapirequest.NamespaceFrom(ctx) - if fieldSelector == nil { - if ok { - return &LinkSetFilter{Namespace: namespace}, nil - } - return filter, nil - } - requirements := fieldSelector.Requirements() - for _, requirement := range requirements { - filter = &LinkSetFilter{} - switch requirement.Operator { - case selection.Equals, selection.DoesNotExist: - if requirement.Value == "" { - return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) - } - default: - return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) - } - - switch requirement.Field { - case "metadata.name": - filter.Name = requirement.Value - case "metadata.namespace": - filter.Namespace = requirement.Value - default: - return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) - } - } - // add namespace to the filter selector if specified - if ok { - if filter != nil { - filter.Namespace = namespace - } else { - filter = &LinkSetFilter{Namespace: namespace} - } - } - - return &LinkSetFilter{}, nil -} - -type LinkSetFilter struct { - // Name filters by the name of the objects - Name string `protobuf:"bytes,1,opt,name=name"` - - // Namespace filters by the namespace of the objects - Namespace string `protobuf:"bytes,2,opt,name=namespace"` -} - -func (r *LinkSetFilter) Filter(ctx context.Context, obj runtime.Object) bool { - f := false // result of the previous filter - o, ok := obj.(*LinkSet) - if !ok { - return f - } - if r.Name != "" { - if o.GetName() == r.Name { - f = false - } else { - f = true - } - } - if r.Namespace != "" { - if o.GetNamespace() == r.Namespace { - f = false - } else { - f = true - } - } - return f -} - -func (r *LinkSet) GetUserDefinedLabels() map[string]string { - return r.Spec.GetUserDefinedLabels() -} - -func (r *LinkSet) GetProvider() string { - return "" -} diff --git a/apis/backend/infra/v1alpha1/linkset_types.go b/apis/backend/infra/v1alpha1/linkset_types.go deleted file mode 100644 index 7d7fad2..0000000 --- a/apis/backend/infra/v1alpha1/linkset_types.go +++ /dev/null @@ -1,77 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "reflect" - - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// LinkSetSpec defines the desired state of LinkSet -type LinkSetSpec struct { - // Endpoints define the endpoint identifiers of the LinkSet - Endpoints []*EndpointID `json:"endpoints" yaml:"endpoints" protobuf:"bytes,1,opt,name=endpoints"` - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,2,opt,name=userDefinedLabels"` -} - -// LinkSetStatus defines the observed state of LinkSet -type LinkSetStatus struct { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` - // ESI defines the ethernet segment identifier of the logical link - // if set this is a multi-homed linkset - // the ESI is a global unique identifier within the administrative domain/topology - ESI *uint32 `json:"esi,omitempty" yaml:"esi,omitempty" protobuf:"varint,2,opt,name=esi"` - // LagId defines the lag id for the logical single-homed or multi-homed - // endpoint - LagId *uint32 `json:"lagId,omitempty" yaml:"lagId,omitempty" protobuf:"varint,3,opt,name=lagId"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// A linkSet represents a set of links that belong together within a node group or accross nodeGroups. -// E.g. it can be used to model a logical Link Aggregation group between 2 nodes or -// it can be used to represent a logical multi-homing construction between a set of nodes -// belonging to 1 or multiple nodeGroups/Topologies. -// +k8s:openapi-gen=true -type LinkSet struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - Spec LinkSetSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - Status LinkSetStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// LinkSetList contains a list of LinkSets -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type LinkSetList struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []LinkSet `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` -} - -var ( - LinkSetKind = reflect.TypeOf(LinkSet{}).Name() - LinkSetKindList = reflect.TypeOf(LinkSetList{}).Name() -) diff --git a/apis/backend/infra/v1alpha1/location.go b/apis/backend/infra/v1alpha1/location.go deleted file mode 100644 index c1790ca..0000000 --- a/apis/backend/infra/v1alpha1/location.go +++ /dev/null @@ -1,22 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -type Location struct { - Latitude string `json:"latitude" yaml:"latitude" protobuf:"bytes,1,opt,name=latitude"` - Longitude string `json:"longitude" yaml:"longitude" protobuf:"bytes,2,opt,name=longitude"` -} diff --git a/apis/backend/infra/v1alpha1/module_interface.go b/apis/backend/infra/v1alpha1/module_interface.go deleted file mode 100644 index b6b351e..0000000 --- a/apis/backend/infra/v1alpha1/module_interface.go +++ /dev/null @@ -1,325 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "crypto/sha1" - "encoding/json" - "fmt" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/apiserver-store/pkg/generic/registry" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - apierrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/fields" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/selection" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" - genericapirequest "k8s.io/apiserver/pkg/endpoints/request" -) - -const ModulePlural = "modules" -const ModuleSingular = "module" - -// +k8s:deepcopy-gen=false -var _ resource.Object = &Module{} -var _ resource.ObjectList = &ModuleList{} -var _ backend.ObjectList = &ModuleList{} -var _ backend.GenericObject = &Module{} -var _ backend.GenericObjectList = &ModuleList{} - -// GetListMeta returns the ListMeta -func (r *ModuleList) GetListMeta() *metav1.ListMeta { - return &r.ListMeta -} - -func (r *Module) GetSingularName() string { - return ModuleSingular -} - -func (Module) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Resource: ModulePlural, - } -} - -// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. -// IsStorageVersion implements resource.Object. -func (Module) IsStorageVersion() bool { - return true -} - -// GetObjectMeta implements resource.Object -func (r *Module) GetObjectMeta() *metav1.ObjectMeta { - return &r.ObjectMeta -} - -// NamespaceScoped returns true to indicate Fortune is a namespaced resource. -// NamespaceScoped implements resource.Object. -func (Module) NamespaceScoped() bool { - return true -} - -// New implements resource.Object -func (Module) New() runtime.Object { - return &Module{} -} - -// NewList implements resource.Object -func (Module) NewList() runtime.Object { - return &ModuleList{} -} - -func (r *Module) NewObjList() backend.GenericObjectList { - return &ModuleList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: ModuleKindList}, - } -} - -func (r *Module) SchemaGroupVersionKind() schema.GroupVersionKind { - return SchemeGroupVersion.WithKind(ModuleKind) -} - -// GetCondition returns the condition based on the condition kind -func (r *Module) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { - return r.Status.GetCondition(t) -} - -// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions -// to be set at once -func (r *Module) SetConditions(c ...conditionv1alpha1.Condition) { - r.Status.SetConditions(c...) -} - -// ModuleConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for Module -func ModuleConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { - switch label { - case "metadata.name": - return label, value, nil - case "metadata.namespace": - return label, value, nil - default: - return "", "", fmt.Errorf("%q is not a known field selector", label) - } -} - -func (r *ModuleList) GetItems() []backend.Object { - objs := []backend.Object{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *ModuleList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *Module) CalculateHash() ([sha1.Size]byte, error) { - // Convert the struct to JSON - jsonData, err := json.Marshal(r) - if err != nil { - return [sha1.Size]byte{}, err - } - - // Calculate SHA-1 hash - return sha1.Sum(jsonData), nil -} - -func (r *Module) GetNamespacedName() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.GetNamespace(), - Name: r.GetName(), - } -} - -func (r *Module) GetKey() store.Key { - return store.KeyFromNSN(r.GetNamespacedName()) -} - -func (r *Module) GetOwnerReference() *commonv1alpha1.OwnerReference { - return &commonv1alpha1.OwnerReference{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Kind: ModuleKind, - Namespace: r.Namespace, - Name: r.Name, - } -} - -func (r *Module) ValidateSyntax(_ string) field.ErrorList { - var allErrs field.ErrorList - - /* - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.type"), - r, - fmt.Errorf("invalid GENID Type %s", r.Spec.Type).Error(), - )) - } - */ - return allErrs -} - -func (r *Module) GetSpec() any { - return r.Spec -} - -func (r *Module) SetSpec(s any) { - if spec, ok := s.(ModuleSpec); ok { - r.Spec = spec - } -} - -// BuildModule returns a reource from a client Object a Spec/Status -func BuildModule(meta metav1.ObjectMeta, spec *ModuleSpec, status *ModuleStatus) *Module { - aspec := ModuleSpec{} - if spec != nil { - aspec = *spec - } - astatus := ModuleStatus{} - if status != nil { - astatus = *status - } - return &Module{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: ModuleKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -func ModuleTableConvertor(gr schema.GroupResource) registry.TableConvertor { - return registry.TableConvertor{ - Resource: gr, - Cells: func(obj runtime.Object) []interface{} { - r, ok := obj.(*Module) - if !ok { - return nil - } - return []interface{}{ - r.GetName(), - r.GetCondition(conditionv1alpha1.ConditionTypeReady).Status, - } - }, - Columns: []metav1.TableColumnDefinition{ - {Name: "Name", Type: "string"}, - {Name: "Ready", Type: "string"}, - }, - } -} - -func ModuleParseFieldSelector(ctx context.Context, fieldSelector fields.Selector) (backend.Filter, error) { - var filter *ModuleFilter - - // add the namespace to the list - namespace, ok := genericapirequest.NamespaceFrom(ctx) - if fieldSelector == nil { - if ok { - return &ModuleFilter{Namespace: namespace}, nil - } - return filter, nil - } - requirements := fieldSelector.Requirements() - for _, requirement := range requirements { - filter = &ModuleFilter{} - switch requirement.Operator { - case selection.Equals, selection.DoesNotExist: - if requirement.Value == "" { - return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) - } - default: - return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) - } - - switch requirement.Field { - case "metadata.name": - filter.Name = requirement.Value - case "metadata.namespace": - filter.Namespace = requirement.Value - default: - return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) - } - } - // add namespace to the filter selector if specified - if ok { - if filter != nil { - filter.Namespace = namespace - } else { - filter = &ModuleFilter{Namespace: namespace} - } - } - - return &ModuleFilter{}, nil -} - -type ModuleFilter struct { - // Name filters by the name of the objects - Name string `protobuf:"bytes,1,opt,name=name"` - - // Namespace filters by the namespace of the objects - Namespace string `protobuf:"bytes,2,opt,name=namespace"` -} - -func (r *ModuleFilter) Filter(ctx context.Context, obj runtime.Object) bool { - f := false // result of the previous filter - o, ok := obj.(*Module) - if !ok { - return f - } - if r.Name != "" { - if o.GetName() == r.Name { - f = false - } else { - f = true - } - } - if r.Namespace != "" { - if o.GetNamespace() == r.Namespace { - f = false - } else { - f = true - } - } - return f -} - -func (r *Module) GetUserDefinedLabels() map[string]string { - return r.Spec.GetUserDefinedLabels() -} - -func (r *Module) GetProvider() string { - return "" -} diff --git a/apis/backend/infra/v1alpha1/module_types.go b/apis/backend/infra/v1alpha1/module_types.go deleted file mode 100644 index 328bb72..0000000 --- a/apis/backend/infra/v1alpha1/module_types.go +++ /dev/null @@ -1,71 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "reflect" - - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// ModuleSpec defines the desired state of Module -type ModuleSpec struct { - // NodeID identifies the node identity this resource belongs to - NodeID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"` - // ModuelBay defines the bay in which the module is deployed - ModuleBay string `json:"moduleBay" yaml:"moduleBay" protobuf:"bytes,2,opt,name=moduleBay"` - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` -} - -// ModuleStatus defines the observed state of Module -type ModuleStatus struct { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// A module refers to a hardware component or expansion module that can be installed within a ModuleBay of a Node. -// Modules provide additional functionality and capabilities to the infrastructure environment, -// allowing users to enhance and customize their deployments according to specific requirements. -// +k8s:openapi-gen=true -type Module struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - Spec ModuleSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - Status ModuleStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// ModuleList contains a list of Modules -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type ModuleList struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []Module `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` -} - -var ( - ModuleKind = reflect.TypeOf(Module{}).Name() - ModuleKindList = reflect.TypeOf(ModuleList{}).Name() -) diff --git a/apis/backend/infra/v1alpha1/modulebay_interface.go b/apis/backend/infra/v1alpha1/modulebay_interface.go deleted file mode 100644 index 6f25516..0000000 --- a/apis/backend/infra/v1alpha1/modulebay_interface.go +++ /dev/null @@ -1,325 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "crypto/sha1" - "encoding/json" - "fmt" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/apiserver-store/pkg/generic/registry" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - apierrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/fields" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/selection" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" - genericapirequest "k8s.io/apiserver/pkg/endpoints/request" -) - -const ModuleBayPlural = "modulebays" -const ModuleBaySingular = "modulebay" - -// +k8s:deepcopy-gen=false -var _ resource.Object = &ModuleBay{} -var _ resource.ObjectList = &ModuleBayList{} -var _ backend.ObjectList = &ModuleBayList{} -var _ backend.GenericObject = &ModuleBay{} -var _ backend.GenericObjectList = &ModuleBayList{} - -// GetListMeta returns the ListMeta -func (r *ModuleBayList) GetListMeta() *metav1.ListMeta { - return &r.ListMeta -} - -func (r *ModuleBay) GetSingularName() string { - return ModuleBaySingular -} - -func (ModuleBay) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Resource: ModuleBayPlural, - } -} - -// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. -// IsStorageVersion implements resource.Object. -func (ModuleBay) IsStorageVersion() bool { - return true -} - -// GetObjectMeta implements resource.Object -func (r *ModuleBay) GetObjectMeta() *metav1.ObjectMeta { - return &r.ObjectMeta -} - -// NamespaceScoped returns true to indicate Fortune is a namespaced resource. -// NamespaceScoped implements resource.Object. -func (ModuleBay) NamespaceScoped() bool { - return true -} - -// New implements resource.Object -func (ModuleBay) New() runtime.Object { - return &ModuleBay{} -} - -// NewList implements resource.Object -func (ModuleBay) NewList() runtime.Object { - return &ModuleBayList{} -} - -func (r *ModuleBay) NewObjList() backend.GenericObjectList { - return &ModuleBayList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: ModuleBayKindList}, - } -} - -func (r *ModuleBay) SchemaGroupVersionKind() schema.GroupVersionKind { - return SchemeGroupVersion.WithKind(ModuleBayKind) -} - -// GetCondition returns the condition based on the condition kind -func (r *ModuleBay) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { - return r.Status.GetCondition(t) -} - -// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions -// to be set at once -func (r *ModuleBay) SetConditions(c ...conditionv1alpha1.Condition) { - r.Status.SetConditions(c...) -} - -// ModuleBayConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for ModuleBay -func ModuleBayConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { - switch label { - case "metadata.name": - return label, value, nil - case "metadata.namespace": - return label, value, nil - default: - return "", "", fmt.Errorf("%q is not a known field selector", label) - } -} - -func (r *ModuleBayList) GetItems() []backend.Object { - objs := []backend.Object{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *ModuleBayList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *ModuleBay) CalculateHash() ([sha1.Size]byte, error) { - // Convert the struct to JSON - jsonData, err := json.Marshal(r) - if err != nil { - return [sha1.Size]byte{}, err - } - - // Calculate SHA-1 hash - return sha1.Sum(jsonData), nil -} - -func (r *ModuleBay) GetNamespacedName() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.GetNamespace(), - Name: r.GetName(), - } -} - -func (r *ModuleBay) GetKey() store.Key { - return store.KeyFromNSN(r.GetNamespacedName()) -} - -func (r *ModuleBay) GetOwnerReference() *commonv1alpha1.OwnerReference { - return &commonv1alpha1.OwnerReference{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Kind: ModuleBayKind, - Namespace: r.Namespace, - Name: r.Name, - } -} - -func (r *ModuleBay) ValidateSyntax(_ string) field.ErrorList { - var allErrs field.ErrorList - - /* - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.type"), - r, - fmt.Errorf("invalid GENID Type %s", r.Spec.Type).Error(), - )) - } - */ - return allErrs -} - -func (r *ModuleBay) GetSpec() any { - return r.Spec -} - -func (r *ModuleBay) SetSpec(s any) { - if spec, ok := s.(ModuleBaySpec); ok { - r.Spec = spec - } -} - -// BuildModuleBay returns a reource from a client Object a Spec/Status -func BuildModuleBay(meta metav1.ObjectMeta, spec *ModuleBaySpec, status *ModuleBayStatus) *ModuleBay { - aspec := ModuleBaySpec{} - if spec != nil { - aspec = *spec - } - astatus := ModuleBayStatus{} - if status != nil { - astatus = *status - } - return &ModuleBay{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: ModuleBayKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -func ModuleBayTableConvertor(gr schema.GroupResource) registry.TableConvertor { - return registry.TableConvertor{ - Resource: gr, - Cells: func(obj runtime.Object) []interface{} { - r, ok := obj.(*ModuleBay) - if !ok { - return nil - } - return []interface{}{ - r.GetName(), - r.GetCondition(conditionv1alpha1.ConditionTypeReady).Status, - } - }, - Columns: []metav1.TableColumnDefinition{ - {Name: "Name", Type: "string"}, - {Name: "Ready", Type: "string"}, - }, - } -} - -func ModuleBayParseFieldSelector(ctx context.Context, fieldSelector fields.Selector) (backend.Filter, error) { - var filter *ModuleBayFilter - - // add the namespace to the list - namespace, ok := genericapirequest.NamespaceFrom(ctx) - if fieldSelector == nil { - if ok { - return &ModuleBayFilter{Namespace: namespace}, nil - } - return filter, nil - } - requirements := fieldSelector.Requirements() - for _, requirement := range requirements { - filter = &ModuleBayFilter{} - switch requirement.Operator { - case selection.Equals, selection.DoesNotExist: - if requirement.Value == "" { - return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) - } - default: - return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) - } - - switch requirement.Field { - case "metadata.name": - filter.Name = requirement.Value - case "metadata.namespace": - filter.Namespace = requirement.Value - default: - return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) - } - } - // add namespace to the filter selector if specified - if ok { - if filter != nil { - filter.Namespace = namespace - } else { - filter = &ModuleBayFilter{Namespace: namespace} - } - } - - return &ModuleBayFilter{}, nil -} - -type ModuleBayFilter struct { - // Name filters by the name of the objects - Name string `protobuf:"bytes,1,opt,name=name"` - - // Namespace filters by the namespace of the objects - Namespace string `protobuf:"bytes,2,opt,name=namespace"` -} - -func (r *ModuleBayFilter) Filter(ctx context.Context, obj runtime.Object) bool { - f := false // result of the previous filter - o, ok := obj.(*ModuleBay) - if !ok { - return f - } - if r.Name != "" { - if o.GetName() == r.Name { - f = false - } else { - f = true - } - } - if r.Namespace != "" { - if o.GetNamespace() == r.Namespace { - f = false - } else { - f = true - } - } - return f -} - -func (r *ModuleBay) GetUserDefinedLabels() map[string]string { - return r.Spec.GetUserDefinedLabels() -} - -func (r *ModuleBay) GetProvider() string { - return "" -} diff --git a/apis/backend/infra/v1alpha1/modulebay_types.go b/apis/backend/infra/v1alpha1/modulebay_types.go deleted file mode 100644 index bf1facf..0000000 --- a/apis/backend/infra/v1alpha1/modulebay_types.go +++ /dev/null @@ -1,71 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "reflect" - - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// ModuleBaySpec defines the desired state of ModuleBay -type ModuleBaySpec struct { - // NodeID identifies the node identity this resource belongs to - NodeID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"` - // Position defines the position in the node the moduleBay is deployed - Position string `json:"psoition" yaml:"psoition" protobuf:"bytes,2,opt,name=psoition"` - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` -} - -// ModuleBayStatus defines the observed state of ModuleBay -type ModuleBayStatus struct { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// A ModuleBay serves as a modular slot or enclosure within a Node, designed to accommodate additional modules. -// ModuleBays provide a flexible and scalable approach to extending the capabilities of Nodes, -// allowing users to customize and enhance their infrastructure deployments according to specific requirements. -// +k8s:openapi-gen=true -type ModuleBay struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - Spec ModuleBaySpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - Status ModuleBayStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// ModuleBayList contains a list of ModuleBays -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type ModuleBayList struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []ModuleBay `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` -} - -var ( - ModuleBayKind = reflect.TypeOf(ModuleBay{}).Name() - ModuleBayKindList = reflect.TypeOf(ModuleBayList{}).Name() -) diff --git a/apis/backend/infra/v1alpha1/node_interface.go b/apis/backend/infra/v1alpha1/node_interface.go deleted file mode 100644 index 1456170..0000000 --- a/apis/backend/infra/v1alpha1/node_interface.go +++ /dev/null @@ -1,354 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "crypto/sha1" - "encoding/json" - "fmt" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/apiserver-store/pkg/generic/registry" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - apierrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/fields" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/selection" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" - genericapirequest "k8s.io/apiserver/pkg/endpoints/request" -) - -const NodePlural = "nodes" -const NodeSingular = "node" - -// +k8s:deepcopy-gen=false -var _ resource.Object = &Node{} -var _ resource.ObjectList = &NodeList{} -var _ backend.ObjectList = &NodeList{} -var _ backend.GenericObject = &Node{} -var _ backend.GenericObjectList = &NodeList{} - -// GetListMeta returns the ListMeta -func (r *NodeList) GetListMeta() *metav1.ListMeta { - return &r.ListMeta -} - -func (r *Node) GetSingularName() string { - return NodeSingular -} - -func (Node) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Resource: NodePlural, - } -} - -// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. -// IsStorageVersion implements resource.Object. -func (Node) IsStorageVersion() bool { - return true -} - -// GetObjectMeta implements resource.Object -func (r *Node) GetObjectMeta() *metav1.ObjectMeta { - return &r.ObjectMeta -} - -// NamespaceScoped returns true to indicate Fortune is a namespaced resource. -// NamespaceScoped implements resource.Object. -func (Node) NamespaceScoped() bool { - return true -} - -// New implements resource.Object -func (Node) New() runtime.Object { - return &Node{} -} - -// NewList implements resource.Object -func (Node) NewList() runtime.Object { - return &NodeList{} -} - -func (r *Node) NewObjList() backend.GenericObjectList { - return &NodeList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: NodeKindList}, - } -} - -func (r *Node) SchemaGroupVersionKind() schema.GroupVersionKind { - return SchemeGroupVersion.WithKind(NodeKind) -} - -// GetCondition returns the condition based on the condition kind -func (r *Node) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { - return r.Status.GetCondition(t) -} - -// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions -// to be set at once -func (r *Node) SetConditions(c ...conditionv1alpha1.Condition) { - r.Status.SetConditions(c...) -} - -// NodeConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for Node -func NodeConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { - switch label { - case "metadata.name": - return label, value, nil - case "metadata.namespace": - return label, value, nil - default: - return "", "", fmt.Errorf("%q is not a known field selector", label) - } -} - -func (r *NodeList) GetItems() []backend.Object { - objs := []backend.Object{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *NodeList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *Node) CalculateHash() ([sha1.Size]byte, error) { - // Convert the struct to JSON - jsonData, err := json.Marshal(r) - if err != nil { - return [sha1.Size]byte{}, err - } - - // Calculate SHA-1 hash - return sha1.Sum(jsonData), nil -} - -func (r *Node) GetNamespacedName() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.GetNamespace(), - Name: r.GetName(), - } -} - -func (r *Node) GetKey() store.Key { - return store.KeyFromNSN(r.GetNamespacedName()) -} - -func (r *Node) GetRegion() string { - return r.Spec.Region -} - -func (r *Node) GetSite() string { - return r.Spec.Site -} - -func (r *Node) GetNodeGroupNodeID() NodeGroupNodeID { - return r.Spec.NodeGroupNodeID -} - -func (r *Node) GetNodeID() NodeID { - return r.Spec.NodeID -} - -func (r *Node) GetOwnerReference() *commonv1alpha1.OwnerReference { - return &commonv1alpha1.OwnerReference{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Kind: NodeKind, - Namespace: r.Namespace, - Name: r.Name, - } -} - -func (r *Node) ValidateSyntax(_ string) field.ErrorList { - var allErrs field.ErrorList - - /* - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.type"), - r, - fmt.Errorf("invalid GENID Type %s", r.Spec.Type).Error(), - )) - } - */ - return allErrs -} - -func (r *Node) GetSpec() any { - return r.Spec -} - -func (r *Node) SetSpec(s any) { - if spec, ok := s.(NodeSpec); ok { - r.Spec = spec - } -} - -// BuildNode returns a reource from a client Object a Spec/Status -func BuildNode(meta metav1.ObjectMeta, spec *NodeSpec, status *NodeStatus) *Node { - aspec := NodeSpec{} - if spec != nil { - aspec = *spec - } - astatus := NodeStatus{} - if status != nil { - astatus = *status - } - return &Node{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: NodeKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -func NodeTableConvertor(gr schema.GroupResource) registry.TableConvertor { - return registry.TableConvertor{ - Resource: gr, - Cells: func(obj runtime.Object) []interface{} { - r, ok := obj.(*Node) - if !ok { - return nil - } - return []interface{}{ - r.GetName(), - r.GetCondition(conditionv1alpha1.ConditionTypeReady).Status, - r.Spec.SiteID.Region, - r.Spec.SiteID.Site, - r.Spec.NodeGroup, - r.Spec.Provider, - } - }, - Columns: []metav1.TableColumnDefinition{ - {Name: "Name", Type: "string"}, - {Name: "Ready", Type: "string"}, - {Name: "Region", Type: "string"}, - {Name: "Site", Type: "string"}, - {Name: "Topology", Type: "string"}, - {Name: "Provider", Type: "string"}, - }, - } -} - -func NodeParseFieldSelector(ctx context.Context, fieldSelector fields.Selector) (backend.Filter, error) { - var filter *NodeFilter - - fmt.Println("fieldSelector", fieldSelector) - - // add the namespace to the list - namespace, ok := genericapirequest.NamespaceFrom(ctx) - if fieldSelector == nil { - if ok { - return &NodeFilter{Namespace: namespace}, nil - } - return filter, nil - } - requirements := fieldSelector.Requirements() - for _, requirement := range requirements { - filter = &NodeFilter{} - switch requirement.Operator { - case selection.Equals, selection.DoesNotExist: - if requirement.Value == "" { - return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) - } - default: - return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) - } - - fmt.Println("fieldSelector", requirement.Field) - fmt.Println("fieldSelector", requirement.Value) - - switch requirement.Field { - case "metadata.name": - filter.Name = requirement.Value - case "metadata.namespace": - filter.Namespace = requirement.Value - default: - return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) - } - } - // add namespace to the filter selector if specified - if ok { - if filter != nil { - filter.Namespace = namespace - } else { - filter = &NodeFilter{Namespace: namespace} - } - } - - return &NodeFilter{}, nil -} - -type NodeFilter struct { - // Name filters by the name of the objects - Name string `protobuf:"bytes,1,opt,name=name"` - - // Namespace filters by the namespace of the objects - Namespace string `protobuf:"bytes,2,opt,name=namespace"` -} - -func (r *NodeFilter) Filter(ctx context.Context, obj runtime.Object) bool { - f := false // result of the previous filter - o, ok := obj.(*Node) - if !ok { - return f - } - if r.Name != "" { - if o.GetName() == r.Name { - f = false - } else { - f = true - } - } - if r.Namespace != "" { - if o.GetNamespace() == r.Namespace { - f = false - } else { - f = true - } - } - return f -} - -func (r *Node) GetUserDefinedLabels() map[string]string { - return r.Spec.GetUserDefinedLabels() -} - -func (r *Node) GetProvider() string { - return r.Spec.Provider -} diff --git a/apis/backend/infra/v1alpha1/node_types.go b/apis/backend/infra/v1alpha1/node_types.go deleted file mode 100644 index 4a720f4..0000000 --- a/apis/backend/infra/v1alpha1/node_types.go +++ /dev/null @@ -1,95 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "reflect" - - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// NodeSpec defines the desired state of Node -type NodeSpec struct { - // NodeGroupNodeID identifies the nodeGroup identity this resource belongs to - NodeGroupNodeID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeGroupID"` - // Rack defines the rack in which the node is deployed - // +optional - Rack *string `json:"rack,omitempty" yaml:"rack,omitempty" protobuf:"bytes,2,opt,name=rack"` - // relative position in the rack - // +optional - Position *string `json:"position,omitempty" yaml:"position,omitempty" protobuf:"bytes,3,opt,name=position"` - // Location defines the location information where this resource is located - // in lon/lat coordinates - // +optional - Location *Location `json:"location,omitempty" yaml:"location,omitempty" protobuf:"bytes,4,opt,name=location"` - // Provider defines the provider implementing this resource. - Provider string `json:"provider" yaml:"provider" protobuf:"bytes,5,opt,name=provider"` - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,6,opt,name=userDefinedLabels"` - - // TBD - // Serial number - // Node config - // Initial config - // IPAddress: IPv4 or IPv6 - // OOB IPAddress -} - -// NodeStatus defines the observed state of Node -type NodeStatus struct { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` - // System ID define the unique system id of the node - // +optional - SystemID *string `json:"systemID,omitempty" yaml:"systemID,omitempty" protobuf:"bytes,2,opt,name=systemID"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// A Node represents a fundamental unit that implements compute, storage, and/or networking within your environment. -// Nodes can embody physical, virtual, or containerized entities, offering versatility in deployment options to suit -// diverse infrastructure requirements. -// Nodes are logically organized within racks and sites/regions, establishing a hierarchical structure for efficient -// resource management and organization. Additionally, Nodes are associated with nodeGroups, facilitating centralized -// management and control within defined administrative boundaries. -// Each Node is assigned a provider, representing the entity responsible for implementing the specifics of the Node. -// +k8s:openapi-gen=true -type Node struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - Spec NodeSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - Status NodeStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// NodeList contains a list of Nodes -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type NodeList struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []Node `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` -} - -var ( - NodeKind = reflect.TypeOf(Node{}).Name() - NodeKindList = reflect.TypeOf(NodeList{}).Name() -) diff --git a/apis/backend/infra/v1alpha1/nodegroup_interface.go b/apis/backend/infra/v1alpha1/nodegroup_interface.go deleted file mode 100644 index 4643e30..0000000 --- a/apis/backend/infra/v1alpha1/nodegroup_interface.go +++ /dev/null @@ -1,325 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "crypto/sha1" - "encoding/json" - "fmt" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/apiserver-store/pkg/generic/registry" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - apierrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/fields" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/selection" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" - genericapirequest "k8s.io/apiserver/pkg/endpoints/request" -) - -const NodeGroupPlural = "nodegroups" -const NodeGroupSingular = "nodegroup" - -// +k8s:deepcopy-gen=false -var _ resource.Object = &NodeGroup{} -var _ resource.ObjectList = &NodeGroupList{} -var _ backend.ObjectList = &NodeGroupList{} -var _ backend.GenericObject = &NodeGroup{} -var _ backend.GenericObjectList = &NodeGroupList{} - -// GetListMeta returns the ListMeta -func (r *NodeGroupList) GetListMeta() *metav1.ListMeta { - return &r.ListMeta -} - -func (r *NodeGroup) GetSingularName() string { - return NodeGroupSingular -} - -func (NodeGroup) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Resource: NodeGroupPlural, - } -} - -// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. -// IsStorageVersion implements resource.Object. -func (NodeGroup) IsStorageVersion() bool { - return true -} - -// GetObjectMeta implements resource.Object -func (r *NodeGroup) GetObjectMeta() *metav1.ObjectMeta { - return &r.ObjectMeta -} - -// NamespaceScoped returns true to indicate Fortune is a namespaced resource. -// NamespaceScoped implements resource.Object. -func (NodeGroup) NamespaceScoped() bool { - return true -} - -// New implements resource.Object -func (NodeGroup) New() runtime.Object { - return &NodeGroup{} -} - -// NewList implements resource.Object -func (NodeGroup) NewList() runtime.Object { - return &NodeGroupList{} -} - -func (r *NodeGroup) NewObjList() backend.GenericObjectList { - return &NodeGroupList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: NodeGroupKindList}, - } -} - -func (r *NodeGroup) SchemaGroupVersionKind() schema.GroupVersionKind { - return SchemeGroupVersion.WithKind(NodeGroupKind) -} - -// GetCondition returns the condition based on the condition kind -func (r *NodeGroup) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { - return r.Status.GetCondition(t) -} - -// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions -// to be set at once -func (r *NodeGroup) SetConditions(c ...conditionv1alpha1.Condition) { - r.Status.SetConditions(c...) -} - -// NodeGroupConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for NodeGroup -func NodeGroupConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { - switch label { - case "metadata.name": - return label, value, nil - case "metadata.namespace": - return label, value, nil - default: - return "", "", fmt.Errorf("%q is not a known field selector", label) - } -} - -func (r *NodeGroupList) GetItems() []backend.Object { - objs := []backend.Object{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *NodeGroupList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *NodeGroup) CalculateHash() ([sha1.Size]byte, error) { - // Convert the struct to JSON - jsonData, err := json.Marshal(r) - if err != nil { - return [sha1.Size]byte{}, err - } - - // Calculate SHA-1 hash - return sha1.Sum(jsonData), nil -} - -func (r *NodeGroup) GetNamespacedName() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.GetNamespace(), - Name: r.GetName(), - } -} - -func (r *NodeGroup) GetKey() store.Key { - return store.KeyFromNSN(r.GetNamespacedName()) -} - -func (r *NodeGroup) GetOwnerReference() *commonv1alpha1.OwnerReference { - return &commonv1alpha1.OwnerReference{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Kind: NodeGroupKind, - Namespace: r.Namespace, - Name: r.Name, - } -} - -func (r *NodeGroup) ValidateSyntax(_ string) field.ErrorList { - var allErrs field.ErrorList - - /* - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.type"), - r, - fmt.Errorf("invalid GENID Type %s", r.Spec.Type).Error(), - )) - } - */ - return allErrs -} - -func (r *NodeGroup) GetSpec() any { - return r.Spec -} - -func (r *NodeGroup) SetSpec(s any) { - if spec, ok := s.(NodeGroupSpec); ok { - r.Spec = spec - } -} - -// BuildNodeGroup returns a reource from a client Object a Spec/Status -func BuildNodeGroup(meta metav1.ObjectMeta, spec *NodeGroupSpec, status *NodeGroupStatus) *NodeGroup { - aspec := NodeGroupSpec{} - if spec != nil { - aspec = *spec - } - astatus := NodeGroupStatus{} - if status != nil { - astatus = *status - } - return &NodeGroup{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: NodeGroupKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -func NodeGroupTableConvertor(gr schema.GroupResource) registry.TableConvertor { - return registry.TableConvertor{ - Resource: gr, - Cells: func(obj runtime.Object) []interface{} { - r, ok := obj.(*NodeGroup) - if !ok { - return nil - } - return []interface{}{ - r.GetName(), - r.GetCondition(conditionv1alpha1.ConditionTypeReady).Status, - } - }, - Columns: []metav1.TableColumnDefinition{ - {Name: "Name", Type: "string"}, - {Name: "Ready", Type: "string"}, - }, - } -} - -func NodeGroupParseFieldSelector(ctx context.Context, fieldSelector fields.Selector) (backend.Filter, error) { - var filter *NodeGroupFilter - - // add the namespace to the list - namespace, ok := genericapirequest.NamespaceFrom(ctx) - if fieldSelector == nil { - if ok { - return &NodeGroupFilter{Namespace: namespace}, nil - } - return filter, nil - } - requirements := fieldSelector.Requirements() - for _, requirement := range requirements { - filter = &NodeGroupFilter{} - switch requirement.Operator { - case selection.Equals, selection.DoesNotExist: - if requirement.Value == "" { - return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) - } - default: - return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) - } - - switch requirement.Field { - case "metadata.name": - filter.Name = requirement.Value - case "metadata.namespace": - filter.Namespace = requirement.Value - default: - return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) - } - } - // add namespace to the filter selector if specified - if ok { - if filter != nil { - filter.Namespace = namespace - } else { - filter = &NodeGroupFilter{Namespace: namespace} - } - } - - return &NodeGroupFilter{}, nil -} - -type NodeGroupFilter struct { - // Name filters by the name of the objects - Name string `protobuf:"bytes,1,opt,name=name"` - - // Namespace filters by the namespace of the objects - Namespace string `protobuf:"bytes,2,opt,name=namespace"` -} - -func (r *NodeGroupFilter) Filter(ctx context.Context, obj runtime.Object) bool { - f := false // result of the previous filter - o, ok := obj.(*NodeGroup) - if !ok { - return f - } - if r.Name != "" { - if o.GetName() == r.Name { - f = false - } else { - f = true - } - } - if r.Namespace != "" { - if o.GetNamespace() == r.Namespace { - f = false - } else { - f = true - } - } - return f -} - -func (r *NodeGroup) GetUserDefinedLabels() map[string]string { - return r.Spec.GetUserDefinedLabels() -} - -func (r *NodeGroup) GetProvider() string { - return "" -} diff --git a/apis/backend/infra/v1alpha1/nodegroup_types.go b/apis/backend/infra/v1alpha1/nodegroup_types.go deleted file mode 100644 index 5b4c54a..0000000 --- a/apis/backend/infra/v1alpha1/nodegroup_types.go +++ /dev/null @@ -1,73 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "reflect" - - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// NodeGroupSpec defines the desired state of NodeGroup -// E.g. A nodeGroup can be a NodeGroup -// E.g. A nodeGroup can be a topology like a DC fabric (frontend and backend could be a different nodeGroup) -// A Node Group is a global unique identifier within the system e.g. representing a topology, a NodeGroup or -// another set of elements that are managed together by a single entity -type NodeGroupSpec struct { - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=userDefinedLabels"` -} - -// NodeGroupStatus defines the observed state of NodeGroup -type NodeGroupStatus struct { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// A NodeGrouo represents a logical grouping of infrastructure resources managed by a single -// administrative entity or organization. NodeGroups serve as administrative boundaries within the environment, -// providing a structured framework for organizing and managing resources based on administrative ownership -// or responsibility. E.g. A NodeGroup on one hand, can be used to represent a topology that spans multiple -// sites and regions, but a NodeGroup can also be used to group all nodes of a NodeGroup together. -// +k8s:openapi-gen=true -type NodeGroup struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - Spec NodeGroupSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - Status NodeGroupStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// NodeGroupList contains a list of NodeGroups -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type NodeGroupList struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []NodeGroup `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` -} - -var ( - NodeGroupKind = reflect.TypeOf(NodeGroup{}).Name() - NodeGroupKindList = reflect.TypeOf(NodeGroupList{}).Name() -) diff --git a/apis/backend/infra/v1alpha1/nodeitem_interface.go b/apis/backend/infra/v1alpha1/nodeitem_interface.go deleted file mode 100644 index 907290f..0000000 --- a/apis/backend/infra/v1alpha1/nodeitem_interface.go +++ /dev/null @@ -1,325 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "crypto/sha1" - "encoding/json" - "fmt" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/apiserver-store/pkg/generic/registry" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - apierrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/fields" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/selection" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" - genericapirequest "k8s.io/apiserver/pkg/endpoints/request" -) - -const NodeItemPlural = "nodeitems" -const NodeItemSingular = "nodeitem" - -// +k8s:deepcopy-gen=false -var _ resource.Object = &NodeItem{} -var _ resource.ObjectList = &NodeItemList{} -var _ backend.ObjectList = &NodeItemList{} -var _ backend.GenericObject = &NodeItem{} -var _ backend.GenericObjectList = &NodeItemList{} - -// GetListMeta returns the ListMeta -func (r *NodeItemList) GetListMeta() *metav1.ListMeta { - return &r.ListMeta -} - -func (r *NodeItem) GetSingularName() string { - return NodeItemSingular -} - -func (NodeItem) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Resource: NodeItemPlural, - } -} - -// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. -// IsStorageVersion implements resource.Object. -func (NodeItem) IsStorageVersion() bool { - return true -} - -// GetObjectMeta implements resource.Object -func (r *NodeItem) GetObjectMeta() *metav1.ObjectMeta { - return &r.ObjectMeta -} - -// NamespaceScoped returns true to indicate Fortune is a namespaced resource. -// NamespaceScoped implements resource.Object. -func (NodeItem) NamespaceScoped() bool { - return true -} - -// New implements resource.Object -func (NodeItem) New() runtime.Object { - return &NodeItem{} -} - -// NewList implements resource.Object -func (NodeItem) NewList() runtime.Object { - return &NodeItemList{} -} - -func (r *NodeItem) NewObjList() backend.GenericObjectList { - return &NodeItemList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: NodeItemKindList}, - } -} - -func (r *NodeItem) SchemaGroupVersionKind() schema.GroupVersionKind { - return SchemeGroupVersion.WithKind(NodeItemKind) -} - -// GetCondition returns the condition based on the condition kind -func (r *NodeItem) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { - return r.Status.GetCondition(t) -} - -// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions -// to be set at once -func (r *NodeItem) SetConditions(c ...conditionv1alpha1.Condition) { - r.Status.SetConditions(c...) -} - -// NodeItemConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for NodeItem -func NodeItemConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { - switch label { - case "metadata.name": - return label, value, nil - case "metadata.namespace": - return label, value, nil - default: - return "", "", fmt.Errorf("%q is not a known field selector", label) - } -} - -func (r *NodeItemList) GetItems() []backend.Object { - objs := []backend.Object{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *NodeItemList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *NodeItem) CalculateHash() ([sha1.Size]byte, error) { - // Convert the struct to JSON - jsonData, err := json.Marshal(r) - if err != nil { - return [sha1.Size]byte{}, err - } - - // Calculate SHA-1 hash - return sha1.Sum(jsonData), nil -} - -func (r *NodeItem) GetNamespacedName() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.GetNamespace(), - Name: r.GetName(), - } -} - -func (r *NodeItem) GetKey() store.Key { - return store.KeyFromNSN(r.GetNamespacedName()) -} - -func (r *NodeItem) GetOwnerReference() *commonv1alpha1.OwnerReference { - return &commonv1alpha1.OwnerReference{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Kind: NodeItemKind, - Namespace: r.Namespace, - Name: r.Name, - } -} - -func (r *NodeItem) ValidateSyntax(_ string) field.ErrorList { - var allErrs field.ErrorList - - /* - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.type"), - r, - fmt.Errorf("invalid GENID Type %s", r.Spec.Type).Error(), - )) - } - */ - return allErrs -} - -func (r *NodeItem) GetSpec() any { - return r.Spec -} - -func (r *NodeItem) SetSpec(s any) { - if spec, ok := s.(NodeItemSpec); ok { - r.Spec = spec - } -} - -// BuildNodeItem returns a reource from a client Object a Spec/Status -func BuildNodeItem(meta metav1.ObjectMeta, spec *NodeItemSpec, status *NodeItemStatus) *NodeItem { - aspec := NodeItemSpec{} - if spec != nil { - aspec = *spec - } - astatus := NodeItemStatus{} - if status != nil { - astatus = *status - } - return &NodeItem{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: NodeItemKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -func NodeItemTableConvertor(gr schema.GroupResource) registry.TableConvertor { - return registry.TableConvertor{ - Resource: gr, - Cells: func(obj runtime.Object) []interface{} { - r, ok := obj.(*NodeItem) - if !ok { - return nil - } - return []interface{}{ - r.GetName(), - r.GetCondition(conditionv1alpha1.ConditionTypeReady).Status, - } - }, - Columns: []metav1.TableColumnDefinition{ - {Name: "Name", Type: "string"}, - {Name: "Ready", Type: "string"}, - }, - } -} - -func NodeItemParseFieldSelector(ctx context.Context, fieldSelector fields.Selector) (backend.Filter, error) { - var filter *NodeItemFilter - - // add the namespace to the list - namespace, ok := genericapirequest.NamespaceFrom(ctx) - if fieldSelector == nil { - if ok { - return &NodeItemFilter{Namespace: namespace}, nil - } - return filter, nil - } - requirements := fieldSelector.Requirements() - for _, requirement := range requirements { - filter = &NodeItemFilter{} - switch requirement.Operator { - case selection.Equals, selection.DoesNotExist: - if requirement.Value == "" { - return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) - } - default: - return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) - } - - switch requirement.Field { - case "metadata.name": - filter.Name = requirement.Value - case "metadata.namespace": - filter.Namespace = requirement.Value - default: - return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) - } - } - // add namespace to the filter selector if specified - if ok { - if filter != nil { - filter.Namespace = namespace - } else { - filter = &NodeItemFilter{Namespace: namespace} - } - } - - return &NodeItemFilter{}, nil -} - -type NodeItemFilter struct { - // Name filters by the name of the objects - Name string `protobuf:"bytes,1,opt,name=name"` - - // Namespace filters by the namespace of the objects - Namespace string `protobuf:"bytes,2,opt,name=namespace"` -} - -func (r *NodeItemFilter) Filter(ctx context.Context, obj runtime.Object) bool { - f := false // result of the previous filter - o, ok := obj.(*NodeItem) - if !ok { - return f - } - if r.Name != "" { - if o.GetName() == r.Name { - f = false - } else { - f = true - } - } - if r.Namespace != "" { - if o.GetNamespace() == r.Namespace { - f = false - } else { - f = true - } - } - return f -} - -func (r *NodeItem) GetUserDefinedLabels() map[string]string { - return r.Spec.GetUserDefinedLabels() -} - -func (r *NodeItem) GetProvider() string { - return "" -} diff --git a/apis/backend/infra/v1alpha1/nodeitem_types.go b/apis/backend/infra/v1alpha1/nodeitem_types.go deleted file mode 100644 index 87aabd9..0000000 --- a/apis/backend/infra/v1alpha1/nodeitem_types.go +++ /dev/null @@ -1,70 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "reflect" - - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// NodeItemSpec defines the desired state of NodeItem -type NodeItemSpec struct { - // NodeID identifies the node identity this resource belongs to - NodeID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"` - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,2,opt,name=userDefinedLabels"` -} - -// NodeItemStatus defines the observed state of NodeItem -type NodeItemStatus struct { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// A NodeItem represents a specific hardware component or accessory associated with a Node. -// NodeItems represent a wide range of hardware elements, e.g Fan(s), PowerUnit(s), CPU(s), -// and other peripheral devices essential for the operation of the Node. -// NodeItem is used to represent the modular components of a node. -// +k8s:openapi-gen=true -type NodeItem struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - Spec NodeItemSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - Status NodeItemStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// NodeItemList contains a list of NodeItems -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type NodeItemList struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []NodeItem `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` -} - -var ( - NodeItemKind = reflect.TypeOf(NodeItem{}).Name() - NodeItemKindList = reflect.TypeOf(NodeItemList{}).Name() -) diff --git a/apis/backend/infra/v1alpha1/nodeset_interface.go b/apis/backend/infra/v1alpha1/nodeset_interface.go deleted file mode 100644 index 9d4f80f..0000000 --- a/apis/backend/infra/v1alpha1/nodeset_interface.go +++ /dev/null @@ -1,325 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "crypto/sha1" - "encoding/json" - "fmt" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/apiserver-store/pkg/generic/registry" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - apierrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/fields" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/selection" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" - genericapirequest "k8s.io/apiserver/pkg/endpoints/request" -) - -const NodeSetPlural = "nodesets" -const NodeSetSingular = "nodeset" - -// +k8s:deepcopy-gen=false -var _ resource.Object = &NodeSet{} -var _ resource.ObjectList = &NodeSetList{} -var _ backend.ObjectList = &NodeSetList{} -var _ backend.GenericObject = &NodeSet{} -var _ backend.GenericObjectList = &NodeSetList{} - -// GetListMeta returns the ListMeta -func (r *NodeSetList) GetListMeta() *metav1.ListMeta { - return &r.ListMeta -} - -func (r *NodeSet) GetSingularName() string { - return NodeSetSingular -} - -func (NodeSet) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Resource: NodeSetPlural, - } -} - -// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. -// IsStorageVersion implements resource.Object. -func (NodeSet) IsStorageVersion() bool { - return true -} - -// GetObjectMeta implements resource.Object -func (r *NodeSet) GetObjectMeta() *metav1.ObjectMeta { - return &r.ObjectMeta -} - -// NamespaceScoped returns true to indicate Fortune is a namespaced resource. -// NamespaceScoped implements resource.Object. -func (NodeSet) NamespaceScoped() bool { - return true -} - -// New implements resource.Object -func (NodeSet) New() runtime.Object { - return &NodeSet{} -} - -// NewList implements resource.Object -func (NodeSet) NewList() runtime.Object { - return &NodeSetList{} -} - -func (r *NodeSet) NewObjList() backend.GenericObjectList { - return &NodeSetList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: NodeSetKindList}, - } -} - -func (r *NodeSet) SchemaGroupVersionKind() schema.GroupVersionKind { - return SchemeGroupVersion.WithKind(NodeSetKind) -} - -// GetCondition returns the condition based on the condition kind -func (r *NodeSet) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { - return r.Status.GetCondition(t) -} - -// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions -// to be set at once -func (r *NodeSet) SetConditions(c ...conditionv1alpha1.Condition) { - r.Status.SetConditions(c...) -} - -// NodeSetConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for NodeSet -func NodeSetConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { - switch label { - case "metadata.name": - return label, value, nil - case "metadata.namespace": - return label, value, nil - default: - return "", "", fmt.Errorf("%q is not a known field selector", label) - } -} - -func (r *NodeSetList) GetItems() []backend.Object { - objs := []backend.Object{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *NodeSetList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *NodeSet) CalculateHash() ([sha1.Size]byte, error) { - // Convert the struct to JSON - jsonData, err := json.Marshal(r) - if err != nil { - return [sha1.Size]byte{}, err - } - - // Calculate SHA-1 hash - return sha1.Sum(jsonData), nil -} - -func (r *NodeSet) GetNamespacedName() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.GetNamespace(), - Name: r.GetName(), - } -} - -func (r *NodeSet) GetKey() store.Key { - return store.KeyFromNSN(r.GetNamespacedName()) -} - -func (r *NodeSet) GetOwnerReference() *commonv1alpha1.OwnerReference { - return &commonv1alpha1.OwnerReference{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Kind: NodeSetKind, - Namespace: r.Namespace, - Name: r.Name, - } -} - -func (r *NodeSet) ValidateSyntax(_ string) field.ErrorList { - var allErrs field.ErrorList - - /* - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.type"), - r, - fmt.Errorf("invalid GENID Type %s", r.Spec.Type).Error(), - )) - } - */ - return allErrs -} - -func (r *NodeSet) GetSpec() any { - return r.Spec -} - -func (r *NodeSet) SetSpec(s any) { - if spec, ok := s.(NodeSetSpec); ok { - r.Spec = spec - } -} - -// BuildNodeSet returns a reource from a client Object a Spec/Status -func BuildNodeSet(meta metav1.ObjectMeta, spec *NodeSetSpec, status *NodeSetStatus) *NodeSet { - aspec := NodeSetSpec{} - if spec != nil { - aspec = *spec - } - astatus := NodeSetStatus{} - if status != nil { - astatus = *status - } - return &NodeSet{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: NodeSetKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -func NodeSetTableConvertor(gr schema.GroupResource) registry.TableConvertor { - return registry.TableConvertor{ - Resource: gr, - Cells: func(obj runtime.Object) []interface{} { - r, ok := obj.(*NodeSet) - if !ok { - return nil - } - return []interface{}{ - r.GetName(), - r.GetCondition(conditionv1alpha1.ConditionTypeReady).Status, - } - }, - Columns: []metav1.TableColumnDefinition{ - {Name: "Name", Type: "string"}, - {Name: "Ready", Type: "string"}, - }, - } -} - -func NodeSetParseFieldSelector(ctx context.Context, fieldSelector fields.Selector) (backend.Filter, error) { - var filter *NodeSetFilter - - // add the namespace to the list - namespace, ok := genericapirequest.NamespaceFrom(ctx) - if fieldSelector == nil { - if ok { - return &NodeSetFilter{Namespace: namespace}, nil - } - return filter, nil - } - requirements := fieldSelector.Requirements() - for _, requirement := range requirements { - filter = &NodeSetFilter{} - switch requirement.Operator { - case selection.Equals, selection.DoesNotExist: - if requirement.Value == "" { - return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) - } - default: - return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) - } - - switch requirement.Field { - case "metadata.name": - filter.Name = requirement.Value - case "metadata.namespace": - filter.Namespace = requirement.Value - default: - return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) - } - } - // add namespace to the filter selector if specified - if ok { - if filter != nil { - filter.Namespace = namespace - } else { - filter = &NodeSetFilter{Namespace: namespace} - } - } - - return &NodeSetFilter{}, nil -} - -type NodeSetFilter struct { - // Name filters by the name of the objects - Name string `protobuf:"bytes,1,opt,name=name"` - - // Namespace filters by the namespace of the objects - Namespace string `protobuf:"bytes,2,opt,name=namespace"` -} - -func (r *NodeSetFilter) Filter(ctx context.Context, obj runtime.Object) bool { - f := false // result of the previous filter - o, ok := obj.(*NodeSet) - if !ok { - return f - } - if r.Name != "" { - if o.GetName() == r.Name { - f = false - } else { - f = true - } - } - if r.Namespace != "" { - if o.GetNamespace() == r.Namespace { - f = false - } else { - f = true - } - } - return f -} - -func (r *NodeSet) GetUserDefinedLabels() map[string]string { - return r.Spec.GetUserDefinedLabels() -} - -func (r *NodeSet) GetProvider() string { - return "" -} diff --git a/apis/backend/infra/v1alpha1/nodeset_types.go b/apis/backend/infra/v1alpha1/nodeset_types.go deleted file mode 100644 index 88b089b..0000000 --- a/apis/backend/infra/v1alpha1/nodeset_types.go +++ /dev/null @@ -1,72 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "reflect" - - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// NodeSetSetSpec defines the desired state of NodeSet -type NodeSetSpec struct { - // NodeGroupName identifies the nodeGroup this resource belongs to - // E.g. a NodeSet in a NodeSet belongs to a nodeGroup where the name of the nodeGroup is the NodeSet - // E.g. a Virtual Node, belongs to a nodeGroup where the name of the nodeGroup represents the topology this node is deployed in - NodeGroup string `json:"nodeGroup" yaml:"nodeGroup" protobuf:"bytes,1,opt,name=nodeGroup"` - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - commonv1alpha1.ClaimLabels `json:",inline" yaml:",inline" protobuf:"bytes,2,opt,name=userDefinedLabels"` -} - -// NodeSetStatus defines the observed state of NodeSet -type NodeSetStatus struct { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// A NodeSet represents a set of nodes. -// E.g. it can be used to model a set of nodes in a NodeSet that share the same -// charecteristics wrt, Numa, interfaces, etc. -// Another usage of NodeSet is the representation of a virtual Node that consists of multiple nodes. -// +k8s:openapi-gen=true -type NodeSet struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - Spec NodeSetSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - Status NodeSetStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// NodeSetList contains a list of NodeSets -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type NodeSetList struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []NodeSet `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` -} - -var ( - NodeSetKind = reflect.TypeOf(NodeSet{}).Name() - NodeSetKindList = reflect.TypeOf(NodeSetList{}).Name() -) diff --git a/apis/backend/infra/v1alpha1/objectreference.go b/apis/backend/infra/v1alpha1/objectreference.go deleted file mode 100644 index 2bd1da9..0000000 --- a/apis/backend/infra/v1alpha1/objectreference.go +++ /dev/null @@ -1,34 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -/* -type ObjectReference struct { - // APIVersion of the target resources - APIVersion string `yaml:"apiVersion,omitempty" json:"apiVersion,omitempty" protobuf:"bytes,1,opt,name=apiVersion"` - - // Kind of the target resources - Kind string `yaml:"kind,omitempty" json:"kind,omitempty" protobuf:"bytes,2,opt,name=kind"` - - // Name of the target resource - // +optional - Name *string `yaml:"name" json:"name" protobuf:"bytes,3,opt,name=name"` - - // Note: Namespace is not allowed; the namespace - // must match the namespace of the PackageVariantSet resource -} -*/ diff --git a/apis/backend/infra/v1alpha1/rack_interface.go b/apis/backend/infra/v1alpha1/rack_interface.go deleted file mode 100644 index decd30f..0000000 --- a/apis/backend/infra/v1alpha1/rack_interface.go +++ /dev/null @@ -1,325 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "crypto/sha1" - "encoding/json" - "fmt" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/apiserver-store/pkg/generic/registry" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - apierrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/fields" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/selection" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" - genericapirequest "k8s.io/apiserver/pkg/endpoints/request" -) - -const RackPlural = "racks" -const RackSingular = "rack" - -// +k8s:deepcopy-gen=false -var _ resource.Object = &Rack{} -var _ resource.ObjectList = &RackList{} -var _ backend.ObjectList = &RackList{} -var _ backend.GenericObject = &Rack{} -var _ backend.GenericObjectList = &RackList{} - -// GetListMeta returns the ListMeta -func (r *RackList) GetListMeta() *metav1.ListMeta { - return &r.ListMeta -} - -func (r *Rack) GetSingularName() string { - return RackSingular -} - -func (Rack) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Resource: RackPlural, - } -} - -// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. -// IsStorageVersion implements resource.Object. -func (Rack) IsStorageVersion() bool { - return true -} - -// GetObjectMeta implements resource.Object -func (r *Rack) GetObjectMeta() *metav1.ObjectMeta { - return &r.ObjectMeta -} - -// NamespaceScoped returns true to indicate Fortune is a namespaced resource. -// NamespaceScoped implements resource.Object. -func (Rack) NamespaceScoped() bool { - return true -} - -// New implements resource.Object -func (Rack) New() runtime.Object { - return &Rack{} -} - -// NewList implements resource.Object -func (Rack) NewList() runtime.Object { - return &RackList{} -} - -func (r *Rack) NewObjList() backend.GenericObjectList { - return &RackList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: RackKindList}, - } -} - -func (r *Rack) SchemaGroupVersionKind() schema.GroupVersionKind { - return SchemeGroupVersion.WithKind(RackKind) -} - -// GetCondition returns the condition based on the condition kind -func (r *Rack) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { - return r.Status.GetCondition(t) -} - -// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions -// to be set at once -func (r *Rack) SetConditions(c ...conditionv1alpha1.Condition) { - r.Status.SetConditions(c...) -} - -// RackConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for Rack -func RackConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { - switch label { - case "metadata.name": - return label, value, nil - case "metadata.namespace": - return label, value, nil - default: - return "", "", fmt.Errorf("%q is not a known field selector", label) - } -} - -func (r *RackList) GetItems() []backend.Object { - objs := []backend.Object{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *RackList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *Rack) CalculateHash() ([sha1.Size]byte, error) { - // Convert the struct to JSON - jsonData, err := json.Marshal(r) - if err != nil { - return [sha1.Size]byte{}, err - } - - // Calculate SHA-1 hash - return sha1.Sum(jsonData), nil -} - -func (r *Rack) GetNamespacedName() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.GetNamespace(), - Name: r.GetName(), - } -} - -func (r *Rack) GetKey() store.Key { - return store.KeyFromNSN(r.GetNamespacedName()) -} - -func (r *Rack) GetOwnerReference() *commonv1alpha1.OwnerReference { - return &commonv1alpha1.OwnerReference{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Kind: RackKind, - Namespace: r.Namespace, - Name: r.Name, - } -} - -func (r *Rack) ValidateSyntax(_ string) field.ErrorList { - var allErrs field.ErrorList - - /* - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.type"), - r, - fmt.Errorf("invalid GENID Type %s", r.Spec.Type).Error(), - )) - } - */ - return allErrs -} - -func (r *Rack) GetSpec() any { - return r.Spec -} - -func (r *Rack) SetSpec(s any) { - if spec, ok := s.(RackSpec); ok { - r.Spec = spec - } -} - -// BuildRack returns a reource from a client Object a Spec/Status -func BuildRack(meta metav1.ObjectMeta, spec *RackSpec, status *RackStatus) *Rack { - aspec := RackSpec{} - if spec != nil { - aspec = *spec - } - astatus := RackStatus{} - if status != nil { - astatus = *status - } - return &Rack{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: RackKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -func RackTableConvertor(gr schema.GroupResource) registry.TableConvertor { - return registry.TableConvertor{ - Resource: gr, - Cells: func(obj runtime.Object) []interface{} { - r, ok := obj.(*Rack) - if !ok { - return nil - } - return []interface{}{ - r.GetName(), - r.GetCondition(conditionv1alpha1.ConditionTypeReady).Status, - } - }, - Columns: []metav1.TableColumnDefinition{ - {Name: "Name", Type: "string"}, - {Name: "Ready", Type: "string"}, - }, - } -} - -func RackParseFieldSelector(ctx context.Context, fieldSelector fields.Selector) (backend.Filter, error) { - var filter *RackFilter - - // add the namespace to the list - namespace, ok := genericapirequest.NamespaceFrom(ctx) - if fieldSelector == nil { - if ok { - return &RackFilter{Namespace: namespace}, nil - } - return filter, nil - } - requirements := fieldSelector.Requirements() - for _, requirement := range requirements { - filter = &RackFilter{} - switch requirement.Operator { - case selection.Equals, selection.DoesNotExist: - if requirement.Value == "" { - return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) - } - default: - return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) - } - - switch requirement.Field { - case "metadata.name": - filter.Name = requirement.Value - case "metadata.namespace": - filter.Namespace = requirement.Value - default: - return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) - } - } - // add namespace to the filter selector if specified - if ok { - if filter != nil { - filter.Namespace = namespace - } else { - filter = &RackFilter{Namespace: namespace} - } - } - - return &RackFilter{}, nil -} - -type RackFilter struct { - // Name filters by the name of the objects - Name string `protobuf:"bytes,1,opt,name=name"` - - // Namespace filters by the namespace of the objects - Namespace string `protobuf:"bytes,2,opt,name=namespace"` -} - -func (r *RackFilter) Filter(ctx context.Context, obj runtime.Object) bool { - f := false // result of the previous filter - o, ok := obj.(*Rack) - if !ok { - return f - } - if r.Name != "" { - if o.GetName() == r.Name { - f = false - } else { - f = true - } - } - if r.Namespace != "" { - if o.GetNamespace() == r.Namespace { - f = false - } else { - f = true - } - } - return f -} - -func (r *Rack) GetUserDefinedLabels() map[string]string { - return r.Spec.GetUserDefinedLabels() -} - -func (r *Rack) GetProvider() string { - return "" -} diff --git a/apis/backend/infra/v1alpha1/rack_types.go b/apis/backend/infra/v1alpha1/rack_types.go deleted file mode 100644 index f937816..0000000 --- a/apis/backend/infra/v1alpha1/rack_types.go +++ /dev/null @@ -1,75 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "reflect" - - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// RackSpec defines the desired state of Rack -type RackSpec struct { - // SiteID identifies the siteID this resource belongs to - SiteID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=siteID"` - // Location defines the location information where this resource is located - // in lon/lat coordinates - Location *Location `json:"location,omitempty" yaml:"location,omitempty" protobuf:"bytes,2,opt,name=location"` - // The height of the rack, measured in units. - Height string `json:"height,omitempty" yaml:"height,omitempty" protobuf:"bytes,3,opt,name=height"` - // The canonical distance between the two vertical rails on a face. In inch - Width string `json:"width,omitempty" yaml:"width,omitempty" protobuf:"bytes,4,opt,name=width"` - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined label - commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,5,opt,name=userDefinedLabels"` -} - -// RackStatus defines the observed state of Rack -type RackStatus struct { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// A rack represents a physical equipment rack within your environment. Each rack is designed to accommodate -// the installation of devices and equipment. -// +k8s:openapi-gen=true -type Rack struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - Spec RackSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - Status RackStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// RackList contains a list of Racks -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type RackList struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []Rack `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` -} - -var ( - RackKind = reflect.TypeOf(Rack{}).Name() - RackKindList = reflect.TypeOf(RackList{}).Name() -) diff --git a/apis/backend/infra/v1alpha1/region_interface.go b/apis/backend/infra/v1alpha1/region_interface.go deleted file mode 100644 index d35e6b4..0000000 --- a/apis/backend/infra/v1alpha1/region_interface.go +++ /dev/null @@ -1,329 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "crypto/sha1" - "encoding/json" - "fmt" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/apiserver-store/pkg/generic/registry" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - apierrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/fields" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/selection" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" - genericapirequest "k8s.io/apiserver/pkg/endpoints/request" -) - -const RegionPlural = "regions" -const RegionSingular = "region" - -// +k8s:deepcopy-gen=false -var _ resource.Object = &Region{} -var _ resource.ObjectList = &RegionList{} -var _ backend.ObjectList = &RegionList{} -var _ backend.GenericObject = &Region{} -var _ backend.GenericObjectList = &RegionList{} - -// GetListMeta returns the ListMeta -func (r *RegionList) GetListMeta() *metav1.ListMeta { - return &r.ListMeta -} - -func (r *Region) GetSingularName() string { - return RegionSingular -} - -func (Region) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Resource: RegionPlural, - } -} - -// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. -// IsStorageVersion implements resource.Object. -func (Region) IsStorageVersion() bool { - return true -} - -// GetObjectMeta implements resource.Object -func (r *Region) GetObjectMeta() *metav1.ObjectMeta { - return &r.ObjectMeta -} - -// NamespaceScoped returns true to indicate Fortune is a namespaced resource. -// NamespaceScoped implements resource.Object. -func (Region) NamespaceScoped() bool { - return true -} - -// New implements resource.Object -func (Region) New() runtime.Object { - return &Region{} -} - -// NewList implements resource.Object -func (Region) NewList() runtime.Object { - return &RegionList{} -} - -func (r *Region) NewObjList() backend.GenericObjectList { - return &RegionList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: RegionKindList}, - } -} - -func (r *Region) SchemaGroupVersionKind() schema.GroupVersionKind { - return SchemeGroupVersion.WithKind(RegionKind) -} - -// GetCondition returns the condition based on the condition kind -func (r *Region) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { - return r.Status.GetCondition(t) -} - -// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions -// to be set at once -func (r *Region) SetConditions(c ...conditionv1alpha1.Condition) { - r.Status.SetConditions(c...) -} - -// RegionConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for Region -func RegionConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { - switch label { - case "metadata.name": - return label, value, nil - case "metadata.namespace": - return label, value, nil - default: - return "", "", fmt.Errorf("%q is not a known field selector", label) - } -} - -func (r *RegionList) GetItems() []backend.Object { - objs := []backend.Object{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *RegionList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *Region) CalculateHash() ([sha1.Size]byte, error) { - // Convert the struct to JSON - jsonData, err := json.Marshal(r) - if err != nil { - return [sha1.Size]byte{}, err - } - - // Calculate SHA-1 hash - return sha1.Sum(jsonData), nil -} - -func (r *Region) GetNamespacedName() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.GetNamespace(), - Name: r.GetName(), - } -} - -func (r *Region) GetKey() store.Key { - return store.KeyFromNSN(r.GetNamespacedName()) -} - -func (r *Region) GetRegion() string { - return r.Name -} - -func (r *Region) GetOwnerReference() *commonv1alpha1.OwnerReference { - return &commonv1alpha1.OwnerReference{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Kind: RegionKind, - Namespace: r.Namespace, - Name: r.Name, - } -} - -func (r *Region) ValidateSyntax(_ string) field.ErrorList { - var allErrs field.ErrorList - - /* - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.type"), - r, - fmt.Errorf("invalid GENID Type %s", r.Spec.Type).Error(), - )) - } - */ - return allErrs -} - -func (r *Region) GetSpec() any { - return r.Spec -} - -func (r *Region) SetSpec(s any) { - if spec, ok := s.(RegionSpec); ok { - r.Spec = spec - } -} - -// BuildRegion returns a reource from a client Object a Spec/Status -func BuildRegion(meta metav1.ObjectMeta, spec *RegionSpec, status *RegionStatus) *Region { - aspec := RegionSpec{} - if spec != nil { - aspec = *spec - } - astatus := RegionStatus{} - if status != nil { - astatus = *status - } - return &Region{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: RegionKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -func RegionTableConvertor(gr schema.GroupResource) registry.TableConvertor { - return registry.TableConvertor{ - Resource: gr, - Cells: func(obj runtime.Object) []interface{} { - r, ok := obj.(*Region) - if !ok { - return nil - } - return []interface{}{ - r.GetName(), - r.GetCondition(conditionv1alpha1.ConditionTypeReady).Status, - } - }, - Columns: []metav1.TableColumnDefinition{ - {Name: "Name", Type: "string"}, - {Name: "Ready", Type: "string"}, - }, - } -} - -func RegionParseFieldSelector(ctx context.Context, fieldSelector fields.Selector) (backend.Filter, error) { - var filter *RegionFilter - - // add the namespace to the list - namespace, ok := genericapirequest.NamespaceFrom(ctx) - if fieldSelector == nil { - if ok { - return &RegionFilter{Namespace: namespace}, nil - } - return filter, nil - } - requirements := fieldSelector.Requirements() - for _, requirement := range requirements { - filter = &RegionFilter{} - switch requirement.Operator { - case selection.Equals, selection.DoesNotExist: - if requirement.Value == "" { - return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) - } - default: - return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) - } - - switch requirement.Field { - case "metadata.name": - filter.Name = requirement.Value - case "metadata.namespace": - filter.Namespace = requirement.Value - default: - return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) - } - } - // add namespace to the filter selector if specified - if ok { - if filter != nil { - filter.Namespace = namespace - } else { - filter = &RegionFilter{Namespace: namespace} - } - } - - return &RegionFilter{}, nil -} - -type RegionFilter struct { - // Name filters by the name of the objects - Name string `protobuf:"bytes,1,opt,name=name"` - - // Namespace filters by the namespace of the objects - Namespace string `protobuf:"bytes,2,opt,name=namespace"` -} - -func (r *RegionFilter) Filter(ctx context.Context, obj runtime.Object) bool { - f := false // result of the previous filter - o, ok := obj.(*Region) - if !ok { - return f - } - if r.Name != "" { - if o.GetName() == r.Name { - f = false - } else { - f = true - } - } - if r.Namespace != "" { - if o.GetNamespace() == r.Namespace { - f = false - } else { - f = true - } - } - return f -} - -func (r *Region) GetUserDefinedLabels() map[string]string { - return r.Spec.GetUserDefinedLabels() -} - -func (r *Region) GetProvider() string { - return "" -} diff --git a/apis/backend/infra/v1alpha1/region_types.go b/apis/backend/infra/v1alpha1/region_types.go deleted file mode 100644 index 4b32edc..0000000 --- a/apis/backend/infra/v1alpha1/region_types.go +++ /dev/null @@ -1,66 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "reflect" - - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// RegionSpec defines the desired state of Region -type RegionSpec struct { - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=userDefinedLabels"` -} - -// RegionStatus defines the observed state of Region -type RegionStatus struct { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// A region represent a geography in which multiple infrastructure resources are grouped -// A region might represent a continent, country, city, campus, or other area depending on your environment. -// +k8s:openapi-gen=true -type Region struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - Spec RegionSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - Status RegionStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// RegionList contains a list of Regions -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type RegionList struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []Region `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` -} - -var ( - RegionKind = reflect.TypeOf(Region{}).Name() - RegionKindList = reflect.TypeOf(RegionList{}).Name() -) diff --git a/apis/backend/infra/v1alpha1/register.go b/apis/backend/infra/v1alpha1/register.go deleted file mode 100644 index caafe3c..0000000 --- a/apis/backend/infra/v1alpha1/register.go +++ /dev/null @@ -1,91 +0,0 @@ -/* -Copyright 2024 Nokia. - -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. -*/ - -// +kubebuilder:object:generate=true -// +groupName=infra.be.kuid.dev -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -const ( - Group = "infra.be.kuid.dev" - Version = "v1alpha1" -) - -var ( - // SchemeGroupVersion contains the API group and version information for the types in this package. - SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version} - // AddToScheme applies all the stored functions to the scheme. A non-nil error - // indicates that one function failed and the attempt was abandoned. - //AddToScheme = (&runtime.SchemeBuilder{}).AddToScheme - AddToScheme = localSchemeBuilder.AddToScheme - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - schemeBuilder runtime.SchemeBuilder - localSchemeBuilder = &schemeBuilder -) - -// Resource takes an unqualified resource and returns a Group qualified GroupResource -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} - -func init() { - localSchemeBuilder.Register(addKnownTypes) -} - -// Adds the list of known types to the given scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - // +kubebuilder:scaffold:install - - scheme.AddKnownTypes(SchemeGroupVersion, - &Region{}, - &RegionList{}, - &Site{}, - &SiteList{}, - &Rack{}, - &RackList{}, - &NodeGroup{}, - &NodeGroupList{}, - &Node{}, - &NodeList{}, - &NodeSet{}, - &NodeSetList{}, - &NodeItem{}, - &NodeItemList{}, - &ModuleBay{}, - &ModuleBayList{}, - &Module{}, - &ModuleList{}, - &Endpoint{}, - &EndpointList{}, - &Link{}, - &LinkList{}, - &LinkSet{}, - &LinkSetList{}, - &EndpointSet{}, - &EndpointSetList{}, - &Cluster{}, - &ClusterList{}, - ) - - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/apis/backend/infra/v1alpha1/site_interface.go b/apis/backend/infra/v1alpha1/site_interface.go deleted file mode 100644 index 4749c40..0000000 --- a/apis/backend/infra/v1alpha1/site_interface.go +++ /dev/null @@ -1,335 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "crypto/sha1" - "encoding/json" - "fmt" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/apiserver-store/pkg/generic/registry" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - apierrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/fields" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/selection" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" - genericapirequest "k8s.io/apiserver/pkg/endpoints/request" -) - -const SitePlural = "sites" -const SiteSingular = "site" - -// +k8s:deepcopy-gen=false -var _ resource.Object = &Site{} -var _ resource.ObjectList = &SiteList{} -var _ backend.ObjectList = &SiteList{} -var _ backend.GenericObject = &Site{} -var _ backend.GenericObjectList = &SiteList{} - -// GetListMeta returns the ListMeta -func (r *SiteList) GetListMeta() *metav1.ListMeta { - return &r.ListMeta -} - -func (r *Site) GetSingularName() string { - return SiteSingular -} - -func (Site) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Resource: SitePlural, - } -} - -// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. -// IsStorageVersion implements resource.Object. -func (Site) IsStorageVersion() bool { - return true -} - -// GetObjectMeta implements resource.Object -func (r *Site) GetObjectMeta() *metav1.ObjectMeta { - return &r.ObjectMeta -} - -// NamespaceScoped returns true to indicate Fortune is a namespaced resource. -// NamespaceScoped implements resource.Object. -func (Site) NamespaceScoped() bool { - return true -} - -// New implements resource.Object -func (Site) New() runtime.Object { - return &Site{} -} - -// NewList implements resource.Object -func (Site) NewList() runtime.Object { - return &SiteList{} -} - -func (r *Site) NewObjList() backend.GenericObjectList { - return &SiteList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: SiteKindList}, - } -} - -func (r *Site) SchemaGroupVersionKind() schema.GroupVersionKind { - return SchemeGroupVersion.WithKind(SiteKind) -} - -// GetCondition returns the condition based on the condition kind -func (r *Site) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { - return r.Status.GetCondition(t) -} - -// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions -// to be set at once -func (r *Site) SetConditions(c ...conditionv1alpha1.Condition) { - r.Status.SetConditions(c...) -} - -// SiteConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for Site -func SiteConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { - switch label { - case "metadata.name": - return label, value, nil - case "metadata.namespace": - return label, value, nil - default: - return "", "", fmt.Errorf("%q is not a known field selector", label) - } -} - -func (r *SiteList) GetItems() []backend.Object { - objs := []backend.Object{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *SiteList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *Site) CalculateHash() ([sha1.Size]byte, error) { - // Convert the struct to JSON - jsonData, err := json.Marshal(r) - if err != nil { - return [sha1.Size]byte{}, err - } - - // Calculate SHA-1 hash - return sha1.Sum(jsonData), nil -} - -func (r *Site) GetNamespacedName() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.GetNamespace(), - Name: r.GetName(), - } -} - -func (r *Site) GetKey() store.Key { - return store.KeyFromNSN(r.GetNamespacedName()) -} - -func (r *Site) GetRegion() string { - return r.Spec.Region -} - -func (r *Site) GetSite() string { - return r.Name -} - -func (r *Site) GetOwnerReference() *commonv1alpha1.OwnerReference { - return &commonv1alpha1.OwnerReference{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Kind: SiteKind, - Namespace: r.Namespace, - Name: r.Name, - } -} - -func (r *Site) ValidateSyntax(_ string) field.ErrorList { - var allErrs field.ErrorList - - /* - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.type"), - r, - fmt.Errorf("invalid GENID Type %s", r.Spec.Type).Error(), - )) - } - */ - return allErrs -} - -func (r *Site) GetSpec() any { - return r.Spec -} - -func (r *Site) SetSpec(s any) { - if spec, ok := s.(SiteSpec); ok { - r.Spec = spec - } -} - -// BuildSite returns a reource from a client Object a Spec/Status -func BuildSite(meta metav1.ObjectMeta, spec *SiteSpec, status *SiteStatus) *Site { - aspec := SiteSpec{} - if spec != nil { - aspec = *spec - } - astatus := SiteStatus{} - if status != nil { - astatus = *status - } - return &Site{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: SiteKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -func SiteTableConvertor(gr schema.GroupResource) registry.TableConvertor { - return registry.TableConvertor{ - Resource: gr, - Cells: func(obj runtime.Object) []interface{} { - r, ok := obj.(*Site) - if !ok { - return nil - } - return []interface{}{ - r.GetName(), - r.GetCondition(conditionv1alpha1.ConditionTypeReady).Status, - r.Spec.Region, - } - }, - Columns: []metav1.TableColumnDefinition{ - {Name: "Name", Type: "string"}, - {Name: "Ready", Type: "string"}, - {Name: "Region", Type: "string"}, - }, - } -} - -func SiteParseFieldSelector(ctx context.Context, fieldSelector fields.Selector) (backend.Filter, error) { - var filter *SiteFilter - - // add the namespace to the list - namespace, ok := genericapirequest.NamespaceFrom(ctx) - if fieldSelector == nil { - if ok { - return &SiteFilter{Namespace: namespace}, nil - } - return filter, nil - } - requirements := fieldSelector.Requirements() - for _, requirement := range requirements { - filter = &SiteFilter{} - switch requirement.Operator { - case selection.Equals, selection.DoesNotExist: - if requirement.Value == "" { - return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) - } - default: - return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) - } - - switch requirement.Field { - case "metadata.name": - filter.Name = requirement.Value - case "metadata.namespace": - filter.Namespace = requirement.Value - default: - return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) - } - } - // add namespace to the filter selector if specified - if ok { - if filter != nil { - filter.Namespace = namespace - } else { - filter = &SiteFilter{Namespace: namespace} - } - } - - return &SiteFilter{}, nil -} - -type SiteFilter struct { - // Name filters by the name of the objects - Name string `protobuf:"bytes,1,opt,name=name"` - - // Namespace filters by the namespace of the objects - Namespace string `protobuf:"bytes,2,opt,name=namespace"` -} - -func (r *SiteFilter) Filter(ctx context.Context, obj runtime.Object) bool { - f := false // result of the previous filter - o, ok := obj.(*Site) - if !ok { - return f - } - if r.Name != "" { - if o.GetName() == r.Name { - f = false - } else { - f = true - } - } - if r.Namespace != "" { - if o.GetNamespace() == r.Namespace { - f = false - } else { - f = true - } - } - return f -} - -func (r *Site) GetUserDefinedLabels() map[string]string { - return r.Spec.GetUserDefinedLabels() -} - -func (r *Site) GetProvider() string { - return "" -} diff --git a/apis/backend/infra/v1alpha1/site_types.go b/apis/backend/infra/v1alpha1/site_types.go deleted file mode 100644 index afba2cc..0000000 --- a/apis/backend/infra/v1alpha1/site_types.go +++ /dev/null @@ -1,72 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "reflect" - - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// SiteSpec defines the desired state of Site -type SiteSpec struct { - // Region defines the region this sites belongs to - Region string `json:"region" yaml:"region" protobuf:"bytes,1,opt,name=region"` - // Location defines the location information where this resource is located - // in lon/lat coordinates - Location *Location `json:"location,omitempty" yaml:"location,omitempty" protobuf:"bytes,2,opt,name=location"` - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` -} - -// SiteStatus defines the observed state of Site -type SiteStatus struct { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// A site serves as a fundamental organizational unit for managing infrastructure resources within your environment. -// The utilization of sites may vary based on the organizational structure and requirements, -// but in essence, each site typically corresponds to a distinct building or campus. -// +k8s:openapi-gen=true -type Site struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - Spec SiteSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - Status SiteStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// SiteList contains a list of Sites -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type SiteList struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []Site `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` -} - -var ( - SiteKind = reflect.TypeOf(Site{}).Name() - SiteKindList = reflect.TypeOf(SiteList{}).Name() -) diff --git a/apis/backend/infra/v1alpha1/zz_generated.deepcopy.go b/apis/backend/infra/v1alpha1/zz_generated.deepcopy.go deleted file mode 100644 index 9396da5..0000000 --- a/apis/backend/infra/v1alpha1/zz_generated.deepcopy.go +++ /dev/null @@ -1,1955 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -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 *BFDLinkParameters) DeepCopyInto(out *BFDLinkParameters) { - *out = *in - if in.Enabled != nil { - in, out := &in.Enabled, &out.Enabled - *out = new(bool) - **out = **in - } - if in.MinTx != nil { - in, out := &in.MinTx, &out.MinTx - *out = new(uint32) - **out = **in - } - if in.MinRx != nil { - in, out := &in.MinRx, &out.MinRx - *out = new(uint32) - **out = **in - } - if in.MinEchoRx != nil { - in, out := &in.MinEchoRx, &out.MinEchoRx - *out = new(uint32) - **out = **in - } - if in.Multiplier != nil { - in, out := &in.Multiplier, &out.Multiplier - *out = new(uint32) - **out = **in - } - if in.TTL != nil { - in, out := &in.TTL, &out.TTL - *out = new(uint32) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BFDLinkParameters. -func (in *BFDLinkParameters) DeepCopy() *BFDLinkParameters { - if in == nil { - return nil - } - out := new(BFDLinkParameters) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BGPLinkParameters) DeepCopyInto(out *BGPLinkParameters) { - *out = *in - if in.BFD != nil { - in, out := &in.BFD, &out.BFD - *out = new(bool) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BGPLinkParameters. -func (in *BGPLinkParameters) DeepCopy() *BGPLinkParameters { - if in == nil { - return nil - } - out := new(BGPLinkParameters) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Cluster) DeepCopyInto(out *Cluster) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Cluster. -func (in *Cluster) DeepCopy() *Cluster { - if in == nil { - return nil - } - out := new(Cluster) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Cluster) 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 *ClusterFilter) DeepCopyInto(out *ClusterFilter) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterFilter. -func (in *ClusterFilter) DeepCopy() *ClusterFilter { - if in == nil { - return nil - } - out := new(ClusterFilter) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClusterList) DeepCopyInto(out *ClusterList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Cluster, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterList. -func (in *ClusterList) DeepCopy() *ClusterList { - if in == nil { - return nil - } - out := new(ClusterList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ClusterList) 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 *ClusterSpec) DeepCopyInto(out *ClusterSpec) { - *out = *in - if in.Location != nil { - in, out := &in.Location, &out.Location - *out = new(Location) - **out = **in - } - in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterSpec. -func (in *ClusterSpec) DeepCopy() *ClusterSpec { - if in == nil { - return nil - } - out := new(ClusterSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClusterStatus) DeepCopyInto(out *ClusterStatus) { - *out = *in - in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterStatus. -func (in *ClusterStatus) DeepCopy() *ClusterStatus { - if in == nil { - return nil - } - out := new(ClusterStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Endpoint) DeepCopyInto(out *Endpoint) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Endpoint. -func (in *Endpoint) DeepCopy() *Endpoint { - if in == nil { - return nil - } - out := new(Endpoint) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Endpoint) 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 *EndpointFilter) DeepCopyInto(out *EndpointFilter) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointFilter. -func (in *EndpointFilter) DeepCopy() *EndpointFilter { - if in == nil { - return nil - } - out := new(EndpointFilter) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EndpointID) DeepCopyInto(out *EndpointID) { - *out = *in - out.NodeID = in.NodeID - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointID. -func (in *EndpointID) DeepCopy() *EndpointID { - if in == nil { - return nil - } - out := new(EndpointID) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EndpointList) DeepCopyInto(out *EndpointList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Endpoint, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointList. -func (in *EndpointList) DeepCopy() *EndpointList { - if in == nil { - return nil - } - out := new(EndpointList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *EndpointList) 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 *EndpointSet) DeepCopyInto(out *EndpointSet) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointSet. -func (in *EndpointSet) DeepCopy() *EndpointSet { - if in == nil { - return nil - } - out := new(EndpointSet) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *EndpointSet) 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 *EndpointSetFilter) DeepCopyInto(out *EndpointSetFilter) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointSetFilter. -func (in *EndpointSetFilter) DeepCopy() *EndpointSetFilter { - if in == nil { - return nil - } - out := new(EndpointSetFilter) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EndpointSetList) DeepCopyInto(out *EndpointSetList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]EndpointSet, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointSetList. -func (in *EndpointSetList) DeepCopy() *EndpointSetList { - if in == nil { - return nil - } - out := new(EndpointSetList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *EndpointSetList) 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 *EndpointSetSpec) DeepCopyInto(out *EndpointSetSpec) { - *out = *in - if in.Endpoints != nil { - in, out := &in.Endpoints, &out.Endpoints - *out = make([]*EndpointID, len(*in)) - for i := range *in { - if (*in)[i] != nil { - in, out := &(*in)[i], &(*out)[i] - *out = new(EndpointID) - **out = **in - } - } - } - if in.Lacp != nil { - in, out := &in.Lacp, &out.Lacp - *out = new(bool) - **out = **in - } - in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointSetSpec. -func (in *EndpointSetSpec) DeepCopy() *EndpointSetSpec { - if in == nil { - return nil - } - out := new(EndpointSetSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EndpointSetStatus) DeepCopyInto(out *EndpointSetStatus) { - *out = *in - in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) - if in.ESI != nil { - in, out := &in.ESI, &out.ESI - *out = new(uint32) - **out = **in - } - if in.LagId != nil { - in, out := &in.LagId, &out.LagId - *out = new(uint32) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointSetStatus. -func (in *EndpointSetStatus) DeepCopy() *EndpointSetStatus { - if in == nil { - return nil - } - out := new(EndpointSetStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EndpointSpec) DeepCopyInto(out *EndpointSpec) { - *out = *in - out.NodeGroupEndpointID = in.NodeGroupEndpointID - if in.Module != nil { - in, out := &in.Module, &out.Module - *out = new(string) - **out = **in - } - in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) - if in.Speed != nil { - in, out := &in.Speed, &out.Speed - *out = new(string) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointSpec. -func (in *EndpointSpec) DeepCopy() *EndpointSpec { - if in == nil { - return nil - } - out := new(EndpointSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EndpointStatus) DeepCopyInto(out *EndpointStatus) { - *out = *in - in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointStatus. -func (in *EndpointStatus) DeepCopy() *EndpointStatus { - if in == nil { - return nil - } - out := new(EndpointStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IGPLinkParameters) DeepCopyInto(out *IGPLinkParameters) { - *out = *in - if in.NetworkType != nil { - in, out := &in.NetworkType, &out.NetworkType - *out = new(NetworkType) - **out = **in - } - if in.Passive != nil { - in, out := &in.Passive, &out.Passive - *out = new(bool) - **out = **in - } - if in.BFD != nil { - in, out := &in.BFD, &out.BFD - *out = new(bool) - **out = **in - } - if in.Metric != nil { - in, out := &in.Metric, &out.Metric - *out = new(uint32) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IGPLinkParameters. -func (in *IGPLinkParameters) DeepCopy() *IGPLinkParameters { - if in == nil { - return nil - } - out := new(IGPLinkParameters) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ISISLinkParameters) DeepCopyInto(out *ISISLinkParameters) { - *out = *in - in.IGPLinkParameters.DeepCopyInto(&out.IGPLinkParameters) - if in.Level != nil { - in, out := &in.Level, &out.Level - *out = new(ISISLevel) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ISISLinkParameters. -func (in *ISISLinkParameters) DeepCopy() *ISISLinkParameters { - if in == nil { - return nil - } - out := new(ISISLinkParameters) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Link) DeepCopyInto(out *Link) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Link. -func (in *Link) DeepCopy() *Link { - if in == nil { - return nil - } - out := new(Link) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Link) 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 *LinkFilter) DeepCopyInto(out *LinkFilter) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinkFilter. -func (in *LinkFilter) DeepCopy() *LinkFilter { - if in == nil { - return nil - } - out := new(LinkFilter) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LinkList) DeepCopyInto(out *LinkList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Link, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinkList. -func (in *LinkList) DeepCopy() *LinkList { - if in == nil { - return nil - } - out := new(LinkList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *LinkList) 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 *LinkSet) DeepCopyInto(out *LinkSet) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinkSet. -func (in *LinkSet) DeepCopy() *LinkSet { - if in == nil { - return nil - } - out := new(LinkSet) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *LinkSet) 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 *LinkSetFilter) DeepCopyInto(out *LinkSetFilter) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinkSetFilter. -func (in *LinkSetFilter) DeepCopy() *LinkSetFilter { - if in == nil { - return nil - } - out := new(LinkSetFilter) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LinkSetList) DeepCopyInto(out *LinkSetList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]LinkSet, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinkSetList. -func (in *LinkSetList) DeepCopy() *LinkSetList { - if in == nil { - return nil - } - out := new(LinkSetList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *LinkSetList) 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 *LinkSetSpec) DeepCopyInto(out *LinkSetSpec) { - *out = *in - if in.Endpoints != nil { - in, out := &in.Endpoints, &out.Endpoints - *out = make([]*EndpointID, len(*in)) - for i := range *in { - if (*in)[i] != nil { - in, out := &(*in)[i], &(*out)[i] - *out = new(EndpointID) - **out = **in - } - } - } - in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinkSetSpec. -func (in *LinkSetSpec) DeepCopy() *LinkSetSpec { - if in == nil { - return nil - } - out := new(LinkSetSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LinkSetStatus) DeepCopyInto(out *LinkSetStatus) { - *out = *in - in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) - if in.ESI != nil { - in, out := &in.ESI, &out.ESI - *out = new(uint32) - **out = **in - } - if in.LagId != nil { - in, out := &in.LagId, &out.LagId - *out = new(uint32) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinkSetStatus. -func (in *LinkSetStatus) DeepCopy() *LinkSetStatus { - if in == nil { - return nil - } - out := new(LinkSetStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LinkSpec) DeepCopyInto(out *LinkSpec) { - *out = *in - if in.Endpoints != nil { - in, out := &in.Endpoints, &out.Endpoints - *out = make([]*NodeGroupEndpointID, len(*in)) - for i := range *in { - if (*in)[i] != nil { - in, out := &(*in)[i], &(*out)[i] - *out = new(NodeGroupEndpointID) - **out = **in - } - } - } - in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) - if in.BFD != nil { - in, out := &in.BFD, &out.BFD - *out = new(BFDLinkParameters) - (*in).DeepCopyInto(*out) - } - if in.OSPF != nil { - in, out := &in.OSPF, &out.OSPF - *out = new(OSPFLinkParameters) - (*in).DeepCopyInto(*out) - } - if in.ISIS != nil { - in, out := &in.ISIS, &out.ISIS - *out = new(ISISLinkParameters) - (*in).DeepCopyInto(*out) - } - if in.BGP != nil { - in, out := &in.BGP, &out.BGP - *out = new(BGPLinkParameters) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinkSpec. -func (in *LinkSpec) DeepCopy() *LinkSpec { - if in == nil { - return nil - } - out := new(LinkSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LinkStatus) DeepCopyInto(out *LinkStatus) { - *out = *in - in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinkStatus. -func (in *LinkStatus) DeepCopy() *LinkStatus { - if in == nil { - return nil - } - out := new(LinkStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Location) DeepCopyInto(out *Location) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Location. -func (in *Location) DeepCopy() *Location { - if in == nil { - return nil - } - out := new(Location) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Module) DeepCopyInto(out *Module) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Module. -func (in *Module) DeepCopy() *Module { - if in == nil { - return nil - } - out := new(Module) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Module) 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 *ModuleBay) DeepCopyInto(out *ModuleBay) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleBay. -func (in *ModuleBay) DeepCopy() *ModuleBay { - if in == nil { - return nil - } - out := new(ModuleBay) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ModuleBay) 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 *ModuleBayFilter) DeepCopyInto(out *ModuleBayFilter) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleBayFilter. -func (in *ModuleBayFilter) DeepCopy() *ModuleBayFilter { - if in == nil { - return nil - } - out := new(ModuleBayFilter) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ModuleBayList) DeepCopyInto(out *ModuleBayList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]ModuleBay, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleBayList. -func (in *ModuleBayList) DeepCopy() *ModuleBayList { - if in == nil { - return nil - } - out := new(ModuleBayList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ModuleBayList) 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 *ModuleBaySpec) DeepCopyInto(out *ModuleBaySpec) { - *out = *in - out.NodeID = in.NodeID - in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleBaySpec. -func (in *ModuleBaySpec) DeepCopy() *ModuleBaySpec { - if in == nil { - return nil - } - out := new(ModuleBaySpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ModuleBayStatus) DeepCopyInto(out *ModuleBayStatus) { - *out = *in - in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleBayStatus. -func (in *ModuleBayStatus) DeepCopy() *ModuleBayStatus { - if in == nil { - return nil - } - out := new(ModuleBayStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ModuleFilter) DeepCopyInto(out *ModuleFilter) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleFilter. -func (in *ModuleFilter) DeepCopy() *ModuleFilter { - if in == nil { - return nil - } - out := new(ModuleFilter) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ModuleList) DeepCopyInto(out *ModuleList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Module, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleList. -func (in *ModuleList) DeepCopy() *ModuleList { - if in == nil { - return nil - } - out := new(ModuleList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ModuleList) 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 *ModuleSpec) DeepCopyInto(out *ModuleSpec) { - *out = *in - out.NodeID = in.NodeID - in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleSpec. -func (in *ModuleSpec) DeepCopy() *ModuleSpec { - if in == nil { - return nil - } - out := new(ModuleSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ModuleStatus) DeepCopyInto(out *ModuleStatus) { - *out = *in - in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleStatus. -func (in *ModuleStatus) DeepCopy() *ModuleStatus { - if in == nil { - return nil - } - out := new(ModuleStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Node) DeepCopyInto(out *Node) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Node. -func (in *Node) DeepCopy() *Node { - if in == nil { - return nil - } - out := new(Node) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Node) 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 *NodeFilter) DeepCopyInto(out *NodeFilter) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeFilter. -func (in *NodeFilter) DeepCopy() *NodeFilter { - if in == nil { - return nil - } - out := new(NodeFilter) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeGroup) DeepCopyInto(out *NodeGroup) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeGroup. -func (in *NodeGroup) DeepCopy() *NodeGroup { - if in == nil { - return nil - } - out := new(NodeGroup) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NodeGroup) 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 *NodeGroupEndpointID) DeepCopyInto(out *NodeGroupEndpointID) { - *out = *in - out.EndpointID = in.EndpointID - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeGroupEndpointID. -func (in *NodeGroupEndpointID) DeepCopy() *NodeGroupEndpointID { - if in == nil { - return nil - } - out := new(NodeGroupEndpointID) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeGroupFilter) DeepCopyInto(out *NodeGroupFilter) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeGroupFilter. -func (in *NodeGroupFilter) DeepCopy() *NodeGroupFilter { - if in == nil { - return nil - } - out := new(NodeGroupFilter) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeGroupList) DeepCopyInto(out *NodeGroupList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]NodeGroup, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeGroupList. -func (in *NodeGroupList) DeepCopy() *NodeGroupList { - if in == nil { - return nil - } - out := new(NodeGroupList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NodeGroupList) 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 *NodeGroupNodeID) DeepCopyInto(out *NodeGroupNodeID) { - *out = *in - out.NodeID = in.NodeID - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeGroupNodeID. -func (in *NodeGroupNodeID) DeepCopy() *NodeGroupNodeID { - if in == nil { - return nil - } - out := new(NodeGroupNodeID) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeGroupSpec) DeepCopyInto(out *NodeGroupSpec) { - *out = *in - in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeGroupSpec. -func (in *NodeGroupSpec) DeepCopy() *NodeGroupSpec { - if in == nil { - return nil - } - out := new(NodeGroupSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeGroupStatus) DeepCopyInto(out *NodeGroupStatus) { - *out = *in - in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeGroupStatus. -func (in *NodeGroupStatus) DeepCopy() *NodeGroupStatus { - if in == nil { - return nil - } - out := new(NodeGroupStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeID) DeepCopyInto(out *NodeID) { - *out = *in - out.SiteID = in.SiteID - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeID. -func (in *NodeID) DeepCopy() *NodeID { - if in == nil { - return nil - } - out := new(NodeID) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeItem) DeepCopyInto(out *NodeItem) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeItem. -func (in *NodeItem) DeepCopy() *NodeItem { - if in == nil { - return nil - } - out := new(NodeItem) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NodeItem) 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 *NodeItemFilter) DeepCopyInto(out *NodeItemFilter) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeItemFilter. -func (in *NodeItemFilter) DeepCopy() *NodeItemFilter { - if in == nil { - return nil - } - out := new(NodeItemFilter) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeItemList) DeepCopyInto(out *NodeItemList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]NodeItem, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeItemList. -func (in *NodeItemList) DeepCopy() *NodeItemList { - if in == nil { - return nil - } - out := new(NodeItemList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NodeItemList) 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 *NodeItemSpec) DeepCopyInto(out *NodeItemSpec) { - *out = *in - out.NodeID = in.NodeID - in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeItemSpec. -func (in *NodeItemSpec) DeepCopy() *NodeItemSpec { - if in == nil { - return nil - } - out := new(NodeItemSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeItemStatus) DeepCopyInto(out *NodeItemStatus) { - *out = *in - in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeItemStatus. -func (in *NodeItemStatus) DeepCopy() *NodeItemStatus { - if in == nil { - return nil - } - out := new(NodeItemStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeList) DeepCopyInto(out *NodeList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Node, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeList. -func (in *NodeList) DeepCopy() *NodeList { - if in == nil { - return nil - } - out := new(NodeList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NodeList) 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 *NodeSet) DeepCopyInto(out *NodeSet) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeSet. -func (in *NodeSet) DeepCopy() *NodeSet { - if in == nil { - return nil - } - out := new(NodeSet) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NodeSet) 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 *NodeSetFilter) DeepCopyInto(out *NodeSetFilter) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeSetFilter. -func (in *NodeSetFilter) DeepCopy() *NodeSetFilter { - if in == nil { - return nil - } - out := new(NodeSetFilter) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeSetList) DeepCopyInto(out *NodeSetList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]NodeSet, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeSetList. -func (in *NodeSetList) DeepCopy() *NodeSetList { - if in == nil { - return nil - } - out := new(NodeSetList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NodeSetList) 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 *NodeSetSpec) DeepCopyInto(out *NodeSetSpec) { - *out = *in - in.ClaimLabels.DeepCopyInto(&out.ClaimLabels) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeSetSpec. -func (in *NodeSetSpec) DeepCopy() *NodeSetSpec { - if in == nil { - return nil - } - out := new(NodeSetSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeSetStatus) DeepCopyInto(out *NodeSetStatus) { - *out = *in - in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeSetStatus. -func (in *NodeSetStatus) DeepCopy() *NodeSetStatus { - if in == nil { - return nil - } - out := new(NodeSetStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeSpec) DeepCopyInto(out *NodeSpec) { - *out = *in - out.NodeGroupNodeID = in.NodeGroupNodeID - if in.Rack != nil { - in, out := &in.Rack, &out.Rack - *out = new(string) - **out = **in - } - if in.Position != nil { - in, out := &in.Position, &out.Position - *out = new(string) - **out = **in - } - if in.Location != nil { - in, out := &in.Location, &out.Location - *out = new(Location) - **out = **in - } - in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeSpec. -func (in *NodeSpec) DeepCopy() *NodeSpec { - if in == nil { - return nil - } - out := new(NodeSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeStatus) DeepCopyInto(out *NodeStatus) { - *out = *in - in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) - if in.SystemID != nil { - in, out := &in.SystemID, &out.SystemID - *out = new(string) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeStatus. -func (in *NodeStatus) DeepCopy() *NodeStatus { - if in == nil { - return nil - } - out := new(NodeStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OSPFLinkParameters) DeepCopyInto(out *OSPFLinkParameters) { - *out = *in - in.IGPLinkParameters.DeepCopyInto(&out.IGPLinkParameters) - if in.Area != nil { - in, out := &in.Area, &out.Area - *out = new(string) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OSPFLinkParameters. -func (in *OSPFLinkParameters) DeepCopy() *OSPFLinkParameters { - if in == nil { - return nil - } - out := new(OSPFLinkParameters) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Rack) DeepCopyInto(out *Rack) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Rack. -func (in *Rack) DeepCopy() *Rack { - if in == nil { - return nil - } - out := new(Rack) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Rack) 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 *RackFilter) DeepCopyInto(out *RackFilter) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RackFilter. -func (in *RackFilter) DeepCopy() *RackFilter { - if in == nil { - return nil - } - out := new(RackFilter) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RackList) DeepCopyInto(out *RackList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Rack, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RackList. -func (in *RackList) DeepCopy() *RackList { - if in == nil { - return nil - } - out := new(RackList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *RackList) 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 *RackSpec) DeepCopyInto(out *RackSpec) { - *out = *in - out.SiteID = in.SiteID - if in.Location != nil { - in, out := &in.Location, &out.Location - *out = new(Location) - **out = **in - } - in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RackSpec. -func (in *RackSpec) DeepCopy() *RackSpec { - if in == nil { - return nil - } - out := new(RackSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RackStatus) DeepCopyInto(out *RackStatus) { - *out = *in - in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RackStatus. -func (in *RackStatus) DeepCopy() *RackStatus { - if in == nil { - return nil - } - out := new(RackStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Region) DeepCopyInto(out *Region) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Region. -func (in *Region) DeepCopy() *Region { - if in == nil { - return nil - } - out := new(Region) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Region) 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 *RegionFilter) DeepCopyInto(out *RegionFilter) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RegionFilter. -func (in *RegionFilter) DeepCopy() *RegionFilter { - if in == nil { - return nil - } - out := new(RegionFilter) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RegionList) DeepCopyInto(out *RegionList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Region, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RegionList. -func (in *RegionList) DeepCopy() *RegionList { - if in == nil { - return nil - } - out := new(RegionList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *RegionList) 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 *RegionSpec) DeepCopyInto(out *RegionSpec) { - *out = *in - in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RegionSpec. -func (in *RegionSpec) DeepCopy() *RegionSpec { - if in == nil { - return nil - } - out := new(RegionSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RegionStatus) DeepCopyInto(out *RegionStatus) { - *out = *in - in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RegionStatus. -func (in *RegionStatus) DeepCopy() *RegionStatus { - if in == nil { - return nil - } - out := new(RegionStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Site) DeepCopyInto(out *Site) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Site. -func (in *Site) DeepCopy() *Site { - if in == nil { - return nil - } - out := new(Site) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Site) 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 *SiteFilter) DeepCopyInto(out *SiteFilter) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SiteFilter. -func (in *SiteFilter) DeepCopy() *SiteFilter { - if in == nil { - return nil - } - out := new(SiteFilter) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SiteID) DeepCopyInto(out *SiteID) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SiteID. -func (in *SiteID) DeepCopy() *SiteID { - if in == nil { - return nil - } - out := new(SiteID) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SiteList) DeepCopyInto(out *SiteList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Site, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SiteList. -func (in *SiteList) DeepCopy() *SiteList { - if in == nil { - return nil - } - out := new(SiteList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *SiteList) 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 *SiteSpec) DeepCopyInto(out *SiteSpec) { - *out = *in - if in.Location != nil { - in, out := &in.Location, &out.Location - *out = new(Location) - **out = **in - } - in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SiteSpec. -func (in *SiteSpec) DeepCopy() *SiteSpec { - if in == nil { - return nil - } - out := new(SiteSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SiteStatus) DeepCopyInto(out *SiteStatus) { - *out = *in - in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SiteStatus. -func (in *SiteStatus) DeepCopy() *SiteStatus { - if in == nil { - return nil - } - out := new(SiteStatus) - in.DeepCopyInto(out) - return out -} diff --git a/apis/backend/ipam/doc.go b/apis/backend/ipam/doc.go deleted file mode 100644 index dd8bd1b..0000000 --- a/apis/backend/ipam/doc.go +++ /dev/null @@ -1,21 +0,0 @@ -/* -Copyright 2024 Nokia. - -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. -*/ - -// +k8s:deepcopy-gen=package,register -// +groupName=ipam.be.kuid.dev - -// ipam defines the ipam api -package ipam diff --git a/apis/backend/ipam/v1alpha1/doc.go b/apis/backend/ipam/v1alpha1/doc.go deleted file mode 100644 index 525fc8b..0000000 --- a/apis/backend/ipam/v1alpha1/doc.go +++ /dev/null @@ -1,28 +0,0 @@ -/* -Copyright 2024 Nokia. - -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. -*/ - -//go:generate deepcopy-gen -O zz_generated.deepcopy -i . -h ../../../../boilerplate.go.txt -//go:generate defaulter-gen -O zz_generated.defaults -i . -h ../../../../boilerplate.go.txt -//go:generate conversion-gen -O zz_generated.conversion -i . -h ../../../../boilerplate.go.txt - -// +k8s:openapi-gen=true -// +k8s:deepcopy-gen=package,register -// +k8s:conversion-gen=github.com/kuidio/kuid/apis/backend/ipam -// +k8s:defaulter-gen=TypeMeta -// +groupName=ipam.be.kuid.dev - -// Package v1alpha1 is the v1alpha1 version of the API. -package v1alpha1 // import "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" diff --git a/apis/backend/ipam/v1alpha1/generated.pb.go b/apis/backend/ipam/v1alpha1/generated.pb.go deleted file mode 100644 index dfd5d51..0000000 --- a/apis/backend/ipam/v1alpha1/generated.pb.go +++ /dev/null @@ -1,3970 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 protoc-gen-gogo. DO NOT EDIT. -// source: github.com/kuidio/kuid/apis/backend/ipam/v1alpha1/generated.proto - -package v1alpha1 - -import ( - fmt "fmt" - - io "io" - - proto "github.com/gogo/protobuf/proto" - github_com_henderiw_iputil "github.com/henderiw/iputil" - v1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - - math "math" - math_bits "math/bits" - reflect "reflect" - strings "strings" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -func (m *IPClaim) Reset() { *m = IPClaim{} } -func (*IPClaim) ProtoMessage() {} -func (*IPClaim) Descriptor() ([]byte, []int) { - return fileDescriptor_13fd918388a77f06, []int{0} -} -func (m *IPClaim) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *IPClaim) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *IPClaim) XXX_Merge(src proto.Message) { - xxx_messageInfo_IPClaim.Merge(m, src) -} -func (m *IPClaim) XXX_Size() int { - return m.Size() -} -func (m *IPClaim) XXX_DiscardUnknown() { - xxx_messageInfo_IPClaim.DiscardUnknown(m) -} - -var xxx_messageInfo_IPClaim proto.InternalMessageInfo - -func (m *IPClaimList) Reset() { *m = IPClaimList{} } -func (*IPClaimList) ProtoMessage() {} -func (*IPClaimList) Descriptor() ([]byte, []int) { - return fileDescriptor_13fd918388a77f06, []int{1} -} -func (m *IPClaimList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *IPClaimList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *IPClaimList) XXX_Merge(src proto.Message) { - xxx_messageInfo_IPClaimList.Merge(m, src) -} -func (m *IPClaimList) XXX_Size() int { - return m.Size() -} -func (m *IPClaimList) XXX_DiscardUnknown() { - xxx_messageInfo_IPClaimList.DiscardUnknown(m) -} - -var xxx_messageInfo_IPClaimList proto.InternalMessageInfo - -func (m *IPClaimSpec) Reset() { *m = IPClaimSpec{} } -func (*IPClaimSpec) ProtoMessage() {} -func (*IPClaimSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_13fd918388a77f06, []int{2} -} -func (m *IPClaimSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *IPClaimSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *IPClaimSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_IPClaimSpec.Merge(m, src) -} -func (m *IPClaimSpec) XXX_Size() int { - return m.Size() -} -func (m *IPClaimSpec) XXX_DiscardUnknown() { - xxx_messageInfo_IPClaimSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_IPClaimSpec proto.InternalMessageInfo - -func (m *IPClaimStatus) Reset() { *m = IPClaimStatus{} } -func (*IPClaimStatus) ProtoMessage() {} -func (*IPClaimStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_13fd918388a77f06, []int{3} -} -func (m *IPClaimStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *IPClaimStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *IPClaimStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_IPClaimStatus.Merge(m, src) -} -func (m *IPClaimStatus) XXX_Size() int { - return m.Size() -} -func (m *IPClaimStatus) XXX_DiscardUnknown() { - xxx_messageInfo_IPClaimStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_IPClaimStatus proto.InternalMessageInfo - -func (m *IPEntry) Reset() { *m = IPEntry{} } -func (*IPEntry) ProtoMessage() {} -func (*IPEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_13fd918388a77f06, []int{4} -} -func (m *IPEntry) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *IPEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *IPEntry) XXX_Merge(src proto.Message) { - xxx_messageInfo_IPEntry.Merge(m, src) -} -func (m *IPEntry) XXX_Size() int { - return m.Size() -} -func (m *IPEntry) XXX_DiscardUnknown() { - xxx_messageInfo_IPEntry.DiscardUnknown(m) -} - -var xxx_messageInfo_IPEntry proto.InternalMessageInfo - -func (m *IPEntryList) Reset() { *m = IPEntryList{} } -func (*IPEntryList) ProtoMessage() {} -func (*IPEntryList) Descriptor() ([]byte, []int) { - return fileDescriptor_13fd918388a77f06, []int{5} -} -func (m *IPEntryList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *IPEntryList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *IPEntryList) XXX_Merge(src proto.Message) { - xxx_messageInfo_IPEntryList.Merge(m, src) -} -func (m *IPEntryList) XXX_Size() int { - return m.Size() -} -func (m *IPEntryList) XXX_DiscardUnknown() { - xxx_messageInfo_IPEntryList.DiscardUnknown(m) -} - -var xxx_messageInfo_IPEntryList proto.InternalMessageInfo - -func (m *IPEntrySpec) Reset() { *m = IPEntrySpec{} } -func (*IPEntrySpec) ProtoMessage() {} -func (*IPEntrySpec) Descriptor() ([]byte, []int) { - return fileDescriptor_13fd918388a77f06, []int{6} -} -func (m *IPEntrySpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *IPEntrySpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *IPEntrySpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_IPEntrySpec.Merge(m, src) -} -func (m *IPEntrySpec) XXX_Size() int { - return m.Size() -} -func (m *IPEntrySpec) XXX_DiscardUnknown() { - xxx_messageInfo_IPEntrySpec.DiscardUnknown(m) -} - -var xxx_messageInfo_IPEntrySpec proto.InternalMessageInfo - -func (m *IPEntryStatus) Reset() { *m = IPEntryStatus{} } -func (*IPEntryStatus) ProtoMessage() {} -func (*IPEntryStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_13fd918388a77f06, []int{7} -} -func (m *IPEntryStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *IPEntryStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *IPEntryStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_IPEntryStatus.Merge(m, src) -} -func (m *IPEntryStatus) XXX_Size() int { - return m.Size() -} -func (m *IPEntryStatus) XXX_DiscardUnknown() { - xxx_messageInfo_IPEntryStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_IPEntryStatus proto.InternalMessageInfo - -func (m *IPIndex) Reset() { *m = IPIndex{} } -func (*IPIndex) ProtoMessage() {} -func (*IPIndex) Descriptor() ([]byte, []int) { - return fileDescriptor_13fd918388a77f06, []int{8} -} -func (m *IPIndex) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *IPIndex) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *IPIndex) XXX_Merge(src proto.Message) { - xxx_messageInfo_IPIndex.Merge(m, src) -} -func (m *IPIndex) XXX_Size() int { - return m.Size() -} -func (m *IPIndex) XXX_DiscardUnknown() { - xxx_messageInfo_IPIndex.DiscardUnknown(m) -} - -var xxx_messageInfo_IPIndex proto.InternalMessageInfo - -func (m *IPIndexList) Reset() { *m = IPIndexList{} } -func (*IPIndexList) ProtoMessage() {} -func (*IPIndexList) Descriptor() ([]byte, []int) { - return fileDescriptor_13fd918388a77f06, []int{9} -} -func (m *IPIndexList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *IPIndexList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *IPIndexList) XXX_Merge(src proto.Message) { - xxx_messageInfo_IPIndexList.Merge(m, src) -} -func (m *IPIndexList) XXX_Size() int { - return m.Size() -} -func (m *IPIndexList) XXX_DiscardUnknown() { - xxx_messageInfo_IPIndexList.DiscardUnknown(m) -} - -var xxx_messageInfo_IPIndexList proto.InternalMessageInfo - -func (m *IPIndexSpec) Reset() { *m = IPIndexSpec{} } -func (*IPIndexSpec) ProtoMessage() {} -func (*IPIndexSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_13fd918388a77f06, []int{10} -} -func (m *IPIndexSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *IPIndexSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *IPIndexSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_IPIndexSpec.Merge(m, src) -} -func (m *IPIndexSpec) XXX_Size() int { - return m.Size() -} -func (m *IPIndexSpec) XXX_DiscardUnknown() { - xxx_messageInfo_IPIndexSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_IPIndexSpec proto.InternalMessageInfo - -func (m *IPIndexStatus) Reset() { *m = IPIndexStatus{} } -func (*IPIndexStatus) ProtoMessage() {} -func (*IPIndexStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_13fd918388a77f06, []int{11} -} -func (m *IPIndexStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *IPIndexStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *IPIndexStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_IPIndexStatus.Merge(m, src) -} -func (m *IPIndexStatus) XXX_Size() int { - return m.Size() -} -func (m *IPIndexStatus) XXX_DiscardUnknown() { - xxx_messageInfo_IPIndexStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_IPIndexStatus proto.InternalMessageInfo - -func (m *Prefix) Reset() { *m = Prefix{} } -func (*Prefix) ProtoMessage() {} -func (*Prefix) Descriptor() ([]byte, []int) { - return fileDescriptor_13fd918388a77f06, []int{12} -} -func (m *Prefix) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Prefix) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Prefix) XXX_Merge(src proto.Message) { - xxx_messageInfo_Prefix.Merge(m, src) -} -func (m *Prefix) XXX_Size() int { - return m.Size() -} -func (m *Prefix) XXX_DiscardUnknown() { - xxx_messageInfo_Prefix.DiscardUnknown(m) -} - -var xxx_messageInfo_Prefix proto.InternalMessageInfo - -func init() { - proto.RegisterType((*IPClaim)(nil), "github.com.kuidio.kuid.apis.backend.ipam.v1alpha1.IPClaim") - proto.RegisterType((*IPClaimList)(nil), "github.com.kuidio.kuid.apis.backend.ipam.v1alpha1.IPClaimList") - proto.RegisterType((*IPClaimSpec)(nil), "github.com.kuidio.kuid.apis.backend.ipam.v1alpha1.IPClaimSpec") - proto.RegisterType((*IPClaimStatus)(nil), "github.com.kuidio.kuid.apis.backend.ipam.v1alpha1.IPClaimStatus") - proto.RegisterType((*IPEntry)(nil), "github.com.kuidio.kuid.apis.backend.ipam.v1alpha1.IPEntry") - proto.RegisterType((*IPEntryList)(nil), "github.com.kuidio.kuid.apis.backend.ipam.v1alpha1.IPEntryList") - proto.RegisterType((*IPEntrySpec)(nil), "github.com.kuidio.kuid.apis.backend.ipam.v1alpha1.IPEntrySpec") - proto.RegisterType((*IPEntryStatus)(nil), "github.com.kuidio.kuid.apis.backend.ipam.v1alpha1.IPEntryStatus") - proto.RegisterType((*IPIndex)(nil), "github.com.kuidio.kuid.apis.backend.ipam.v1alpha1.IPIndex") - proto.RegisterType((*IPIndexList)(nil), "github.com.kuidio.kuid.apis.backend.ipam.v1alpha1.IPIndexList") - proto.RegisterType((*IPIndexSpec)(nil), "github.com.kuidio.kuid.apis.backend.ipam.v1alpha1.IPIndexSpec") - proto.RegisterType((*IPIndexStatus)(nil), "github.com.kuidio.kuid.apis.backend.ipam.v1alpha1.IPIndexStatus") - proto.RegisterType((*Prefix)(nil), "github.com.kuidio.kuid.apis.backend.ipam.v1alpha1.Prefix") -} - -func init() { - proto.RegisterFile("github.com/kuidio/kuid/apis/backend/ipam/v1alpha1/generated.proto", fileDescriptor_13fd918388a77f06) -} - -var fileDescriptor_13fd918388a77f06 = []byte{ - // 1087 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x58, 0x4f, 0x6f, 0x1b, 0x45, - 0x14, 0xcf, 0x3a, 0x71, 0x1c, 0x8f, 0x93, 0xa8, 0x19, 0x2e, 0xdb, 0x1c, 0x76, 0x2d, 0x23, 0x90, - 0x2f, 0xec, 0xe2, 0xaa, 0x42, 0xa5, 0x15, 0x11, 0xd9, 0xb4, 0xa0, 0x48, 0x45, 0xb5, 0x86, 0x22, - 0x24, 0x54, 0x89, 0x8e, 0x77, 0xc7, 0xf6, 0x60, 0xef, 0x1f, 0xed, 0xae, 0x13, 0xfb, 0xc6, 0x05, - 0x81, 0x38, 0xf1, 0x01, 0xf8, 0x1e, 0x48, 0x7c, 0x82, 0x1c, 0x38, 0xf4, 0x82, 0xd4, 0xd3, 0x8a, - 0x2c, 0x5f, 0x81, 0x53, 0x4e, 0x68, 0xfe, 0xd8, 0xbb, 0xb6, 0xb1, 0x71, 0x5a, 0xb9, 0x6a, 0x4e, - 0xce, 0xbc, 0x79, 0xef, 0xf7, 0xfe, 0xcc, 0x7b, 0xbf, 0xb7, 0x0a, 0x38, 0xee, 0xd0, 0xb8, 0x3b, - 0x68, 0x19, 0xb6, 0xef, 0x9a, 0xbd, 0x01, 0x75, 0xa8, 0xcf, 0x7f, 0x4c, 0x1c, 0xd0, 0xc8, 0x6c, - 0x61, 0xbb, 0x47, 0x3c, 0xc7, 0xa4, 0x01, 0x76, 0xcd, 0xb3, 0x06, 0xee, 0x07, 0x5d, 0xdc, 0x30, - 0x3b, 0xc4, 0x23, 0x21, 0x8e, 0x89, 0x63, 0x04, 0xa1, 0x1f, 0xfb, 0xb0, 0x91, 0x41, 0x18, 0x02, - 0x82, 0xff, 0x18, 0x0c, 0xc2, 0x90, 0x10, 0x06, 0x83, 0x30, 0xc6, 0x10, 0x87, 0x1f, 0xe4, 0xbc, - 0x76, 0xfc, 0x8e, 0x6f, 0x72, 0xa4, 0xd6, 0xa0, 0xcd, 0x4f, 0xfc, 0xc0, 0xff, 0x12, 0x1e, 0x0e, - 0x1f, 0x2c, 0x0b, 0xd2, 0xf6, 0x5d, 0xd7, 0xf7, 0x16, 0x86, 0x77, 0x78, 0xb4, 0xdc, 0xd8, 0x73, - 0x68, 0x4c, 0x97, 0xd9, 0xdf, 0xed, 0xdd, 0x8b, 0x0c, 0xea, 0x33, 0x7d, 0x17, 0xdb, 0x5d, 0xea, - 0x91, 0x70, 0x64, 0x06, 0xbd, 0x8e, 0x00, 0x70, 0x49, 0x8c, 0xcd, 0xb3, 0x79, 0xab, 0x8f, 0x16, - 0x59, 0x85, 0x03, 0x2f, 0xa6, 0x2e, 0x31, 0x23, 0xbb, 0x4b, 0x5c, 0x3c, 0x6b, 0x57, 0xfb, 0xad, - 0x00, 0x4a, 0xa7, 0xcd, 0x93, 0x3e, 0xa6, 0x2e, 0x7c, 0x0e, 0x76, 0x18, 0xbc, 0x83, 0x63, 0xac, - 0x2a, 0x55, 0xa5, 0x5e, 0xb9, 0xf3, 0xa1, 0x21, 0x60, 0x8d, 0x3c, 0xac, 0x11, 0xf4, 0x3a, 0xa2, - 0xd8, 0x4c, 0xdb, 0x38, 0x6b, 0x18, 0x4f, 0x5a, 0xdf, 0x11, 0x3b, 0xfe, 0x82, 0xc4, 0xd8, 0x82, - 0x17, 0x89, 0xbe, 0x91, 0x26, 0x3a, 0xc8, 0x64, 0x68, 0x82, 0x0a, 0x9f, 0x83, 0xad, 0x28, 0x20, - 0xb6, 0x5a, 0xe0, 0xe8, 0x47, 0xc6, 0xb5, 0x5f, 0xd2, 0x90, 0xb1, 0x7e, 0x19, 0x10, 0xdb, 0xda, - 0x95, 0xbe, 0xb6, 0xd8, 0x09, 0x71, 0x64, 0xd8, 0x05, 0xdb, 0x51, 0x8c, 0xe3, 0x41, 0xa4, 0x6e, - 0x72, 0x1f, 0x9f, 0xbe, 0x86, 0x0f, 0x8e, 0x63, 0xed, 0x4b, 0x2f, 0xdb, 0xe2, 0x8c, 0x24, 0x7e, - 0xed, 0x0f, 0x05, 0x54, 0xa4, 0xe6, 0x63, 0x1a, 0xc5, 0xf0, 0xd9, 0x5c, 0xf5, 0x8c, 0xd5, 0xaa, - 0xc7, 0xac, 0x79, 0xed, 0x6e, 0x49, 0x4f, 0x3b, 0x63, 0x49, 0xae, 0x72, 0xdf, 0x82, 0x22, 0x8d, - 0x89, 0x1b, 0xa9, 0x85, 0xea, 0x66, 0xbd, 0x72, 0xe7, 0xfe, 0xab, 0xa7, 0x65, 0xed, 0x49, 0x37, - 0xc5, 0x53, 0x06, 0x88, 0x04, 0x6e, 0xed, 0xcf, 0xe2, 0x24, 0x1d, 0x56, 0x4e, 0xf8, 0x2e, 0x28, - 0x52, 0xcf, 0x21, 0x43, 0x9e, 0x4b, 0x39, 0x67, 0xc4, 0x84, 0x48, 0xdc, 0xc1, 0x23, 0x00, 0x82, - 0x90, 0xb4, 0xe9, 0xf0, 0xe9, 0x28, 0x20, 0xfc, 0x55, 0xcb, 0x96, 0xc6, 0x5e, 0xbf, 0x39, 0x91, - 0x5e, 0x25, 0xfa, 0xee, 0x69, 0x33, 0x3b, 0xa3, 0x9c, 0x05, 0xac, 0x81, 0x6d, 0x71, 0xe2, 0xaf, - 0x55, 0xb6, 0x00, 0xab, 0xb3, 0xd0, 0x45, 0xf2, 0x06, 0xbe, 0x07, 0x4a, 0xd8, 0x71, 0x42, 0x12, - 0x45, 0xea, 0x16, 0x57, 0xaa, 0xa4, 0x89, 0x5e, 0x3a, 0x16, 0x22, 0x34, 0xbe, 0x83, 0x3a, 0x28, - 0x86, 0xd8, 0xeb, 0x10, 0xb5, 0xc8, 0x95, 0xca, 0x2c, 0x56, 0xc4, 0x04, 0x48, 0xc8, 0xe1, 0x7d, - 0xb0, 0xef, 0x90, 0x36, 0x1e, 0xf4, 0xe3, 0xcf, 0x71, 0x4c, 0xce, 0xf1, 0x48, 0xdd, 0xae, 0x2a, - 0xf5, 0x1d, 0x0b, 0xa6, 0x89, 0xbe, 0xff, 0x70, 0xea, 0x06, 0xcd, 0x68, 0xc2, 0xbb, 0x60, 0xd7, - 0x0e, 0x09, 0x8e, 0x89, 0x88, 0x4d, 0x2d, 0x71, 0xcb, 0x5b, 0x69, 0xa2, 0xef, 0x9e, 0xe4, 0xe4, - 0x68, 0x4a, 0x8b, 0x59, 0x89, 0x1c, 0x1e, 0x13, 0xaf, 0x13, 0x77, 0xd5, 0x9d, 0xaa, 0x52, 0xdf, - 0x13, 0x56, 0xcd, 0x9c, 0x1c, 0x4d, 0x69, 0x41, 0x1b, 0xec, 0xc9, 0x9c, 0x3e, 0xc3, 0x2e, 0xed, - 0x8f, 0xd4, 0x32, 0x4f, 0xe8, 0x93, 0x34, 0xd1, 0xf7, 0x8e, 0xf3, 0x17, 0x57, 0x89, 0x5e, 0xcf, - 0x71, 0x4d, 0x97, 0x78, 0x0e, 0x09, 0xe9, 0xb9, 0x49, 0x83, 0x41, 0x4c, 0xfb, 0xc6, 0x94, 0x2e, - 0x9a, 0xc6, 0x84, 0xb7, 0xc1, 0x26, 0x75, 0x86, 0x2a, 0xe0, 0x11, 0x95, 0xd2, 0x44, 0xdf, 0x3c, - 0x75, 0x86, 0x88, 0xc9, 0xa0, 0x0f, 0x2a, 0x36, 0x6f, 0x6a, 0xdc, 0x22, 0xfd, 0x48, 0xad, 0xf0, - 0x56, 0xbe, 0xb7, 0xb4, 0xdf, 0x04, 0x25, 0x66, 0x9d, 0x76, 0x92, 0xd9, 0x5b, 0xef, 0xc8, 0xc6, - 0xa9, 0xe4, 0x84, 0x28, 0xef, 0x01, 0x3e, 0x03, 0x45, 0xff, 0xdc, 0x23, 0xa1, 0xba, 0xcb, 0x5d, - 0x3d, 0xb8, 0x96, 0xab, 0x27, 0xcc, 0x12, 0x91, 0x36, 0x09, 0x89, 0x67, 0x13, 0xf1, 0xec, 0x42, - 0x26, 0x40, 0x6b, 0xff, 0x14, 0xc0, 0xde, 0xd4, 0x40, 0xc3, 0x9f, 0x15, 0x70, 0x30, 0xe1, 0x61, - 0xe2, 0x08, 0xa9, 0x1c, 0xd9, 0xe3, 0xff, 0x71, 0x2e, 0xad, 0x72, 0xa9, 0xce, 0x02, 0x59, 0xb7, - 0x65, 0xc2, 0x07, 0x73, 0x57, 0x68, 0xde, 0x6d, 0xd6, 0xb6, 0x85, 0x05, 0x6d, 0x9b, 0x6b, 0xff, - 0xcd, 0x25, 0xed, 0x9f, 0x4d, 0xd2, 0xd6, 0xc2, 0x49, 0x9a, 0x9f, 0x00, 0x31, 0x2b, 0xab, 0x4c, - 0x80, 0x01, 0x00, 0x19, 0x06, 0x34, 0x1c, 0x3d, 0xa5, 0x2e, 0xe1, 0x93, 0x53, 0xb6, 0xf6, 0xd9, - 0xa4, 0x3f, 0x9a, 0x48, 0x51, 0x4e, 0x43, 0xee, 0x95, 0x47, 0x5e, 0x1c, 0x8e, 0x6e, 0xc8, 0x5e, - 0xe1, 0xb1, 0xae, 0x79, 0xaf, 0x08, 0x1f, 0xab, 0xec, 0x15, 0xae, 0x79, 0x53, 0xf6, 0x0a, 0x0f, - 0x76, 0xc1, 0x5e, 0xf9, 0xa9, 0x38, 0x49, 0xe7, 0xcd, 0xed, 0x95, 0x23, 0x50, 0xe6, 0x0c, 0xc3, - 0xcd, 0xc5, 0xd8, 0x54, 0xa5, 0xa3, 0xf2, 0xc9, 0xf8, 0xe2, 0x2a, 0xd1, 0xc7, 0x1b, 0x8f, 0x03, - 0x64, 0x26, 0xf0, 0xfd, 0x99, 0x69, 0x9a, 0xbc, 0xd5, 0x4a, 0x13, 0xb5, 0xda, 0x4e, 0x99, 0xe3, - 0xf9, 0xed, 0x35, 0xf0, 0xfc, 0x8f, 0x0a, 0x38, 0x18, 0x44, 0x24, 0x7c, 0x48, 0xda, 0xd4, 0x23, - 0x8e, 0xe4, 0xf4, 0xd2, 0x0a, 0x63, 0x32, 0x4b, 0xb4, 0x5f, 0xcd, 0xa2, 0x64, 0x44, 0x37, 0x77, - 0x85, 0xe6, 0x7d, 0xb2, 0x77, 0xe7, 0xf5, 0xe5, 0x5b, 0x30, 0xf7, 0xee, 0xbc, 0xfe, 0x48, 0xdc, - 0x65, 0xab, 0xa0, 0xbc, 0x8e, 0x55, 0xf0, 0xab, 0xc2, 0x56, 0x41, 0x6e, 0x06, 0xdf, 0xaa, 0x55, - 0x20, 0x29, 0x93, 0xcf, 0xc1, 0x0d, 0xa1, 0x4c, 0x1e, 0xeb, 0x9a, 0x29, 0x53, 0xf8, 0x58, 0x85, - 0x32, 0xb9, 0xe6, 0x4d, 0xa1, 0x4c, 0x1e, 0xec, 0x02, 0xca, 0x3c, 0x9b, 0x64, 0xc3, 0x19, 0xb3, - 0x03, 0x76, 0x04, 0xdd, 0x10, 0xd6, 0x9a, 0xcc, 0xe5, 0xc7, 0xaf, 0xe0, 0x52, 0x30, 0x57, 0x96, - 0x58, 0x53, 0x42, 0xa2, 0x09, 0x78, 0xed, 0x07, 0xfe, 0xa9, 0x94, 0x2b, 0xf8, 0xdb, 0xf5, 0xa9, - 0x94, 0xaf, 0x43, 0x61, 0x9d, 0x75, 0xf8, 0x5d, 0x01, 0x92, 0xe8, 0x73, 0x8b, 0x40, 0x59, 0xba, - 0x08, 0xfe, 0x9b, 0x67, 0x0b, 0x6f, 0x9e, 0x67, 0xad, 0xaf, 0x2f, 0x2e, 0xb5, 0x8d, 0x17, 0x97, - 0xda, 0xc6, 0xcb, 0x4b, 0x6d, 0xe3, 0xfb, 0x54, 0x53, 0x2e, 0x52, 0x4d, 0x79, 0x91, 0x6a, 0xca, - 0xcb, 0x54, 0x53, 0xfe, 0x4a, 0x35, 0xe5, 0x97, 0xbf, 0xb5, 0x8d, 0x6f, 0x1a, 0xd7, 0xfe, 0x37, - 0xcc, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x69, 0x3f, 0xce, 0x77, 0xba, 0x11, 0x00, 0x00, -} - -func (m *IPClaim) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *IPClaim) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *IPClaim) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *IPClaimList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *IPClaimList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *IPClaimList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *IPClaimSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *IPClaimSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *IPClaimSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Owner != nil { - { - size, err := m.Owner.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x62 - } - { - size, err := m.ClaimLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x5a - if m.Idx != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.Idx)) - i-- - dAtA[i] = 0x50 - } - if m.AddressFamily != nil { - i -= len(*m.AddressFamily) - copy(dAtA[i:], *m.AddressFamily) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.AddressFamily))) - i-- - dAtA[i] = 0x4a - } - if m.PrefixLength != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.PrefixLength)) - i-- - dAtA[i] = 0x40 - } - if m.CreatePrefix != nil { - i-- - if *m.CreatePrefix { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x38 - } - if m.DefaultGateway != nil { - i-- - if *m.DefaultGateway { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x30 - } - if m.Range != nil { - i -= len(*m.Range) - copy(dAtA[i:], *m.Range) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Range))) - i-- - dAtA[i] = 0x2a - } - if m.Address != nil { - i -= len(*m.Address) - copy(dAtA[i:], *m.Address) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Address))) - i-- - dAtA[i] = 0x22 - } - if m.Prefix != nil { - i -= len(*m.Prefix) - copy(dAtA[i:], *m.Prefix) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Prefix))) - i-- - dAtA[i] = 0x1a - } - if m.PrefixType != nil { - i -= len(*m.PrefixType) - copy(dAtA[i:], *m.PrefixType) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.PrefixType))) - i-- - dAtA[i] = 0x12 - } - i -= len(m.Index) - copy(dAtA[i:], m.Index) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Index))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *IPClaimStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *IPClaimStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *IPClaimStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ExpiryTime != nil { - i -= len(*m.ExpiryTime) - copy(dAtA[i:], *m.ExpiryTime) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ExpiryTime))) - i-- - dAtA[i] = 0x32 - } - if m.DefaultGateway != nil { - i -= len(*m.DefaultGateway) - copy(dAtA[i:], *m.DefaultGateway) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.DefaultGateway))) - i-- - dAtA[i] = 0x2a - } - if m.Prefix != nil { - i -= len(*m.Prefix) - copy(dAtA[i:], *m.Prefix) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Prefix))) - i-- - dAtA[i] = 0x22 - } - if m.Address != nil { - i -= len(*m.Address) - copy(dAtA[i:], *m.Address) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Address))) - i-- - dAtA[i] = 0x1a - } - if m.Range != nil { - i -= len(*m.Range) - copy(dAtA[i:], *m.Range) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Range))) - i-- - dAtA[i] = 0x12 - } - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *IPEntry) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *IPEntry) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *IPEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *IPEntryList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *IPEntryList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *IPEntryList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *IPEntrySpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *IPEntrySpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *IPEntrySpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Owner != nil { - { - size, err := m.Owner.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x4a - } - i -= len(m.Claim) - copy(dAtA[i:], m.Claim) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Claim))) - i-- - dAtA[i] = 0x42 - { - size, err := m.UserDefinedLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - if m.AddressFamily != nil { - i -= len(*m.AddressFamily) - copy(dAtA[i:], *m.AddressFamily) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.AddressFamily))) - i-- - dAtA[i] = 0x32 - } - if m.DefaultGateway != nil { - i-- - if *m.DefaultGateway { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x28 - } - i -= len(m.Prefix) - copy(dAtA[i:], m.Prefix) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Prefix))) - i-- - dAtA[i] = 0x22 - i -= len(m.ClaimType) - copy(dAtA[i:], m.ClaimType) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.ClaimType))) - i-- - dAtA[i] = 0x1a - if m.PrefixType != nil { - i -= len(*m.PrefixType) - copy(dAtA[i:], *m.PrefixType) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.PrefixType))) - i-- - dAtA[i] = 0x12 - } - i -= len(m.Index) - copy(dAtA[i:], m.Index) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Index))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *IPEntryStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *IPEntryStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *IPEntryStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *IPIndex) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *IPIndex) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *IPIndex) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *IPIndexList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *IPIndexList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *IPIndexList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *IPIndexSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *IPIndexSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *IPIndexSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Prefixes) > 0 { - for iNdEx := len(m.Prefixes) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Prefixes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *IPIndexStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *IPIndexStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *IPIndexStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Prefixes) > 0 { - for iNdEx := len(m.Prefixes) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Prefixes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Prefix) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Prefix) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Prefix) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.UserDefinedLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - i -= len(m.Prefix) - copy(dAtA[i:], m.Prefix) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Prefix))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { - offset -= sovGenerated(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *IPClaim) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *IPClaimList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *IPClaimSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Index) - n += 1 + l + sovGenerated(uint64(l)) - if m.PrefixType != nil { - l = len(*m.PrefixType) - n += 1 + l + sovGenerated(uint64(l)) - } - if m.Prefix != nil { - l = len(*m.Prefix) - n += 1 + l + sovGenerated(uint64(l)) - } - if m.Address != nil { - l = len(*m.Address) - n += 1 + l + sovGenerated(uint64(l)) - } - if m.Range != nil { - l = len(*m.Range) - n += 1 + l + sovGenerated(uint64(l)) - } - if m.DefaultGateway != nil { - n += 2 - } - if m.CreatePrefix != nil { - n += 2 - } - if m.PrefixLength != nil { - n += 1 + sovGenerated(uint64(*m.PrefixLength)) - } - if m.AddressFamily != nil { - l = len(*m.AddressFamily) - n += 1 + l + sovGenerated(uint64(l)) - } - if m.Idx != nil { - n += 1 + sovGenerated(uint64(*m.Idx)) - } - l = m.ClaimLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.Owner != nil { - l = m.Owner.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *IPClaimStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.Range != nil { - l = len(*m.Range) - n += 1 + l + sovGenerated(uint64(l)) - } - if m.Address != nil { - l = len(*m.Address) - n += 1 + l + sovGenerated(uint64(l)) - } - if m.Prefix != nil { - l = len(*m.Prefix) - n += 1 + l + sovGenerated(uint64(l)) - } - if m.DefaultGateway != nil { - l = len(*m.DefaultGateway) - n += 1 + l + sovGenerated(uint64(l)) - } - if m.ExpiryTime != nil { - l = len(*m.ExpiryTime) - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *IPEntry) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *IPEntryList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *IPEntrySpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Index) - n += 1 + l + sovGenerated(uint64(l)) - if m.PrefixType != nil { - l = len(*m.PrefixType) - n += 1 + l + sovGenerated(uint64(l)) - } - l = len(m.ClaimType) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Prefix) - n += 1 + l + sovGenerated(uint64(l)) - if m.DefaultGateway != nil { - n += 2 - } - if m.AddressFamily != nil { - l = len(*m.AddressFamily) - n += 1 + l + sovGenerated(uint64(l)) - } - l = m.UserDefinedLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Claim) - n += 1 + l + sovGenerated(uint64(l)) - if m.Owner != nil { - l = m.Owner.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *IPEntryStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *IPIndex) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *IPIndexList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *IPIndexSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Prefixes) > 0 { - for _, e := range m.Prefixes { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *IPIndexStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Prefixes) > 0 { - for _, e := range m.Prefixes { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *Prefix) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Prefix) - n += 1 + l + sovGenerated(uint64(l)) - l = m.UserDefinedLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func sovGenerated(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenerated(x uint64) (n int) { - return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *IPClaim) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&IPClaim{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "IPClaimSpec", "IPClaimSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "IPClaimStatus", "IPClaimStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *IPClaimList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]IPClaim{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "IPClaim", "IPClaim", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&IPClaimList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *IPClaimSpec) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&IPClaimSpec{`, - `Index:` + fmt.Sprintf("%v", this.Index) + `,`, - `PrefixType:` + valueToStringGenerated(this.PrefixType) + `,`, - `Prefix:` + valueToStringGenerated(this.Prefix) + `,`, - `Address:` + valueToStringGenerated(this.Address) + `,`, - `Range:` + valueToStringGenerated(this.Range) + `,`, - `DefaultGateway:` + valueToStringGenerated(this.DefaultGateway) + `,`, - `CreatePrefix:` + valueToStringGenerated(this.CreatePrefix) + `,`, - `PrefixLength:` + valueToStringGenerated(this.PrefixLength) + `,`, - `AddressFamily:` + valueToStringGenerated(this.AddressFamily) + `,`, - `Idx:` + valueToStringGenerated(this.Idx) + `,`, - `ClaimLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ClaimLabels), "ClaimLabels", "v1alpha1.ClaimLabels", 1), `&`, ``, 1) + `,`, - `Owner:` + strings.Replace(fmt.Sprintf("%v", this.Owner), "OwnerReference", "v1alpha1.OwnerReference", 1) + `,`, - `}`, - }, "") - return s -} -func (this *IPClaimStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&IPClaimStatus{`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `Range:` + valueToStringGenerated(this.Range) + `,`, - `Address:` + valueToStringGenerated(this.Address) + `,`, - `Prefix:` + valueToStringGenerated(this.Prefix) + `,`, - `DefaultGateway:` + valueToStringGenerated(this.DefaultGateway) + `,`, - `ExpiryTime:` + valueToStringGenerated(this.ExpiryTime) + `,`, - `}`, - }, "") - return s -} -func (this *IPEntry) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&IPEntry{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "IPEntrySpec", "IPEntrySpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "IPEntryStatus", "IPEntryStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *IPEntryList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]IPEntry{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "IPEntry", "IPEntry", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&IPEntryList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *IPEntrySpec) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&IPEntrySpec{`, - `Index:` + fmt.Sprintf("%v", this.Index) + `,`, - `PrefixType:` + valueToStringGenerated(this.PrefixType) + `,`, - `ClaimType:` + fmt.Sprintf("%v", this.ClaimType) + `,`, - `Prefix:` + fmt.Sprintf("%v", this.Prefix) + `,`, - `DefaultGateway:` + valueToStringGenerated(this.DefaultGateway) + `,`, - `AddressFamily:` + valueToStringGenerated(this.AddressFamily) + `,`, - `UserDefinedLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.UserDefinedLabels), "UserDefinedLabels", "v1alpha1.UserDefinedLabels", 1), `&`, ``, 1) + `,`, - `Claim:` + fmt.Sprintf("%v", this.Claim) + `,`, - `Owner:` + strings.Replace(fmt.Sprintf("%v", this.Owner), "OwnerReference", "v1alpha1.OwnerReference", 1) + `,`, - `}`, - }, "") - return s -} -func (this *IPEntryStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&IPEntryStatus{`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *IPIndex) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&IPIndex{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "IPIndexSpec", "IPIndexSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "IPIndexStatus", "IPIndexStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *IPIndexList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]IPIndex{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "IPIndex", "IPIndex", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&IPIndexList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *IPIndexSpec) String() string { - if this == nil { - return "nil" - } - repeatedStringForPrefixes := "[]Prefix{" - for _, f := range this.Prefixes { - repeatedStringForPrefixes += strings.Replace(strings.Replace(f.String(), "Prefix", "Prefix", 1), `&`, ``, 1) + "," - } - repeatedStringForPrefixes += "}" - s := strings.Join([]string{`&IPIndexSpec{`, - `Prefixes:` + repeatedStringForPrefixes + `,`, - `}`, - }, "") - return s -} -func (this *IPIndexStatus) String() string { - if this == nil { - return "nil" - } - repeatedStringForPrefixes := "[]Prefix{" - for _, f := range this.Prefixes { - repeatedStringForPrefixes += strings.Replace(strings.Replace(f.String(), "Prefix", "Prefix", 1), `&`, ``, 1) + "," - } - repeatedStringForPrefixes += "}" - s := strings.Join([]string{`&IPIndexStatus{`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `Prefixes:` + repeatedStringForPrefixes + `,`, - `}`, - }, "") - return s -} -func (this *Prefix) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Prefix{`, - `Prefix:` + fmt.Sprintf("%v", this.Prefix) + `,`, - `UserDefinedLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.UserDefinedLabels), "UserDefinedLabels", "v1alpha1.UserDefinedLabels", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func valueToStringGenerated(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *IPClaim) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: IPClaim: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IPClaim: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *IPClaimList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: IPClaimList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IPClaimList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, IPClaim{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *IPClaimSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: IPClaimSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IPClaimSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Index = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PrefixType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := IPPrefixType(dAtA[iNdEx:postIndex]) - m.PrefixType = &s - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Prefix", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Prefix = &s - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Address = &s - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Range", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Range = &s - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DefaultGateway", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.DefaultGateway = &b - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CreatePrefix", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.CreatePrefix = &b - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PrefixLength", wireType) - } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.PrefixLength = &v - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AddressFamily", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := github_com_henderiw_iputil.AddressFamily(dAtA[iNdEx:postIndex]) - m.AddressFamily = &s - iNdEx = postIndex - case 10: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Idx", wireType) - } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Idx = &v - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ClaimLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 12: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Owner == nil { - m.Owner = &v1alpha1.OwnerReference{} - } - if err := m.Owner.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *IPClaimStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: IPClaimStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IPClaimStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Range", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Range = &s - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Address = &s - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Prefix", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Prefix = &s - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DefaultGateway", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.DefaultGateway = &s - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExpiryTime", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.ExpiryTime = &s - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *IPEntry) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: IPEntry: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IPEntry: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *IPEntryList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: IPEntryList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IPEntryList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, IPEntry{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *IPEntrySpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: IPEntrySpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IPEntrySpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Index = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PrefixType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := IPPrefixType(dAtA[iNdEx:postIndex]) - m.PrefixType = &s - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClaimType = IPClaimType(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Prefix", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Prefix = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DefaultGateway", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.DefaultGateway = &b - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AddressFamily", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := github_com_henderiw_iputil.AddressFamily(dAtA[iNdEx:postIndex]) - m.AddressFamily = &s - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UserDefinedLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.UserDefinedLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Claim", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Claim = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Owner == nil { - m.Owner = &v1alpha1.OwnerReference{} - } - if err := m.Owner.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *IPEntryStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: IPEntryStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IPEntryStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *IPIndex) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: IPIndex: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IPIndex: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *IPIndexList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: IPIndexList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IPIndexList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, IPIndex{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *IPIndexSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: IPIndexSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IPIndexSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Prefixes", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Prefixes = append(m.Prefixes, Prefix{}) - if err := m.Prefixes[len(m.Prefixes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *IPIndexStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: IPIndexStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IPIndexStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Prefixes", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Prefixes = append(m.Prefixes, Prefix{}) - if err := m.Prefixes[len(m.Prefixes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Prefix) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Prefix: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Prefix: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Prefix", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Prefix = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UserDefinedLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.UserDefinedLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenerated(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenerated - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenerated - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenerated - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") -) diff --git a/apis/backend/ipam/v1alpha1/generated.proto b/apis/backend/ipam/v1alpha1/generated.proto deleted file mode 100644 index c63785c..0000000 --- a/apis/backend/ipam/v1alpha1/generated.proto +++ /dev/null @@ -1,250 +0,0 @@ -/* -Copyright 2024 Nokia. - -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. -*/ -// This file was autogenerated by go-to-protobuf. Do not edit it manually! - -syntax = "proto2"; - -package github.com.kuidio.kuid.apis.backend.ipam.v1alpha1; - -import "github.com/kuidio/kuid/apis/common/v1alpha1/generated.proto"; -import "github.com/kuidio/kuid/apis/condition/v1alpha1/generated.proto"; -import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; -import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; - -// Package-wide variables from generator "generated". -option go_package = "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1"; - -// IPClaim is the Schema for the ipclaim API -// -// +k8s:openapi-gen=true -message IPClaim { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional IPClaimSpec spec = 2; - - optional IPClaimStatus status = 3; -} - -// IPClaimList contains a list of IPClaims -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message IPClaimList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated IPClaim items = 2; -} - -// IPClaimSpec defines the desired state of IPClaim -message IPClaimSpec { - // Index defines the index for the IP Entry - optional string index = 1; - - // PrefixType defines the prefixtype of IPEntry; for address and range claims this is not relevant - // - network kind is used for physical, virtual nics on a device - // - pool kind is used for allocating dedicated IP addresses - // - aggregate kind is used for claiming an aggregate prefix; only used for networkInstance prefixes - // +kubebuilder:validation:Enum=`network`;`aggregate`;`pool`; - // +optional - optional string prefixType = 2; - - // Prefix defines the prefix for the IP claim - // +optional - optional string prefix = 3; - - // Address defines the address for the IP claim - // +optional - optional string address = 4; - - // Range defines the range for the IP claim - // +optional - optional string range = 5; - - // DefaultGateway defines if the address acts as a default gateway - // +optional - optional bool defaultGateway = 6; - - // CreatePrefix defines if this prefix must be created. Only used for dynamic prefixes - // e.g. non /32 ipv4 and non /128 ipv6 prefixes - // +optional - optional bool createPrefix = 7; - - // PrefixLength defines the prefix length for the IP Claim, Must be set when CreatePrefic is set - // If not present we use assume /32 for ipv4 and /128 for ipv6 - // +optional - optional uint32 prefixLength = 8; - - // AddressFamily defines the address family for the IP claim - // +kubebuilder:validation:Enum=`ipv4`;`ipv6` - // +kubebuilder:validation:Optional - // +optional - optional string addressFamily = 9; - - // Index defines the index of the IP Claim, used to get a deterministic IP from a prefix - // If not present we claim a random prefix from a prefix - // +kubebuilder:validation:Optional - // +optional - optional uint32 idx = 10; - - // ClaimLabels define the user defined labels and selector labels used - // in resource claim - optional github.com.kuidio.kuid.apis.common.v1alpha1.ClaimLabels claimLabels = 11; - - // Owner defines the ownerReference of the IPClaim - // Allow for different namesapces, hence it is part of the spec - optional github.com.kuidio.kuid.apis.common.v1alpha1.OwnerReference owner = 12; -} - -// IPClaimStatus defines the observed state of IPClaim -message IPClaimStatus { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 1; - - // Range defines the range, claimed through the IPAM backend - // +optional - optional string range = 2; - - // Address defines the address, claimed through the IPAM backend - // +optional - optional string address = 3; - - // Prefix defines the prefix, claimed through the IPAM backend - // +optional - optional string prefix = 4; - - // DefaultGateway defines the default gateway IP for the claimed prefix - // DefaultGateway is only relevant for prefix kind = network - // +optional - optional string defaultGateway = 5; - - // ExpiryTime defines when the claim expires - // +kubebuilder:validation:Optional - // +optional - optional string expiryTime = 6; -} - -// IPEntry is the Schema for the ipentry API -// -// +k8s:openapi-gen=true -message IPEntry { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional IPEntrySpec spec = 2; - - optional IPEntryStatus status = 3; -} - -// IPEntryList contains a list of IPEntries -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message IPEntryList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated IPEntry items = 2; -} - -// IPEntrySpec defines the desired state of IPEntry -message IPEntrySpec { - // Index defines the index for the IP Entry - optional string index = 1; - - // PrefixType defines the prefixtype of IPEntry; for address and range claims this is not relevant - // - network kind is used for physical, virtual nics on a device - // - pool kind is used for allocating dedicated IP addresses - // - aggregate kind is used for claiming an aggregate prefix; only used for networkInstance prefixes - // +kubebuilder:validation:Enum=`network`;`aggregate`;`pool`; - // +optional - optional string prefixType = 2; - - // ClaimType defines the claimType of the IP Entry - // +kubebuilder:validation:Enum=`staticAddress`;`staticPrefix`;`staticRange`;`dynamicPrefix`;`dynamicAddress`; - optional string claimType = 3; - - // Prefix defines the prefix for the IP entry; which can be an expanded prefix from the prefix, range or address - optional string prefix = 4; - - // DefaultGateway defines if the address acts as a default gateway - // +optional - optional bool defaultGateway = 5; - - // AddressFamily defines the address family for the IP claim - // +kubebuilder:validation:Enum=`ipv4`;`ipv6` - // +kubebuilder:validation:Optional - // +optional - optional string addressFamily = 6; - - // UserDefinedLabels define the user defined labels - optional github.com.kuidio.kuid.apis.common.v1alpha1.UserDefinedLabels userDefinedLabels = 7; - - // Claim defines the name of the ip claim that is the origin of this ip entry - optional string claim = 8; - - // Owner defines the ownerReference of the IPENtry - // Allow for different namesapces, hence it is part of the spec - optional github.com.kuidio.kuid.apis.common.v1alpha1.OwnerReference owner = 9; -} - -// IPEntryStatus defines the observed state of IPEntry -message IPEntryStatus { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 1; -} - -// IPIndex is the Schema for the IPIndex API -// -// +k8s:openapi-gen=true -message IPIndex { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional IPIndexSpec spec = 2; - - optional IPIndexStatus status = 3; -} - -// IPIndexList contains a list of IPIndexs -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message IPIndexList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated IPIndex items = 2; -} - -// IPIndexSpec defines the desired state of IPIndex -message IPIndexSpec { - // Prefixes define the aggregate prefixes for the network instance - // A Network instance needs at least 1 prefix to be defined to become operational - repeated Prefix prefixes = 1; -} - -// IPIndexStatus defines the observed state of IPIndex -message IPIndexStatus { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 1; - - // Prefixes defines the prefixes, claimed through the IPAM backend - repeated Prefix prefixes = 2; -} - -message Prefix { - // Prefix defines the ip cidr in prefix notation. - // +kubebuilder:validation:Pattern=`(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))|((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))` - optional string prefix = 1; - - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - optional github.com.kuidio.kuid.apis.common.v1alpha1.UserDefinedLabels userDefinedLabels = 2; -} - diff --git a/apis/backend/ipam/v1alpha1/ipam_types.go b/apis/backend/ipam/v1alpha1/ipam_types.go deleted file mode 100644 index d6c9b07..0000000 --- a/apis/backend/ipam/v1alpha1/ipam_types.go +++ /dev/null @@ -1,94 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "k8s.io/utils/ptr" -) - -type IPClaimType string - -const ( - IPClaimType_Invalid IPClaimType = "invalid" - IPClaimType_StaticAddress IPClaimType = "staticAddress" - IPClaimType_StaticPrefix IPClaimType = "staticPrefix" - IPClaimType_StaticRange IPClaimType = "staticRange" - IPClaimType_DynamicAddress IPClaimType = "dynamicAddress" - IPClaimType_DynamicPrefix IPClaimType = "dynamicPrefix" -) - -func GetIPClaimTypeFromString(s string) IPClaimType { - switch s { - case string(IPClaimType_StaticAddress): - return IPClaimType_StaticAddress - case string(IPClaimType_StaticPrefix): - return IPClaimType_StaticPrefix - case string(IPClaimType_StaticRange): - return IPClaimType_StaticRange - case string(IPClaimType_DynamicAddress): - return IPClaimType_DynamicAddress - case string(IPClaimType_DynamicPrefix): - return IPClaimType_DynamicPrefix - default: - return IPClaimType_Invalid - } -} - -type IPClaimSummaryType string - -const ( - IPClaimSummaryType_Prefix IPClaimSummaryType = "prefix" - IPClaimSummaryType_Address IPClaimSummaryType = "address" - IPClaimSummaryType_Range IPClaimSummaryType = "range" - IPClaimSummaryType_Invalid IPClaimSummaryType = "invalid" -) - -func GetIPClaimSummaryTypeFromString(s string) IPClaimSummaryType { - switch s { - case string(IPClaimSummaryType_Prefix): - return IPClaimSummaryType_Prefix - case string(IPClaimSummaryType_Address): - return IPClaimSummaryType_Address - case string(IPClaimSummaryType_Range): - return IPClaimSummaryType_Range - default: - return IPClaimSummaryType_Invalid - } -} - -type IPPrefixType string - -const ( - IPPrefixType_Invalid IPPrefixType = "invalid" - IPPrefixType_Other IPPrefixType = "other" - IPPrefixType_Pool IPPrefixType = "pool" - IPPrefixType_Network IPPrefixType = "network" - IPPrefixType_Aggregate IPPrefixType = "aggregate" -) - -func GetIPPrefixTypeFromString(s string) *IPPrefixType { - switch s { - case string(IPPrefixType_Pool): - return ptr.To[IPPrefixType](IPPrefixType_Pool) - case string(IPPrefixType_Network): - return ptr.To[IPPrefixType](IPPrefixType_Network) - case string(IPPrefixType_Aggregate): - return ptr.To[IPPrefixType](IPPrefixType_Aggregate) - default: - return nil - } -} diff --git a/apis/backend/ipam/v1alpha1/ipclaim_interface.go b/apis/backend/ipam/v1alpha1/ipclaim_interface.go deleted file mode 100644 index 4d0c8fc..0000000 --- a/apis/backend/ipam/v1alpha1/ipclaim_interface.go +++ /dev/null @@ -1,529 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "crypto/sha1" - "encoding/json" - "fmt" - "strings" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/apiserver-store/pkg/generic/registry" - "github.com/henderiw/idxtable/pkg/table" - "github.com/henderiw/idxtable/pkg/tree" - "github.com/henderiw/iputil" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/selection" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" -) - -const IPClaimPlural = "ipclaims" -const IPClaimSingular = "ipclaim" - -// +k8s:deepcopy-gen=false -var _ resource.Object = &IPClaim{} -var _ resource.ObjectList = &IPClaimList{} - -var _ resource.ObjectWithStatusSubResource = &IPClaim{} - -func (IPClaimStatus) SubResourceName() string { - return fmt.Sprintf("%s/%s", IPClaimPlural, "status") -} - -func (r IPClaimStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { - cfg, ok := obj.(*IPClaim) - if ok { - cfg.Status = r - } -} - -func (r *IPClaim) GetStatus() resource.StatusSubResource { - return r.Status -} - -// GetListMeta returns the ListMeta -func (r *IPClaimList) GetListMeta() *metav1.ListMeta { - return &r.ListMeta -} - -func (r *IPClaim) GetSingularName() string { - return IPClaimSingular -} - -func (IPClaim) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Resource: IPClaimPlural, - } -} - -// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. -// IsStorageVersion implements resource.Object. -func (IPClaim) IsStorageVersion() bool { - return true -} - -// GetObjectMeta implements resource.Object -func (r *IPClaim) GetObjectMeta() *metav1.ObjectMeta { - return &r.ObjectMeta -} - -// NamespaceScoped returns true to indicate Fortune is a namespaced resource. -// NamespaceScoped implements resource.Object. -func (IPClaim) NamespaceScoped() bool { - return true -} - -// New implements resource.Object -func (IPClaim) New() runtime.Object { - return &IPClaim{} -} - -// NewList implements resource.Object -func (IPClaim) NewList() runtime.Object { - return &IPClaimList{} -} - -// GetCondition returns the condition based on the condition kind -func (r *IPClaim) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { - return r.Status.GetCondition(t) -} - -// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions -// to be set at once -func (r *IPClaim) SetConditions(c ...conditionv1alpha1.Condition) { - r.Status.SetConditions(c...) -} - -// IPClaimConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for IPClaim -func IPClaimConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { - switch label { - case "metadata.name": - return label, value, nil - case "metadata.namespace": - return label, value, nil - case "spec.networkInstance": - return label, value, nil - default: - return "", "", fmt.Errorf("%q is not a known field selector", label) - } -} - -func (r *IPClaimList) GetItems() []backend.Object { - objs := []backend.Object{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *IPClaim) CalculateHash() ([sha1.Size]byte, error) { - // Convert the struct to JSON - jsonData, err := json.Marshal(r) - if err != nil { - return [sha1.Size]byte{}, err - } - - // Calculate SHA-1 hash - return sha1.Sum(jsonData), nil -} - -func (r *IPClaim) GetNamespacedName() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.GetNamespace(), - Name: r.GetName(), - } -} - -func (r *IPClaim) GetKey() store.Key { - return store.KeyFromNSN(types.NamespacedName{Namespace: r.Namespace, Name: r.Spec.Index}) -} - -func (r *IPClaim) GetIndex() string { - return r.Spec.Index -} - -func (r *IPClaim) GetSelector() *metav1.LabelSelector { - return r.Spec.Selector -} - -func (r *IPClaim) GetOwnerReference() *commonv1alpha1.OwnerReference { - return &commonv1alpha1.OwnerReference{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Kind: r.Kind, - Namespace: r.Namespace, - Name: r.Name, - } -} - -func (r *IPClaim) GetIPPrefixType() IPPrefixType { - if r.Spec.PrefixType == nil { - return IPPrefixType_Other - } - switch *r.Spec.PrefixType { - case IPPrefixType_Aggregate, IPPrefixType_Network, IPPrefixType_Pool: - return *r.Spec.PrefixType - default: - return IPPrefixType_Invalid - } -} - -func (r *IPClaim) GetStaticID() *uint64 { return nil } - -func (r *IPClaim) GetStaticTreeID(t string) tree.ID { return nil } - -func (r *IPClaim) GetClaimID(t string, id uint64) tree.ID { return nil } - -func (r *IPClaim) GetRange() *string { - return r.Spec.Range -} - -func (r *IPClaim) GetRangeID(_ string) (tree.Range, error) { return nil, fmt.Errorf("not supported") } - -func (r *IPClaim) GetTable(s string, to, from uint64) table.Table { - return nil -} - -func (r *IPClaim) GetClaimRequest() string { - // we assume validation is already done when calling this - if r.Spec.Address != nil { - return *r.Spec.Address - } - if r.Spec.Prefix != nil { - return *r.Spec.Prefix - } - if r.Spec.Range != nil { - return *r.Spec.Range - } - return "" -} - -func (r *IPClaim) GetClaimResponse() string { - // we assume validation is already done when calling this - if r.Status.Address != nil { - return *r.Status.Address - } - if r.Status.Prefix != nil { - return *r.Status.Prefix - } - if r.Status.Range != nil { - return *r.Status.Range - } - return "" -} - -func (r *IPClaim) GetIPClaimType() (IPClaimType, error) { - claimType := IPClaimType_Invalid - var sb strings.Builder - count := 0 - if r.Spec.Address != nil { - sb.WriteString(fmt.Sprintf("address: %s", *r.Spec.Address)) - claimType = IPClaimType_StaticAddress - count++ - - } - if r.Spec.Prefix != nil { - if count > 0 { - sb.WriteString(", ") - } - sb.WriteString(fmt.Sprintf("prefix: %s", *r.Spec.Prefix)) - claimType = IPClaimType_StaticPrefix - count++ - - } - if r.Spec.Range != nil { - if count > 0 { - sb.WriteString(", ") - } - sb.WriteString(fmt.Sprintf("range: %s", *r.Spec.Range)) - claimType = IPClaimType_StaticRange - count++ - } - if count > 1 { - return IPClaimType_Invalid, fmt.Errorf("an ipclaim can only have 1 claimType, got %s", sb.String()) - } - if count == 0 { - if r.Spec.CreatePrefix != nil { - return IPClaimType_DynamicPrefix, nil - } else { - return IPClaimType_DynamicAddress, nil - } - } - return claimType, nil -} - -func (r *IPClaim) GetIPClaimSummaryType() IPClaimSummaryType { - ipClaimType, err := r.GetIPClaimType() - if err != nil { - return IPClaimSummaryType_Invalid - } - switch ipClaimType { - case IPClaimType_DynamicAddress, IPClaimType_StaticAddress: - return IPClaimSummaryType_Address - case IPClaimType_DynamicPrefix, IPClaimType_StaticPrefix: - return IPClaimSummaryType_Prefix - case IPClaimType_StaticRange: - return IPClaimSummaryType_Range - default: - return IPClaimSummaryType_Invalid - } -} - -func (r *IPClaim) ValidateSyntax(_ string) field.ErrorList { - var allErrs field.ErrorList - - gv, err := schema.ParseGroupVersion(r.APIVersion) - if err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("apiVersion"), - r, - fmt.Errorf("invalid apiVersion: err: %s", err.Error()).Error(), - )) - return allErrs - } - - // this is for user convenience - if r.Spec.Owner == nil { - r.Spec.Owner = &commonv1alpha1.OwnerReference{ - Group: gv.Group, - Version: gv.Version, - Kind: r.Kind, - Namespace: r.Namespace, - Name: r.Name, - } - } - - ipClaimType, err := r.GetIPClaimType() - if err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath(""), - r, - err.Error(), - )) - return allErrs - } - var v SyntaxValidator - switch ipClaimType { - case IPClaimType_StaticAddress: - v = &staticAddressSyntaxValidator{name: "staticIPAddress"} - case IPClaimType_StaticPrefix: - v = &staticPrefixSyntaxValidator{name: "staticIPprefix"} - case IPClaimType_StaticRange: - v = &staticRangeSyntaxValidator{name: "staticIPRange"} - case IPClaimType_DynamicAddress: - v = &dynamicAddressSyntaxValidator{name: "dynamicIPRange"} - case IPClaimType_DynamicPrefix: - v = &dynamicPrefixSyntaxValidator{name: "dynamicIPprefix"} - default: - return allErrs - } - return v.Validate(r) -} - -func (r *IPClaim) ValidateOwner(labels labels.Set) error { - routeClaimName := labels[backend.KuidClaimNameKey] - routeOwner := commonv1alpha1.OwnerReference{ - Group: labels[backend.KuidOwnerGroupKey], - Version: labels[backend.KuidOwnerVersionKey], - Kind: labels[backend.KuidOwnerKindKey], - Namespace: labels[backend.KuidOwnerNamespaceKey], - Name: labels[backend.KuidOwnerNameKey], - } - if (r.Spec.Owner != nil && *r.Spec.Owner != routeOwner) || r.Name != routeClaimName { - return fmt.Errorf("route owned by different claim got name %s/%s owner %s/%s", - r.Name, - routeClaimName, - r.Spec.Owner.String(), - routeOwner.String(), - ) - } - return nil -} - -// GetDummyLabelsFromPrefix returns a map with the labels from the spec -// augmented with the prefixkind and the subnet from the prefixInfo -func (r *IPClaim) GetDummyLabelsFromPrefix(pi iputil.Prefix) map[string]string { - labels := map[string]string{} - for k, v := range r.Spec.GetUserDefinedLabels() { - labels[k] = v - } - labels[backend.KuidIPAMIPPrefixTypeKey] = string(r.GetIPPrefixType()) - labels[backend.KuidIPAMClaimSummaryTypeKey] = string(r.GetIPClaimSummaryType()) - labels[backend.KuidIPAMSubnetKey] = string(pi.GetSubnetName()) - - return labels -} - -// GetLabelSelector returns a labels selector based on the label selector -func (r *IPClaim) GetLabelSelector() (labels.Selector, error) { - return r.Spec.GetLabelSelector() -} - -func (r *IPClaim) GetClaimType() backend.ClaimType { - return backend.ClaimType_Invalid -} - -func (r *IPClaim) GetClaimLabels() labels.Set { - claimType, _ := r.GetIPClaimType() // ignoring error is ok since this was validated before - - labels := r.Spec.GetUserDefinedLabels() - // system defined labels - labels[backend.KuidClaimTypeKey] = string(claimType) - labels[backend.KuidClaimNameKey] = r.Name - labels[backend.KuidOwnerGroupKey] = r.Spec.Owner.Group - labels[backend.KuidOwnerVersionKey] = r.Spec.Owner.Version - labels[backend.KuidOwnerKindKey] = r.Spec.Owner.Kind - labels[backend.KuidOwnerNamespaceKey] = r.Spec.Owner.Namespace - labels[backend.KuidOwnerNameKey] = r.Spec.Owner.Name - return labels -} - -// GetOwnerSelector returns a label selector to select the owner of the claim in the backend -func (r *IPClaim) GetOwnerSelector() (labels.Selector, error) { - l := map[string]string{ - backend.KuidOwnerGroupKey: r.Spec.Owner.Group, - backend.KuidOwnerVersionKey: r.Spec.Owner.Version, - backend.KuidOwnerKindKey: r.Spec.Owner.Kind, - backend.KuidOwnerNamespaceKey: r.Spec.Owner.Namespace, - backend.KuidOwnerNameKey: r.Spec.Owner.Name, - backend.KuidClaimNameKey: r.Name, - } - - fullselector := labels.NewSelector() - for k, v := range l { - req, err := labels.NewRequirement(k, selection.Equals, []string{v}) - if err != nil { - return nil, err - } - fullselector = fullselector.Add(*req) - } - return fullselector, nil -} - -// GetGatewayLabelSelector returns a label selector to select the gateway of the claim in the backend -func (r *IPClaim) GetDefaultGatewayLabelSelector(subnetString string) (labels.Selector, error) { - l := map[string]string{ - backend.KuidIPAMDefaultGatewayKey: "true", - backend.KuidIPAMSubnetKey: subnetString, - } - fullselector := labels.NewSelector() - for k, v := range l { - req, err := labels.NewRequirement(k, selection.Equals, []string{v}) - if err != nil { - return nil, err - } - fullselector = fullselector.Add(*req) - } - return fullselector, nil -} - -// BuildIPClaim returns a reource from a client Object a Spec/Status -func BuildIPClaim(meta metav1.ObjectMeta, spec *IPClaimSpec, status *IPClaimStatus) *IPClaim { - aspec := IPClaimSpec{} - if spec != nil { - aspec = *spec - } - astatus := IPClaimStatus{} - if status != nil { - astatus = *status - } - return &IPClaim{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: IPClaimKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -func (r *IPClaim) SetStatusRange(s *string) { r.Status.Range = s } - -func (r *IPClaim) SetStatusID(s *uint64) {} - -func (r *IPClaim) GetStatusID() *uint64 { return nil } - -func IPClaimTableConvertor(gr schema.GroupResource) registry.TableConvertor { - return registry.TableConvertor{ - Resource: gr, - Cells: func(obj runtime.Object) []interface{} { - ipclaim, ok := obj.(*IPClaim) - if !ok { - return nil - } - ipClaimType, _ := ipclaim.GetIPClaimType() - return []interface{}{ - ipclaim.Name, - ipclaim.GetCondition(conditionv1alpha1.ConditionTypeReady).Status, - ipclaim.Spec.Index, - string(ipClaimType), - string(ipclaim.GetIPPrefixType()), - ipclaim.GetClaimRequest(), - ipclaim.GetClaimResponse(), - ipclaim.Status.DefaultGateway, - } - }, - Columns: []metav1.TableColumnDefinition{ - {Name: "Name", Type: "string"}, - {Name: "Ready", Type: "string"}, - {Name: "Index", Type: "string"}, - {Name: "ClaimType", Type: "string"}, - {Name: "PrefixType", Type: "string"}, - {Name: "ClaimReq", Type: "string"}, - {Name: "ClaimRsp", Type: "string"}, - {Name: "DefaultGateway", Type: "string"}, - }, - } -} - -func (r *IPClaim) GetSpec() any { - return r.Spec -} - -func (r *IPClaim) SetSpec(s any) { - if spec, ok := s.(IPClaimSpec); ok { - r.Spec = spec - } -} - -func (r *IPClaim) NewObjList() backend.GenericObjectList { - return &IPClaimList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: IPClaimListKind}, - } -} - -func (r *IPClaimList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} diff --git a/apis/backend/ipam/v1alpha1/ipclaim_syntaxvalidator_dynamic_address.go b/apis/backend/ipam/v1alpha1/ipclaim_syntaxvalidator_dynamic_address.go deleted file mode 100644 index aa0436d..0000000 --- a/apis/backend/ipam/v1alpha1/ipclaim_syntaxvalidator_dynamic_address.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - fmt "fmt" - - "k8s.io/apimachinery/pkg/util/validation/field" -) - -type dynamicAddressSyntaxValidator struct { - name string -} - -func (r *dynamicAddressSyntaxValidator) Validate(claim *IPClaim) field.ErrorList { - var allErrs field.ErrorList - - ipPrefixType := claim.GetIPPrefixType() - if ipPrefixType == IPPrefixType_Invalid { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.type"), - claim, - fmt.Errorf("%s, invalid claim type, got %s", r.name, string(ipPrefixType)).Error(), - )) - } - - if claim.Spec.DefaultGateway != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.defaultGateway"), - claim, - fmt.Errorf("%s cannot have a defaultGateway", r.name).Error(), - )) - - } - if claim.Spec.CreatePrefix != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.createPrefix"), - claim, - fmt.Errorf("%s cannot have a createPrefix", r.name).Error(), - )) - } - if claim.Spec.PrefixLength != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.prefixLength"), - claim, - fmt.Errorf("%s cannot have a prefixLength", r.name).Error(), - )) - } - - return allErrs -} diff --git a/apis/backend/ipam/v1alpha1/ipclaim_syntaxvalidator_dynamic_prefix.go b/apis/backend/ipam/v1alpha1/ipclaim_syntaxvalidator_dynamic_prefix.go deleted file mode 100644 index dff674a..0000000 --- a/apis/backend/ipam/v1alpha1/ipclaim_syntaxvalidator_dynamic_prefix.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - fmt "fmt" - - "k8s.io/apimachinery/pkg/util/validation/field" -) - -type dynamicPrefixSyntaxValidator struct { - name string -} - -func (r *dynamicPrefixSyntaxValidator) Validate(claim *IPClaim) field.ErrorList { - var allErrs field.ErrorList - - ipPrefixType := claim.GetIPPrefixType() - if ipPrefixType == IPPrefixType_Invalid { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.type"), - claim, - fmt.Errorf("%s, invalid claim type, got %s", r.name, string(ipPrefixType)).Error(), - )) - } - - if claim.Spec.DefaultGateway != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.defaultGateway"), - claim, - fmt.Errorf("%s cannot have a defaultGateway", r.name).Error(), - )) - - } - if claim.Spec.CreatePrefix == nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.createPrefix"), - claim, - fmt.Errorf("%s must have a createPrefix", r.name).Error(), - )) - } - if claim.Spec.PrefixLength == nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.prefixLength"), - claim, - fmt.Errorf("%s must have a prefixLength", r.name).Error(), - )) - } - - return allErrs -} - -/* -func (r *dynamicClaimSyntaxValidator) ValidateSyntax(_ context.Context, claim *ipambev1alpha1.IPClaim) field.ErrorList { - var allErrs field.ErrorList - // dynamic entries with aggregate prefix kind not supported - if claim.Spec.Kind == ipambev1alpha1.PrefixKindAggregate { - allErrs = append(allErrs, field.Invalid( - field.NewPath(""), - claim, - fmt.Sprintf("a dynamic prefix claim is not supported for: %s", claim.Spec.Kind), - )) - return allErrs - } - // a dynamic prefix claim has to set the prefixLength - if claim.Spec.CreatePrefix != nil && claim.Spec.PrefixLength == nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.prefixLength"), - claim, - "a dynamic prefix claim has to specify the prefixLength", - )) - return allErrs - } - if claim.Spec.PrefixLength != nil && claim.Spec.CreatePrefix == nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.createPrefix"), - claim, - "a dynamic prefix with prefixLength set has to also set a createPrefix", - )) - return allErrs - } - // TODO Pool - return allErrs -} -*/ diff --git a/apis/backend/ipam/v1alpha1/ipclaim_syntaxvalidator_static_address.go b/apis/backend/ipam/v1alpha1/ipclaim_syntaxvalidator_static_address.go deleted file mode 100644 index ad1812e..0000000 --- a/apis/backend/ipam/v1alpha1/ipclaim_syntaxvalidator_static_address.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - fmt "fmt" - - "github.com/henderiw/iputil" - "k8s.io/apimachinery/pkg/util/validation/field" -) - -type staticAddressSyntaxValidator struct { - name string -} - -func (r *staticAddressSyntaxValidator) Validate(claim *IPClaim) field.ErrorList { - var allErrs field.ErrorList - if claim.Spec.Address == nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.address"), - claim, - fmt.Errorf("%s requires a address", r.name).Error(), - )) - } - pi, err := iputil.New(*claim.Spec.Address) - if err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.address"), - claim, - fmt.Errorf("%s invalid prefix; err %s", r.name, err.Error()).Error(), - )) - } - if pi.IsAddressPrefix() { // - if claim.Spec.DefaultGateway != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.defaultGateway"), - claim, - fmt.Errorf("%s cannot have a defaultGateway on a prefix which is not a network type", r.name).Error(), - )) - } - - } else { - if !((pi.GetAddressFamily() == iputil.AddressFamilyIpv4 && pi.GetPrefixLength().Int() == 31) || - (pi.GetAddressFamily() == iputil.AddressFamilyIpv6 && pi.GetPrefixLength().Int() == 127)) { - if !pi.IsNorLastNorFirst() { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.prefix"), - claim, - fmt.Errorf("%s cannot have a address that is the first or last address in a prefix based address", r.name).Error(), - )) - } - } - } - - if claim.Spec.CreatePrefix != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.createPrefix"), - claim, - fmt.Errorf("%s cannot have a createPrefix", r.name).Error(), - )) - } - if claim.Spec.PrefixLength != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.prefixLength"), - claim, - fmt.Errorf("%s cannot have a prefixLength", r.name).Error(), - )) - } - if claim.Spec.AddressFamily != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.addressFamily"), - claim, - fmt.Errorf("%s cannot have a addressFamily", r.name).Error(), - )) - } - if claim.Spec.Idx != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.index"), - claim, - fmt.Errorf("%s cannot have a index", r.name).Error(), - )) - } - return allErrs -} diff --git a/apis/backend/ipam/v1alpha1/ipclaim_syntaxvalidator_static_prefix.go b/apis/backend/ipam/v1alpha1/ipclaim_syntaxvalidator_static_prefix.go deleted file mode 100644 index e2ca3b4..0000000 --- a/apis/backend/ipam/v1alpha1/ipclaim_syntaxvalidator_static_prefix.go +++ /dev/null @@ -1,111 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - fmt "fmt" - - "github.com/henderiw/iputil" - "k8s.io/apimachinery/pkg/util/validation/field" - "k8s.io/utils/ptr" -) - -type staticPrefixSyntaxValidator struct { - name string -} - -func (r *staticPrefixSyntaxValidator) Validate(claim *IPClaim) field.ErrorList { - var allErrs field.ErrorList - if claim.Spec.Prefix == nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.prefix"), - claim, - fmt.Errorf("%s requires a prefix", r.name).Error(), - )) - } - pi, err := iputil.New(*claim.Spec.Prefix) - if err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.prefix"), - claim, - fmt.Errorf("%s invalid prefix; err %s", r.name, err.Error()).Error(), - )) - } - // this is for user convenience - if claim.Spec.CreatePrefix == nil { - claim.Spec.CreatePrefix = ptr.To[bool](true) - } - if claim.Spec.PrefixLength == nil { - claim.Spec.PrefixLength = ptr.To[uint32](uint32(pi.GetPrefixLength())) - } - if pi.IsAddressPrefix() { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.prefix"), - claim, - fmt.Sprintf("%s invalid prefix, no /32 for ipv4 or /128 for ipv6 notationallowed, got %s", r.name, *claim.Spec.Prefix), - )) - } - ipPrefixType := claim.GetIPPrefixType() - if ipPrefixType == IPPrefixType_Invalid { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.type"), - claim, - fmt.Errorf("%s, invalid claim type, got %s", r.name, string(ipPrefixType)).Error(), - )) - } - if ipPrefixType != IPPrefixType_Network { - if pi.GetIPSubnet().String() != pi.GetIPPrefix().String() { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.prefix"), - claim, - fmt.Sprintf("%s, invalid prefix net <> address is not allowed for claimType: %s", r.name, string(ipPrefixType)), - )) - } - } - - if claim.Spec.DefaultGateway != nil { - if ipPrefixType != IPPrefixType_Network { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.type"), - claim, - fmt.Errorf("%s cannot have a defaultGateway on a prefix which is not a network type", r.name).Error(), - )) - } - if !pi.IsNorLastNorFirst() { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.prefix"), - claim, - fmt.Errorf("%s cannot have a defaultGateway on a prefix which is the first or last ip in the prefix", r.name).Error(), - )) - } - } - if claim.Spec.AddressFamily != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.addressFamily"), - claim, - fmt.Errorf("%s cannot have a addressFamily", r.name).Error(), - )) - } - if claim.Spec.Idx != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.index"), - claim, - fmt.Errorf("%s cannot have a index", r.name).Error(), - )) - } - return allErrs -} diff --git a/apis/backend/ipam/v1alpha1/ipclaim_syntaxvalidator_static_range.go b/apis/backend/ipam/v1alpha1/ipclaim_syntaxvalidator_static_range.go deleted file mode 100644 index 923a97e..0000000 --- a/apis/backend/ipam/v1alpha1/ipclaim_syntaxvalidator_static_range.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "fmt" - - "go4.org/netipx" - "k8s.io/apimachinery/pkg/util/validation/field" -) - -type staticRangeSyntaxValidator struct { - name string -} - -func (r *staticRangeSyntaxValidator) Validate(claim *IPClaim) field.ErrorList { - var allErrs field.ErrorList - if claim.Spec.Range == nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.range"), - claim, - fmt.Errorf("%s requires a range", r.name).Error(), - )) - } - if _, err := netipx.ParseIPRange(*claim.Spec.Range); err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.range"), - claim, - fmt.Errorf("%s invalid range; err %s", r.name, err.Error()).Error(), - )) - } - ipPrefixType := claim.GetIPPrefixType() - if ipPrefixType != IPPrefixType_Other { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.type"), - claim, - fmt.Errorf("%s invalid claim, expecting %s, got %s", r.name, string(IPPrefixType_Other), string(ipPrefixType)).Error(), - )) - } - if claim.Spec.DefaultGateway != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.defaultGateway"), - claim, - fmt.Errorf("%s cannot have a defaultGateway", r.name).Error(), - )) - } - if claim.Spec.CreatePrefix != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.createPrefix"), - claim, - fmt.Errorf("%s cannot have a createPrefix", r.name).Error(), - )) - } - if claim.Spec.PrefixLength != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.prefixLength"), - claim, - fmt.Errorf("%s cannot have a prefixLength", r.name).Error(), - )) - } - if claim.Spec.AddressFamily != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.addressFamily"), - claim, - fmt.Errorf("%s cannot have a addressFamily", r.name).Error(), - )) - } - if claim.Spec.Idx != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.index"), - claim, - fmt.Errorf("%s cannot have a index", r.name).Error(), - )) - } - return allErrs -} diff --git a/apis/backend/ipam/v1alpha1/ipclaim_types.go b/apis/backend/ipam/v1alpha1/ipclaim_types.go deleted file mode 100644 index 7ecdc11..0000000 --- a/apis/backend/ipam/v1alpha1/ipclaim_types.go +++ /dev/null @@ -1,126 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "reflect" - - "github.com/henderiw/iputil" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// IPClaimSpec defines the desired state of IPClaim -type IPClaimSpec struct { - // Index defines the index for the IP Entry - Index string `json:"index" yaml:"index" protobuf:"bytes,1,opt,name=index"` - // PrefixType defines the prefixtype of IPEntry; for address and range claims this is not relevant - // - network kind is used for physical, virtual nics on a device - // - pool kind is used for allocating dedicated IP addresses - // - aggregate kind is used for claiming an aggregate prefix; only used for networkInstance prefixes - // +kubebuilder:validation:Enum=`network`;`aggregate`;`pool`; - // +optional - PrefixType *IPPrefixType `json:"prefixType,omitempty" yaml:"prefixType,omitempty" protobuf:"bytes,2,opt,name=prefixType"` - // Prefix defines the prefix for the IP claim - // +optional - Prefix *string `json:"prefix,omitempty" yaml:"prefix,omitempty" protobuf:"bytes,3,opt,name=prefix"` - // Address defines the address for the IP claim - // +optional - Address *string `json:"address,omitempty" yaml:"address,omitempty" protobuf:"bytes,4,opt,name=address"` - // Range defines the range for the IP claim - // +optional - Range *string `json:"range,omitempty" yaml:"range,omitempty" protobuf:"bytes,5,opt,name=range"` - // DefaultGateway defines if the address acts as a default gateway - // +optional - DefaultGateway *bool `json:"defaultGateway,omitempty" yaml:"defaultGateway,omitempty" protobuf:"varint,6,opt,name=defaultGateway"` - // CreatePrefix defines if this prefix must be created. Only used for dynamic prefixes - // e.g. non /32 ipv4 and non /128 ipv6 prefixes - // +optional - CreatePrefix *bool `json:"createPrefix,omitempty" yaml:"createPrefix,omitempty" protobuf:"varint,7,opt,name=createPrefix"` - // PrefixLength defines the prefix length for the IP Claim, Must be set when CreatePrefic is set - // If not present we use assume /32 for ipv4 and /128 for ipv6 - // +optional - PrefixLength *uint32 `json:"prefixLength,omitempty" yaml:"prefixLength,omitempty" protobuf:"varint,8,opt,name=prefixLength"` - // AddressFamily defines the address family for the IP claim - // +kubebuilder:validation:Enum=`ipv4`;`ipv6` - // +kubebuilder:validation:Optional - // +optional - AddressFamily *iputil.AddressFamily `json:"addressFamily,omitempty" yaml:"addressFamily,omitempty" protobuf:"bytes,9,opt,name=addressFamily"` - // Index defines the index of the IP Claim, used to get a deterministic IP from a prefix - // If not present we claim a random prefix from a prefix - // +kubebuilder:validation:Optional - // +optional - Idx *uint32 `json:"idx,omitempty" yaml:"idx,omitempty" protobuf:"varint,10,opt,name=idx"` - // ClaimLabels define the user defined labels and selector labels used - // in resource claim - commonv1alpha1.ClaimLabels `json:",inline" yaml:",inline" protobuf:"bytes,11,opt,name=claimLabels"` - // Owner defines the ownerReference of the IPClaim - // Allow for different namesapces, hence it is part of the spec - Owner *commonv1alpha1.OwnerReference `json:"owner,omitempty" yaml:"owner,omitempty" protobuf:"bytes,12,opt,name=owner"` -} - -// IPClaimStatus defines the observed state of IPClaim -type IPClaimStatus struct { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` - // Range defines the range, claimed through the IPAM backend - // +optional - Range *string `json:"range,omitempty" yaml:"range,omitempty" protobuf:"bytes,2,opt,name=range"` - // Address defines the address, claimed through the IPAM backend - // +optional - Address *string `json:"address,omitempty" yaml:"address,omitempty" protobuf:"bytes,3,opt,name=address"` - // Prefix defines the prefix, claimed through the IPAM backend - // +optional - Prefix *string `json:"prefix,omitempty" yaml:"prefix,omitempty" protobuf:"bytes,4,opt,name=prefix"` - // DefaultGateway defines the default gateway IP for the claimed prefix - // DefaultGateway is only relevant for prefix kind = network - // +optional - DefaultGateway *string `json:"defaultGateway,omitempty" yaml:"defaultGateway,omitempty" protobuf:"bytes,5,opt,name=defaultGateway"` - // ExpiryTime defines when the claim expires - // +kubebuilder:validation:Optional - // +optional - ExpiryTime *string `json:"expiryTime,omitempty" yaml:"expiryTime,omitempty" protobuf:"bytes,6,opt,name=expiryTime"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// IPClaim is the Schema for the ipclaim API -// -// +k8s:openapi-gen=true -type IPClaim struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - Spec IPClaimSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - Status IPClaimStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// IPClaimList contains a list of IPClaims -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type IPClaimList struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []IPClaim `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` -} - -var ( - IPClaimKind = reflect.TypeOf(IPClaim{}).Name() - IPClaimListKind = reflect.TypeOf(IPClaimList{}).Name() -) diff --git a/apis/backend/ipam/v1alpha1/ipentry_interface.go b/apis/backend/ipam/v1alpha1/ipentry_interface.go deleted file mode 100644 index 0caf9de..0000000 --- a/apis/backend/ipam/v1alpha1/ipentry_interface.go +++ /dev/null @@ -1,338 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "crypto/sha1" - "encoding/json" - "fmt" - "net/netip" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/apiserver-store/pkg/generic/registry" - "github.com/henderiw/iputil" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" - "k8s.io/utils/ptr" -) - -const IPEntryPlural = "ipentries" -const IPEntrySingular = "ipentry" - -// +k8s:deepcopy-gen=false -var _ resource.Object = &IPEntry{} -var _ resource.ObjectList = &IPEntryList{} - -// GetListMeta returns the ListMeta -func (r *IPEntryList) GetListMeta() *metav1.ListMeta { - return &r.ListMeta -} - -func (r *IPEntryList) GetItems() []backend.Object { - entries := make([]backend.Object, 0, len(r.Items)) - for _, entry := range r.Items { - entries = append(entries, &entry) - } - return entries -} - -func (r *IPEntry) GetSingularName() string { - return IPEntrySingular -} - -func (IPEntry) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Resource: IPEntryPlural, - } -} - -// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. -// IsStorageVersion implements resource.Object. -func (IPEntry) IsStorageVersion() bool { - return true -} - -// GetObjectMeta implements resource.Object -func (r *IPEntry) GetObjectMeta() *metav1.ObjectMeta { - return &r.ObjectMeta -} - -// NamespaceScoped returns true to indicate Fortune is a namespaced resource. -// NamespaceScoped implements resource.Object. -func (IPEntry) NamespaceScoped() bool { - return true -} - -// New implements resource.Object -func (IPEntry) New() runtime.Object { - return &IPEntry{} -} - -// NewList implements resource.Object -func (IPEntry) NewList() runtime.Object { - return &IPEntryList{} -} - -// GetCondition returns the condition based on the condition kind -func (r *IPEntry) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { - return r.Status.GetCondition(t) -} - -// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions -// to be set at once -func (r *IPEntry) SetConditions(c ...conditionv1alpha1.Condition) { - r.Status.SetConditions(c...) -} - -// IPEntryConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for IPEntry -func IPEntryConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { - switch label { - case "metadata.name": - return label, value, nil - case "metadata.namespace": - return label, value, nil - case "spec.networkInstance": - return label, value, nil - default: - return "", "", fmt.Errorf("%q is not a known field selector", label) - } -} - -func (r *IPEntry) CalculateHash() ([sha1.Size]byte, error) { - // Convert the struct to JSON - jsonData, err := json.Marshal(r) - if err != nil { - return [sha1.Size]byte{}, err - } - - // Calculate SHA-1 hash - return sha1.Sum(jsonData), nil -} - -func (r *IPEntry) GetNamespacedName() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.GetNamespace(), - Name: r.GetName(), - } -} - -func (r *IPEntry) GetKey() store.Key { - return store.KeyFromNSN(types.NamespacedName{Namespace: r.Namespace, Name: r.Spec.Index}) -} - -func (r *IPEntry) GetIndex() string { - return r.Spec.Index -} - -func (r *IPEntry) GetOwnerReference() *commonv1alpha1.OwnerReference { - return r.Spec.Owner -} - -func (r *IPEntry) GetClaimName() string { - return r.Spec.Claim -} - -// dummy to satisfy the interface -func (r *IPEntry) GetClaimType() backend.ClaimType { - return backend.ClaimType_Invalid -} - -func (r *IPEntry) GetClaimSummaryType() IPClaimSummaryType { - switch r.Spec.ClaimType { - case IPClaimType_DynamicAddress, IPClaimType_StaticAddress: - return IPClaimSummaryType_Address - case IPClaimType_DynamicPrefix, IPClaimType_StaticPrefix: - return IPClaimSummaryType_Prefix - case IPClaimType_StaticRange: - return IPClaimSummaryType_Range - default: - return IPClaimSummaryType_Invalid - } -} - -func (r *IPEntry) GetIPPrefixType() IPPrefixType { - if r.Spec.PrefixType == nil { - return IPPrefixType_Other - } - switch *r.Spec.PrefixType { - case IPPrefixType_Aggregate, IPPrefixType_Network, IPPrefixType_Pool: - return *r.Spec.PrefixType - default: - return IPPrefixType_Invalid - } -} - -func (r *IPEntry) GetIPPrefix() string { - return r.Spec.Prefix -} - -func (r *IPEntry) GetOwnerGVK() schema.GroupVersionKind { - return schema.GroupVersionKind{ - Group: r.Spec.Owner.Group, - Version: r.Spec.Owner.Version, - Kind: r.Spec.Owner.Kind, - } -} - -func (r *IPEntry) GetOwnerNSN() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.Spec.Owner.Namespace, - Name: r.Spec.Owner.Name, - } -} - -func (r *IPEntry) GetSpecID() string { - return r.Spec.Prefix -} - -func (r *IPEntry) GetSpec() any { - return r.Spec -} - -func (r *IPEntry) SetSpec(s any) { - if spec, ok := s.(IPEntrySpec); ok { - r.Spec = spec - } -} - -func GetIPEntry(ctx context.Context, k store.Key, prefix netip.Prefix, labels map[string]string) backend.EntryObject { - //log := log.FromContext(ctx) - pi := iputil.NewPrefixInfo(prefix) - - index := k.Name - ns := k.Namespace - - spec := &IPEntrySpec{ - Index: index, - PrefixType: GetIPPrefixTypeFromString(labels[backend.KuidIPAMIPPrefixTypeKey]), - ClaimType: GetIPClaimTypeFromString(labels[backend.KuidClaimTypeKey]), - AddressFamily: ptr.To[iputil.AddressFamily](pi.GetAddressFamily()), - Prefix: pi.String(), - Claim: labels[backend.KuidClaimNameKey], - Owner: &commonv1alpha1.OwnerReference{ - Group: labels[backend.KuidOwnerGroupKey], - Version: labels[backend.KuidOwnerVersionKey], - Kind: labels[backend.KuidOwnerKindKey], - Namespace: labels[backend.KuidOwnerNamespaceKey], - Name: labels[backend.KuidOwnerNameKey], - }, - } - if _, ok := labels[backend.KuidIPAMDefaultGatewayKey]; ok { - spec.DefaultGateway = ptr.To[bool](true) - } - // filter the system defined labels from the labels to prepare for the user defined labels - udLabels := map[string]string{} - for k, v := range labels { - if !backend.BackendSystemKeys.Has(k) && !backend.BackendIPAMSystemKeys.Has(k) { - udLabels[k] = v - } - } - spec.UserDefinedLabels.Labels = udLabels - - status := &IPEntryStatus{} - status.SetConditions(conditionv1alpha1.Ready()) - - return BuildIPEntry( - metav1.ObjectMeta{ - Name: fmt.Sprintf("%s.%s", index, pi.GetSubnetName()), - Namespace: ns, - }, - spec, - status, - ) -} - -// BuildIPEntry returns a reource from a client Object a Spec/Status -func BuildIPEntry(meta metav1.ObjectMeta, spec *IPEntrySpec, status *IPEntryStatus) *IPEntry { - aspec := IPEntrySpec{} - if spec != nil { - aspec = *spec - } - astatus := IPEntryStatus{} - if status != nil { - astatus = *status - } - return &IPEntry{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: IPEntryKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -func IPEntryTableConvertor(gr schema.GroupResource) registry.TableConvertor { - return registry.TableConvertor{ - Resource: gr, - Cells: func(obj runtime.Object) []interface{} { - ipentry, ok := obj.(*IPEntry) - if !ok { - return nil - } - return []interface{}{ - ipentry.Name, - ipentry.GetCondition(conditionv1alpha1.ConditionTypeReady).Status, - ipentry.Spec.Index, - ipentry.Spec.ClaimType, - string(ipentry.GetIPPrefixType()), - ipentry.GetIPPrefix(), - ipentry.Spec.DefaultGateway, - } - }, - Columns: []metav1.TableColumnDefinition{ - {Name: "Name", Type: "string"}, - {Name: "Ready", Type: "string"}, - {Name: "NetworkInstance", Type: "string"}, - {Name: "ClaimType", Type: "string"}, - {Name: "PrefixType", Type: "string"}, - {Name: "Prefix", Type: "string"}, - {Name: "DefaultGateway", Type: "string"}, - }, - } -} - -func (r *IPEntry) ValidateSyntax(_ string) field.ErrorList { - var allErrs field.ErrorList - return allErrs -} - -func (r *IPEntry) NewObjList() backend.GenericObjectList { - return &IPEntryList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: IPEntryListKind}, - } -} - -func (r *IPEntryList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} diff --git a/apis/backend/ipam/v1alpha1/ipentry_interface_test.go b/apis/backend/ipam/v1alpha1/ipentry_interface_test.go deleted file mode 100644 index e60fa1e..0000000 --- a/apis/backend/ipam/v1alpha1/ipentry_interface_test.go +++ /dev/null @@ -1,71 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "fmt" - "testing" - - "github.com/henderiw/iputil" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - "github.com/stretchr/testify/assert" - "k8s.io/apimachinery/pkg/types" -) - -func TestGetIPEntry(t *testing.T) { - tests := map[string]struct { - name string - namespace string - prefix string - labels map[string]string - }{ - "Normal": { - name: "a", - namespace: "b", - prefix: "10.0.0.0/24", - labels: map[string]string{ - backend.KuidOwnerVersionKey: "v1alpha1", - backend.KuidOwnerKindKey: "ipam.res.kuid.dev", - backend.KuidOwnerNameKey: "vpc1.10.0.0.0-24", - backend.KuidOwnerNamespaceKey: "default", - backend.KuidClaimNameKey: "10.0.0.0-24", - backend.KuidIPAMSubnetKey: "10.0.0.0-24", - backend.KuidIPAMIndexKey: "1", - backend.KuidIPAMDefaultGatewayKey: "true", - "x": "y", - }, - }, - } - - for name, tc := range tests { - t.Run(name, func(t *testing.T) { - prefix, err := iputil.New(tc.prefix) - if err != nil { - assert.Error(t, err) - } - - ipEntry := GetIPEntry(context.TODO(), store.KeyFromNSN(types.NamespacedName{ - Name: tc.name, - Namespace: tc.namespace, - }), prefix.Prefix, tc.labels) - - fmt.Println("ipEntry", ipEntry) - }) - } -} diff --git a/apis/backend/ipam/v1alpha1/ipentry_types.go b/apis/backend/ipam/v1alpha1/ipentry_types.go deleted file mode 100644 index e3bea3b..0000000 --- a/apis/backend/ipam/v1alpha1/ipentry_types.go +++ /dev/null @@ -1,93 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "reflect" - - "github.com/henderiw/iputil" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// IPEntrySpec defines the desired state of IPEntry -type IPEntrySpec struct { - // Index defines the index for the IP Entry - Index string `json:"index" yaml:"index" protobuf:"bytes,1,opt,name=index"` - // PrefixType defines the prefixtype of IPEntry; for address and range claims this is not relevant - // - network kind is used for physical, virtual nics on a device - // - pool kind is used for allocating dedicated IP addresses - // - aggregate kind is used for claiming an aggregate prefix; only used for networkInstance prefixes - // +kubebuilder:validation:Enum=`network`;`aggregate`;`pool`; - // +optional - PrefixType *IPPrefixType `json:"prefixType,omitempty" yaml:"prefixType,omitempty" protobuf:"bytes,2,opt,name=prefixType"` - // ClaimType defines the claimType of the IP Entry - // +kubebuilder:validation:Enum=`staticAddress`;`staticPrefix`;`staticRange`;`dynamicPrefix`;`dynamicAddress`; - ClaimType IPClaimType `json:"claimType,omitempty" yaml:"claimType,omitempty" protobuf:"bytes,3,opt,name=claimType"` - // Prefix defines the prefix for the IP entry; which can be an expanded prefix from the prefix, range or address - Prefix string `json:"prefix" yaml:"prefix" protobuf:"bytes,4,opt,name=prefix"` - // DefaultGateway defines if the address acts as a default gateway - // +optional - DefaultGateway *bool `json:"defaultGateway,omitempty" yaml:"defaultGateway,omitempty" protobuf:"varint,5,opt,name=defaultGateway"` - // AddressFamily defines the address family for the IP claim - // +kubebuilder:validation:Enum=`ipv4`;`ipv6` - // +kubebuilder:validation:Optional - // +optional - AddressFamily *iputil.AddressFamily `json:"addressFamily,omitempty" yaml:"addressFamily,omitempty" protobuf:"bytes,6,opt,name=addressFamily"` - // UserDefinedLabels define the user defined labels - commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,7,opt,name=userDefinedLabels"` - // Claim defines the name of the ip claim that is the origin of this ip entry - Claim string `json:"claim" yaml:"claim" protobuf:"bytes,8,opt,name=claim"` - // Owner defines the ownerReference of the IPENtry - // Allow for different namesapces, hence it is part of the spec - Owner *commonv1alpha1.OwnerReference `json:"owner,omitempty" yaml:"owner,omitempty" protobuf:"bytes,9,opt,name=owner"` -} - -// IPEntryStatus defines the observed state of IPEntry -type IPEntryStatus struct { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// IPEntry is the Schema for the ipentry API -// -// +k8s:openapi-gen=true -type IPEntry struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - Spec IPEntrySpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - Status IPEntryStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// IPEntryList contains a list of IPEntries -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type IPEntryList struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []IPEntry `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` -} - -var ( - IPEntryKind = reflect.TypeOf(IPEntry{}).Name() - IPEntryListKind = reflect.TypeOf(IPEntryList{}).Name() -) diff --git a/apis/backend/ipam/v1alpha1/ipindex_interface.go b/apis/backend/ipam/v1alpha1/ipindex_interface.go deleted file mode 100644 index 6276c73..0000000 --- a/apis/backend/ipam/v1alpha1/ipindex_interface.go +++ /dev/null @@ -1,333 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "crypto/sha1" - "encoding/json" - "fmt" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/apiserver-store/pkg/generic/registry" - "github.com/henderiw/idxtable/pkg/tree/gtree" - "github.com/henderiw/iputil" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" - "k8s.io/utils/ptr" - "sigs.k8s.io/controller-runtime/pkg/client" -) - -const IPIndexPlural = "ipindices" -const IPIndexSingular = "ipindex" - -// +k8s:deepcopy-gen=false -var _ resource.Object = &IPIndex{} -var _ resource.ObjectList = &IPIndexList{} - -// GetListMeta returns the ListMeta -func (r *IPIndexList) GetListMeta() *metav1.ListMeta { - return &r.ListMeta -} - -func (r *IPIndex) GetSingularName() string { - return IPIndexSingular -} - -func (IPIndex) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Resource: IPIndexPlural, - } -} - -// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. -// IsStorageVersion implements resource.Object. -func (IPIndex) IsStorageVersion() bool { - return true -} - -// GetObjectMeta implements resource.Object -func (r *IPIndex) GetObjectMeta() *metav1.ObjectMeta { - return &r.ObjectMeta -} - -// NamespaceScoped returns true to indicate Fortune is a namespaced resource. -// NamespaceScoped implements resource.Object. -func (IPIndex) NamespaceScoped() bool { - return true -} - -// New implements resource.Object -func (IPIndex) New() runtime.Object { - return &IPIndex{} -} - -// NewList implements resource.Object -func (IPIndex) NewList() runtime.Object { - return &IPIndexList{} -} - -// GetCondition returns the condition based on the condition kind -func (r *IPIndex) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { - return r.Status.GetCondition(t) -} - -// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions -// to be set at once -func (r *IPIndex) SetConditions(c ...conditionv1alpha1.Condition) { - r.Status.SetConditions(c...) -} - -// IPIndexConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for IPIndex -func IPIndexConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { - switch label { - case "metadata.name": - return label, value, nil - case "metadata.namespace": - return label, value, nil - default: - return "", "", fmt.Errorf("%q is not a known field selector", label) - } -} - -func (r *IPIndexList) GetItems() []backend.Object { - objs := []backend.Object{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *IPIndex) CalculateHash() ([sha1.Size]byte, error) { - // Convert the struct to JSON - jsonData, err := json.Marshal(r) - if err != nil { - return [sha1.Size]byte{}, err - } - - // Calculate SHA-1 hash - return sha1.Sum(jsonData), nil -} - -func (r *IPIndex) GetNamespacedName() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.GetNamespace(), - Name: r.GetName(), - } -} - -// GetTree satisfies the interface but should not be used -func (r *IPIndex) GetTree() gtree.GTree { - return nil -} - -func (r *IPIndex) GetKey() store.Key { - return store.KeyFromNSN(r.GetNamespacedName()) -} - -func (r *IPIndex) GetType() string { - return "" -} - -func (r *IPIndex) GetOwnerReference() *commonv1alpha1.OwnerReference { - return &commonv1alpha1.OwnerReference{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Kind: IPIndexKind, - Namespace: r.Namespace, - Name: r.Name, - } -} - -func (r *IPIndex) ValidateSyntax(_ string) field.ErrorList { - var allErrs field.ErrorList - - if len(r.Spec.Prefixes) == 0 { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.minID"), - r, - fmt.Errorf("a ipindex needs a prefix").Error(), - )) - - } - - return allErrs -} - -func (r *IPIndex) GetClaim(prefix Prefix) (*IPClaim, error) { - pi, err := iputil.New(prefix.Prefix) - if err != nil { - return nil, err - } - - return BuildIPClaim( - metav1.ObjectMeta{ - Namespace: r.GetNamespace(), - Name: pi.GetSubnetName(), - }, - &IPClaimSpec{ - PrefixType: ptr.To[IPPrefixType](IPPrefixType_Aggregate), - Index: r.Name, - Prefix: ptr.To[string](prefix.Prefix), - PrefixLength: ptr.To[uint32](uint32(pi.GetPrefixLength())), - CreatePrefix: ptr.To[bool](true), - ClaimLabels: commonv1alpha1.ClaimLabels{ - UserDefinedLabels: prefix.UserDefinedLabels, - }, - Owner: commonv1alpha1.GetOwnerReference(r), - }, - nil, - ), nil -} - -// BuildIPIndex returns a reource from a client Object a Spec/Status -func BuildIPIndex(meta metav1.ObjectMeta, spec *IPIndexSpec, status *IPIndexStatus) *IPIndex { - aspec := IPIndexSpec{} - if spec != nil { - aspec = *spec - } - astatus := IPIndexStatus{} - if status != nil { - astatus = *status - } - return &IPIndex{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: IPIndexKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -// GetMinID satisfies the interface but should not be used -func (r *IPIndex) GetMinID() *uint64 { return nil } - -// GetMaxID satisfies the interface but should not be used -func (r *IPIndex) GetMaxID() *uint64 { return nil } - -// GetMinClaim satisfies the interface but should not be used -func (r *IPIndex) GetMinClaim() backend.ClaimObject { return nil } - -// GetMaxClaim satisfies the interface but should not be used -func (r *IPIndex) GetMaxClaim() backend.ClaimObject { return nil } - -func IPIndexTableConvertor(gr schema.GroupResource) registry.TableConvertor { - return registry.TableConvertor{ - Resource: gr, - Cells: func(obj runtime.Object) []interface{} { - index, ok := obj.(*IPIndex) - if !ok { - return nil - } - - prefixes := make([]string, 5) - for i, prefix := range index.Spec.Prefixes { - if i >= 5 { - break - } - prefixes[i] = prefix.Prefix - } - - return []interface{}{ - index.Name, - index.GetCondition(conditionv1alpha1.ConditionTypeReady).Status, - prefixes[0], - prefixes[1], - prefixes[2], - prefixes[3], - prefixes[4], - } - }, - Columns: []metav1.TableColumnDefinition{ - {Name: "Name", Type: "string"}, - {Name: "Ready", Type: "string"}, - {Name: "Prefix0", Type: "string"}, - {Name: "Prefix1", Type: "string"}, - {Name: "Prefix2", Type: "string"}, - {Name: "Prefix3", Type: "string"}, - {Name: "Prefix4", Type: "string"}, - }, - } -} - -func GetIPClaimFromPrefix(obj client.Object, prefix Prefix) *IPClaim { - // prefix validation should have happened before - pi, _ := iputil.New(prefix.Prefix) - - var prefixType *IPPrefixType - if pt, ok := prefix.Labels[backend.KuidIPAMIPPrefixTypeKey]; ok { - prefixType = GetIPPrefixTypeFromString(pt) - } - - // topology.vpc-name -> vpc-name default is the default router - index := obj.GetName() - - return BuildIPClaim( - metav1.ObjectMeta{ - Namespace: obj.GetNamespace(), - Name: fmt.Sprintf("%s.%s", index, pi.GetSubnetName()), - }, - &IPClaimSpec{ - PrefixType: prefixType, - Index: index, - Prefix: ptr.To[string](prefix.Prefix), - PrefixLength: ptr.To[uint32](uint32(pi.GetPrefixLength())), - CreatePrefix: ptr.To[bool](true), - ClaimLabels: commonv1alpha1.ClaimLabels{ - UserDefinedLabels: prefix.UserDefinedLabels, - }, - Owner: commonv1alpha1.GetOwnerReference(obj), - }, - nil, - ) -} - -func (r *IPIndex) GetSpec() any { - return r.Spec -} - -func (r *IPIndex) SetSpec(s any) { - if spec, ok := s.(IPIndexSpec); ok { - r.Spec = spec - } -} - -func (r *IPIndex) NewObjList() backend.GenericObjectList { - return &IPIndexList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: IPIndexListKind}, - } -} - -func (r *IPIndexList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} diff --git a/apis/backend/ipam/v1alpha1/ipindex_types.go b/apis/backend/ipam/v1alpha1/ipindex_types.go deleted file mode 100644 index 0cdd72b..0000000 --- a/apis/backend/ipam/v1alpha1/ipindex_types.go +++ /dev/null @@ -1,77 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "reflect" - - resourcev1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// IPIndexSpec defines the desired state of IPIndex -type IPIndexSpec struct { - // Prefixes define the aggregate prefixes for the network instance - // A Network instance needs at least 1 prefix to be defined to become operational - Prefixes []Prefix `json:"prefixes" yaml:"prefixes" protobuf:"bytes,1,opt,name=prefixes"` -} - -type Prefix struct { - // Prefix defines the ip cidr in prefix notation. - // +kubebuilder:validation:Pattern=`(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))|((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))` - Prefix string `json:"prefix" yaml:"prefix" protobuf:"bytes,1,opt,name=prefix"` - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - resourcev1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,2,opt,name=userDefinedLabels"` -} - -// IPIndexStatus defines the observed state of IPIndex -type IPIndexStatus struct { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` - // Prefixes defines the prefixes, claimed through the IPAM backend - Prefixes []Prefix `json:"prefixes,omitempty" yaml:"prefixes,omitempty" protobuf:"bytes,2,rep,name=prefixes"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// IPIndex is the Schema for the IPIndex API -// -// +k8s:openapi-gen=true -type IPIndex struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - Spec IPIndexSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - Status IPIndexStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// IPIndexList contains a list of IPIndexs -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type IPIndexList struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []IPIndex `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` -} - -var ( - IPIndexKind = reflect.TypeOf(IPIndex{}).Name() - IPIndexListKind = reflect.TypeOf(IPIndexList{}).Name() -) diff --git a/apis/backend/ipam/v1alpha1/register.go b/apis/backend/ipam/v1alpha1/register.go deleted file mode 100644 index 286cf5c..0000000 --- a/apis/backend/ipam/v1alpha1/register.go +++ /dev/null @@ -1,69 +0,0 @@ -/* -Copyright 2024 Nokia. - -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. -*/ - -// +kubebuilder:object:generate=true -// +groupName=ipam.res.kuid.dev -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -const ( - Group = "ipam.be.kuid.dev" - Version = "v1alpha1" -) - -var ( - // SchemeGroupVersion contains the API group and version information for the types in this package. - SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version} - // AddToScheme applies all the stored functions to the scheme. A non-nil error - // indicates that one function failed and the attempt was abandoned. - //AddToScheme = (&runtime.SchemeBuilder{}).AddToScheme - AddToScheme = localSchemeBuilder.AddToScheme - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - schemeBuilder runtime.SchemeBuilder - localSchemeBuilder = &schemeBuilder -) - -// Resource takes an unqualified resource and returns a Group qualified GroupResource -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} - -func init() { - localSchemeBuilder.Register(addKnownTypes) -} - -// Adds the list of known types to the given scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - // +kubebuilder:scaffold:install - - scheme.AddKnownTypes(SchemeGroupVersion, - &IPClaim{}, - &IPClaimList{}, - &IPEntry{}, - &IPEntryList{}, - &IPIndex{}, - &IPIndexList{}, - ) - - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/apis/backend/ipam/v1alpha1/zz_generated.deepcopy.go b/apis/backend/ipam/v1alpha1/zz_generated.deepcopy.go deleted file mode 100644 index 93bc3e0..0000000 --- a/apis/backend/ipam/v1alpha1/zz_generated.deepcopy.go +++ /dev/null @@ -1,437 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - iputil "github.com/henderiw/iputil" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - 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 *IPClaim) DeepCopyInto(out *IPClaim) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPClaim. -func (in *IPClaim) DeepCopy() *IPClaim { - if in == nil { - return nil - } - out := new(IPClaim) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *IPClaim) 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 *IPClaimList) DeepCopyInto(out *IPClaimList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]IPClaim, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPClaimList. -func (in *IPClaimList) DeepCopy() *IPClaimList { - if in == nil { - return nil - } - out := new(IPClaimList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *IPClaimList) 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 *IPClaimSpec) DeepCopyInto(out *IPClaimSpec) { - *out = *in - if in.PrefixType != nil { - in, out := &in.PrefixType, &out.PrefixType - *out = new(IPPrefixType) - **out = **in - } - if in.Prefix != nil { - in, out := &in.Prefix, &out.Prefix - *out = new(string) - **out = **in - } - if in.Address != nil { - in, out := &in.Address, &out.Address - *out = new(string) - **out = **in - } - if in.Range != nil { - in, out := &in.Range, &out.Range - *out = new(string) - **out = **in - } - if in.DefaultGateway != nil { - in, out := &in.DefaultGateway, &out.DefaultGateway - *out = new(bool) - **out = **in - } - if in.CreatePrefix != nil { - in, out := &in.CreatePrefix, &out.CreatePrefix - *out = new(bool) - **out = **in - } - if in.PrefixLength != nil { - in, out := &in.PrefixLength, &out.PrefixLength - *out = new(uint32) - **out = **in - } - if in.AddressFamily != nil { - in, out := &in.AddressFamily, &out.AddressFamily - *out = new(iputil.AddressFamily) - **out = **in - } - if in.Idx != nil { - in, out := &in.Idx, &out.Idx - *out = new(uint32) - **out = **in - } - in.ClaimLabels.DeepCopyInto(&out.ClaimLabels) - if in.Owner != nil { - in, out := &in.Owner, &out.Owner - *out = new(commonv1alpha1.OwnerReference) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPClaimSpec. -func (in *IPClaimSpec) DeepCopy() *IPClaimSpec { - if in == nil { - return nil - } - out := new(IPClaimSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IPClaimStatus) DeepCopyInto(out *IPClaimStatus) { - *out = *in - in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) - if in.Range != nil { - in, out := &in.Range, &out.Range - *out = new(string) - **out = **in - } - if in.Address != nil { - in, out := &in.Address, &out.Address - *out = new(string) - **out = **in - } - if in.Prefix != nil { - in, out := &in.Prefix, &out.Prefix - *out = new(string) - **out = **in - } - if in.DefaultGateway != nil { - in, out := &in.DefaultGateway, &out.DefaultGateway - *out = new(string) - **out = **in - } - if in.ExpiryTime != nil { - in, out := &in.ExpiryTime, &out.ExpiryTime - *out = new(string) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPClaimStatus. -func (in *IPClaimStatus) DeepCopy() *IPClaimStatus { - if in == nil { - return nil - } - out := new(IPClaimStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IPEntry) DeepCopyInto(out *IPEntry) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPEntry. -func (in *IPEntry) DeepCopy() *IPEntry { - if in == nil { - return nil - } - out := new(IPEntry) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *IPEntry) 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 *IPEntryList) DeepCopyInto(out *IPEntryList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]IPEntry, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPEntryList. -func (in *IPEntryList) DeepCopy() *IPEntryList { - if in == nil { - return nil - } - out := new(IPEntryList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *IPEntryList) 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 *IPEntrySpec) DeepCopyInto(out *IPEntrySpec) { - *out = *in - if in.PrefixType != nil { - in, out := &in.PrefixType, &out.PrefixType - *out = new(IPPrefixType) - **out = **in - } - if in.DefaultGateway != nil { - in, out := &in.DefaultGateway, &out.DefaultGateway - *out = new(bool) - **out = **in - } - if in.AddressFamily != nil { - in, out := &in.AddressFamily, &out.AddressFamily - *out = new(iputil.AddressFamily) - **out = **in - } - in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) - if in.Owner != nil { - in, out := &in.Owner, &out.Owner - *out = new(commonv1alpha1.OwnerReference) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPEntrySpec. -func (in *IPEntrySpec) DeepCopy() *IPEntrySpec { - if in == nil { - return nil - } - out := new(IPEntrySpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IPEntryStatus) DeepCopyInto(out *IPEntryStatus) { - *out = *in - in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPEntryStatus. -func (in *IPEntryStatus) DeepCopy() *IPEntryStatus { - if in == nil { - return nil - } - out := new(IPEntryStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IPIndex) DeepCopyInto(out *IPIndex) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPIndex. -func (in *IPIndex) DeepCopy() *IPIndex { - if in == nil { - return nil - } - out := new(IPIndex) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *IPIndex) 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 *IPIndexList) DeepCopyInto(out *IPIndexList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]IPIndex, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPIndexList. -func (in *IPIndexList) DeepCopy() *IPIndexList { - if in == nil { - return nil - } - out := new(IPIndexList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *IPIndexList) 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 *IPIndexSpec) DeepCopyInto(out *IPIndexSpec) { - *out = *in - if in.Prefixes != nil { - in, out := &in.Prefixes, &out.Prefixes - *out = make([]Prefix, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPIndexSpec. -func (in *IPIndexSpec) DeepCopy() *IPIndexSpec { - if in == nil { - return nil - } - out := new(IPIndexSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IPIndexStatus) DeepCopyInto(out *IPIndexStatus) { - *out = *in - in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) - if in.Prefixes != nil { - in, out := &in.Prefixes, &out.Prefixes - *out = make([]Prefix, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPIndexStatus. -func (in *IPIndexStatus) DeepCopy() *IPIndexStatus { - if in == nil { - return nil - } - out := new(IPIndexStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Prefix) DeepCopyInto(out *Prefix) { - *out = *in - in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Prefix. -func (in *Prefix) DeepCopy() *Prefix { - if in == nil { - return nil - } - out := new(Prefix) - in.DeepCopyInto(out) - return out -} diff --git a/apis/backend/object.go b/apis/backend/object.go index 7314399..7860307 100644 --- a/apis/backend/object.go +++ b/apis/backend/object.go @@ -17,19 +17,15 @@ limitations under the License. package backend import ( - "context" - "crypto/sha1" - "github.com/henderiw/idxtable/pkg/table" "github.com/henderiw/idxtable/pkg/tree" "github.com/henderiw/idxtable/pkg/tree/gtree" "github.com/henderiw/store" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" + + //condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + "github.com/kform-dev/choreo/apis/condition" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/validation/field" "sigs.k8s.io/controller-runtime/pkg/client" @@ -43,17 +39,18 @@ type IndexObject interface { GetMaxID() *uint64 GetMinClaim() ClaimObject GetMaxClaim() ClaimObject + GetMax() uint64 } type ClaimObject interface { Object - GetIndex() string // implement - GetSelector() *metav1.LabelSelector // implement + GetIndex() string + GetSelector() *metav1.LabelSelector GetOwnerSelector() (labels.Selector, error) - GetClaimType() ClaimType GetLabelSelector() (labels.Selector, error) GetClaimLabels() labels.Set ValidateOwner(labels labels.Set) error + GetClaimType() ClaimType GetStaticID() *uint64 GetStaticTreeID(t string) tree.ID GetClaimID(t string, id uint64) tree.ID @@ -71,45 +68,14 @@ type EntryObject interface { Object GetIndex() string GetClaimType() ClaimType - GetOwnerGVK() schema.GroupVersionKind - GetOwnerNSN() types.NamespacedName - SetSpec(x any) - GetSpec() any GetSpecID() string } -type GenericObject interface { - Object - SetSpec(x any) - GetSpec() any - NewObjList() GenericObjectList - //SchemaGroupVersionKind() schema.GroupVersionKind - //GetUserDefinedLabels() map[string]string - //GetProvider() string -} - type Object interface { client.Object GetNamespacedName() types.NamespacedName GetKey() store.Key - GetOwnerReference() *commonv1alpha1.OwnerReference - GetObjectMeta() *metav1.ObjectMeta - GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition - SetConditions(c ...conditionv1alpha1.Condition) - CalculateHash() ([sha1.Size]byte, error) + GetCondition(t condition.ConditionType) condition.Condition + SetConditions(c ...condition.Condition) ValidateSyntax(s string) field.ErrorList } - -type ObjectList interface { - GetItems() []Object - client.ObjectList -} - -type GenericObjectList interface { - GetObjects() []GenericObject - client.ObjectList -} - -type Filter interface { - Filter(ctx context.Context, obj runtime.Object) bool -} diff --git a/apis/backend/storage_providers.go b/apis/backend/storage_providers.go new file mode 100644 index 0000000..dd38d28 --- /dev/null +++ b/apis/backend/storage_providers.go @@ -0,0 +1,31 @@ +/* +Copyright 2023 The Nephio 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. +*/ + +package backend + +import ( + "context" + + "github.com/henderiw/apiserver-builder/pkg/builder" + "github.com/henderiw/apiserver-builder/pkg/builder/rest" +) + +type StorageProviders interface { + GetIndexStorageProvider() *rest.StorageProvider + GetClaimStorageProvider() *rest.StorageProvider + GetEntryStorageProvider() *rest.StorageProvider + ApplyStorageToBackend(ctx context.Context, apiServer *builder.Server) error +} diff --git a/apis/backend/vlan/doc.go b/apis/backend/vlan/doc.go deleted file mode 100644 index 902f4aa..0000000 --- a/apis/backend/vlan/doc.go +++ /dev/null @@ -1,21 +0,0 @@ -/* -Copyright 2024 Nokia. - -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. -*/ - -// +k8s:deepcopy-gen=package,register -// +groupName=vlan.be.kuid.dev - -// vlan defines the vlan api -package vlan diff --git a/apis/backend/vlan/v1alpha1/doc.go b/apis/backend/vlan/v1alpha1/doc.go deleted file mode 100644 index a24aa90..0000000 --- a/apis/backend/vlan/v1alpha1/doc.go +++ /dev/null @@ -1,28 +0,0 @@ -/* -Copyright 2024 Nokia. - -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. -*/ - -//go:generate deepcopy-gen -O zz_generated.deepcopy -i . -h ../../../../boilerplate.go.txt -//go:generate defaulter-gen -O zz_generated.defaults -i . -h ../../../../boilerplate.go.txt -//go:generate conversion-gen -O zz_generated.conversion -i . -h ../../../../boilerplate.go.txt - -// +k8s:openapi-gen=true -// +k8s:deepcopy-gen=package,register -// +k8s:conversion-gen=github.com/kuidio/kuid/apis/backend/vlan -// +k8s:defaulter-gen=TypeMeta -// +groupName=vlan.be.kuid.dev - -// Package v1alpha1 is the v1alpha1 version of the API. -package v1alpha1 // import "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" diff --git a/apis/backend/vlan/v1alpha1/generated.pb.go b/apis/backend/vlan/v1alpha1/generated.pb.go deleted file mode 100644 index 8fefba7..0000000 --- a/apis/backend/vlan/v1alpha1/generated.pb.go +++ /dev/null @@ -1,3282 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 protoc-gen-gogo. DO NOT EDIT. -// source: github.com/kuidio/kuid/apis/backend/vlan/v1alpha1/generated.proto - -package v1alpha1 - -import ( - fmt "fmt" - - io "io" - - proto "github.com/gogo/protobuf/proto" - github_com_kuidio_kuid_apis_backend "github.com/kuidio/kuid/apis/backend" - v1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - - math "math" - math_bits "math/bits" - reflect "reflect" - strings "strings" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -func (m *VLANClaim) Reset() { *m = VLANClaim{} } -func (*VLANClaim) ProtoMessage() {} -func (*VLANClaim) Descriptor() ([]byte, []int) { - return fileDescriptor_e3a41394a05ebbdf, []int{0} -} -func (m *VLANClaim) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VLANClaim) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *VLANClaim) XXX_Merge(src proto.Message) { - xxx_messageInfo_VLANClaim.Merge(m, src) -} -func (m *VLANClaim) XXX_Size() int { - return m.Size() -} -func (m *VLANClaim) XXX_DiscardUnknown() { - xxx_messageInfo_VLANClaim.DiscardUnknown(m) -} - -var xxx_messageInfo_VLANClaim proto.InternalMessageInfo - -func (m *VLANClaimList) Reset() { *m = VLANClaimList{} } -func (*VLANClaimList) ProtoMessage() {} -func (*VLANClaimList) Descriptor() ([]byte, []int) { - return fileDescriptor_e3a41394a05ebbdf, []int{1} -} -func (m *VLANClaimList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VLANClaimList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *VLANClaimList) XXX_Merge(src proto.Message) { - xxx_messageInfo_VLANClaimList.Merge(m, src) -} -func (m *VLANClaimList) XXX_Size() int { - return m.Size() -} -func (m *VLANClaimList) XXX_DiscardUnknown() { - xxx_messageInfo_VLANClaimList.DiscardUnknown(m) -} - -var xxx_messageInfo_VLANClaimList proto.InternalMessageInfo - -func (m *VLANClaimSpec) Reset() { *m = VLANClaimSpec{} } -func (*VLANClaimSpec) ProtoMessage() {} -func (*VLANClaimSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_e3a41394a05ebbdf, []int{2} -} -func (m *VLANClaimSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VLANClaimSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *VLANClaimSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_VLANClaimSpec.Merge(m, src) -} -func (m *VLANClaimSpec) XXX_Size() int { - return m.Size() -} -func (m *VLANClaimSpec) XXX_DiscardUnknown() { - xxx_messageInfo_VLANClaimSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_VLANClaimSpec proto.InternalMessageInfo - -func (m *VLANClaimStatus) Reset() { *m = VLANClaimStatus{} } -func (*VLANClaimStatus) ProtoMessage() {} -func (*VLANClaimStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_e3a41394a05ebbdf, []int{3} -} -func (m *VLANClaimStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VLANClaimStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *VLANClaimStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_VLANClaimStatus.Merge(m, src) -} -func (m *VLANClaimStatus) XXX_Size() int { - return m.Size() -} -func (m *VLANClaimStatus) XXX_DiscardUnknown() { - xxx_messageInfo_VLANClaimStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_VLANClaimStatus proto.InternalMessageInfo - -func (m *VLANEntry) Reset() { *m = VLANEntry{} } -func (*VLANEntry) ProtoMessage() {} -func (*VLANEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_e3a41394a05ebbdf, []int{4} -} -func (m *VLANEntry) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VLANEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *VLANEntry) XXX_Merge(src proto.Message) { - xxx_messageInfo_VLANEntry.Merge(m, src) -} -func (m *VLANEntry) XXX_Size() int { - return m.Size() -} -func (m *VLANEntry) XXX_DiscardUnknown() { - xxx_messageInfo_VLANEntry.DiscardUnknown(m) -} - -var xxx_messageInfo_VLANEntry proto.InternalMessageInfo - -func (m *VLANEntryList) Reset() { *m = VLANEntryList{} } -func (*VLANEntryList) ProtoMessage() {} -func (*VLANEntryList) Descriptor() ([]byte, []int) { - return fileDescriptor_e3a41394a05ebbdf, []int{5} -} -func (m *VLANEntryList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VLANEntryList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *VLANEntryList) XXX_Merge(src proto.Message) { - xxx_messageInfo_VLANEntryList.Merge(m, src) -} -func (m *VLANEntryList) XXX_Size() int { - return m.Size() -} -func (m *VLANEntryList) XXX_DiscardUnknown() { - xxx_messageInfo_VLANEntryList.DiscardUnknown(m) -} - -var xxx_messageInfo_VLANEntryList proto.InternalMessageInfo - -func (m *VLANEntrySpec) Reset() { *m = VLANEntrySpec{} } -func (*VLANEntrySpec) ProtoMessage() {} -func (*VLANEntrySpec) Descriptor() ([]byte, []int) { - return fileDescriptor_e3a41394a05ebbdf, []int{6} -} -func (m *VLANEntrySpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VLANEntrySpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *VLANEntrySpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_VLANEntrySpec.Merge(m, src) -} -func (m *VLANEntrySpec) XXX_Size() int { - return m.Size() -} -func (m *VLANEntrySpec) XXX_DiscardUnknown() { - xxx_messageInfo_VLANEntrySpec.DiscardUnknown(m) -} - -var xxx_messageInfo_VLANEntrySpec proto.InternalMessageInfo - -func (m *VLANEntryStatus) Reset() { *m = VLANEntryStatus{} } -func (*VLANEntryStatus) ProtoMessage() {} -func (*VLANEntryStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_e3a41394a05ebbdf, []int{7} -} -func (m *VLANEntryStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VLANEntryStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *VLANEntryStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_VLANEntryStatus.Merge(m, src) -} -func (m *VLANEntryStatus) XXX_Size() int { - return m.Size() -} -func (m *VLANEntryStatus) XXX_DiscardUnknown() { - xxx_messageInfo_VLANEntryStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_VLANEntryStatus proto.InternalMessageInfo - -func (m *VLANIndex) Reset() { *m = VLANIndex{} } -func (*VLANIndex) ProtoMessage() {} -func (*VLANIndex) Descriptor() ([]byte, []int) { - return fileDescriptor_e3a41394a05ebbdf, []int{8} -} -func (m *VLANIndex) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VLANIndex) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *VLANIndex) XXX_Merge(src proto.Message) { - xxx_messageInfo_VLANIndex.Merge(m, src) -} -func (m *VLANIndex) XXX_Size() int { - return m.Size() -} -func (m *VLANIndex) XXX_DiscardUnknown() { - xxx_messageInfo_VLANIndex.DiscardUnknown(m) -} - -var xxx_messageInfo_VLANIndex proto.InternalMessageInfo - -func (m *VLANIndexList) Reset() { *m = VLANIndexList{} } -func (*VLANIndexList) ProtoMessage() {} -func (*VLANIndexList) Descriptor() ([]byte, []int) { - return fileDescriptor_e3a41394a05ebbdf, []int{9} -} -func (m *VLANIndexList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VLANIndexList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *VLANIndexList) XXX_Merge(src proto.Message) { - xxx_messageInfo_VLANIndexList.Merge(m, src) -} -func (m *VLANIndexList) XXX_Size() int { - return m.Size() -} -func (m *VLANIndexList) XXX_DiscardUnknown() { - xxx_messageInfo_VLANIndexList.DiscardUnknown(m) -} - -var xxx_messageInfo_VLANIndexList proto.InternalMessageInfo - -func (m *VLANIndexSpec) Reset() { *m = VLANIndexSpec{} } -func (*VLANIndexSpec) ProtoMessage() {} -func (*VLANIndexSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_e3a41394a05ebbdf, []int{10} -} -func (m *VLANIndexSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VLANIndexSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *VLANIndexSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_VLANIndexSpec.Merge(m, src) -} -func (m *VLANIndexSpec) XXX_Size() int { - return m.Size() -} -func (m *VLANIndexSpec) XXX_DiscardUnknown() { - xxx_messageInfo_VLANIndexSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_VLANIndexSpec proto.InternalMessageInfo - -func (m *VLANIndexStatus) Reset() { *m = VLANIndexStatus{} } -func (*VLANIndexStatus) ProtoMessage() {} -func (*VLANIndexStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_e3a41394a05ebbdf, []int{11} -} -func (m *VLANIndexStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VLANIndexStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *VLANIndexStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_VLANIndexStatus.Merge(m, src) -} -func (m *VLANIndexStatus) XXX_Size() int { - return m.Size() -} -func (m *VLANIndexStatus) XXX_DiscardUnknown() { - xxx_messageInfo_VLANIndexStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_VLANIndexStatus proto.InternalMessageInfo - -func init() { - proto.RegisterType((*VLANClaim)(nil), "github.com.kuidio.kuid.apis.backend.vlan.v1alpha1.VLANClaim") - proto.RegisterType((*VLANClaimList)(nil), "github.com.kuidio.kuid.apis.backend.vlan.v1alpha1.VLANClaimList") - proto.RegisterType((*VLANClaimSpec)(nil), "github.com.kuidio.kuid.apis.backend.vlan.v1alpha1.VLANClaimSpec") - proto.RegisterType((*VLANClaimStatus)(nil), "github.com.kuidio.kuid.apis.backend.vlan.v1alpha1.VLANClaimStatus") - proto.RegisterType((*VLANEntry)(nil), "github.com.kuidio.kuid.apis.backend.vlan.v1alpha1.VLANEntry") - proto.RegisterType((*VLANEntryList)(nil), "github.com.kuidio.kuid.apis.backend.vlan.v1alpha1.VLANEntryList") - proto.RegisterType((*VLANEntrySpec)(nil), "github.com.kuidio.kuid.apis.backend.vlan.v1alpha1.VLANEntrySpec") - proto.RegisterType((*VLANEntryStatus)(nil), "github.com.kuidio.kuid.apis.backend.vlan.v1alpha1.VLANEntryStatus") - proto.RegisterType((*VLANIndex)(nil), "github.com.kuidio.kuid.apis.backend.vlan.v1alpha1.VLANIndex") - proto.RegisterType((*VLANIndexList)(nil), "github.com.kuidio.kuid.apis.backend.vlan.v1alpha1.VLANIndexList") - proto.RegisterType((*VLANIndexSpec)(nil), "github.com.kuidio.kuid.apis.backend.vlan.v1alpha1.VLANIndexSpec") - proto.RegisterType((*VLANIndexStatus)(nil), "github.com.kuidio.kuid.apis.backend.vlan.v1alpha1.VLANIndexStatus") -} - -func init() { - proto.RegisterFile("github.com/kuidio/kuid/apis/backend/vlan/v1alpha1/generated.proto", fileDescriptor_e3a41394a05ebbdf) -} - -var fileDescriptor_e3a41394a05ebbdf = []byte{ - // 862 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x57, 0x4f, 0x8f, 0xdb, 0x44, - 0x14, 0x8f, 0x9d, 0x75, 0x54, 0x4f, 0x48, 0x61, 0x8d, 0x84, 0x42, 0x0e, 0x4e, 0x95, 0x5e, 0x7a, - 0xe9, 0x98, 0x54, 0x08, 0x55, 0x2a, 0xaa, 0x58, 0x6f, 0x7a, 0x88, 0xd4, 0x52, 0x69, 0x28, 0x20, - 0xa1, 0x1e, 0x3a, 0xb1, 0x67, 0x93, 0x69, 0xe2, 0x3f, 0xb2, 0x9d, 0xb0, 0xb9, 0x71, 0xab, 0xc4, - 0x89, 0x4f, 0xc0, 0x91, 0x4f, 0x01, 0xf7, 0x3d, 0xee, 0xb1, 0x12, 0x52, 0xd4, 0x0d, 0xdf, 0x82, - 0x13, 0x9a, 0x37, 0x13, 0xc7, 0x4a, 0x48, 0x48, 0x28, 0x0b, 0xe4, 0xe4, 0x9d, 0x37, 0xef, 0xfd, - 0x7e, 0xef, 0xcf, 0xbc, 0xdf, 0xee, 0xa2, 0x93, 0x3e, 0xcf, 0x06, 0xe3, 0x1e, 0xf6, 0xa2, 0xc0, - 0x19, 0x8e, 0xb9, 0xcf, 0x23, 0xf8, 0x38, 0x34, 0xe6, 0xa9, 0xd3, 0xa3, 0xde, 0x90, 0x85, 0xbe, - 0x33, 0x19, 0xd1, 0xd0, 0x99, 0xb4, 0xe9, 0x28, 0x1e, 0xd0, 0xb6, 0xd3, 0x67, 0x21, 0x4b, 0x68, - 0xc6, 0x7c, 0x1c, 0x27, 0x51, 0x16, 0x59, 0xed, 0x25, 0x04, 0x96, 0x10, 0xf0, 0xc1, 0x02, 0x02, - 0x2b, 0x08, 0x2c, 0x20, 0xf0, 0x02, 0xa2, 0x71, 0xb7, 0xc0, 0xda, 0x8f, 0xfa, 0x91, 0x03, 0x48, - 0xbd, 0xf1, 0x19, 0x9c, 0xe0, 0x00, 0x3f, 0x49, 0x86, 0xc6, 0x83, 0x6d, 0x49, 0x7a, 0x51, 0x10, - 0x44, 0x9b, 0xd3, 0x6b, 0x3c, 0xdc, 0x1e, 0x1c, 0xfa, 0x3c, 0xe3, 0xdb, 0xe2, 0x3f, 0x1e, 0xde, - 0x4f, 0x31, 0x8f, 0x84, 0x7f, 0x40, 0xbd, 0x01, 0x0f, 0x59, 0x32, 0x75, 0xe2, 0x61, 0x5f, 0x02, - 0x04, 0x2c, 0xa3, 0xce, 0x64, 0x3d, 0xea, 0x93, 0x4d, 0x51, 0xc9, 0x38, 0xcc, 0x78, 0xc0, 0x9c, - 0xd4, 0x1b, 0xb0, 0x80, 0xae, 0xc6, 0xb5, 0x7e, 0xd1, 0x91, 0xf9, 0xd5, 0xe3, 0x93, 0xcf, 0x4f, - 0x47, 0x94, 0x07, 0xd6, 0x0b, 0x74, 0x43, 0x10, 0xf8, 0x34, 0xa3, 0x75, 0xed, 0x96, 0x76, 0xa7, - 0x7a, 0xef, 0x23, 0x2c, 0x81, 0x71, 0x11, 0x18, 0xc7, 0xc3, 0xbe, 0x6c, 0xb7, 0xf0, 0xc6, 0x93, - 0x36, 0x7e, 0xda, 0x7b, 0xc9, 0xbc, 0xec, 0x09, 0xcb, 0xa8, 0x6b, 0x5d, 0xcc, 0x9a, 0xa5, 0xf9, - 0xac, 0x89, 0x96, 0x36, 0x92, 0xa3, 0x5a, 0x3d, 0x74, 0x94, 0xc6, 0xcc, 0xab, 0xeb, 0x80, 0xfe, - 0x19, 0xde, 0x7b, 0x96, 0x38, 0xcf, 0xf6, 0x8b, 0x98, 0x79, 0xee, 0x3b, 0x8a, 0xed, 0x48, 0x9c, - 0x08, 0x60, 0x5b, 0x2f, 0x51, 0x25, 0xcd, 0x68, 0x36, 0x4e, 0xeb, 0x65, 0x60, 0x71, 0xdf, 0x8a, - 0x05, 0x90, 0xdc, 0x9b, 0x8a, 0xa7, 0x22, 0xcf, 0x44, 0x31, 0xb4, 0x2e, 0x35, 0x54, 0xcb, 0x7d, - 0x1f, 0xf3, 0x34, 0xb3, 0x9e, 0xaf, 0xf5, 0x10, 0xef, 0xd6, 0x43, 0x11, 0x0d, 0x1d, 0x7c, 0x4f, - 0x71, 0xdd, 0x58, 0x58, 0x0a, 0xfd, 0xa3, 0xc8, 0xe0, 0x19, 0x0b, 0xd2, 0xba, 0x7e, 0xab, 0x7c, - 0xa7, 0x7a, 0xef, 0xd3, 0xb7, 0x29, 0xcd, 0xad, 0x29, 0x22, 0xa3, 0x2b, 0x20, 0x89, 0x44, 0x6e, - 0xfd, 0xac, 0x17, 0x4a, 0x12, 0x6d, 0xb5, 0x6e, 0x23, 0x83, 0x87, 0x3e, 0x3b, 0x87, 0x7a, 0xcc, - 0x42, 0x98, 0x30, 0x12, 0x79, 0x67, 0x7d, 0x80, 0x74, 0xee, 0xc3, 0x5c, 0x6b, 0x6e, 0x65, 0x3e, - 0x6b, 0xea, 0xdd, 0x0e, 0xd1, 0xb9, 0x6f, 0x35, 0x91, 0x91, 0xd0, 0xb0, 0xcf, 0x60, 0x18, 0xa6, - 0x6b, 0x8a, 0x40, 0x22, 0x0c, 0x44, 0xda, 0xad, 0x08, 0x55, 0x3d, 0xe8, 0x1e, 0xed, 0xb1, 0x51, - 0x5a, 0x3f, 0x82, 0x9e, 0xdd, 0xdf, 0x5a, 0x98, 0xdc, 0xc1, 0x65, 0x49, 0xa7, 0xcb, 0x78, 0xf7, - 0x7d, 0x95, 0x5d, 0xb5, 0x60, 0x24, 0x45, 0x06, 0xeb, 0x39, 0x32, 0xa2, 0x6f, 0x43, 0x96, 0xd4, - 0x0d, 0xa0, 0x7a, 0xb0, 0x17, 0xd5, 0x53, 0x11, 0x49, 0xd8, 0x19, 0x4b, 0x58, 0xe8, 0x31, 0x59, - 0x8e, 0xb4, 0x49, 0xd0, 0xd6, 0x2b, 0x1d, 0xbd, 0xbb, 0xf2, 0x7a, 0xac, 0xef, 0x35, 0x74, 0x9c, - 0xaf, 0x3e, 0xf3, 0xa5, 0x55, 0xbd, 0x8e, 0x93, 0xbf, 0xa0, 0x57, 0x51, 0x85, 0x62, 0x57, 0x81, - 0xdc, 0x0f, 0x55, 0xc9, 0xc7, 0x6b, 0x57, 0x64, 0x9d, 0xf6, 0xef, 0x0f, 0x0a, 0x23, 0xc4, 0xce, - 0x63, 0x9e, 0x4c, 0x9f, 0xf1, 0x80, 0xc1, 0x9c, 0x4c, 0xf7, 0xa6, 0xd8, 0xf4, 0x47, 0xb9, 0x95, - 0x14, 0x3c, 0x72, 0x6d, 0x79, 0x14, 0x66, 0xc9, 0xf4, 0x60, 0xb4, 0x05, 0xb2, 0xbd, 0x76, 0x6d, - 0x91, 0x2c, 0xbb, 0x69, 0x0b, 0xf8, 0x1e, 0x8e, 0xb6, 0x40, 0xba, 0x1b, 0xb4, 0xe5, 0xa7, 0x72, - 0xa1, 0xa4, 0xdd, 0xb5, 0xe5, 0x05, 0x32, 0x61, 0x81, 0x9f, 0x4d, 0x63, 0x06, 0xe3, 0x35, 0x5d, - 0x57, 0x39, 0x9a, 0xa7, 0x8b, 0x8b, 0xdf, 0x67, 0xcd, 0xbb, 0x3b, 0xfc, 0x75, 0x81, 0xf3, 0x00, - 0xb2, 0x04, 0xb5, 0x1a, 0xb0, 0x14, 0xf2, 0xe5, 0x23, 0x05, 0xbd, 0x58, 0x8c, 0x7f, 0x5d, 0xa0, - 0x6e, 0x23, 0x03, 0x8e, 0x20, 0x50, 0x85, 0x9e, 0x40, 0x00, 0x91, 0x77, 0x4b, 0x15, 0xab, 0x5c, - 0x87, 0x8a, 0xfd, 0xa8, 0x49, 0x15, 0x2b, 0xbc, 0xd3, 0xff, 0x95, 0x8a, 0xe5, 0xe2, 0xd2, 0x55, - 0x0f, 0xe4, 0x30, 0xc4, 0x05, 0xb2, 0xbd, 0x76, 0x71, 0x91, 0x2c, 0xbb, 0x89, 0x0b, 0xf8, 0x1e, - 0x8e, 0xb8, 0x40, 0xba, 0x1b, 0xc4, 0xe5, 0xd7, 0x62, 0x49, 0x20, 0x2e, 0x4d, 0x64, 0x04, 0x3c, - 0xec, 0x76, 0xa0, 0x9e, 0x9a, 0x7c, 0xe6, 0x4f, 0x84, 0x81, 0x48, 0x3b, 0x38, 0xd0, 0xf3, 0x6e, - 0x47, 0xfd, 0x3a, 0x94, 0x0e, 0xc2, 0x40, 0xa4, 0xdd, 0x7a, 0xa5, 0xa1, 0xe3, 0x71, 0xca, 0x92, - 0x0e, 0x3b, 0xe3, 0x21, 0xf3, 0x95, 0x04, 0xc8, 0xf1, 0x3c, 0xdc, 0x6b, 0xe5, 0xbe, 0x5c, 0x45, - 0x59, 0x3e, 0xf8, 0xb5, 0x2b, 0xb2, 0xce, 0xd9, 0x7a, 0xa3, 0x36, 0xb2, 0x30, 0xdc, 0x7f, 0xa0, - 0xbe, 0x3f, 0xdf, 0xe9, 0xf2, 0x7f, 0xb2, 0xd3, 0xee, 0xd7, 0x17, 0x57, 0x76, 0xe9, 0xf2, 0xca, - 0x2e, 0xbd, 0xbe, 0xb2, 0x4b, 0xdf, 0xcd, 0x6d, 0xed, 0x62, 0x6e, 0x6b, 0x97, 0x73, 0x5b, 0x7b, - 0x3d, 0xb7, 0xb5, 0x37, 0x73, 0x5b, 0xfb, 0xe1, 0x37, 0xbb, 0xf4, 0x4d, 0x7b, 0xef, 0x7f, 0x21, - 0xff, 0x08, 0x00, 0x00, 0xff, 0xff, 0x86, 0x58, 0x31, 0xfc, 0x76, 0x0e, 0x00, 0x00, -} - -func (m *VLANClaim) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *VLANClaim) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VLANClaim) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *VLANClaimList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *VLANClaimList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VLANClaimList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *VLANClaimSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *VLANClaimSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VLANClaimSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Owner != nil { - { - size, err := m.Owner.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - { - size, err := m.ClaimLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - if m.Range != nil { - i -= len(*m.Range) - copy(dAtA[i:], *m.Range) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Range))) - i-- - dAtA[i] = 0x1a - } - if m.ID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.ID)) - i-- - dAtA[i] = 0x10 - } - i -= len(m.Index) - copy(dAtA[i:], m.Index) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Index))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *VLANClaimStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *VLANClaimStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VLANClaimStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ExpiryTime != nil { - i -= len(*m.ExpiryTime) - copy(dAtA[i:], *m.ExpiryTime) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ExpiryTime))) - i-- - dAtA[i] = 0x22 - } - if m.Range != nil { - i -= len(*m.Range) - copy(dAtA[i:], *m.Range) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Range))) - i-- - dAtA[i] = 0x1a - } - if m.ID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.ID)) - i-- - dAtA[i] = 0x10 - } - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *VLANEntry) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *VLANEntry) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VLANEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *VLANEntryList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *VLANEntryList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VLANEntryList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *VLANEntrySpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *VLANEntrySpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VLANEntrySpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Owner != nil { - { - size, err := m.Owner.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - i -= len(m.Claim) - copy(dAtA[i:], m.Claim) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Claim))) - i-- - dAtA[i] = 0x2a - { - size, err := m.ClaimLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - i -= len(m.ID) - copy(dAtA[i:], m.ID) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.ID))) - i-- - dAtA[i] = 0x1a - i -= len(m.ClaimType) - copy(dAtA[i:], m.ClaimType) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.ClaimType))) - i-- - dAtA[i] = 0x12 - i -= len(m.Index) - copy(dAtA[i:], m.Index) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Index))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *VLANEntryStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *VLANEntryStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VLANEntryStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *VLANIndex) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *VLANIndex) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VLANIndex) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *VLANIndexList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *VLANIndexList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VLANIndexList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *VLANIndexSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *VLANIndexSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VLANIndexSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.UserDefinedLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if m.MaxID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MaxID)) - i-- - dAtA[i] = 0x10 - } - if m.MinID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MinID)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *VLANIndexStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *VLANIndexStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VLANIndexStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if m.MaxID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MaxID)) - i-- - dAtA[i] = 0x10 - } - if m.MinID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MinID)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { - offset -= sovGenerated(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *VLANClaim) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *VLANClaimList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *VLANClaimSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Index) - n += 1 + l + sovGenerated(uint64(l)) - if m.ID != nil { - n += 1 + sovGenerated(uint64(*m.ID)) - } - if m.Range != nil { - l = len(*m.Range) - n += 1 + l + sovGenerated(uint64(l)) - } - l = m.ClaimLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.Owner != nil { - l = m.Owner.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *VLANClaimStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.ID != nil { - n += 1 + sovGenerated(uint64(*m.ID)) - } - if m.Range != nil { - l = len(*m.Range) - n += 1 + l + sovGenerated(uint64(l)) - } - if m.ExpiryTime != nil { - l = len(*m.ExpiryTime) - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *VLANEntry) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *VLANEntryList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *VLANEntrySpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Index) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.ClaimType) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.ID) - n += 1 + l + sovGenerated(uint64(l)) - l = m.ClaimLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Claim) - n += 1 + l + sovGenerated(uint64(l)) - if m.Owner != nil { - l = m.Owner.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *VLANEntryStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *VLANIndex) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *VLANIndexList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *VLANIndexSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MinID != nil { - n += 1 + sovGenerated(uint64(*m.MinID)) - } - if m.MaxID != nil { - n += 1 + sovGenerated(uint64(*m.MaxID)) - } - l = m.UserDefinedLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *VLANIndexStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MinID != nil { - n += 1 + sovGenerated(uint64(*m.MinID)) - } - if m.MaxID != nil { - n += 1 + sovGenerated(uint64(*m.MaxID)) - } - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func sovGenerated(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenerated(x uint64) (n int) { - return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *VLANClaim) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&VLANClaim{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "VLANClaimSpec", "VLANClaimSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "VLANClaimStatus", "VLANClaimStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *VLANClaimList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]VLANClaim{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "VLANClaim", "VLANClaim", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&VLANClaimList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *VLANClaimSpec) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&VLANClaimSpec{`, - `Index:` + fmt.Sprintf("%v", this.Index) + `,`, - `ID:` + valueToStringGenerated(this.ID) + `,`, - `Range:` + valueToStringGenerated(this.Range) + `,`, - `ClaimLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ClaimLabels), "ClaimLabels", "v1alpha1.ClaimLabels", 1), `&`, ``, 1) + `,`, - `Owner:` + strings.Replace(fmt.Sprintf("%v", this.Owner), "OwnerReference", "v1alpha1.OwnerReference", 1) + `,`, - `}`, - }, "") - return s -} -func (this *VLANClaimStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&VLANClaimStatus{`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `ID:` + valueToStringGenerated(this.ID) + `,`, - `Range:` + valueToStringGenerated(this.Range) + `,`, - `ExpiryTime:` + valueToStringGenerated(this.ExpiryTime) + `,`, - `}`, - }, "") - return s -} -func (this *VLANEntry) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&VLANEntry{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "VLANEntrySpec", "VLANEntrySpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "VLANEntryStatus", "VLANEntryStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *VLANEntryList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]VLANEntry{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "VLANEntry", "VLANEntry", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&VLANEntryList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *VLANEntrySpec) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&VLANEntrySpec{`, - `Index:` + fmt.Sprintf("%v", this.Index) + `,`, - `ClaimType:` + fmt.Sprintf("%v", this.ClaimType) + `,`, - `ID:` + fmt.Sprintf("%v", this.ID) + `,`, - `ClaimLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ClaimLabels), "ClaimLabels", "v1alpha1.ClaimLabels", 1), `&`, ``, 1) + `,`, - `Claim:` + fmt.Sprintf("%v", this.Claim) + `,`, - `Owner:` + strings.Replace(fmt.Sprintf("%v", this.Owner), "OwnerReference", "v1alpha1.OwnerReference", 1) + `,`, - `}`, - }, "") - return s -} -func (this *VLANEntryStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&VLANEntryStatus{`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *VLANIndex) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&VLANIndex{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "VLANIndexSpec", "VLANIndexSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "VLANIndexStatus", "VLANIndexStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *VLANIndexList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]VLANIndex{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "VLANIndex", "VLANIndex", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&VLANIndexList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *VLANIndexSpec) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&VLANIndexSpec{`, - `MinID:` + valueToStringGenerated(this.MinID) + `,`, - `MaxID:` + valueToStringGenerated(this.MaxID) + `,`, - `UserDefinedLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.UserDefinedLabels), "UserDefinedLabels", "v1alpha1.UserDefinedLabels", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *VLANIndexStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&VLANIndexStatus{`, - `MinID:` + valueToStringGenerated(this.MinID) + `,`, - `MaxID:` + valueToStringGenerated(this.MaxID) + `,`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func valueToStringGenerated(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *VLANClaim) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VLANClaim: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VLANClaim: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *VLANClaimList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VLANClaimList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VLANClaimList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, VLANClaim{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *VLANClaimSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VLANClaimSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VLANClaimSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Index = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ID = &v - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Range", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Range = &s - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ClaimLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Owner == nil { - m.Owner = &v1alpha1.OwnerReference{} - } - if err := m.Owner.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *VLANClaimStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VLANClaimStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VLANClaimStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ID = &v - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Range", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Range = &s - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExpiryTime", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.ExpiryTime = &s - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *VLANEntry) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VLANEntry: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VLANEntry: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *VLANEntryList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VLANEntryList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VLANEntryList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, VLANEntry{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *VLANEntrySpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VLANEntrySpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VLANEntrySpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Index = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClaimType = github_com_kuidio_kuid_apis_backend.ClaimType(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ClaimLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Claim", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Claim = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Owner == nil { - m.Owner = &v1alpha1.OwnerReference{} - } - if err := m.Owner.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *VLANEntryStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VLANEntryStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VLANEntryStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *VLANIndex) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VLANIndex: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VLANIndex: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *VLANIndexList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VLANIndexList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VLANIndexList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, VLANIndex{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *VLANIndexSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VLANIndexSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VLANIndexSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinID", wireType) - } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MinID = &v - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxID", wireType) - } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MaxID = &v - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UserDefinedLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.UserDefinedLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *VLANIndexStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VLANIndexStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VLANIndexStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinID", wireType) - } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MinID = &v - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxID", wireType) - } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MaxID = &v - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenerated(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenerated - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenerated - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenerated - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") -) diff --git a/apis/backend/vlan/v1alpha1/generated.proto b/apis/backend/vlan/v1alpha1/generated.proto deleted file mode 100644 index 9f8502a..0000000 --- a/apis/backend/vlan/v1alpha1/generated.proto +++ /dev/null @@ -1,190 +0,0 @@ -/* -Copyright 2024 Nokia. - -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. -*/ -// This file was autogenerated by go-to-protobuf. Do not edit it manually! - -syntax = "proto2"; - -package github.com.kuidio.kuid.apis.backend.vlan.v1alpha1; - -import "github.com/kuidio/kuid/apis/common/v1alpha1/generated.proto"; -import "github.com/kuidio/kuid/apis/condition/v1alpha1/generated.proto"; -import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; -import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; - -// Package-wide variables from generator "generated". -option go_package = "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1"; - -// VLANClaim is the Schema for the VLANClaim API -// -// +k8s:openapi-gen=true -message VLANClaim { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional VLANClaimSpec spec = 2; - - optional VLANClaimStatus status = 3; -} - -// VLANClaimList contains a list of VLANClaims -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message VLANClaimList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated VLANClaim items = 2; -} - -// VLANClaimSpec defines the desired state of VLANClaim -message VLANClaimSpec { - // VLANIndex defines the vlan index for the VLAN Claim - optional string index = 1; - - // VLANID defines the vlan for the VLAN claim - // +optional - optional uint32 id = 2; - - // Range defines the vlan range for the VLAN claim - // The following notation is used: start-end - - // the vlans in the range must be consecutive - // +optional - optional string range = 3; - - // ClaimLabels define the user defined labels and selector labels used - // in resource claim - optional github.com.kuidio.kuid.apis.common.v1alpha1.ClaimLabels claimLabels = 4; - - // Owner defines the ownerReference of the VLANClaim - // Allow for different namesapces, hence it is part of the spec - optional github.com.kuidio.kuid.apis.common.v1alpha1.OwnerReference owner = 5; -} - -// VLANClaimStatus defines the observed state of VLANClaim -message VLANClaimStatus { - // ConditionedStatus provides the status of the Claim using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 1; - - // VLANID defines the vlan for the VLAN claim - // +optional - optional uint32 id = 2; - - // VLANRange defines the vlan range for the VLAN claim - // +optional - optional string range = 3; - - // ExpiryTime defines when the claim expires - // +kubebuilder:validation:Optional - // +optional - optional string expiryTime = 4; -} - -// VLANEntry is the Schema for the vlanentry API -// -// +k8s:openapi-gen=true -message VLANEntry { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional VLANEntrySpec spec = 2; - - optional VLANEntryStatus status = 3; -} - -// VLANEntryList contains a list of VLANEntries -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message VLANEntryList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated VLANEntry items = 2; -} - -// VLANEntrySpec defines the desired state of VLANEntry -message VLANEntrySpec { - // VLANIndex defines the vlan index for the VLAN Claim - optional string index = 1; - - // ClaimType defines the claimType of the VLAN Entry - optional string claimType = 2; - - // ID defines the id of the VLAN entry in the tree - optional string id = 3; - - // ClaimLabels define the user defined labels and selector labels used - // in resource claim - optional github.com.kuidio.kuid.apis.common.v1alpha1.ClaimLabels claimLabels = 4; - - // Claim defines the name of the claim that is the origin of this entry - optional string claim = 5; - - // Owner defines the ownerReference of the VLANClaim - // Allow for different namesapces, hence it is part of the spec - optional github.com.kuidio.kuid.apis.common.v1alpha1.OwnerReference owner = 6; -} - -// VLANEntryStatus defines the observed state of VLANEntry -message VLANEntryStatus { - // ConditionedStatus provides the status of the VLANEntry using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 1; -} - -// VLANIndex is the Schema for the VLANIndex API -// -// +k8s:openapi-gen=true -message VLANIndex { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional VLANIndexSpec spec = 2; - - optional VLANIndexStatus status = 3; -} - -// VLANIndexList contains a list of VLANIndexs -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message VLANIndexList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated VLANIndex items = 2; -} - -// VLANIndexSpec defines the desired state of VLANIndex -message VLANIndexSpec { - // MinID defines the min VLAN ID the index supports - // +optional - optional uint32 minID = 1; - - // MaxID defines the max VLAN ID the index supports - // +optional - optional uint32 maxID = 2; - - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - optional github.com.kuidio.kuid.apis.common.v1alpha1.UserDefinedLabels userDefinedLabels = 3; -} - -// VLANIndexStatus defines the observed state of VLANIndex -message VLANIndexStatus { - // MinID defines the min VLAN ID the index supports - // +optional - optional uint32 minID = 1; - - // MaxID defines the max VLAN ID the index supports - // +optional - optional uint32 maxID = 2; - - // ConditionedStatus provides the status of the VLANIndex using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 3; -} - diff --git a/apis/backend/vlan/v1alpha1/register.go b/apis/backend/vlan/v1alpha1/register.go deleted file mode 100644 index a0e90db..0000000 --- a/apis/backend/vlan/v1alpha1/register.go +++ /dev/null @@ -1,69 +0,0 @@ -/* -Copyright 2024 Nokia. - -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. -*/ - -// +kubebuilder:object:generate=true -// +groupName=vlan.be.kuid.dev -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -const ( - Group = "vlan.be.kuid.dev" - Version = "v1alpha1" -) - -var ( - // SchemeGroupVersion contains the API group and version information for the types in this package. - SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version} - // AddToScheme applies all the stored functions to the scheme. A non-nil error - // indicates that one function failed and the attempt was abandoned. - //AddToScheme = (&runtime.SchemeBuilder{}).AddToScheme - AddToScheme = localSchemeBuilder.AddToScheme - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - schemeBuilder runtime.SchemeBuilder - localSchemeBuilder = &schemeBuilder -) - -// Resource takes an unqualified resource and returns a Group qualified GroupResource -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} - -func init() { - localSchemeBuilder.Register(addKnownTypes) -} - -// Adds the list of known types to the given scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - // +kubebuilder:scaffold:install - - scheme.AddKnownTypes(SchemeGroupVersion, - &VLANClaim{}, - &VLANClaimList{}, - &VLANEntry{}, - &VLANEntryList{}, - &VLANIndex{}, - &VLANIndexList{}, - ) - - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/apis/backend/vlan/v1alpha1/vlan_types.go b/apis/backend/vlan/v1alpha1/vlan_types.go deleted file mode 100644 index 957ea35..0000000 --- a/apis/backend/vlan/v1alpha1/vlan_types.go +++ /dev/null @@ -1,44 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -type VLANClaimType string - -const ( - ClaimType_Invalid VLANClaimType = "invalid" - ClaimType_StaticID VLANClaimType = "staticVLANID" - ClaimType_DynamicID VLANClaimType = "dynamicVLANID" - ClaimType_Range VLANClaimType = "vlanRange" -) - -func GetClaimTypeFromString(s string) VLANClaimType { - switch s { - case string(ClaimType_StaticID): - return ClaimType_StaticID - case string(ClaimType_DynamicID): - return ClaimType_DynamicID - case string(ClaimType_Range): - return ClaimType_Range - default: - return ClaimType_Invalid - } -} - -const ( - VLANIndexReservedMinName = "rangeReservedMin" - VLANIndexReservedMaxName = "rangeReservedMax" -) diff --git a/apis/backend/vlan/v1alpha1/vlanclaim_interface.go b/apis/backend/vlan/v1alpha1/vlanclaim_interface.go deleted file mode 100644 index 5a39e9c..0000000 --- a/apis/backend/vlan/v1alpha1/vlanclaim_interface.go +++ /dev/null @@ -1,530 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "crypto/sha1" - "encoding/json" - "errors" - "fmt" - "strconv" - "strings" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/idxtable/pkg/table" - "github.com/henderiw/idxtable/pkg/table/table16" - "github.com/henderiw/idxtable/pkg/tree" - "github.com/henderiw/idxtable/pkg/tree/id16" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/selection" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" - "k8s.io/utils/ptr" -) - -const VLANClaimPlural = "vlanclaims" -const VLANClaimSingular = "vlanclaim" -const VLANID_Min = 0 -const VLANID_Max = 4095 - -// +k8s:deepcopy-gen=false -var _ resource.Object = &VLANClaim{} -var _ resource.ObjectList = &VLANClaimList{} - -var _ resource.ObjectWithStatusSubResource = &VLANClaim{} - -func (VLANClaimStatus) SubResourceName() string { - return fmt.Sprintf("%s/%s", VLANClaimPlural, "status") -} - -func (r VLANClaimStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { - cfg, ok := obj.(*VLANClaim) - if ok { - cfg.Status = r - } -} - -func (r *VLANClaim) GetStatus() resource.StatusSubResource { - return r.Status -} - -// GetListMeta returns the ListMeta -func (r *VLANClaimList) GetListMeta() *metav1.ListMeta { - return &r.ListMeta -} - -func (r *VLANClaim) GetSingularName() string { - return VLANClaimSingular -} - -func (VLANClaim) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Resource: VLANClaimPlural, - } -} - -// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. -// IsStorageVersion implements resource.Object. -func (VLANClaim) IsStorageVersion() bool { - return true -} - -// GetObjectMeta implements resource.Object -func (r *VLANClaim) GetObjectMeta() *metav1.ObjectMeta { - return &r.ObjectMeta -} - -// NamespaceScoped returns true to indicate Fortune is a namespaced resource. -// NamespaceScoped implements resource.Object. -func (VLANClaim) NamespaceScoped() bool { - return true -} - -// New implements resource.Object -func (VLANClaim) New() runtime.Object { - return &VLANClaim{} -} - -// NewList implements resource.Object -func (VLANClaim) NewList() runtime.Object { - return &VLANClaimList{} -} - -// GetCondition returns the condition based on the condition kind -func (r *VLANClaim) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { - return r.Status.GetCondition(t) -} - -// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions -// to be set at once -func (r *VLANClaim) SetConditions(c ...conditionv1alpha1.Condition) { - r.Status.SetConditions(c...) -} - -// VLANClaimConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for VLANClaim -func VLANClaimConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { - switch label { - case "metadata.name": - return label, value, nil - case "metadata.namespace": - return label, value, nil - case "spec.index": - return label, value, nil - default: - return "", "", fmt.Errorf("%q is not a known field selector", label) - } -} - -func (r *VLANClaimList) GetItems() []backend.Object { - objs := []backend.Object{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *VLANClaim) CalculateHash() ([sha1.Size]byte, error) { - // Convert the struct to JSON - jsonData, err := json.Marshal(r) - if err != nil { - return [sha1.Size]byte{}, err - } - - // Calculate SHA-1 hash - return sha1.Sum(jsonData), nil -} - -func (r *VLANClaim) GetNamespacedName() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.GetNamespace(), - Name: r.GetName(), - } -} - -func (r *VLANClaim) GetKey() store.Key { - return store.KeyFromNSN(types.NamespacedName{Namespace: r.Namespace, Name: r.Spec.Index}) -} - -func (r *VLANClaim) GetIndex() string { - return r.Spec.Index -} - -func (r *VLANClaim) GetSelector() *metav1.LabelSelector { - return r.Spec.Selector -} - -func (r *VLANClaim) GetOwnerReference() *commonv1alpha1.OwnerReference { - return &commonv1alpha1.OwnerReference{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Kind: r.Kind, - Namespace: r.Namespace, - Name: r.Name, - } -} - -func (r *VLANClaim) GetStaticID() *uint64 { - if r.Spec.ID == nil { - return nil - } - return ptr.To[uint64](uint64(*r.Spec.ID)) -} - -func (r *VLANClaim) GetStaticTreeID(t string) tree.ID { - if r.Spec.ID == nil { - return nil - } - return id16.NewID(uint16(*r.Spec.ID), id16.IDBitSize) -} - -func (r *VLANClaim) GetClaimID(t string, id uint64) tree.ID { - return id16.NewID(uint16(id), id16.IDBitSize) -} - -func (r *VLANClaim) GetRange() *string { - return r.Spec.Range -} - -func (r *VLANClaim) GetRangeID(_ string) (tree.Range, error) { - if r.Spec.Range == nil { - return nil, fmt.Errorf("cannot provide a range without an id") - } - return id16.ParseRange(*r.Spec.Range) -} - -func (r *VLANClaim) GetTable(s string, to, from uint64) table.Table { - return table16.New(uint16(to), uint16(from)) -} - -func (r *VLANClaim) GetClaimRequest() string { - // we assume validation is already done when calling this - if r.Spec.ID != nil { - return strconv.Itoa(int(*r.Spec.ID)) - } - if r.Spec.Range != nil { - return *r.Spec.Range - } - return "" -} - -func (r *VLANClaim) GetClaimResponse() string { - // we assume validation is already done when calling this - if r.Status.ID != nil { - return strconv.Itoa(int(*r.Status.ID)) - } - if r.Status.Range != nil { - return *r.Status.Range - } - return "" -} - -func (r *VLANClaim) GetClaimType() backend.ClaimType { - claimType := backend.ClaimType_Invalid - count := 0 - if r.Spec.ID != nil { - claimType = backend.ClaimType_StaticID - count++ - - } - if r.Spec.Range != nil { - claimType = backend.ClaimType_Range - count++ - - } - if count > 1 { - return backend.ClaimType_Invalid - } - if count == 0 { - return backend.ClaimType_DynamicID - } - return claimType -} - -func (r *VLANClaim) ValidateVLANClaimType() error { - var sb strings.Builder - count := 0 - if r.Spec.ID != nil { - sb.WriteString(fmt.Sprintf("id: %d", *r.Spec.ID)) - count++ - - } - if r.Spec.Range != nil { - if count > 0 { - sb.WriteString(", ") - } - sb.WriteString(fmt.Sprintf("range: %s", *r.Spec.Range)) - count++ - - } - if count > 1 { - return fmt.Errorf("a claim can only have 1 addressing, got %s", sb.String()) - } - return nil -} - -func validateVLANID(id int) error { - if id < VLANID_Min { - return fmt.Errorf("invalid vlan id, got %d", id) - } - if id > VLANID_Max { - return fmt.Errorf("invalid vlan id, got %d", id) - } - return nil -} - -func (r *VLANClaim) ValidateVLANID() error { - if r.Spec.ID == nil { - return fmt.Errorf("no vlan id provided") - } - if err := validateVLANID(int(*r.Spec.ID)); err != nil { - return fmt.Errorf("invalid vlan id err %s", err.Error()) - } - return nil -} - -func (r *VLANClaim) GetVLANRange() (int, int) { - if r.Spec.Range == nil { - return 0, 0 - } - parts := strings.SplitN(*r.Spec.Range, "-", 2) - if len(parts) != 2 { - return 0, 0 - } - start, err := strconv.Atoi(parts[0]) - if err != nil { - return 0, 0 - } - end, err := strconv.Atoi(parts[1]) - if err != nil { - return 0, 0 - } - return start, end -} - -func (r *VLANClaim) ValidateVLANRange() error { - if r.Spec.Range == nil { - return fmt.Errorf("no vlan range provided") - } - parts := strings.SplitN(*r.Spec.Range, "-", 2) - if len(parts) != 2 { - return fmt.Errorf("invalid vlan range, expected -, got: %s", *r.Spec.Range) - } - var errm error - start, err := strconv.Atoi(parts[0]) - if err != nil { - errm = errors.Join(errm, fmt.Errorf("invalid vlan range start, got: %s, err: %s", *r.Spec.Range, err.Error())) - } - end, err := strconv.Atoi(parts[1]) - if err != nil { - errm = errors.Join(errm, fmt.Errorf("invalid vlan range end, got: %s, err: %s", *r.Spec.Range, err.Error())) - } - if errm != nil { - return errm - } - if start > end { - errm = errors.Join(errm, fmt.Errorf("invalid vlan range start > end %s", *r.Spec.Range)) - } - if err := validateVLANID(start); err != nil { - errm = errors.Join(errm, fmt.Errorf("invalid vlan start err %s", err.Error())) - } - if err := validateVLANID(end); err != nil { - errm = errors.Join(errm, fmt.Errorf("invalid vlan end err %s", err.Error())) - } - return errm -} - -func (r *VLANClaim) ValidateSyntax(s string) field.ErrorList { - var allErrs field.ErrorList - - gv, err := schema.ParseGroupVersion(r.APIVersion) - if err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("apiVersion"), - r, - fmt.Errorf("invalid apiVersion: err: %s", err.Error()).Error(), - )) - return allErrs - } - - // this is for user convenience - if r.Spec.Owner == nil { - r.Spec.Owner = &commonv1alpha1.OwnerReference{ - Group: gv.Group, - Version: gv.Version, - Kind: r.Kind, - Namespace: r.Namespace, - Name: r.Name, - } - } - - if err := r.ValidateVLANClaimType(); err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath(""), - r, - err.Error(), - )) - return allErrs - } - var v SyntaxValidator - claimType := r.GetClaimType() - switch claimType { - case backend.ClaimType_DynamicID: - v = &vlanDynamicIDSyntaxValidator{name: string(claimType)} - case backend.ClaimType_StaticID: - v = &vlanStaticIDSyntaxValidator{name: string(claimType)} - case backend.ClaimType_Range: - v = &vlanRangeSyntaxValidator{name: string(claimType)} - default: - return allErrs - } - return v.Validate(r) -} - -func (r *VLANClaim) ValidateOwner(labels labels.Set) error { - routeClaimName := labels[backend.KuidClaimNameKey] - routeOwner := commonv1alpha1.OwnerReference{ - Group: labels[backend.KuidOwnerGroupKey], - Version: labels[backend.KuidOwnerVersionKey], - Kind: labels[backend.KuidOwnerKindKey], - Namespace: labels[backend.KuidOwnerNamespaceKey], - Name: labels[backend.KuidOwnerNameKey], - } - if (r.Spec.Owner != nil && *r.Spec.Owner != routeOwner) || r.Name != routeClaimName { - return fmt.Errorf("route owned by different claim got name %s/%s owner %s/%s", - r.Name, - routeClaimName, - r.Spec.Owner.String(), - routeOwner.String(), - ) - } - return nil -} - -// GetLabelSelector returns a labels selector based on the label selector -func (r *VLANClaim) GetLabelSelector() (labels.Selector, error) { - return r.Spec.GetLabelSelector() -} - -func (r *VLANClaim) GetClaimLabels() labels.Set { - labels := r.Spec.GetUserDefinedLabels() - // system defined labels - labels[backend.KuidClaimTypeKey] = string(r.GetClaimType()) - labels[backend.KuidClaimNameKey] = r.Name - labels[backend.KuidOwnerGroupKey] = r.Spec.Owner.Group - labels[backend.KuidOwnerVersionKey] = r.Spec.Owner.Version - labels[backend.KuidOwnerKindKey] = r.Spec.Owner.Kind - labels[backend.KuidOwnerNamespaceKey] = r.Spec.Owner.Namespace - labels[backend.KuidOwnerNameKey] = r.Spec.Owner.Name - return labels -} - -// GetOwnerSelector returns a label selector to select the owner of the claim in the backend -func (r *VLANClaim) GetOwnerSelector() (labels.Selector, error) { - l := map[string]string{ - backend.KuidOwnerGroupKey: r.Spec.Owner.Group, - backend.KuidOwnerVersionKey: r.Spec.Owner.Version, - backend.KuidOwnerKindKey: r.Spec.Owner.Kind, - backend.KuidOwnerNamespaceKey: r.Spec.Owner.Namespace, - backend.KuidOwnerNameKey: r.Spec.Owner.Name, - backend.KuidClaimNameKey: r.Name, - } - - fullselector := labels.NewSelector() - for k, v := range l { - req, err := labels.NewRequirement(k, selection.Equals, []string{v}) - if err != nil { - return nil, err - } - fullselector = fullselector.Add(*req) - } - return fullselector, nil -} - -// BuildVLANClaim returns a reource from a client Object a Spec/Status -func BuildVLANClaim(meta metav1.ObjectMeta, spec *VLANClaimSpec, status *VLANClaimStatus) *VLANClaim { - aspec := VLANClaimSpec{} - if spec != nil { - aspec = *spec - } - astatus := VLANClaimStatus{} - if status != nil { - astatus = *status - } - return &VLANClaim{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: VLANClaimKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -func (r *VLANClaim) SetStatusRange(s *string) { - r.Status.Range = s -} - -func (r *VLANClaim) SetStatusID(s *uint64) { - if s == nil { - r.Status.ID = nil - return - } - r.Status.ID = ptr.To[uint32](uint32(*s)) -} - -func (r *VLANClaim) GetStatusID() *uint64 { - if r.Status.ID == nil { - return nil - } - return ptr.To[uint64](uint64(*r.Status.ID)) -} - -func (r *VLANClaim) GetSpec() any { - return r.Spec -} - -func (r *VLANClaim) SetSpec(s any) { - if spec, ok := s.(VLANClaimSpec); ok { - r.Spec = spec - } -} - -func (r *VLANClaim) NewObjList() backend.GenericObjectList { - return &VLANClaimList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: VLANClaimListKind}, - } -} - -func (r *VLANClaimList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} diff --git a/apis/backend/vlan/v1alpha1/vlanclaim_syntaxvalidator.go b/apis/backend/vlan/v1alpha1/vlanclaim_syntaxvalidator.go deleted file mode 100644 index 2d85656..0000000 --- a/apis/backend/vlan/v1alpha1/vlanclaim_syntaxvalidator.go +++ /dev/null @@ -1,68 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - fmt "fmt" - - "k8s.io/apimachinery/pkg/util/validation/field" -) - -type SyntaxValidator interface { - Validate(claim *VLANClaim) field.ErrorList -} - -type vlanRangeSyntaxValidator struct { - name string -} - -func (r *vlanRangeSyntaxValidator) Validate(claim *VLANClaim) field.ErrorList { - var allErrs field.ErrorList - if err := claim.ValidateVLANRange(); err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.range"), - claim, - fmt.Errorf("invalid vlan range %s, err: %s", r.name, err.Error()).Error(), - )) - } - return allErrs -} - -type vlanDynamicIDSyntaxValidator struct { - name string -} - -func (r *vlanDynamicIDSyntaxValidator) Validate(claim *VLANClaim) field.ErrorList { - var allErrs field.ErrorList - return allErrs -} - -type vlanStaticIDSyntaxValidator struct { - name string -} - -func (r *vlanStaticIDSyntaxValidator) Validate(claim *VLANClaim) field.ErrorList { - var allErrs field.ErrorList - if err := claim.ValidateVLANID(); err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.id"), - claim, - fmt.Errorf("invalid vlan id %s", r.name).Error(), - )) - } - return allErrs -} diff --git a/apis/backend/vlan/v1alpha1/vlanclaim_types.go b/apis/backend/vlan/v1alpha1/vlanclaim_types.go deleted file mode 100644 index 63045e5..0000000 --- a/apis/backend/vlan/v1alpha1/vlanclaim_types.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "reflect" - - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// VLANClaimSpec defines the desired state of VLANClaim -type VLANClaimSpec struct { - // VLANIndex defines the vlan index for the VLAN Claim - Index string `json:"index" yaml:"index" protobuf:"bytes,1,opt,name=index"` - // VLANID defines the vlan for the VLAN claim - // +optional - ID *uint32 `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,2,opt,name=id"` - // Range defines the vlan range for the VLAN claim - // The following notation is used: start-end - - // the vlans in the range must be consecutive - // +optional - Range *string `json:"range,omitempty" yaml:"range,omitempty" protobuf:"bytes,3,opt,name=range"` - // ClaimLabels define the user defined labels and selector labels used - // in resource claim - commonv1alpha1.ClaimLabels `json:",inline" yaml:",inline" protobuf:"bytes,4,opt,name=claimLabels"` - // Owner defines the ownerReference of the VLANClaim - // Allow for different namesapces, hence it is part of the spec - Owner *commonv1alpha1.OwnerReference `json:"owner,omitempty" yaml:"owner,omitempty" protobuf:"bytes,5,opt,name=owner"` -} - -// VLANClaimStatus defines the observed state of VLANClaim -type VLANClaimStatus struct { - // ConditionedStatus provides the status of the Claim using conditions - // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` - // VLANID defines the vlan for the VLAN claim - // +optional - ID *uint32 `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,2,opt,name=id"` - // VLANRange defines the vlan range for the VLAN claim - // +optional - Range *string `json:"range,omitempty" yaml:"range,omitempty" protobuf:"bytes,3,opt,name=range"` - // ExpiryTime defines when the claim expires - // +kubebuilder:validation:Optional - // +optional - ExpiryTime *string `json:"expiryTime,omitempty" yaml:"expiryTime,omitempty" protobuf:"bytes,4,opt,name=expiryTime"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// VLANClaim is the Schema for the VLANClaim API -// -// +k8s:openapi-gen=true -type VLANClaim struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - Spec VLANClaimSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - Status VLANClaimStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// VLANClaimList contains a list of VLANClaims -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type VLANClaimList struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []VLANClaim `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` -} - -var ( - VLANClaimKind = reflect.TypeOf(VLANClaim{}).Name() - VLANClaimListKind = reflect.TypeOf(VLANClaimList{}).Name() -) diff --git a/apis/backend/vlan/v1alpha1/vlanentry_interface.go b/apis/backend/vlan/v1alpha1/vlanentry_interface.go deleted file mode 100644 index 0ac66f8..0000000 --- a/apis/backend/vlan/v1alpha1/vlanentry_interface.go +++ /dev/null @@ -1,275 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "crypto/sha1" - "encoding/json" - "fmt" - strings "strings" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" -) - -const VLANEntryPlural = "vlanentries" -const VLANEntrySingular = "vlanentry" - -// +k8s:deepcopy-gen=false -var _ resource.Object = &VLANEntry{} -var _ resource.ObjectList = &VLANEntryList{} - -// GetListMeta returns the ListMeta -func (r *VLANEntryList) GetListMeta() *metav1.ListMeta { - return &r.ListMeta -} - -func (r *VLANEntryList) GetItems() []backend.Object { - entries := make([]backend.Object, 0, len(r.Items)) - for _, entry := range r.Items { - entries = append(entries, &entry) - } - return entries -} - -func (r *VLANEntry) GetSingularName() string { - return VLANEntrySingular -} - -func (VLANEntry) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Resource: VLANEntryPlural, - } -} - -// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. -// IsStorageVersion implements resource.Object. -func (VLANEntry) IsStorageVersion() bool { - return true -} - -// GetObjectMeta implements resource.Object -func (r *VLANEntry) GetObjectMeta() *metav1.ObjectMeta { - return &r.ObjectMeta -} - -// NamespaceScoped returns true to indicate Fortune is a namespaced resource. -// NamespaceScoped implements resource.Object. -func (VLANEntry) NamespaceScoped() bool { - return true -} - -// New implements resource.Object -func (VLANEntry) New() runtime.Object { - return &VLANEntry{} -} - -// NewList implements resource.Object -func (VLANEntry) NewList() runtime.Object { - return &VLANEntryList{} -} - -// GetCondition returns the condition based on the condition kind -func (r *VLANEntry) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { - return r.Status.GetCondition(t) -} - -// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions -// to be set at once -func (r *VLANEntry) SetConditions(c ...conditionv1alpha1.Condition) { - r.Status.SetConditions(c...) -} - -// VLANEntryConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for VLANEntry -func VLANEntryConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { - switch label { - case "metadata.name": - return label, value, nil - case "metadata.namespace": - return label, value, nil - case "spec.index": - return label, value, nil - default: - return "", "", fmt.Errorf("%q is not a known field selector", label) - } -} - -func (r *VLANEntry) CalculateHash() ([sha1.Size]byte, error) { - // Convert the struct to JSON - jsonData, err := json.Marshal(r) - if err != nil { - return [sha1.Size]byte{}, err - } - - // Calculate SHA-1 hash - return sha1.Sum(jsonData), nil -} - -func (r *VLANEntry) GetNamespacedName() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.GetNamespace(), - Name: r.GetName(), - } -} - -func (r *VLANEntry) GetOwnerReference() *commonv1alpha1.OwnerReference { - return r.Spec.Owner -} - -func (r *VLANEntry) GetClaimName() string { - return r.Spec.Claim -} - -func (r *VLANEntry) GetClaimType() backend.ClaimType { - return r.Spec.ClaimType -} - -func (r *VLANEntry) GetKey() store.Key { - return store.KeyFromNSN(types.NamespacedName{Namespace: r.Namespace, Name: r.Spec.Index}) -} - -func (r *VLANEntry) GetIndex() string { - return r.Spec.Index -} - -func (r *VLANEntry) GetOwnerGVK() schema.GroupVersionKind { - return schema.GroupVersionKind{ - Group: r.Spec.Owner.Group, - Version: r.Spec.Owner.Version, - Kind: r.Spec.Owner.Kind, - } -} - -func (r *VLANEntry) GetOwnerNSN() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.Spec.Owner.Namespace, - Name: r.Spec.Owner.Name, - } -} - -func (r *VLANEntry) GetSpec() any { - return r.Spec -} - -func (r *VLANEntry) GetSpecID() string { - return r.Spec.ID -} - -func (r *VLANEntry) SetSpec(spec any) { - s, ok := spec.(VLANEntrySpec) - if ok { - r.Spec = s - } -} - -func GetVLANEntry(k store.Key, vrange, id string, labels map[string]string) backend.EntryObject { - //log := log.FromContext(ctx) - - index := k.Name - ns := k.Namespace - - spec := &VLANEntrySpec{ - Index: index, - ClaimType: backend.GetClaimTypeFromString(labels[backend.KuidClaimTypeKey]), - Claim: labels[backend.KuidClaimNameKey], - ID: id, - Owner: &commonv1alpha1.OwnerReference{ - Group: labels[backend.KuidOwnerGroupKey], - Version: labels[backend.KuidOwnerVersionKey], - Kind: labels[backend.KuidOwnerKindKey], - Namespace: labels[backend.KuidOwnerNamespaceKey], - Name: labels[backend.KuidOwnerNameKey], - }, - } - // filter the system defined labels from the labels to prepare for the user defined labels - udLabels := map[string]string{} - for k, v := range labels { - if !backend.BackendSystemKeys.Has(k) { - udLabels[k] = v - } - } - spec.UserDefinedLabels.Labels = udLabels - - status := &VLANEntryStatus{} - status.SetConditions(conditionv1alpha1.Ready()) - - id = strings.ReplaceAll(id, "/", "-") - name := fmt.Sprintf("%s.%s", index, id) - if vrange != "" { - name = fmt.Sprintf("%s.%s", vrange, id) - } - - return BuildVLANEntry( - metav1.ObjectMeta{ - Name: name, - Namespace: ns, - }, - spec, - status, - ) -} - -// BuildVLANEntry returns a reource from a client Object a Spec/Status -func BuildVLANEntry(meta metav1.ObjectMeta, spec *VLANEntrySpec, status *VLANEntryStatus) backend.EntryObject { - aspec := VLANEntrySpec{} - if spec != nil { - aspec = *spec - } - astatus := VLANEntryStatus{} - if status != nil { - astatus = *status - } - return &VLANEntry{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: VLANEntryKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -func (r *VLANEntry) ValidateSyntax(_ string) field.ErrorList { - var allErrs field.ErrorList - return allErrs -} - -func (r *VLANEntry) NewObjList() backend.GenericObjectList { - return &VLANEntryList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: VLANEntryListKind}, - } -} - -func (r *VLANEntryList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} diff --git a/apis/backend/vlan/v1alpha1/vlanentry_types.go b/apis/backend/vlan/v1alpha1/vlanentry_types.go deleted file mode 100644 index dbdf993..0000000 --- a/apis/backend/vlan/v1alpha1/vlanentry_types.go +++ /dev/null @@ -1,78 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "reflect" - - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// VLANEntrySpec defines the desired state of VLANEntry -type VLANEntrySpec struct { - // VLANIndex defines the vlan index for the VLAN Claim - Index string `json:"index" yaml:"index" protobuf:"bytes,1,opt,name=index"` - // ClaimType defines the claimType of the VLAN Entry - ClaimType backend.ClaimType `json:"claimType,omitempty" yaml:"claimType,omitempty" protobuf:"bytes,2,opt,name=claimType"` - // ID defines the id of the VLAN entry in the tree - ID string `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,3,opt,name=id"` - // ClaimLabels define the user defined labels and selector labels used - // in resource claim - commonv1alpha1.ClaimLabels `json:",inline" yaml:",inline" protobuf:"bytes,4,opt,name=claimLabels"` - // Claim defines the name of the claim that is the origin of this entry - Claim string `json:"claim" yaml:"claim" protobuf:"bytes,5,opt,name=claim"` - // Owner defines the ownerReference of the VLANClaim - // Allow for different namesapces, hence it is part of the spec - Owner *commonv1alpha1.OwnerReference `json:"owner,omitempty" yaml:"owner,omitempty" protobuf:"bytes,6,opt,name=owner"` -} - -// VLANEntryStatus defines the observed state of VLANEntry -type VLANEntryStatus struct { - // ConditionedStatus provides the status of the VLANEntry using conditions - // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// VLANEntry is the Schema for the vlanentry API -// -// +k8s:openapi-gen=true -type VLANEntry struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - Spec VLANEntrySpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - Status VLANEntryStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// VLANEntryList contains a list of VLANEntries -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type VLANEntryList struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []VLANEntry `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` -} - -var ( - VLANEntryKind = reflect.TypeOf(VLANEntry{}).Name() - VLANEntryListKind = reflect.TypeOf(VLANEntryList{}).Name() -) diff --git a/apis/backend/vlan/v1alpha1/vlanindex_interface.go b/apis/backend/vlan/v1alpha1/vlanindex_interface.go deleted file mode 100644 index c6c5a50..0000000 --- a/apis/backend/vlan/v1alpha1/vlanindex_interface.go +++ /dev/null @@ -1,309 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "crypto/sha1" - "encoding/json" - "fmt" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/idxtable/pkg/tree/gtree" - "github.com/henderiw/idxtable/pkg/tree/tree16" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" - "k8s.io/utils/ptr" -) - -const VLANIndexPlural = "vlanindices" -const VLANIndexSingular = "vlanindex" - -// +k8s:deepcopy-gen=false -var _ resource.Object = &VLANIndex{} -var _ resource.ObjectList = &VLANIndexList{} - -// GetListMeta returns the ListMeta -func (r *VLANIndexList) GetListMeta() *metav1.ListMeta { - return &r.ListMeta -} - -func (r *VLANIndex) GetSingularName() string { - return VLANIndexSingular -} - -func (VLANIndex) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Resource: VLANIndexPlural, - } -} - -// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. -// IsStorageVersion implements resource.Object. -func (VLANIndex) IsStorageVersion() bool { - return true -} - -// GetObjectMeta implements resource.Object -func (r *VLANIndex) GetObjectMeta() *metav1.ObjectMeta { - return &r.ObjectMeta -} - -// NamespaceScoped returns true to indicate Fortune is a namespaced resource. -// NamespaceScoped implements resource.Object. -func (VLANIndex) NamespaceScoped() bool { - return true -} - -// New implements resource.Object -func (VLANIndex) New() runtime.Object { - return &VLANIndex{} -} - -// NewList implements resource.Object -func (VLANIndex) NewList() runtime.Object { - return &VLANIndexList{} -} - -// GetCondition returns the condition based on the condition kind -func (r *VLANIndex) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { - return r.Status.GetCondition(t) -} - -// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions -// to be set at once -func (r *VLANIndex) SetConditions(c ...conditionv1alpha1.Condition) { - r.Status.SetConditions(c...) -} - -// VLANIndexConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for VLANIndex -func VLANIndexConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { - switch label { - case "metadata.name": - return label, value, nil - case "metadata.namespace": - return label, value, nil - default: - return "", "", fmt.Errorf("%q is not a known field selector", label) - } -} - -func (r *VLANIndexList) GetItems() []backend.Object { - objs := []backend.Object{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *VLANIndex) CalculateHash() ([sha1.Size]byte, error) { - // Convert the struct to JSON - jsonData, err := json.Marshal(r) - if err != nil { - return [sha1.Size]byte{}, err - } - - // Calculate SHA-1 hash - return sha1.Sum(jsonData), nil -} - -func (r *VLANIndex) GetNamespacedName() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.GetNamespace(), - Name: r.GetName(), - } -} - -func (r *VLANIndex) GetTree() gtree.GTree { - tree, err := tree16.New(12) - if err != nil { - return nil - } - return tree -} - -func (r *VLANIndex) GetKey() store.Key { - return store.KeyFromNSN(r.GetNamespacedName()) -} - -func (r *VLANIndex) GetType() string { - return "" -} - -func (r *VLANIndex) GetOwnerReference() *commonv1alpha1.OwnerReference { - return &commonv1alpha1.OwnerReference{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Kind: VLANIndexKind, - Namespace: r.Namespace, - Name: r.Name, - } -} - -func (r *VLANIndex) ValidateSyntax(_ string) field.ErrorList { - var allErrs field.ErrorList - - if r.Spec.MinID != nil { - if err := validateVLANID(int(*r.Spec.MinID)); err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.minID"), - r, - fmt.Errorf("invalid vlan ID %d", *r.Spec.MinID).Error(), - )) - } - } - if r.Spec.MaxID != nil { - if err := validateVLANID(int(*r.Spec.MaxID)); err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.maxID"), - r, - fmt.Errorf("invalid vlan ID %d", *r.Spec.MaxID).Error(), - )) - } - } - if r.Spec.MinID != nil && r.Spec.MaxID != nil { - if *r.Spec.MinID > *r.Spec.MaxID { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.maxID"), - r, - fmt.Errorf("min vlan ID %d cannot be bigger than max vlan ID %d", *r.Spec.MinID, *r.Spec.MaxID).Error(), - )) - } - } - return allErrs -} - -func GetMinClaimRange(id uint32) string { - return fmt.Sprintf("%d-%d", VLANID_Min, id-1) -} - -func GetMaxClaimRange(id uint32) string { - return fmt.Sprintf("%d-%d", id+1, VLANID_Max) -} - -func (r *VLANIndex) GetMinID() *uint64 { - if r.Spec.MinID == nil { - return nil - } - return ptr.To[uint64](uint64(*r.Spec.MinID)) -} - -func (r *VLANIndex) GetMaxID() *uint64 { - if r.Spec.MaxID == nil { - return nil - } - return ptr.To[uint64](uint64(*r.Spec.MaxID)) -} - -func (r *VLANIndex) GetMinClaimNSN() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.Namespace, - Name: fmt.Sprintf("%s.%s", r.Name, VLANIndexReservedMinName), - } -} - -func (r *VLANIndex) GetMaxClaimNSN() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.Namespace, - Name: fmt.Sprintf("%s.%s", r.Name, VLANIndexReservedMaxName), - } -} - -func (r *VLANIndex) GetMinClaim() backend.ClaimObject { - return BuildVLANClaim( - metav1.ObjectMeta{ - Namespace: r.GetNamespace(), - Name: r.GetMinClaimNSN().Name, - }, - &VLANClaimSpec{ - Index: r.Name, - Range: ptr.To[string](GetMinClaimRange(*r.Spec.MinID)), - Owner: commonv1alpha1.GetOwnerReference(r), - }, - nil, - ) -} - -func (r *VLANIndex) GetMaxClaim() backend.ClaimObject { - return BuildVLANClaim( - metav1.ObjectMeta{ - Namespace: r.GetNamespace(), - Name: r.GetMaxClaimNSN().Name, - }, - &VLANClaimSpec{ - Index: r.Name, - Range: ptr.To[string](GetMaxClaimRange(*r.Spec.MaxID)), - Owner: commonv1alpha1.GetOwnerReference(r), - }, - nil, - ) -} - -// BuildVLANIndex returns a reource from a client Object a Spec/Status -func BuildVLANIndex(meta metav1.ObjectMeta, spec *VLANIndexSpec, status *VLANIndexStatus) *VLANIndex { - aspec := VLANIndexSpec{} - if spec != nil { - aspec = *spec - } - astatus := VLANIndexStatus{} - if status != nil { - astatus = *status - } - return &VLANIndex{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: VLANIndexKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -func (r *VLANIndex) GetSpec() any { - return r.Spec -} - -func (r *VLANIndex) SetSpec(s any) { - if spec, ok := s.(VLANIndexSpec); ok { - r.Spec = spec - } -} - -func (r *VLANIndex) NewObjList() backend.GenericObjectList { - return &VLANIndexList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: VLANIndexListKind}, - } -} - -func (r *VLANIndexList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} diff --git a/apis/backend/vlan/v1alpha1/zz_generated.deepcopy.go b/apis/backend/vlan/v1alpha1/zz_generated.deepcopy.go deleted file mode 100644 index 19d8c3d..0000000 --- a/apis/backend/vlan/v1alpha1/zz_generated.deepcopy.go +++ /dev/null @@ -1,366 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - 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 *VLANClaim) DeepCopyInto(out *VLANClaim) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANClaim. -func (in *VLANClaim) DeepCopy() *VLANClaim { - if in == nil { - return nil - } - out := new(VLANClaim) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *VLANClaim) 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 *VLANClaimList) DeepCopyInto(out *VLANClaimList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]VLANClaim, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANClaimList. -func (in *VLANClaimList) DeepCopy() *VLANClaimList { - if in == nil { - return nil - } - out := new(VLANClaimList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *VLANClaimList) 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 *VLANClaimSpec) DeepCopyInto(out *VLANClaimSpec) { - *out = *in - if in.ID != nil { - in, out := &in.ID, &out.ID - *out = new(uint32) - **out = **in - } - if in.Range != nil { - in, out := &in.Range, &out.Range - *out = new(string) - **out = **in - } - in.ClaimLabels.DeepCopyInto(&out.ClaimLabels) - if in.Owner != nil { - in, out := &in.Owner, &out.Owner - *out = new(commonv1alpha1.OwnerReference) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANClaimSpec. -func (in *VLANClaimSpec) DeepCopy() *VLANClaimSpec { - if in == nil { - return nil - } - out := new(VLANClaimSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VLANClaimStatus) DeepCopyInto(out *VLANClaimStatus) { - *out = *in - in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) - if in.ID != nil { - in, out := &in.ID, &out.ID - *out = new(uint32) - **out = **in - } - if in.Range != nil { - in, out := &in.Range, &out.Range - *out = new(string) - **out = **in - } - if in.ExpiryTime != nil { - in, out := &in.ExpiryTime, &out.ExpiryTime - *out = new(string) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANClaimStatus. -func (in *VLANClaimStatus) DeepCopy() *VLANClaimStatus { - if in == nil { - return nil - } - out := new(VLANClaimStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VLANEntry) DeepCopyInto(out *VLANEntry) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANEntry. -func (in *VLANEntry) DeepCopy() *VLANEntry { - if in == nil { - return nil - } - out := new(VLANEntry) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *VLANEntry) 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 *VLANEntryList) DeepCopyInto(out *VLANEntryList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]VLANEntry, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANEntryList. -func (in *VLANEntryList) DeepCopy() *VLANEntryList { - if in == nil { - return nil - } - out := new(VLANEntryList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *VLANEntryList) 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 *VLANEntrySpec) DeepCopyInto(out *VLANEntrySpec) { - *out = *in - in.ClaimLabels.DeepCopyInto(&out.ClaimLabels) - if in.Owner != nil { - in, out := &in.Owner, &out.Owner - *out = new(commonv1alpha1.OwnerReference) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANEntrySpec. -func (in *VLANEntrySpec) DeepCopy() *VLANEntrySpec { - if in == nil { - return nil - } - out := new(VLANEntrySpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VLANEntryStatus) DeepCopyInto(out *VLANEntryStatus) { - *out = *in - in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANEntryStatus. -func (in *VLANEntryStatus) DeepCopy() *VLANEntryStatus { - if in == nil { - return nil - } - out := new(VLANEntryStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VLANIndex) DeepCopyInto(out *VLANIndex) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANIndex. -func (in *VLANIndex) DeepCopy() *VLANIndex { - if in == nil { - return nil - } - out := new(VLANIndex) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *VLANIndex) 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 *VLANIndexList) DeepCopyInto(out *VLANIndexList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]VLANIndex, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANIndexList. -func (in *VLANIndexList) DeepCopy() *VLANIndexList { - if in == nil { - return nil - } - out := new(VLANIndexList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *VLANIndexList) 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 *VLANIndexSpec) DeepCopyInto(out *VLANIndexSpec) { - *out = *in - if in.MinID != nil { - in, out := &in.MinID, &out.MinID - *out = new(uint32) - **out = **in - } - if in.MaxID != nil { - in, out := &in.MaxID, &out.MaxID - *out = new(uint32) - **out = **in - } - in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANIndexSpec. -func (in *VLANIndexSpec) DeepCopy() *VLANIndexSpec { - if in == nil { - return nil - } - out := new(VLANIndexSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VLANIndexStatus) DeepCopyInto(out *VLANIndexStatus) { - *out = *in - if in.MinID != nil { - in, out := &in.MinID, &out.MinID - *out = new(uint32) - **out = **in - } - if in.MaxID != nil { - in, out := &in.MaxID, &out.MaxID - *out = new(uint32) - **out = **in - } - in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANIndexStatus. -func (in *VLANIndexStatus) DeepCopy() *VLANIndexStatus { - if in == nil { - return nil - } - out := new(VLANIndexStatus) - in.DeepCopyInto(out) - return out -} diff --git a/apis/backend/vxlan/doc.go b/apis/backend/vxlan/doc.go deleted file mode 100644 index 1a78093..0000000 --- a/apis/backend/vxlan/doc.go +++ /dev/null @@ -1,21 +0,0 @@ -/* -Copyright 2024 Nokia. - -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. -*/ - -// +k8s:deepcopy-gen=package,register -// +groupName=vxlan.be.kuid.dev - -// vxlan defines the vxlan api -package vxlan diff --git a/apis/backend/vxlan/v1alpha1/doc.go b/apis/backend/vxlan/v1alpha1/doc.go deleted file mode 100644 index a65c46f..0000000 --- a/apis/backend/vxlan/v1alpha1/doc.go +++ /dev/null @@ -1,28 +0,0 @@ -/* -Copyright 2024 Nokia. - -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. -*/ - -//go:generate deepcopy-gen -O zz_generated.deepcopy -i . -h ../../../../boilerplate.go.txt -//go:generate defaulter-gen -O zz_generated.defaults -i . -h ../../../../boilerplate.go.txt -//go:generate conversion-gen -O zz_generated.conversion -i . -h ../../../../boilerplate.go.txt - -// +k8s:openapi-gen=true -// +k8s:deepcopy-gen=package,register -// +k8s:conversion-gen=github.com/kuidio/kuid/apis/backend/vxlan -// +k8s:defaulter-gen=TypeMeta -// +groupName=vxlan.be.kuid.dev - -// Package v1alpha1 is the v1alpha1 version of the API. -package v1alpha1 // import "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1" diff --git a/apis/backend/vxlan/v1alpha1/generated.pb.go b/apis/backend/vxlan/v1alpha1/generated.pb.go deleted file mode 100644 index 06713f7..0000000 --- a/apis/backend/vxlan/v1alpha1/generated.pb.go +++ /dev/null @@ -1,3645 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 protoc-gen-gogo. DO NOT EDIT. -// source: github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1/generated.proto - -package v1alpha1 - -import ( - fmt "fmt" - - io "io" - - proto "github.com/gogo/protobuf/proto" - github_com_kuidio_kuid_apis_backend "github.com/kuidio/kuid/apis/backend" - v1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - - math "math" - math_bits "math/bits" - reflect "reflect" - strings "strings" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -func (m *VXLANClaim) Reset() { *m = VXLANClaim{} } -func (*VXLANClaim) ProtoMessage() {} -func (*VXLANClaim) Descriptor() ([]byte, []int) { - return fileDescriptor_e3cfe53e40ad77eb, []int{0} -} -func (m *VXLANClaim) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VXLANClaim) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *VXLANClaim) XXX_Merge(src proto.Message) { - xxx_messageInfo_VXLANClaim.Merge(m, src) -} -func (m *VXLANClaim) XXX_Size() int { - return m.Size() -} -func (m *VXLANClaim) XXX_DiscardUnknown() { - xxx_messageInfo_VXLANClaim.DiscardUnknown(m) -} - -var xxx_messageInfo_VXLANClaim proto.InternalMessageInfo - -func (m *VXLANClaimList) Reset() { *m = VXLANClaimList{} } -func (*VXLANClaimList) ProtoMessage() {} -func (*VXLANClaimList) Descriptor() ([]byte, []int) { - return fileDescriptor_e3cfe53e40ad77eb, []int{1} -} -func (m *VXLANClaimList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VXLANClaimList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *VXLANClaimList) XXX_Merge(src proto.Message) { - xxx_messageInfo_VXLANClaimList.Merge(m, src) -} -func (m *VXLANClaimList) XXX_Size() int { - return m.Size() -} -func (m *VXLANClaimList) XXX_DiscardUnknown() { - xxx_messageInfo_VXLANClaimList.DiscardUnknown(m) -} - -var xxx_messageInfo_VXLANClaimList proto.InternalMessageInfo - -func (m *VXLANClaimSpec) Reset() { *m = VXLANClaimSpec{} } -func (*VXLANClaimSpec) ProtoMessage() {} -func (*VXLANClaimSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_e3cfe53e40ad77eb, []int{2} -} -func (m *VXLANClaimSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VXLANClaimSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *VXLANClaimSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_VXLANClaimSpec.Merge(m, src) -} -func (m *VXLANClaimSpec) XXX_Size() int { - return m.Size() -} -func (m *VXLANClaimSpec) XXX_DiscardUnknown() { - xxx_messageInfo_VXLANClaimSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_VXLANClaimSpec proto.InternalMessageInfo - -func (m *VXLANClaimStatus) Reset() { *m = VXLANClaimStatus{} } -func (*VXLANClaimStatus) ProtoMessage() {} -func (*VXLANClaimStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_e3cfe53e40ad77eb, []int{3} -} -func (m *VXLANClaimStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VXLANClaimStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *VXLANClaimStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_VXLANClaimStatus.Merge(m, src) -} -func (m *VXLANClaimStatus) XXX_Size() int { - return m.Size() -} -func (m *VXLANClaimStatus) XXX_DiscardUnknown() { - xxx_messageInfo_VXLANClaimStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_VXLANClaimStatus proto.InternalMessageInfo - -func (m *VXLANDynamicIDSyntaxValidator) Reset() { *m = VXLANDynamicIDSyntaxValidator{} } -func (*VXLANDynamicIDSyntaxValidator) ProtoMessage() {} -func (*VXLANDynamicIDSyntaxValidator) Descriptor() ([]byte, []int) { - return fileDescriptor_e3cfe53e40ad77eb, []int{4} -} -func (m *VXLANDynamicIDSyntaxValidator) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VXLANDynamicIDSyntaxValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *VXLANDynamicIDSyntaxValidator) XXX_Merge(src proto.Message) { - xxx_messageInfo_VXLANDynamicIDSyntaxValidator.Merge(m, src) -} -func (m *VXLANDynamicIDSyntaxValidator) XXX_Size() int { - return m.Size() -} -func (m *VXLANDynamicIDSyntaxValidator) XXX_DiscardUnknown() { - xxx_messageInfo_VXLANDynamicIDSyntaxValidator.DiscardUnknown(m) -} - -var xxx_messageInfo_VXLANDynamicIDSyntaxValidator proto.InternalMessageInfo - -func (m *VXLANEntry) Reset() { *m = VXLANEntry{} } -func (*VXLANEntry) ProtoMessage() {} -func (*VXLANEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_e3cfe53e40ad77eb, []int{5} -} -func (m *VXLANEntry) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VXLANEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *VXLANEntry) XXX_Merge(src proto.Message) { - xxx_messageInfo_VXLANEntry.Merge(m, src) -} -func (m *VXLANEntry) XXX_Size() int { - return m.Size() -} -func (m *VXLANEntry) XXX_DiscardUnknown() { - xxx_messageInfo_VXLANEntry.DiscardUnknown(m) -} - -var xxx_messageInfo_VXLANEntry proto.InternalMessageInfo - -func (m *VXLANEntryList) Reset() { *m = VXLANEntryList{} } -func (*VXLANEntryList) ProtoMessage() {} -func (*VXLANEntryList) Descriptor() ([]byte, []int) { - return fileDescriptor_e3cfe53e40ad77eb, []int{6} -} -func (m *VXLANEntryList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VXLANEntryList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *VXLANEntryList) XXX_Merge(src proto.Message) { - xxx_messageInfo_VXLANEntryList.Merge(m, src) -} -func (m *VXLANEntryList) XXX_Size() int { - return m.Size() -} -func (m *VXLANEntryList) XXX_DiscardUnknown() { - xxx_messageInfo_VXLANEntryList.DiscardUnknown(m) -} - -var xxx_messageInfo_VXLANEntryList proto.InternalMessageInfo - -func (m *VXLANEntrySpec) Reset() { *m = VXLANEntrySpec{} } -func (*VXLANEntrySpec) ProtoMessage() {} -func (*VXLANEntrySpec) Descriptor() ([]byte, []int) { - return fileDescriptor_e3cfe53e40ad77eb, []int{7} -} -func (m *VXLANEntrySpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VXLANEntrySpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *VXLANEntrySpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_VXLANEntrySpec.Merge(m, src) -} -func (m *VXLANEntrySpec) XXX_Size() int { - return m.Size() -} -func (m *VXLANEntrySpec) XXX_DiscardUnknown() { - xxx_messageInfo_VXLANEntrySpec.DiscardUnknown(m) -} - -var xxx_messageInfo_VXLANEntrySpec proto.InternalMessageInfo - -func (m *VXLANEntryStatus) Reset() { *m = VXLANEntryStatus{} } -func (*VXLANEntryStatus) ProtoMessage() {} -func (*VXLANEntryStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_e3cfe53e40ad77eb, []int{8} -} -func (m *VXLANEntryStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VXLANEntryStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *VXLANEntryStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_VXLANEntryStatus.Merge(m, src) -} -func (m *VXLANEntryStatus) XXX_Size() int { - return m.Size() -} -func (m *VXLANEntryStatus) XXX_DiscardUnknown() { - xxx_messageInfo_VXLANEntryStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_VXLANEntryStatus proto.InternalMessageInfo - -func (m *VXLANIndex) Reset() { *m = VXLANIndex{} } -func (*VXLANIndex) ProtoMessage() {} -func (*VXLANIndex) Descriptor() ([]byte, []int) { - return fileDescriptor_e3cfe53e40ad77eb, []int{9} -} -func (m *VXLANIndex) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VXLANIndex) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *VXLANIndex) XXX_Merge(src proto.Message) { - xxx_messageInfo_VXLANIndex.Merge(m, src) -} -func (m *VXLANIndex) XXX_Size() int { - return m.Size() -} -func (m *VXLANIndex) XXX_DiscardUnknown() { - xxx_messageInfo_VXLANIndex.DiscardUnknown(m) -} - -var xxx_messageInfo_VXLANIndex proto.InternalMessageInfo - -func (m *VXLANIndexList) Reset() { *m = VXLANIndexList{} } -func (*VXLANIndexList) ProtoMessage() {} -func (*VXLANIndexList) Descriptor() ([]byte, []int) { - return fileDescriptor_e3cfe53e40ad77eb, []int{10} -} -func (m *VXLANIndexList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VXLANIndexList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *VXLANIndexList) XXX_Merge(src proto.Message) { - xxx_messageInfo_VXLANIndexList.Merge(m, src) -} -func (m *VXLANIndexList) XXX_Size() int { - return m.Size() -} -func (m *VXLANIndexList) XXX_DiscardUnknown() { - xxx_messageInfo_VXLANIndexList.DiscardUnknown(m) -} - -var xxx_messageInfo_VXLANIndexList proto.InternalMessageInfo - -func (m *VXLANIndexSpec) Reset() { *m = VXLANIndexSpec{} } -func (*VXLANIndexSpec) ProtoMessage() {} -func (*VXLANIndexSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_e3cfe53e40ad77eb, []int{11} -} -func (m *VXLANIndexSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VXLANIndexSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *VXLANIndexSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_VXLANIndexSpec.Merge(m, src) -} -func (m *VXLANIndexSpec) XXX_Size() int { - return m.Size() -} -func (m *VXLANIndexSpec) XXX_DiscardUnknown() { - xxx_messageInfo_VXLANIndexSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_VXLANIndexSpec proto.InternalMessageInfo - -func (m *VXLANIndexStatus) Reset() { *m = VXLANIndexStatus{} } -func (*VXLANIndexStatus) ProtoMessage() {} -func (*VXLANIndexStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_e3cfe53e40ad77eb, []int{12} -} -func (m *VXLANIndexStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VXLANIndexStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *VXLANIndexStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_VXLANIndexStatus.Merge(m, src) -} -func (m *VXLANIndexStatus) XXX_Size() int { - return m.Size() -} -func (m *VXLANIndexStatus) XXX_DiscardUnknown() { - xxx_messageInfo_VXLANIndexStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_VXLANIndexStatus proto.InternalMessageInfo - -func (m *VXLANRangeSyntaxValidator) Reset() { *m = VXLANRangeSyntaxValidator{} } -func (*VXLANRangeSyntaxValidator) ProtoMessage() {} -func (*VXLANRangeSyntaxValidator) Descriptor() ([]byte, []int) { - return fileDescriptor_e3cfe53e40ad77eb, []int{13} -} -func (m *VXLANRangeSyntaxValidator) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VXLANRangeSyntaxValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *VXLANRangeSyntaxValidator) XXX_Merge(src proto.Message) { - xxx_messageInfo_VXLANRangeSyntaxValidator.Merge(m, src) -} -func (m *VXLANRangeSyntaxValidator) XXX_Size() int { - return m.Size() -} -func (m *VXLANRangeSyntaxValidator) XXX_DiscardUnknown() { - xxx_messageInfo_VXLANRangeSyntaxValidator.DiscardUnknown(m) -} - -var xxx_messageInfo_VXLANRangeSyntaxValidator proto.InternalMessageInfo - -func (m *VXLANStaticIDSyntaxValidator) Reset() { *m = VXLANStaticIDSyntaxValidator{} } -func (*VXLANStaticIDSyntaxValidator) ProtoMessage() {} -func (*VXLANStaticIDSyntaxValidator) Descriptor() ([]byte, []int) { - return fileDescriptor_e3cfe53e40ad77eb, []int{14} -} -func (m *VXLANStaticIDSyntaxValidator) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VXLANStaticIDSyntaxValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *VXLANStaticIDSyntaxValidator) XXX_Merge(src proto.Message) { - xxx_messageInfo_VXLANStaticIDSyntaxValidator.Merge(m, src) -} -func (m *VXLANStaticIDSyntaxValidator) XXX_Size() int { - return m.Size() -} -func (m *VXLANStaticIDSyntaxValidator) XXX_DiscardUnknown() { - xxx_messageInfo_VXLANStaticIDSyntaxValidator.DiscardUnknown(m) -} - -var xxx_messageInfo_VXLANStaticIDSyntaxValidator proto.InternalMessageInfo - -func init() { - proto.RegisterType((*VXLANClaim)(nil), "github.com.kuidio.kuid.apis.backend.vxlan.v1alpha1.VXLANClaim") - proto.RegisterType((*VXLANClaimList)(nil), "github.com.kuidio.kuid.apis.backend.vxlan.v1alpha1.VXLANClaimList") - proto.RegisterType((*VXLANClaimSpec)(nil), "github.com.kuidio.kuid.apis.backend.vxlan.v1alpha1.VXLANClaimSpec") - proto.RegisterType((*VXLANClaimStatus)(nil), "github.com.kuidio.kuid.apis.backend.vxlan.v1alpha1.VXLANClaimStatus") - proto.RegisterType((*VXLANDynamicIDSyntaxValidator)(nil), "github.com.kuidio.kuid.apis.backend.vxlan.v1alpha1.VXLANDynamicIDSyntaxValidator") - proto.RegisterType((*VXLANEntry)(nil), "github.com.kuidio.kuid.apis.backend.vxlan.v1alpha1.VXLANEntry") - proto.RegisterType((*VXLANEntryList)(nil), "github.com.kuidio.kuid.apis.backend.vxlan.v1alpha1.VXLANEntryList") - proto.RegisterType((*VXLANEntrySpec)(nil), "github.com.kuidio.kuid.apis.backend.vxlan.v1alpha1.VXLANEntrySpec") - proto.RegisterType((*VXLANEntryStatus)(nil), "github.com.kuidio.kuid.apis.backend.vxlan.v1alpha1.VXLANEntryStatus") - proto.RegisterType((*VXLANIndex)(nil), "github.com.kuidio.kuid.apis.backend.vxlan.v1alpha1.VXLANIndex") - proto.RegisterType((*VXLANIndexList)(nil), "github.com.kuidio.kuid.apis.backend.vxlan.v1alpha1.VXLANIndexList") - proto.RegisterType((*VXLANIndexSpec)(nil), "github.com.kuidio.kuid.apis.backend.vxlan.v1alpha1.VXLANIndexSpec") - proto.RegisterType((*VXLANIndexStatus)(nil), "github.com.kuidio.kuid.apis.backend.vxlan.v1alpha1.VXLANIndexStatus") - proto.RegisterType((*VXLANRangeSyntaxValidator)(nil), "github.com.kuidio.kuid.apis.backend.vxlan.v1alpha1.VXLANRangeSyntaxValidator") - proto.RegisterType((*VXLANStaticIDSyntaxValidator)(nil), "github.com.kuidio.kuid.apis.backend.vxlan.v1alpha1.VXLANStaticIDSyntaxValidator") -} - -func init() { - proto.RegisterFile("github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1/generated.proto", fileDescriptor_e3cfe53e40ad77eb) -} - -var fileDescriptor_e3cfe53e40ad77eb = []byte{ - // 911 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x57, 0x4f, 0x6f, 0x1b, 0x45, - 0x14, 0xf7, 0x6e, 0xb2, 0x51, 0x3d, 0x21, 0x51, 0xb3, 0x48, 0xc8, 0x0d, 0xb0, 0xae, 0xdc, 0x4b, - 0x2f, 0x9d, 0x25, 0x11, 0x42, 0x95, 0x2a, 0x45, 0xea, 0xc6, 0x3d, 0x58, 0x6a, 0xa9, 0x34, 0x2d, - 0x55, 0x85, 0x7a, 0xe8, 0x78, 0x77, 0x62, 0x0f, 0xf6, 0xfe, 0xd1, 0xee, 0xd8, 0xd8, 0x37, 0x6e, - 0x20, 0x4e, 0x7c, 0x03, 0x8e, 0x7c, 0x0a, 0x2e, 0x9c, 0x72, 0xac, 0xc4, 0xa5, 0x07, 0x64, 0x61, - 0xf3, 0x2d, 0x38, 0xa1, 0x79, 0x33, 0xf6, 0x2e, 0x76, 0x6d, 0x6c, 0x0a, 0x01, 0x9f, 0x36, 0xf3, - 0xe6, 0xbd, 0xdf, 0x6f, 0xde, 0x7b, 0xf3, 0x7e, 0x19, 0x23, 0xaf, 0xc5, 0x45, 0xbb, 0xd7, 0xc4, - 0x7e, 0x1c, 0xba, 0x9d, 0x1e, 0x0f, 0x78, 0x0c, 0x1f, 0x97, 0x26, 0x3c, 0x73, 0x9b, 0xd4, 0xef, - 0xb0, 0x28, 0x70, 0xfb, 0x83, 0x2e, 0x8d, 0xdc, 0xfe, 0x09, 0xed, 0x26, 0x6d, 0x7a, 0xe2, 0xb6, - 0x58, 0xc4, 0x52, 0x2a, 0x58, 0x80, 0x93, 0x34, 0x16, 0xb1, 0x7d, 0x9a, 0x63, 0x60, 0x85, 0x01, - 0x1f, 0x2c, 0x31, 0xb0, 0xc6, 0xc0, 0x80, 0x81, 0xa7, 0x18, 0xc7, 0x77, 0x0a, 0xbc, 0xad, 0xb8, - 0x15, 0xbb, 0x00, 0xd5, 0xec, 0x5d, 0xc0, 0x0a, 0x16, 0xf0, 0x97, 0xa2, 0x38, 0xbe, 0xb7, 0xea, - 0x98, 0x7e, 0x1c, 0x86, 0xf1, 0xf2, 0xf3, 0x1d, 0x9f, 0xad, 0x0e, 0x8e, 0x02, 0x2e, 0xf8, 0xaa, - 0xf8, 0x8f, 0x3b, 0x77, 0x33, 0xcc, 0x63, 0xe9, 0x1f, 0x52, 0xbf, 0xcd, 0x23, 0x96, 0x0e, 0xdd, - 0xa4, 0xd3, 0x52, 0x00, 0x21, 0x13, 0xd4, 0xed, 0x2f, 0x46, 0x7d, 0xb2, 0x2c, 0x2a, 0xed, 0x45, - 0x82, 0x87, 0xcc, 0xcd, 0xfc, 0x36, 0x0b, 0xe9, 0x7c, 0x5c, 0xed, 0x27, 0x13, 0xa1, 0x67, 0xcf, - 0x1f, 0xde, 0xff, 0xf4, 0xbc, 0x4b, 0x79, 0x68, 0xbf, 0x44, 0xd7, 0x24, 0x43, 0x40, 0x05, 0xad, - 0x18, 0x37, 0x8d, 0xdb, 0xfb, 0xa7, 0x1f, 0x61, 0x85, 0x8c, 0x8b, 0xc8, 0x38, 0xe9, 0xb4, 0x54, - 0xc1, 0xa5, 0x37, 0xee, 0x9f, 0xe0, 0xc7, 0xcd, 0x2f, 0x98, 0x2f, 0x1e, 0x31, 0x41, 0x3d, 0xfb, - 0x72, 0x54, 0x2d, 0x4d, 0x46, 0x55, 0x94, 0xdb, 0xc8, 0x0c, 0xd5, 0x0e, 0xd0, 0x6e, 0x96, 0x30, - 0xbf, 0x62, 0x02, 0xba, 0x87, 0x37, 0xef, 0x26, 0xce, 0xcf, 0xfb, 0x24, 0x61, 0xbe, 0xf7, 0x8e, - 0xe6, 0xdb, 0x95, 0x2b, 0x02, 0xe8, 0x76, 0x17, 0xed, 0x65, 0x82, 0x8a, 0x5e, 0x56, 0xd9, 0x01, - 0x9e, 0xfa, 0x5b, 0xf2, 0x00, 0x96, 0x77, 0xa8, 0x99, 0xf6, 0xd4, 0x9a, 0x68, 0x8e, 0xda, 0xcf, - 0x06, 0x3a, 0xcc, 0x9d, 0x1f, 0xf2, 0x4c, 0xd8, 0x2f, 0x16, 0x0a, 0x89, 0xd7, 0x2b, 0xa4, 0x8c, - 0x86, 0x32, 0x5e, 0xd7, 0x64, 0xd7, 0xa6, 0x96, 0x42, 0x11, 0x7d, 0x64, 0x71, 0xc1, 0xc2, 0xac, - 0x62, 0xde, 0xdc, 0xb9, 0xbd, 0x7f, 0x7a, 0xf6, 0x76, 0xd9, 0x79, 0x07, 0x9a, 0xca, 0x6a, 0x48, - 0x50, 0xa2, 0xb0, 0x6b, 0x3f, 0x9a, 0xc5, 0xac, 0x64, 0x71, 0xed, 0x5b, 0xc8, 0xe2, 0x51, 0xc0, - 0x06, 0x90, 0x52, 0xb9, 0x10, 0x27, 0x8d, 0x44, 0xed, 0xd9, 0xef, 0x21, 0x93, 0x07, 0xd0, 0xdf, - 0x03, 0x6f, 0x6f, 0x32, 0xaa, 0x9a, 0x8d, 0x3a, 0x31, 0x79, 0x60, 0x57, 0x91, 0x95, 0xd2, 0xa8, - 0xc5, 0xa0, 0x25, 0x65, 0xaf, 0x2c, 0x03, 0x89, 0x34, 0x10, 0x65, 0xb7, 0x63, 0xb4, 0xef, 0x43, - 0x01, 0x69, 0x93, 0x75, 0xb3, 0xca, 0x2e, 0x94, 0xed, 0xee, 0xca, 0xdc, 0xd4, 0x30, 0xe6, 0x49, - 0x9d, 0xe7, 0xf1, 0xde, 0xbb, 0xfa, 0x74, 0xfb, 0x05, 0x23, 0x29, 0x32, 0xd8, 0x2f, 0x90, 0x15, - 0x7f, 0x19, 0xb1, 0xb4, 0x62, 0x01, 0xd5, 0xbd, 0x8d, 0xa8, 0x1e, 0xcb, 0x48, 0xc2, 0x2e, 0x58, - 0xca, 0x22, 0x9f, 0xa9, 0x74, 0x94, 0x4d, 0x81, 0xd6, 0xbe, 0x31, 0xd1, 0xf5, 0xf9, 0x2b, 0x64, - 0x7f, 0x6b, 0xa0, 0xa3, 0x99, 0x08, 0xb0, 0x40, 0x59, 0xf5, 0x0d, 0xb9, 0xff, 0x17, 0xfc, 0x3a, - 0xaa, 0x90, 0xed, 0x3c, 0x90, 0x77, 0x43, 0xe7, 0x7c, 0xb4, 0xb0, 0x45, 0x16, 0x69, 0xff, 0x7e, - 0xa7, 0x30, 0x42, 0x6c, 0x90, 0xf0, 0x74, 0xf8, 0x94, 0x87, 0x0c, 0x1a, 0x55, 0xf6, 0x0e, 0xe5, - 0xc8, 0x3f, 0x98, 0x59, 0x49, 0xc1, 0xa3, 0x56, 0x45, 0x1f, 0x42, 0x25, 0xea, 0xc3, 0x88, 0x86, - 0xdc, 0x6f, 0xd4, 0x9f, 0x0c, 0x23, 0x41, 0x07, 0xcf, 0x68, 0x97, 0x07, 0x54, 0xc4, 0x69, 0x2e, - 0x43, 0x0f, 0x22, 0x91, 0x0e, 0xb7, 0x48, 0x86, 0xe0, 0xbc, 0x57, 0x20, 0x43, 0x8a, 0x67, 0x4d, - 0x19, 0x02, 0xe7, 0x6d, 0x92, 0x21, 0x38, 0xf0, 0x12, 0x19, 0xfa, 0x61, 0xa7, 0x98, 0xd5, 0xfa, - 0x32, 0xf4, 0x12, 0x95, 0x61, 0xd6, 0x9f, 0x0e, 0x13, 0x06, 0x6d, 0x2e, 0x7b, 0x9e, 0x76, 0x2c, - 0x9f, 0x4f, 0x37, 0x7e, 0x1f, 0x55, 0xef, 0xac, 0xf1, 0x26, 0xc1, 0xb3, 0x00, 0x92, 0x83, 0xda, - 0xc7, 0x30, 0x3e, 0x6a, 0x46, 0x90, 0x86, 0x9e, 0x8e, 0xd0, 0x95, 0x6b, 0xd9, 0x2d, 0x64, 0xc1, - 0x12, 0xb4, 0xac, 0x50, 0x13, 0x08, 0x20, 0x6a, 0x2f, 0x17, 0xbc, 0xbd, 0x7f, 0x43, 0xf0, 0xbe, - 0x37, 0xb4, 0xe0, 0x15, 0x2e, 0xeb, 0xff, 0x4a, 0xf0, 0x72, 0x99, 0x69, 0xe8, 0x2b, 0xb2, 0x2d, - 0x32, 0x03, 0xe7, 0xbd, 0x02, 0x99, 0x51, 0x3c, 0x6b, 0xca, 0x0c, 0x38, 0x6f, 0x93, 0xcc, 0xc0, - 0x81, 0x97, 0xc8, 0xcc, 0x2f, 0x7f, 0xca, 0x0a, 0x64, 0xa6, 0x8a, 0xac, 0x90, 0x47, 0x8d, 0x3a, - 0xa4, 0x74, 0xa0, 0x2e, 0xfc, 0x23, 0x69, 0x20, 0xca, 0x0e, 0x0e, 0x74, 0xd0, 0xa8, 0xeb, 0x7f, - 0xa1, 0xca, 0x41, 0x1a, 0x88, 0xb2, 0xdb, 0x5f, 0x1b, 0xe8, 0xa8, 0x97, 0xb1, 0xb4, 0xce, 0x2e, - 0x78, 0xc4, 0x02, 0x2d, 0x06, 0xaa, 0x49, 0x67, 0x1b, 0x0d, 0xdf, 0x67, 0xf3, 0x28, 0xf9, 0xcd, - 0x5f, 0xd8, 0x22, 0x8b, 0x9c, 0xb5, 0xf1, 0x74, 0x36, 0x0b, 0x1d, 0xfe, 0x07, 0x12, 0x7c, 0xf3, - 0x74, 0xef, 0xfc, 0x37, 0xd3, 0xfd, 0x3e, 0xba, 0x01, 0x29, 0xc2, 0x53, 0x65, 0xfe, 0x85, 0xe1, - 0xa0, 0x0f, 0x60, 0x53, 0xfa, 0xbe, 0xe1, 0x05, 0xe2, 0x3d, 0xbf, 0x1c, 0x3b, 0xa5, 0x57, 0x63, - 0xa7, 0xf4, 0x7a, 0xec, 0x94, 0xbe, 0x9a, 0x38, 0xc6, 0xe5, 0xc4, 0x31, 0x5e, 0x4d, 0x1c, 0xe3, - 0xf5, 0xc4, 0x31, 0x7e, 0x9d, 0x38, 0xc6, 0x77, 0xbf, 0x39, 0xa5, 0xcf, 0x4f, 0x37, 0xff, 0x01, - 0xfb, 0x47, 0x00, 0x00, 0x00, 0xff, 0xff, 0x10, 0x40, 0x45, 0xe0, 0xf5, 0x0e, 0x00, 0x00, -} - -func (m *VXLANClaim) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *VXLANClaim) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VXLANClaim) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *VXLANClaimList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *VXLANClaimList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VXLANClaimList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *VXLANClaimSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *VXLANClaimSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VXLANClaimSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Owner != nil { - { - size, err := m.Owner.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - { - size, err := m.ClaimLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - if m.Range != nil { - i -= len(*m.Range) - copy(dAtA[i:], *m.Range) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Range))) - i-- - dAtA[i] = 0x1a - } - if m.ID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.ID)) - i-- - dAtA[i] = 0x10 - } - i -= len(m.Index) - copy(dAtA[i:], m.Index) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Index))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *VXLANClaimStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *VXLANClaimStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VXLANClaimStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ExpiryTime != nil { - i -= len(*m.ExpiryTime) - copy(dAtA[i:], *m.ExpiryTime) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ExpiryTime))) - i-- - dAtA[i] = 0x22 - } - if m.Range != nil { - i -= len(*m.Range) - copy(dAtA[i:], *m.Range) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Range))) - i-- - dAtA[i] = 0x1a - } - if m.ID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.ID)) - i-- - dAtA[i] = 0x10 - } - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *VXLANDynamicIDSyntaxValidator) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *VXLANDynamicIDSyntaxValidator) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VXLANDynamicIDSyntaxValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *VXLANEntry) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *VXLANEntry) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VXLANEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *VXLANEntryList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *VXLANEntryList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VXLANEntryList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *VXLANEntrySpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *VXLANEntrySpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VXLANEntrySpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Owner != nil { - { - size, err := m.Owner.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - i -= len(m.Claim) - copy(dAtA[i:], m.Claim) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Claim))) - i-- - dAtA[i] = 0x2a - { - size, err := m.ClaimLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - i -= len(m.ID) - copy(dAtA[i:], m.ID) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.ID))) - i-- - dAtA[i] = 0x1a - i -= len(m.ClaimType) - copy(dAtA[i:], m.ClaimType) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.ClaimType))) - i-- - dAtA[i] = 0x12 - i -= len(m.Index) - copy(dAtA[i:], m.Index) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Index))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *VXLANEntryStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *VXLANEntryStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VXLANEntryStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *VXLANIndex) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *VXLANIndex) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VXLANIndex) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *VXLANIndexList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *VXLANIndexList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VXLANIndexList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *VXLANIndexSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *VXLANIndexSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VXLANIndexSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.UserDefinedLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if m.MaxID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MaxID)) - i-- - dAtA[i] = 0x10 - } - if m.MinID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MinID)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *VXLANIndexStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *VXLANIndexStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VXLANIndexStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.ConditionedStatus.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if m.MaxID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MaxID)) - i-- - dAtA[i] = 0x10 - } - if m.MinID != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MinID)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *VXLANRangeSyntaxValidator) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *VXLANRangeSyntaxValidator) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VXLANRangeSyntaxValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *VXLANStaticIDSyntaxValidator) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *VXLANStaticIDSyntaxValidator) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VXLANStaticIDSyntaxValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { - offset -= sovGenerated(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *VXLANClaim) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *VXLANClaimList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *VXLANClaimSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Index) - n += 1 + l + sovGenerated(uint64(l)) - if m.ID != nil { - n += 1 + sovGenerated(uint64(*m.ID)) - } - if m.Range != nil { - l = len(*m.Range) - n += 1 + l + sovGenerated(uint64(l)) - } - l = m.ClaimLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.Owner != nil { - l = m.Owner.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *VXLANClaimStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.ID != nil { - n += 1 + sovGenerated(uint64(*m.ID)) - } - if m.Range != nil { - l = len(*m.Range) - n += 1 + l + sovGenerated(uint64(l)) - } - if m.ExpiryTime != nil { - l = len(*m.ExpiryTime) - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *VXLANDynamicIDSyntaxValidator) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *VXLANEntry) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *VXLANEntryList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *VXLANEntrySpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Index) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.ClaimType) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.ID) - n += 1 + l + sovGenerated(uint64(l)) - l = m.ClaimLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Claim) - n += 1 + l + sovGenerated(uint64(l)) - if m.Owner != nil { - l = m.Owner.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *VXLANEntryStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *VXLANIndex) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *VXLANIndexList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *VXLANIndexSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MinID != nil { - n += 1 + sovGenerated(uint64(*m.MinID)) - } - if m.MaxID != nil { - n += 1 + sovGenerated(uint64(*m.MaxID)) - } - l = m.UserDefinedLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *VXLANIndexStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MinID != nil { - n += 1 + sovGenerated(uint64(*m.MinID)) - } - if m.MaxID != nil { - n += 1 + sovGenerated(uint64(*m.MaxID)) - } - l = m.ConditionedStatus.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *VXLANRangeSyntaxValidator) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *VXLANStaticIDSyntaxValidator) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func sovGenerated(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenerated(x uint64) (n int) { - return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *VXLANClaim) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&VXLANClaim{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "VXLANClaimSpec", "VXLANClaimSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "VXLANClaimStatus", "VXLANClaimStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *VXLANClaimList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]VXLANClaim{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "VXLANClaim", "VXLANClaim", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&VXLANClaimList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *VXLANClaimSpec) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&VXLANClaimSpec{`, - `Index:` + fmt.Sprintf("%v", this.Index) + `,`, - `ID:` + valueToStringGenerated(this.ID) + `,`, - `Range:` + valueToStringGenerated(this.Range) + `,`, - `ClaimLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ClaimLabels), "ClaimLabels", "v1alpha1.ClaimLabels", 1), `&`, ``, 1) + `,`, - `Owner:` + strings.Replace(fmt.Sprintf("%v", this.Owner), "OwnerReference", "v1alpha1.OwnerReference", 1) + `,`, - `}`, - }, "") - return s -} -func (this *VXLANClaimStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&VXLANClaimStatus{`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `ID:` + valueToStringGenerated(this.ID) + `,`, - `Range:` + valueToStringGenerated(this.Range) + `,`, - `ExpiryTime:` + valueToStringGenerated(this.ExpiryTime) + `,`, - `}`, - }, "") - return s -} -func (this *VXLANDynamicIDSyntaxValidator) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&VXLANDynamicIDSyntaxValidator{`, - `}`, - }, "") - return s -} -func (this *VXLANEntry) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&VXLANEntry{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "VXLANEntrySpec", "VXLANEntrySpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "VXLANEntryStatus", "VXLANEntryStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *VXLANEntryList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]VXLANEntry{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "VXLANEntry", "VXLANEntry", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&VXLANEntryList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *VXLANEntrySpec) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&VXLANEntrySpec{`, - `Index:` + fmt.Sprintf("%v", this.Index) + `,`, - `ClaimType:` + fmt.Sprintf("%v", this.ClaimType) + `,`, - `ID:` + fmt.Sprintf("%v", this.ID) + `,`, - `ClaimLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ClaimLabels), "ClaimLabels", "v1alpha1.ClaimLabels", 1), `&`, ``, 1) + `,`, - `Claim:` + fmt.Sprintf("%v", this.Claim) + `,`, - `Owner:` + strings.Replace(fmt.Sprintf("%v", this.Owner), "OwnerReference", "v1alpha1.OwnerReference", 1) + `,`, - `}`, - }, "") - return s -} -func (this *VXLANEntryStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&VXLANEntryStatus{`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *VXLANIndex) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&VXLANIndex{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "VXLANIndexSpec", "VXLANIndexSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "VXLANIndexStatus", "VXLANIndexStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *VXLANIndexList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]VXLANIndex{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "VXLANIndex", "VXLANIndex", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&VXLANIndexList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *VXLANIndexSpec) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&VXLANIndexSpec{`, - `MinID:` + valueToStringGenerated(this.MinID) + `,`, - `MaxID:` + valueToStringGenerated(this.MaxID) + `,`, - `UserDefinedLabels:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.UserDefinedLabels), "UserDefinedLabels", "v1alpha1.UserDefinedLabels", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *VXLANIndexStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&VXLANIndexStatus{`, - `MinID:` + valueToStringGenerated(this.MinID) + `,`, - `MaxID:` + valueToStringGenerated(this.MaxID) + `,`, - `ConditionedStatus:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ConditionedStatus), "ConditionedStatus", "v1alpha11.ConditionedStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *VXLANRangeSyntaxValidator) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&VXLANRangeSyntaxValidator{`, - `}`, - }, "") - return s -} -func (this *VXLANStaticIDSyntaxValidator) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&VXLANStaticIDSyntaxValidator{`, - `}`, - }, "") - return s -} -func valueToStringGenerated(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *VXLANClaim) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VXLANClaim: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VXLANClaim: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *VXLANClaimList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VXLANClaimList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VXLANClaimList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, VXLANClaim{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *VXLANClaimSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VXLANClaimSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VXLANClaimSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Index = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ID = &v - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Range", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Range = &s - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ClaimLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Owner == nil { - m.Owner = &v1alpha1.OwnerReference{} - } - if err := m.Owner.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *VXLANClaimStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VXLANClaimStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VXLANClaimStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ID = &v - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Range", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Range = &s - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExpiryTime", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.ExpiryTime = &s - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *VXLANDynamicIDSyntaxValidator) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VXLANDynamicIDSyntaxValidator: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VXLANDynamicIDSyntaxValidator: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *VXLANEntry) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VXLANEntry: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VXLANEntry: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *VXLANEntryList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VXLANEntryList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VXLANEntryList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, VXLANEntry{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *VXLANEntrySpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VXLANEntrySpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VXLANEntrySpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Index = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClaimType = github_com_kuidio_kuid_apis_backend.ClaimType(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ClaimLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Claim", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Claim = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Owner == nil { - m.Owner = &v1alpha1.OwnerReference{} - } - if err := m.Owner.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *VXLANEntryStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VXLANEntryStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VXLANEntryStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *VXLANIndex) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VXLANIndex: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VXLANIndex: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *VXLANIndexList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VXLANIndexList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VXLANIndexList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, VXLANIndex{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *VXLANIndexSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VXLANIndexSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VXLANIndexSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinID", wireType) - } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MinID = &v - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxID", wireType) - } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MaxID = &v - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UserDefinedLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.UserDefinedLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *VXLANIndexStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VXLANIndexStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VXLANIndexStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinID", wireType) - } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MinID = &v - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxID", wireType) - } - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MaxID = &v - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConditionedStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ConditionedStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *VXLANRangeSyntaxValidator) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VXLANRangeSyntaxValidator: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VXLANRangeSyntaxValidator: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *VXLANStaticIDSyntaxValidator) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VXLANStaticIDSyntaxValidator: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VXLANStaticIDSyntaxValidator: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenerated(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenerated - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenerated - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenerated - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") -) diff --git a/apis/backend/vxlan/v1alpha1/generated.proto b/apis/backend/vxlan/v1alpha1/generated.proto deleted file mode 100644 index 4d7faaf..0000000 --- a/apis/backend/vxlan/v1alpha1/generated.proto +++ /dev/null @@ -1,197 +0,0 @@ -/* -Copyright 2024 Nokia. - -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. -*/ -// This file was autogenerated by go-to-protobuf. Do not edit it manually! - -syntax = "proto2"; - -package github.com.kuidio.kuid.apis.backend.vxlan.v1alpha1; - -import "github.com/kuidio/kuid/apis/common/v1alpha1/generated.proto"; -import "github.com/kuidio/kuid/apis/condition/v1alpha1/generated.proto"; -import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; -import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; - -// Package-wide variables from generator "generated". -option go_package = "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1"; - -// VXLANClaim is the Schema for the VXLANClaim API -// -// +k8s:openapi-gen=true -message VXLANClaim { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional VXLANClaimSpec spec = 2; - - optional VXLANClaimStatus status = 3; -} - -// VXLANClaimList contains a list of VXLANClaims -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message VXLANClaimList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated VXLANClaim items = 2; -} - -// VXLANClaimSpec defines the desired state of VXLANClaim -message VXLANClaimSpec { - // VXLANIndex defines the VXLAN index for the VXLAN Claim - optional string index = 1; - - // VXLANID defines the VXLAN for the VXLAN claim - optional uint32 id = 2; - - // Range defines the VXLAN range for the VXLAN claim - // The following notation is used: start-end - - // the VXLANs in the range must be consecutive - optional string range = 3; - - // ClaimLabels define the user defined labels and selector labels used - // in resource claim - optional github.com.kuidio.kuid.apis.common.v1alpha1.ClaimLabels claimLabels = 4; - - // Owner defines the ownerReference of the VXLANClaim - // Allow for different namesapces, hence it is part of the spec - optional github.com.kuidio.kuid.apis.common.v1alpha1.OwnerReference owner = 5; -} - -// VXLANClaimStatus defines the observed state of VXLANClaim -message VXLANClaimStatus { - // ConditionedStatus provides the status of the IPClain using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 1; - - // VXLANID defines the VXLAN for the VXLAN claim - // +optional - optional uint32 id = 2; - - // VXLANRange defines the VXLAN range for the VXLAN claim - // +optional - optional string range = 3; - - // ExpiryTime defines when the claim expires - // +kubebuilder:validation:Optional - // +optional - optional string expiryTime = 4; -} - -message VXLANDynamicIDSyntaxValidator { -} - -// VXLANEntry is the Schema for the VXLANentry API -// -// +k8s:openapi-gen=true -message VXLANEntry { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional VXLANEntrySpec spec = 2; - - optional VXLANEntryStatus status = 3; -} - -// VXLANEntryList contains a list of VXLANEntries -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message VXLANEntryList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated VXLANEntry items = 2; -} - -// VXLANEntrySpec defines the desired state of VXLANEntry -message VXLANEntrySpec { - // VXLANIndex defines the VXLAN index for the VXLAN Claim - optional string index = 1; - - // ClaimType defines the claimType of the VXLAN Entry - optional string claimType = 2; - - // ID defines the id of the VXLAN entry in the tree - optional string id = 3; - - // ClaimLabels define the user defined labels and selector labels used - // in resource claim - optional github.com.kuidio.kuid.apis.common.v1alpha1.ClaimLabels claimLabels = 4; - - // Claim defines the name of the claim that is the origin of this entry - optional string claim = 5; - - // Owner defines the ownerReference of the VXLANClaim - // Allow for different namesapces, hence it is part of the spec - optional github.com.kuidio.kuid.apis.common.v1alpha1.OwnerReference owner = 6; -} - -// VXLANEntryStatus defines the observed state of VXLANEntry -message VXLANEntryStatus { - // ConditionedStatus provides the status of the VXLANEntry using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 1; -} - -// VXLANIndex is the Schema for the VXLANIndex API -// -// +k8s:openapi-gen=true -message VXLANIndex { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - optional VXLANIndexSpec spec = 2; - - optional VXLANIndexStatus status = 3; -} - -// VXLANIndexList contains a list of VXLANIndexs -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -message VXLANIndexList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - repeated VXLANIndex items = 2; -} - -// VXLANIndexSpec defines the desired state of VXLANIndex -message VXLANIndexSpec { - // MinID defines the min ID the index supports - // +optional - optional uint32 minID = 1; - - // MaxID defines the max ID the index supports - // +optional - optional uint32 maxID = 2; - - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - optional github.com.kuidio.kuid.apis.common.v1alpha1.UserDefinedLabels userDefinedLabels = 3; -} - -// VXLANIndexStatus defines the observed state of VXLANIndex -message VXLANIndexStatus { - // MinID defines the min ID the index is configured with - // +optional - optional uint32 minID = 1; - - // MaxID defines the max ID the index is configured with - // +optional - optional uint32 maxID = 2; - - // ConditionedStatus provides the status of the VLANIndex using conditions - // - a ready condition indicates the overall status of the resource - optional github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus conditionedStatus = 3; -} - -message VXLANRangeSyntaxValidator { -} - -message VXLANStaticIDSyntaxValidator { -} - diff --git a/apis/backend/vxlan/v1alpha1/register.go b/apis/backend/vxlan/v1alpha1/register.go deleted file mode 100644 index 6df2c34..0000000 --- a/apis/backend/vxlan/v1alpha1/register.go +++ /dev/null @@ -1,69 +0,0 @@ -/* -Copyright 2024 Nokia. - -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. -*/ - -// +kubebuilder:object:generate=true -// +groupName=vxlan.be.kuid.dev -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -const ( - Group = "vxlan.be.kuid.dev" - Version = "v1alpha1" -) - -var ( - // SchemeGroupVersion contains the API group and version information for the types in this package. - SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version} - // AddToScheme applies all the stored functions to the scheme. A non-nil error - // indicates that one function failed and the attempt was abandoned. - //AddToScheme = (&runtime.SchemeBuilder{}).AddToScheme - AddToScheme = localSchemeBuilder.AddToScheme - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - schemeBuilder runtime.SchemeBuilder - localSchemeBuilder = &schemeBuilder -) - -// Resource takes an unqualified resource and returns a Group qualified GroupResource -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} - -func init() { - localSchemeBuilder.Register(addKnownTypes) -} - -// Adds the list of known types to the given scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - // +kubebuilder:scaffold:install - - scheme.AddKnownTypes(SchemeGroupVersion, - &VXLANClaim{}, - &VXLANClaimList{}, - &VXLANEntry{}, - &VXLANEntryList{}, - &VXLANIndex{}, - &VXLANIndexList{}, - ) - - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/apis/backend/vxlan/v1alpha1/vxlan_types.go b/apis/backend/vxlan/v1alpha1/vxlan_types.go deleted file mode 100644 index dd9e127..0000000 --- a/apis/backend/vxlan/v1alpha1/vxlan_types.go +++ /dev/null @@ -1,44 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -type VXLANClaimType string - -const ( - VXLANClaimType_Invalid VXLANClaimType = "invalid" - VXLANClaimType_StaticID VXLANClaimType = "staticVXLANID" - VXLANClaimType_DynamicID VXLANClaimType = "dynamicVXLANID" - VXLANClaimType_Range VXLANClaimType = "vxlanRange" -) - -func GetClaimTypeFromString(s string) VXLANClaimType { - switch s { - case string(VXLANClaimType_StaticID): - return VXLANClaimType_StaticID - case string(VXLANClaimType_DynamicID): - return VXLANClaimType_DynamicID - case string(VXLANClaimType_Range): - return VXLANClaimType_Range - default: - return VXLANClaimType_Invalid - } -} - -const ( - VXLANIndexReservedMinName = "rangeReservedMin" - VXLANIndexReservedMaxName = "rangeReservedMax" -) diff --git a/apis/backend/vxlan/v1alpha1/vxlanclaim_interface.go b/apis/backend/vxlan/v1alpha1/vxlanclaim_interface.go deleted file mode 100644 index e0b3ac3..0000000 --- a/apis/backend/vxlan/v1alpha1/vxlanclaim_interface.go +++ /dev/null @@ -1,530 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "crypto/sha1" - "encoding/json" - "errors" - "fmt" - "strconv" - "strings" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/idxtable/pkg/table" - "github.com/henderiw/idxtable/pkg/table/table32" - "github.com/henderiw/idxtable/pkg/tree" - "github.com/henderiw/idxtable/pkg/tree/id32" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/selection" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" - "k8s.io/utils/ptr" -) - -const VXLANClaimPlural = "vxlanclaims" -const VXLANClaimSingular = "vxlanclaim" -const VXLANID_Min = 0 -const VXLANID_Max = 16777215 - -// +k8s:deepcopy-gen=false -var _ resource.Object = &VXLANClaim{} -var _ resource.ObjectList = &VXLANClaimList{} - -var _ resource.ObjectWithStatusSubResource = &VXLANClaim{} - -func (VXLANClaimStatus) SubResourceName() string { - return fmt.Sprintf("%s/%s", VXLANClaimPlural, "status") -} - -func (r VXLANClaimStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { - cfg, ok := obj.(*VXLANClaim) - if ok { - cfg.Status = r - } -} - -func (r *VXLANClaim) GetStatus() resource.StatusSubResource { - return r.Status -} - -// GetListMeta returns the ListMeta -func (r *VXLANClaimList) GetListMeta() *metav1.ListMeta { - return &r.ListMeta -} - -func (r *VXLANClaim) GetSingularName() string { - return VXLANClaimSingular -} - -func (VXLANClaim) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Resource: VXLANClaimPlural, - } -} - -// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. -// IsStorageVersion implements resource.Object. -func (VXLANClaim) IsStorageVersion() bool { - return true -} - -// GetObjectMeta implements resource.Object -func (r *VXLANClaim) GetObjectMeta() *metav1.ObjectMeta { - return &r.ObjectMeta -} - -// NamespaceScoped returns true to indicate Fortune is a namespaced resource. -// NamespaceScoped implements resource.Object. -func (VXLANClaim) NamespaceScoped() bool { - return true -} - -// New implements resource.Object -func (VXLANClaim) New() runtime.Object { - return &VXLANClaim{} -} - -// NewList implements resource.Object -func (VXLANClaim) NewList() runtime.Object { - return &VXLANClaimList{} -} - -// GetCondition returns the condition based on the condition kind -func (r *VXLANClaim) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { - return r.Status.GetCondition(t) -} - -// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions -// to be set at once -func (r *VXLANClaim) SetConditions(c ...conditionv1alpha1.Condition) { - r.Status.SetConditions(c...) -} - -// VXLANClaimConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for VXLANClaim -func VXLANClaimConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { - switch label { - case "metadata.name": - return label, value, nil - case "metadata.namespace": - return label, value, nil - case "spec.index": - return label, value, nil - default: - return "", "", fmt.Errorf("%q is not a known field selector", label) - } -} - -func (r *VXLANClaimList) GetItems() []backend.Object { - objs := []backend.Object{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *VXLANClaim) CalculateHash() ([sha1.Size]byte, error) { - // Convert the struct to JSON - jsonData, err := json.Marshal(r) - if err != nil { - return [sha1.Size]byte{}, err - } - - // Calculate SHA-1 hash - return sha1.Sum(jsonData), nil -} - -func (r *VXLANClaim) GetNamespacedName() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.GetNamespace(), - Name: r.GetName(), - } -} - -func (r *VXLANClaim) GetKey() store.Key { - return store.KeyFromNSN(types.NamespacedName{Namespace: r.Namespace, Name: r.Spec.Index}) -} - -func (r *VXLANClaim) GetIndex() string { - return r.Spec.Index -} - -func (r *VXLANClaim) GetSelector() *metav1.LabelSelector { - return r.Spec.Selector -} - -func (r *VXLANClaim) GetOwnerReference() *commonv1alpha1.OwnerReference { - return &commonv1alpha1.OwnerReference{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Kind: r.Kind, - Namespace: r.Namespace, - Name: r.Name, - } -} - -func (r *VXLANClaim) GetStaticID() *uint64 { - if r.Spec.ID == nil { - return nil - } - return ptr.To[uint64](uint64(*r.Spec.ID)) -} - -func (r *VXLANClaim) GetStaticTreeID(t string) tree.ID { - if r.Spec.ID == nil { - return nil - } - return id32.NewID(uint32(*r.Spec.ID), id32.IDBitSize) -} - -func (r *VXLANClaim) GetClaimID(t string, id uint64) tree.ID { - return id32.NewID(uint32(id), id32.IDBitSize) -} - -func (r *VXLANClaim) GetRange() *string { - return r.Spec.Range -} - -func (r *VXLANClaim) GetRangeID(_ string) (tree.Range, error) { - if r.Spec.Range == nil { - return nil, fmt.Errorf("cannot provide a range without an id") - } - return id32.ParseRange(*r.Spec.Range) -} - -func (r *VXLANClaim) GetTable(s string, to, from uint64) table.Table { - return table32.New(uint32(to), uint32(from)) -} - -func (r *VXLANClaim) GetClaimRequest() string { - // we assume validation is already done when calling this - if r.Spec.ID != nil { - return strconv.Itoa(int(*r.Spec.ID)) - } - if r.Spec.Range != nil { - return *r.Spec.Range - } - return "" -} - -func (r *VXLANClaim) GetClaimResponse() string { - // we assume validation is already done when calling this - if r.Status.ID != nil { - return strconv.Itoa(int(*r.Status.ID)) - } - if r.Status.Range != nil { - return *r.Status.Range - } - return "" -} - -func (r *VXLANClaim) GetClaimType() backend.ClaimType { - claimType := backend.ClaimType_Invalid - count := 0 - if r.Spec.ID != nil { - claimType = backend.ClaimType_StaticID - count++ - - } - if r.Spec.Range != nil { - claimType = backend.ClaimType_Range - count++ - - } - if count > 1 { - return backend.ClaimType_Invalid - } - if count == 0 { - return backend.ClaimType_DynamicID - } - return claimType -} - -func (r *VXLANClaim) ValidateVXLANClaimType() error { - var sb strings.Builder - count := 0 - if r.Spec.ID != nil { - sb.WriteString(fmt.Sprintf("id: %d", *r.Spec.ID)) - count++ - - } - if r.Spec.Range != nil { - if count > 0 { - sb.WriteString(", ") - } - sb.WriteString(fmt.Sprintf("range: %s", *r.Spec.Range)) - count++ - - } - if count > 1 { - return fmt.Errorf("an ipclaim can only have 1 addressing, got %s", sb.String()) - } - return nil -} - -func validateVXLANID(id int) error { - if id < VXLANID_Min { - return fmt.Errorf("invalid id, got %d", id) - } - if id > VXLANID_Max { - return fmt.Errorf("invalid id, got %d", id) - } - return nil -} - -func (r *VXLANClaim) ValidateVXLANID() error { - if r.Spec.ID == nil { - return fmt.Errorf("no VXLAN id provided") - } - if err := validateVXLANID(int(*r.Spec.ID)); err != nil { - return fmt.Errorf("invalid VXLAN id err %s", err.Error()) - } - return nil -} - -func (r *VXLANClaim) GetVXLANRange() (int, int) { - if r.Spec.Range == nil { - return 0, 0 - } - parts := strings.SplitN(*r.Spec.Range, "-", 2) - if len(parts) != 2 { - return 0, 0 - } - start, err := strconv.Atoi(parts[0]) - if err != nil { - return 0, 0 - } - end, err := strconv.Atoi(parts[1]) - if err != nil { - return 0, 0 - } - return start, end -} - -func (r *VXLANClaim) ValidateVXLANRange() error { - if r.Spec.Range == nil { - return fmt.Errorf("no VXLAN range provided") - } - parts := strings.SplitN(*r.Spec.Range, "-", 2) - if len(parts) != 2 { - return fmt.Errorf("invalid VXLAN range, expected -, got: %s", *r.Spec.Range) - } - var errm error - start, err := strconv.Atoi(parts[0]) - if err != nil { - errm = errors.Join(errm, fmt.Errorf("invalid VXLAN range start, got: %s, err: %s", *r.Spec.Range, err.Error())) - } - end, err := strconv.Atoi(parts[1]) - if err != nil { - errm = errors.Join(errm, fmt.Errorf("invalid VXLAN range end, got: %s, err: %s", *r.Spec.Range, err.Error())) - } - if errm != nil { - return errm - } - if start > end { - errm = errors.Join(errm, fmt.Errorf("invalid VXLAN range start > end %s", *r.Spec.Range)) - } - if err := validateVXLANID(start); err != nil { - errm = errors.Join(errm, fmt.Errorf("invalid VXLAN start err %s", err.Error())) - } - if err := validateVXLANID(end); err != nil { - errm = errors.Join(errm, fmt.Errorf("invalid VXLAN end err %s", err.Error())) - } - return errm -} - -func (r *VXLANClaim) ValidateSyntax(s string) field.ErrorList { - var allErrs field.ErrorList - - gv, err := schema.ParseGroupVersion(r.APIVersion) - if err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("apiVersion"), - r, - fmt.Errorf("invalid apiVersion: err: %s", err.Error()).Error(), - )) - return allErrs - } - - // this is for user convenience - if r.Spec.Owner == nil { - r.Spec.Owner = &commonv1alpha1.OwnerReference{ - Group: gv.Group, - Version: gv.Version, - Kind: r.Kind, - Namespace: r.Namespace, - Name: r.Name, - } - } - - if err := r.ValidateVXLANClaimType(); err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath(""), - r, - err.Error(), - )) - return allErrs - } - var v SyntaxValidator - claimType := r.GetClaimType() - switch claimType { - case backend.ClaimType_DynamicID: - v = &VXLANDynamicIDSyntaxValidator{name: string(claimType)} - case backend.ClaimType_StaticID: - v = &VXLANStaticIDSyntaxValidator{name: string(claimType)} - case backend.ClaimType_Range: - v = &VXLANRangeSyntaxValidator{name: string(claimType)} - default: - return allErrs - } - return v.Validate(r) -} - -func (r *VXLANClaim) ValidateOwner(labels labels.Set) error { - routeClaimName := labels[backend.KuidClaimNameKey] - routeOwner := commonv1alpha1.OwnerReference{ - Group: labels[backend.KuidOwnerGroupKey], - Version: labels[backend.KuidOwnerVersionKey], - Kind: labels[backend.KuidOwnerKindKey], - Namespace: labels[backend.KuidOwnerNamespaceKey], - Name: labels[backend.KuidOwnerNameKey], - } - if (r.Spec.Owner != nil && *r.Spec.Owner != routeOwner) || r.Name != routeClaimName { - return fmt.Errorf("route owned by different claim got name %s/%s owner %s/%s", - r.Name, - routeClaimName, - r.Spec.Owner.String(), - routeOwner.String(), - ) - } - return nil -} - -// GetLabelSelector returns a labels selector based on the label selector -func (r *VXLANClaim) GetLabelSelector() (labels.Selector, error) { - return r.Spec.GetLabelSelector() -} - -func (r *VXLANClaim) GetClaimLabels() labels.Set { - labels := r.Spec.GetUserDefinedLabels() - // system defined labels - labels[backend.KuidClaimTypeKey] = string(r.GetClaimType()) - labels[backend.KuidClaimNameKey] = r.Name - labels[backend.KuidOwnerGroupKey] = r.Spec.Owner.Group - labels[backend.KuidOwnerVersionKey] = r.Spec.Owner.Version - labels[backend.KuidOwnerKindKey] = r.Spec.Owner.Kind - labels[backend.KuidOwnerNamespaceKey] = r.Spec.Owner.Namespace - labels[backend.KuidOwnerNameKey] = r.Spec.Owner.Name - return labels -} - -// GetOwnerSelector returns a label selector to select the owner of the claim in the backend -func (r *VXLANClaim) GetOwnerSelector() (labels.Selector, error) { - l := map[string]string{ - backend.KuidOwnerGroupKey: r.Spec.Owner.Group, - backend.KuidOwnerVersionKey: r.Spec.Owner.Version, - backend.KuidOwnerKindKey: r.Spec.Owner.Kind, - backend.KuidOwnerNamespaceKey: r.Spec.Owner.Namespace, - backend.KuidOwnerNameKey: r.Spec.Owner.Name, - backend.KuidClaimNameKey: r.Name, - } - - fullselector := labels.NewSelector() - for k, v := range l { - req, err := labels.NewRequirement(k, selection.Equals, []string{v}) - if err != nil { - return nil, err - } - fullselector = fullselector.Add(*req) - } - return fullselector, nil -} - -// BuildVXLANClaim returns a reource from a client Object a Spec/Status -func BuildVXLANClaim(meta metav1.ObjectMeta, spec *VXLANClaimSpec, status *VXLANClaimStatus) *VXLANClaim { - aspec := VXLANClaimSpec{} - if spec != nil { - aspec = *spec - } - astatus := VXLANClaimStatus{} - if status != nil { - astatus = *status - } - return &VXLANClaim{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: VXLANClaimKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -func (r *VXLANClaim) SetStatusRange(s *string) { - r.Status.Range = s -} - -func (r *VXLANClaim) SetStatusID(s *uint64) { - if s == nil { - r.Status.ID = nil - return - } - r.Status.ID = ptr.To[uint32](uint32(*s)) -} - -func (r *VXLANClaim) GetStatusID() *uint64 { - if r.Status.ID == nil { - return nil - } - return ptr.To[uint64](uint64(*r.Status.ID)) -} - -func (r *VXLANClaim) GetSpec() any { - return r.Spec -} - -func (r *VXLANClaim) SetSpec(s any) { - if spec, ok := s.(VXLANClaimSpec); ok { - r.Spec = spec - } -} - -func (r *VXLANClaim) NewObjList() backend.GenericObjectList { - return &VXLANClaimList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: VXLANClaimListKind}, - } -} - -func (r *VXLANClaimList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} diff --git a/apis/backend/vxlan/v1alpha1/vxlanclaim_syntaxvalidator.go b/apis/backend/vxlan/v1alpha1/vxlanclaim_syntaxvalidator.go deleted file mode 100644 index 102fc56..0000000 --- a/apis/backend/vxlan/v1alpha1/vxlanclaim_syntaxvalidator.go +++ /dev/null @@ -1,68 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - fmt "fmt" - - "k8s.io/apimachinery/pkg/util/validation/field" -) - -type SyntaxValidator interface { - Validate(claim *VXLANClaim) field.ErrorList -} - -type VXLANRangeSyntaxValidator struct { - name string -} - -func (r *VXLANRangeSyntaxValidator) Validate(claim *VXLANClaim) field.ErrorList { - var allErrs field.ErrorList - if err := claim.ValidateVXLANRange(); err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.range"), - claim, - fmt.Errorf("invalid VXLAN range %s", r.name).Error(), - )) - } - return allErrs -} - -type VXLANDynamicIDSyntaxValidator struct { - name string -} - -func (r *VXLANDynamicIDSyntaxValidator) Validate(claim *VXLANClaim) field.ErrorList { - var allErrs field.ErrorList - return allErrs -} - -type VXLANStaticIDSyntaxValidator struct { - name string -} - -func (r *VXLANStaticIDSyntaxValidator) Validate(claim *VXLANClaim) field.ErrorList { - var allErrs field.ErrorList - if err := claim.ValidateVXLANID(); err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.id"), - claim, - fmt.Errorf("invalid VXLAN id %s", r.name).Error(), - )) - } - return allErrs -} diff --git a/apis/backend/vxlan/v1alpha1/vxlanentry_interface.go b/apis/backend/vxlan/v1alpha1/vxlanentry_interface.go deleted file mode 100644 index 6b82f24..0000000 --- a/apis/backend/vxlan/v1alpha1/vxlanentry_interface.go +++ /dev/null @@ -1,275 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "crypto/sha1" - "encoding/json" - "fmt" - strings "strings" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" -) - -const VXLANEntryPlural = "vxlanentries" -const VXLANEntrySingular = "vxlanentry" - -// +k8s:deepcopy-gen=false -var _ resource.Object = &VXLANEntry{} -var _ resource.ObjectList = &VXLANEntryList{} - -// GetListMeta returns the ListMeta -func (r *VXLANEntryList) GetListMeta() *metav1.ListMeta { - return &r.ListMeta -} - -func (r *VXLANEntryList) GetItems() []backend.Object { - entries := make([]backend.Object, 0, len(r.Items)) - for _, entry := range r.Items { - entries = append(entries, &entry) - } - return entries -} - -func (r *VXLANEntry) GetSingularName() string { - return VXLANEntrySingular -} - -func (VXLANEntry) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Resource: VXLANEntryPlural, - } -} - -// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. -// IsStorageVersion implements resource.Object. -func (VXLANEntry) IsStorageVersion() bool { - return true -} - -// GetObjectMeta implements resource.Object -func (r *VXLANEntry) GetObjectMeta() *metav1.ObjectMeta { - return &r.ObjectMeta -} - -// NamespaceScoped returns true to indicate Fortune is a namespaced resource. -// NamespaceScoped implements resource.Object. -func (VXLANEntry) NamespaceScoped() bool { - return true -} - -// New implements resource.Object -func (VXLANEntry) New() runtime.Object { - return &VXLANEntry{} -} - -// NewList implements resource.Object -func (VXLANEntry) NewList() runtime.Object { - return &VXLANEntryList{} -} - -// GetCondition returns the condition based on the condition kind -func (r *VXLANEntry) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { - return r.Status.GetCondition(t) -} - -// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions -// to be set at once -func (r *VXLANEntry) SetConditions(c ...conditionv1alpha1.Condition) { - r.Status.SetConditions(c...) -} - -// VXLANEntryConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for VXLANEntry -func VXLANEntryConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { - switch label { - case "metadata.name": - return label, value, nil - case "metadata.namespace": - return label, value, nil - case "spec.index": - return label, value, nil - default: - return "", "", fmt.Errorf("%q is not a known field selector", label) - } -} - -func (r *VXLANEntry) CalculateHash() ([sha1.Size]byte, error) { - // Convert the struct to JSON - jsonData, err := json.Marshal(r) - if err != nil { - return [sha1.Size]byte{}, err - } - - // Calculate SHA-1 hash - return sha1.Sum(jsonData), nil -} - -func (r *VXLANEntry) GetNamespacedName() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.GetNamespace(), - Name: r.GetName(), - } -} - -func (r *VXLANEntry) GetOwnerReference() *commonv1alpha1.OwnerReference { - return r.Spec.Owner -} - -func (r *VXLANEntry) GetClaimName() string { - return r.Spec.Claim -} - -func (r *VXLANEntry) GetClaimType() backend.ClaimType { - return r.Spec.ClaimType -} - -func (r *VXLANEntry) GetKey() store.Key { - return store.KeyFromNSN(types.NamespacedName{Namespace: r.Namespace, Name: r.Spec.Index}) -} - -func (r *VXLANEntry) GetIndex() string { - return r.Spec.Index -} - -func (r *VXLANEntry) GetOwnerGVK() schema.GroupVersionKind { - return schema.GroupVersionKind{ - Group: r.Spec.Owner.Group, - Version: r.Spec.Owner.Version, - Kind: r.Spec.Owner.Kind, - } -} - -func (r *VXLANEntry) GetOwnerNSN() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.Spec.Owner.Namespace, - Name: r.Spec.Owner.Name, - } -} - -func (r *VXLANEntry) GetSpec() any { - return r.Spec -} - -func (r *VXLANEntry) GetSpecID() string { - return r.Spec.ID -} - -func (r *VXLANEntry) SetSpec(spec any) { - s, ok := spec.(VXLANEntrySpec) - if ok { - r.Spec = s - } -} - -func GetVXLANEntry(k store.Key, vrange, id string, labels map[string]string) backend.EntryObject { - //log := log.FromContext(ctx) - - index := k.Name - ns := k.Namespace - - spec := &VXLANEntrySpec{ - Index: index, - ClaimType: backend.GetClaimTypeFromString(labels[backend.KuidClaimTypeKey]), - Claim: labels[backend.KuidClaimNameKey], - ID: id, - Owner: &commonv1alpha1.OwnerReference{ - Group: labels[backend.KuidOwnerGroupKey], - Version: labels[backend.KuidOwnerVersionKey], - Kind: labels[backend.KuidOwnerKindKey], - Namespace: labels[backend.KuidOwnerNamespaceKey], - Name: labels[backend.KuidOwnerNameKey], - }, - } - // filter the system defined labels from the labels to prepare for the user defined labels - udLabels := map[string]string{} - for k, v := range labels { - if !backend.BackendSystemKeys.Has(k) { - udLabels[k] = v - } - } - spec.UserDefinedLabels.Labels = udLabels - - status := &VXLANEntryStatus{} - status.SetConditions(conditionv1alpha1.Ready()) - - id = strings.ReplaceAll(id, "/", "-") - name := fmt.Sprintf("%s.%s", index, id) - if vrange != "" { - name = fmt.Sprintf("%s.%s", vrange, id) - } - - return BuildVXLANEntry( - metav1.ObjectMeta{ - Name: name, - Namespace: ns, - }, - spec, - status, - ) -} - -// BuildVXLANEntry returns a reource from a client Object a Spec/Status -func BuildVXLANEntry(meta metav1.ObjectMeta, spec *VXLANEntrySpec, status *VXLANEntryStatus) backend.EntryObject { - aspec := VXLANEntrySpec{} - if spec != nil { - aspec = *spec - } - astatus := VXLANEntryStatus{} - if status != nil { - astatus = *status - } - return &VXLANEntry{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: VXLANEntryKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -func (r *VXLANEntry) ValidateSyntax(_ string) field.ErrorList { - var allErrs field.ErrorList - return allErrs -} - -func (r *VXLANEntry) NewObjList() backend.GenericObjectList { - return &VXLANEntryList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: VXLANEntryListKind}, - } -} - -func (r *VXLANEntryList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} diff --git a/apis/backend/vxlan/v1alpha1/vxlanentry_types.go b/apis/backend/vxlan/v1alpha1/vxlanentry_types.go deleted file mode 100644 index 8052718..0000000 --- a/apis/backend/vxlan/v1alpha1/vxlanentry_types.go +++ /dev/null @@ -1,78 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "reflect" - - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// VXLANEntrySpec defines the desired state of VXLANEntry -type VXLANEntrySpec struct { - // VXLANIndex defines the VXLAN index for the VXLAN Claim - Index string `json:"index" yaml:"index" protobuf:"bytes,1,opt,name=index"` - // ClaimType defines the claimType of the VXLAN Entry - ClaimType backend.ClaimType `json:"claimType,omitempty" yaml:"claimType,omitempty" protobuf:"bytes,2,opt,name=claimType"` - // ID defines the id of the VXLAN entry in the tree - ID string `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,3,opt,name=id"` - // ClaimLabels define the user defined labels and selector labels used - // in resource claim - commonv1alpha1.ClaimLabels `json:",inline" yaml:",inline" protobuf:"bytes,4,opt,name=claimLabels"` - // Claim defines the name of the claim that is the origin of this entry - Claim string `json:"claim" yaml:"claim" protobuf:"bytes,5,opt,name=claim"` - // Owner defines the ownerReference of the VXLANClaim - // Allow for different namesapces, hence it is part of the spec - Owner *commonv1alpha1.OwnerReference `json:"owner,omitempty" yaml:"owner,omitempty" protobuf:"bytes,6,opt,name=owner"` -} - -// VXLANEntryStatus defines the observed state of VXLANEntry -type VXLANEntryStatus struct { - // ConditionedStatus provides the status of the VXLANEntry using conditions - // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// VXLANEntry is the Schema for the VXLANentry API -// -// +k8s:openapi-gen=true -type VXLANEntry struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - Spec VXLANEntrySpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - Status VXLANEntryStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// VXLANEntryList contains a list of VXLANEntries -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type VXLANEntryList struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []VXLANEntry `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` -} - -var ( - VXLANEntryKind = reflect.TypeOf(VXLANEntry{}).Name() - VXLANEntryListKind = reflect.TypeOf(VXLANEntryList{}).Name() -) diff --git a/apis/backend/vxlan/v1alpha1/vxlanindex_interface.go b/apis/backend/vxlan/v1alpha1/vxlanindex_interface.go deleted file mode 100644 index 75aea28..0000000 --- a/apis/backend/vxlan/v1alpha1/vxlanindex_interface.go +++ /dev/null @@ -1,309 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "crypto/sha1" - "encoding/json" - "fmt" - - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/henderiw/idxtable/pkg/tree/gtree" - "github.com/henderiw/idxtable/pkg/tree/tree32" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/validation/field" - "k8s.io/utils/ptr" -) - -const VXLANIndexPlural = "vxlanindices" -const VXLANIndexSingular = "vxlanindex" - -// +k8s:deepcopy-gen=false -var _ resource.Object = &VXLANIndex{} -var _ resource.ObjectList = &VXLANIndexList{} - -// GetListMeta returns the ListMeta -func (r *VXLANIndexList) GetListMeta() *metav1.ListMeta { - return &r.ListMeta -} - -func (r *VXLANIndex) GetSingularName() string { - return VXLANIndexSingular -} - -func (VXLANIndex) GetGroupVersionResource() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Resource: VXLANIndexPlural, - } -} - -// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. -// IsStorageVersion implements resource.Object. -func (VXLANIndex) IsStorageVersion() bool { - return true -} - -// GetObjectMeta implements resource.Object -func (r *VXLANIndex) GetObjectMeta() *metav1.ObjectMeta { - return &r.ObjectMeta -} - -// NamespaceScoped returns true to indicate Fortune is a namespaced resource. -// NamespaceScoped implements resource.Object. -func (VXLANIndex) NamespaceScoped() bool { - return true -} - -// New implements resource.Object -func (VXLANIndex) New() runtime.Object { - return &VXLANIndex{} -} - -// NewList implements resource.Object -func (VXLANIndex) NewList() runtime.Object { - return &VXLANIndexList{} -} - -// GetCondition returns the condition based on the condition kind -func (r *VXLANIndex) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { - return r.Status.GetCondition(t) -} - -// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions -// to be set at once -func (r *VXLANIndex) SetConditions(c ...conditionv1alpha1.Condition) { - r.Status.SetConditions(c...) -} - -// VXLANIndexConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for VXLANIndex -func VXLANIndexConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { - switch label { - case "metadata.name": - return label, value, nil - case "metadata.namespace": - return label, value, nil - default: - return "", "", fmt.Errorf("%q is not a known field selector", label) - } -} - -func (r *VXLANIndexList) GetItems() []backend.Object { - objs := []backend.Object{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} - -func (r *VXLANIndex) CalculateHash() ([sha1.Size]byte, error) { - // Convert the struct to JSON - jsonData, err := json.Marshal(r) - if err != nil { - return [sha1.Size]byte{}, err - } - - // Calculate SHA-1 hash - return sha1.Sum(jsonData), nil -} - -func (r *VXLANIndex) GetNamespacedName() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.GetNamespace(), - Name: r.GetName(), - } -} - -func (r *VXLANIndex) GetTree() gtree.GTree { - tree, err := tree32.New(24) - if err != nil { - return nil - } - return tree -} - -func (r *VXLANIndex) GetKey() store.Key { - return store.KeyFromNSN(r.GetNamespacedName()) -} - -func (r *VXLANIndex) GetType() string { - return "" -} - -func (r *VXLANIndex) GetOwnerReference() *commonv1alpha1.OwnerReference { - return &commonv1alpha1.OwnerReference{ - Group: SchemeGroupVersion.Group, - Version: SchemeGroupVersion.Version, - Kind: VXLANIndexKind, - Namespace: r.Namespace, - Name: r.Name, - } -} - -func (r *VXLANIndex) ValidateSyntax(_ string) field.ErrorList { - var allErrs field.ErrorList - - if r.Spec.MinID != nil { - if err := validateVXLANID(int(*r.Spec.MinID)); err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.minID"), - r, - fmt.Errorf("invalid id %d", *r.Spec.MinID).Error(), - )) - } - } - if r.Spec.MaxID != nil { - if err := validateVXLANID(int(*r.Spec.MaxID)); err != nil { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.maxID"), - r, - fmt.Errorf("invalid id %d", *r.Spec.MaxID).Error(), - )) - } - } - if r.Spec.MinID != nil && r.Spec.MaxID != nil { - if *r.Spec.MinID > *r.Spec.MaxID { - allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.maxID"), - r, - fmt.Errorf("min id %d cannot be bigger than max id %d", *r.Spec.MinID, *r.Spec.MaxID).Error(), - )) - } - } - return allErrs -} - -func GetMinClaimRange(id uint32) string { - return fmt.Sprintf("%d-%d", VXLANID_Min, id-1) -} - -func GetMaxClaimRange(id uint32) string { - return fmt.Sprintf("%d-%d", id+1, VXLANID_Max) -} - -func (r *VXLANIndex) GetMinID() *uint64 { - if r.Spec.MinID == nil { - return nil - } - return ptr.To[uint64](uint64(*r.Spec.MinID)) -} - -func (r *VXLANIndex) GetMaxID() *uint64 { - if r.Spec.MaxID == nil { - return nil - } - return ptr.To[uint64](uint64(*r.Spec.MaxID)) -} - -func (r *VXLANIndex) GetMinClaimNSN() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.Namespace, - Name: fmt.Sprintf("%s.%s", r.Name, VXLANIndexReservedMinName), - } -} - -func (r *VXLANIndex) GetMaxClaimNSN() types.NamespacedName { - return types.NamespacedName{ - Namespace: r.Namespace, - Name: fmt.Sprintf("%s.%s", r.Name, VXLANIndexReservedMaxName), - } -} - -func (r *VXLANIndex) GetMinClaim() backend.ClaimObject { - return BuildVXLANClaim( - metav1.ObjectMeta{ - Namespace: r.GetNamespace(), - Name: r.GetMinClaimNSN().Name, - }, - &VXLANClaimSpec{ - Index: r.Name, - Range: ptr.To[string](GetMinClaimRange(*r.Spec.MinID)), - Owner: commonv1alpha1.GetOwnerReference(r), - }, - nil, - ) -} - -func (r *VXLANIndex) GetMaxClaim() backend.ClaimObject { - return BuildVXLANClaim( - metav1.ObjectMeta{ - Namespace: r.GetNamespace(), - Name: r.GetMaxClaimNSN().Name, - }, - &VXLANClaimSpec{ - Index: r.Name, - Range: ptr.To[string](GetMaxClaimRange(*r.Spec.MaxID)), - Owner: commonv1alpha1.GetOwnerReference(r), - }, - nil, - ) -} - -// BuildVXLANIndex returns a reource from a client Object a Spec/Status -func BuildVXLANIndex(meta metav1.ObjectMeta, spec *VXLANIndexSpec, status *VXLANIndexStatus) *VXLANIndex { - aspec := VXLANIndexSpec{} - if spec != nil { - aspec = *spec - } - astatus := VXLANIndexStatus{} - if status != nil { - astatus = *status - } - return &VXLANIndex{ - TypeMeta: metav1.TypeMeta{ - APIVersion: SchemeGroupVersion.Identifier(), - Kind: VXLANIndexKind, - }, - ObjectMeta: meta, - Spec: aspec, - Status: astatus, - } -} - -func (r *VXLANIndex) GetSpec() any { - return r.Spec -} - -func (r *VXLANIndex) SetSpec(s any) { - if spec, ok := s.(VXLANIndexSpec); ok { - r.Spec = spec - } -} - -func (r *VXLANIndex) NewObjList() backend.GenericObjectList { - return &VXLANIndexList{ - TypeMeta: metav1.TypeMeta{APIVersion: SchemeGroupVersion.Identifier(), Kind: VXLANIndexListKind}, - } -} - -func (r *VXLANIndexList) GetObjects() []backend.GenericObject { - objs := []backend.GenericObject{} - for _, r := range r.Items { - r := r - objs = append(objs, &r) - } - return objs -} diff --git a/apis/backend/vxlan/v1alpha1/vxlanindex_types.go b/apis/backend/vxlan/v1alpha1/vxlanindex_types.go deleted file mode 100644 index 7924658..0000000 --- a/apis/backend/vxlan/v1alpha1/vxlanindex_types.go +++ /dev/null @@ -1,78 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "reflect" - - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// VXLANIndexSpec defines the desired state of VXLANIndex -type VXLANIndexSpec struct { - // MinID defines the min ID the index supports - // +optional - MinID *uint32 `json:"minID,omitempty" yaml:"minID,omitempty" protobuf:"bytes,1,opt,name=minID"` - // MaxID defines the max ID the index supports - // +optional - MaxID *uint32 `json:"maxID,omitempty" yaml:"maxID,omitempty" protobuf:"bytes,2,opt,name=maxID"` - // UserDefinedLabels define metadata to the resource. - // defined in the spec to distingiush metadata labels from user defined labels - commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` -} - -// VXLANIndexStatus defines the observed state of VXLANIndex -type VXLANIndexStatus struct { - // MinID defines the min ID the index is configured with - // +optional - MinID *uint32 `json:"minID,omitempty" yaml:"minID,omitempty" protobuf:"bytes,1,opt,name=minID"` - // MaxID defines the max ID the index is configured with - // +optional - MaxID *uint32 `json:"maxID,omitempty" yaml:"maxID,omitempty" protobuf:"bytes,2,opt,name=maxID"` - // ConditionedStatus provides the status of the VLANIndex using conditions - // - a ready condition indicates the overall status of the resource - conditionv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=conditionedStatus"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// VXLANIndex is the Schema for the VXLANIndex API -// -// +k8s:openapi-gen=true -type VXLANIndex struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - Spec VXLANIndexSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - Status VXLANIndexStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// VXLANIndexList contains a list of VXLANIndexs -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type VXLANIndexList struct { - metav1.TypeMeta `json:",inline" yaml:",inline"` - metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []VXLANIndex `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` -} - -var ( - VXLANIndexKind = reflect.TypeOf(VXLANIndex{}).Name() - VXLANIndexListKind = reflect.TypeOf(VXLANIndexList{}).Name() -) diff --git a/apis/backend/vxlan/v1alpha1/zz_generated.deepcopy.go b/apis/backend/vxlan/v1alpha1/zz_generated.deepcopy.go deleted file mode 100644 index e35c40d..0000000 --- a/apis/backend/vxlan/v1alpha1/zz_generated.deepcopy.go +++ /dev/null @@ -1,414 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - 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 *VXLANClaim) DeepCopyInto(out *VXLANClaim) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VXLANClaim. -func (in *VXLANClaim) DeepCopy() *VXLANClaim { - if in == nil { - return nil - } - out := new(VXLANClaim) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *VXLANClaim) 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 *VXLANClaimList) DeepCopyInto(out *VXLANClaimList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]VXLANClaim, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VXLANClaimList. -func (in *VXLANClaimList) DeepCopy() *VXLANClaimList { - if in == nil { - return nil - } - out := new(VXLANClaimList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *VXLANClaimList) 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 *VXLANClaimSpec) DeepCopyInto(out *VXLANClaimSpec) { - *out = *in - if in.ID != nil { - in, out := &in.ID, &out.ID - *out = new(uint32) - **out = **in - } - if in.Range != nil { - in, out := &in.Range, &out.Range - *out = new(string) - **out = **in - } - in.ClaimLabels.DeepCopyInto(&out.ClaimLabels) - if in.Owner != nil { - in, out := &in.Owner, &out.Owner - *out = new(commonv1alpha1.OwnerReference) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VXLANClaimSpec. -func (in *VXLANClaimSpec) DeepCopy() *VXLANClaimSpec { - if in == nil { - return nil - } - out := new(VXLANClaimSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VXLANClaimStatus) DeepCopyInto(out *VXLANClaimStatus) { - *out = *in - in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) - if in.ID != nil { - in, out := &in.ID, &out.ID - *out = new(uint32) - **out = **in - } - if in.Range != nil { - in, out := &in.Range, &out.Range - *out = new(string) - **out = **in - } - if in.ExpiryTime != nil { - in, out := &in.ExpiryTime, &out.ExpiryTime - *out = new(string) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VXLANClaimStatus. -func (in *VXLANClaimStatus) DeepCopy() *VXLANClaimStatus { - if in == nil { - return nil - } - out := new(VXLANClaimStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VXLANDynamicIDSyntaxValidator) DeepCopyInto(out *VXLANDynamicIDSyntaxValidator) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VXLANDynamicIDSyntaxValidator. -func (in *VXLANDynamicIDSyntaxValidator) DeepCopy() *VXLANDynamicIDSyntaxValidator { - if in == nil { - return nil - } - out := new(VXLANDynamicIDSyntaxValidator) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VXLANEntry) DeepCopyInto(out *VXLANEntry) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VXLANEntry. -func (in *VXLANEntry) DeepCopy() *VXLANEntry { - if in == nil { - return nil - } - out := new(VXLANEntry) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *VXLANEntry) 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 *VXLANEntryList) DeepCopyInto(out *VXLANEntryList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]VXLANEntry, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VXLANEntryList. -func (in *VXLANEntryList) DeepCopy() *VXLANEntryList { - if in == nil { - return nil - } - out := new(VXLANEntryList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *VXLANEntryList) 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 *VXLANEntrySpec) DeepCopyInto(out *VXLANEntrySpec) { - *out = *in - in.ClaimLabels.DeepCopyInto(&out.ClaimLabels) - if in.Owner != nil { - in, out := &in.Owner, &out.Owner - *out = new(commonv1alpha1.OwnerReference) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VXLANEntrySpec. -func (in *VXLANEntrySpec) DeepCopy() *VXLANEntrySpec { - if in == nil { - return nil - } - out := new(VXLANEntrySpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VXLANEntryStatus) DeepCopyInto(out *VXLANEntryStatus) { - *out = *in - in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VXLANEntryStatus. -func (in *VXLANEntryStatus) DeepCopy() *VXLANEntryStatus { - if in == nil { - return nil - } - out := new(VXLANEntryStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VXLANIndex) DeepCopyInto(out *VXLANIndex) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VXLANIndex. -func (in *VXLANIndex) DeepCopy() *VXLANIndex { - if in == nil { - return nil - } - out := new(VXLANIndex) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *VXLANIndex) 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 *VXLANIndexList) DeepCopyInto(out *VXLANIndexList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]VXLANIndex, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VXLANIndexList. -func (in *VXLANIndexList) DeepCopy() *VXLANIndexList { - if in == nil { - return nil - } - out := new(VXLANIndexList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *VXLANIndexList) 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 *VXLANIndexSpec) DeepCopyInto(out *VXLANIndexSpec) { - *out = *in - if in.MinID != nil { - in, out := &in.MinID, &out.MinID - *out = new(uint32) - **out = **in - } - if in.MaxID != nil { - in, out := &in.MaxID, &out.MaxID - *out = new(uint32) - **out = **in - } - in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VXLANIndexSpec. -func (in *VXLANIndexSpec) DeepCopy() *VXLANIndexSpec { - if in == nil { - return nil - } - out := new(VXLANIndexSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VXLANIndexStatus) DeepCopyInto(out *VXLANIndexStatus) { - *out = *in - if in.MinID != nil { - in, out := &in.MinID, &out.MinID - *out = new(uint32) - **out = **in - } - if in.MaxID != nil { - in, out := &in.MaxID, &out.MaxID - *out = new(uint32) - **out = **in - } - in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VXLANIndexStatus. -func (in *VXLANIndexStatus) DeepCopy() *VXLANIndexStatus { - if in == nil { - return nil - } - out := new(VXLANIndexStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VXLANRangeSyntaxValidator) DeepCopyInto(out *VXLANRangeSyntaxValidator) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VXLANRangeSyntaxValidator. -func (in *VXLANRangeSyntaxValidator) DeepCopy() *VXLANRangeSyntaxValidator { - if in == nil { - return nil - } - out := new(VXLANRangeSyntaxValidator) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VXLANStaticIDSyntaxValidator) DeepCopyInto(out *VXLANStaticIDSyntaxValidator) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VXLANStaticIDSyntaxValidator. -func (in *VXLANStaticIDSyntaxValidator) DeepCopy() *VXLANStaticIDSyntaxValidator { - if in == nil { - return nil - } - out := new(VXLANStaticIDSyntaxValidator) - in.DeepCopyInto(out) - return out -} diff --git a/apis/backend/doc.go b/apis/common/doc.go similarity index 97% rename from apis/backend/doc.go rename to apis/common/doc.go index 293ff96..22f6b72 100644 --- a/apis/backend/doc.go +++ b/apis/common/doc.go @@ -16,4 +16,4 @@ limitations under the License. // +kubebuilder:object:generate=true // +k8s:deepcopy-gen=package,register -package backend +package common diff --git a/apis/common/labels.go b/apis/common/labels.go new file mode 100644 index 0000000..5a20eeb --- /dev/null +++ b/apis/common/labels.go @@ -0,0 +1,86 @@ +/* +Copyright 2023 The Nephio 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. +*/ + +package common + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/selection" +) + +// +k8s:openapi-gen=true +// UserDefinedLabels define metadata to the resource. +type UserDefinedLabels struct { + // Labels as user defined labels + // +optional + Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty" protobuf:"bytes,1,rep,name=labels"` +} + +// GetUserDefinedLabels returns a map with a copy of the +// user defined labels +func (r *UserDefinedLabels) GetUserDefinedLabels() map[string]string { + l := map[string]string{} + if len(r.Labels) != 0 { + for k, v := range r.Labels { + l[k] = v + } + } + return l +} + +// +k8s:openapi-gen=true +type ClaimLabels struct { + UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=userDefinedLabels"` + // Selector defines the selector criterias + // +kubebuilder:validation:Optional + Selector *metav1.LabelSelector `json:"selector,omitempty" yaml:"selector,omitempty" protobuf:"bytes,2,opt,name=selector"` +} + +// GetUserDefinedLabels returns a map with a copy of the +// user defined labels +func (r *ClaimLabels) GetUserDefinedLabels() map[string]string { + return r.UserDefinedLabels.GetUserDefinedLabels() +} + +// GetSelectorLabels returns a map with a copy of the +// selector labels +func (r *ClaimLabels) GetSelectorLabels() map[string]string { + l := map[string]string{} + if r.Selector != nil { + for k, v := range r.Selector.MatchLabels { + l[k] = v + } + } + return l +} + + +// GetLabelSelector returns a labels selector based +// on the label selector +func (r *ClaimLabels) GetLabelSelector() (labels.Selector, error) { + l := r.GetSelectorLabels() + fullselector := labels.NewSelector() + for k, v := range l { + req, err := labels.NewRequirement(k, selection.Equals, []string{v}) + if err != nil { + return nil, err + } + fullselector = fullselector.Add(*req) + } + return fullselector, nil +} + diff --git a/apis/common/v1alpha1/generated.pb.go b/apis/common/v1alpha1/generated.pb.go deleted file mode 100644 index c92b874..0000000 --- a/apis/common/v1alpha1/generated.pb.go +++ /dev/null @@ -1,1026 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 protoc-gen-gogo. DO NOT EDIT. -// source: github.com/kuidio/kuid/apis/common/v1alpha1/generated.proto - -package v1alpha1 - -import ( - fmt "fmt" - - io "io" - math "math" - math_bits "math/bits" - reflect "reflect" - strings "strings" - - proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -func (m *ClaimLabels) Reset() { *m = ClaimLabels{} } -func (*ClaimLabels) ProtoMessage() {} -func (*ClaimLabels) Descriptor() ([]byte, []int) { - return fileDescriptor_ff64f0e0dd0fa4cf, []int{0} -} -func (m *ClaimLabels) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ClaimLabels) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ClaimLabels) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClaimLabels.Merge(m, src) -} -func (m *ClaimLabels) XXX_Size() int { - return m.Size() -} -func (m *ClaimLabels) XXX_DiscardUnknown() { - xxx_messageInfo_ClaimLabels.DiscardUnknown(m) -} - -var xxx_messageInfo_ClaimLabels proto.InternalMessageInfo - -func (m *OwnerReference) Reset() { *m = OwnerReference{} } -func (*OwnerReference) ProtoMessage() {} -func (*OwnerReference) Descriptor() ([]byte, []int) { - return fileDescriptor_ff64f0e0dd0fa4cf, []int{1} -} -func (m *OwnerReference) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *OwnerReference) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *OwnerReference) XXX_Merge(src proto.Message) { - xxx_messageInfo_OwnerReference.Merge(m, src) -} -func (m *OwnerReference) XXX_Size() int { - return m.Size() -} -func (m *OwnerReference) XXX_DiscardUnknown() { - xxx_messageInfo_OwnerReference.DiscardUnknown(m) -} - -var xxx_messageInfo_OwnerReference proto.InternalMessageInfo - -func (m *UserDefinedLabels) Reset() { *m = UserDefinedLabels{} } -func (*UserDefinedLabels) ProtoMessage() {} -func (*UserDefinedLabels) Descriptor() ([]byte, []int) { - return fileDescriptor_ff64f0e0dd0fa4cf, []int{2} -} -func (m *UserDefinedLabels) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *UserDefinedLabels) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *UserDefinedLabels) XXX_Merge(src proto.Message) { - xxx_messageInfo_UserDefinedLabels.Merge(m, src) -} -func (m *UserDefinedLabels) XXX_Size() int { - return m.Size() -} -func (m *UserDefinedLabels) XXX_DiscardUnknown() { - xxx_messageInfo_UserDefinedLabels.DiscardUnknown(m) -} - -var xxx_messageInfo_UserDefinedLabels proto.InternalMessageInfo - -func init() { - proto.RegisterType((*ClaimLabels)(nil), "github.com.kuidio.kuid.apis.common.v1alpha1.ClaimLabels") - proto.RegisterType((*OwnerReference)(nil), "github.com.kuidio.kuid.apis.common.v1alpha1.OwnerReference") - proto.RegisterType((*UserDefinedLabels)(nil), "github.com.kuidio.kuid.apis.common.v1alpha1.UserDefinedLabels") - proto.RegisterMapType((map[string]string)(nil), "github.com.kuidio.kuid.apis.common.v1alpha1.UserDefinedLabels.LabelsEntry") -} - -func init() { - proto.RegisterFile("github.com/kuidio/kuid/apis/common/v1alpha1/generated.proto", fileDescriptor_ff64f0e0dd0fa4cf) -} - -var fileDescriptor_ff64f0e0dd0fa4cf = []byte{ - // 502 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0xbf, 0x6f, 0xd3, 0x4e, - 0x14, 0xcf, 0x35, 0x49, 0xdb, 0x5c, 0xfa, 0xed, 0x97, 0x9c, 0x18, 0x42, 0x06, 0xa7, 0x0a, 0x4b, - 0x51, 0xc5, 0x59, 0x29, 0x0c, 0x05, 0x24, 0x06, 0x03, 0x42, 0x02, 0x04, 0xe2, 0x10, 0x0c, 0x48, - 0x0c, 0x17, 0xe7, 0xc5, 0x39, 0xd9, 0xbe, 0xb3, 0xce, 0x76, 0x50, 0x36, 0x36, 0x56, 0xfe, 0x26, - 0xa6, 0x8c, 0x5d, 0x90, 0x3a, 0x45, 0xc4, 0xfc, 0x0f, 0xcc, 0xc8, 0x77, 0x0e, 0x0d, 0x64, 0xaa, - 0x98, 0x7c, 0xef, 0x3e, 0x3f, 0xde, 0xe7, 0xbd, 0x93, 0xf1, 0x83, 0x40, 0x64, 0xd3, 0x7c, 0x44, - 0x7d, 0x15, 0xbb, 0x61, 0x2e, 0xc6, 0x42, 0x99, 0x8f, 0xcb, 0x13, 0x91, 0xba, 0xbe, 0x8a, 0x63, - 0x25, 0xdd, 0xd9, 0x90, 0x47, 0xc9, 0x94, 0x0f, 0xdd, 0x00, 0x24, 0x68, 0x9e, 0xc1, 0x98, 0x26, - 0x5a, 0x65, 0x8a, 0x9c, 0x5c, 0x8a, 0xa9, 0x15, 0x9b, 0x0f, 0x2d, 0xc5, 0xd4, 0x8a, 0xe9, 0x5a, - 0xdc, 0xbb, 0xbd, 0xd1, 0x29, 0x50, 0x81, 0x72, 0x8d, 0xc7, 0x28, 0x9f, 0x98, 0xca, 0x14, 0xe6, - 0x64, 0xbd, 0x7b, 0x77, 0xc3, 0xb3, 0x94, 0x0a, 0x55, 0x06, 0x89, 0xb9, 0x3f, 0x15, 0x12, 0xf4, - 0xdc, 0x4d, 0xc2, 0xc0, 0x26, 0x8b, 0x21, 0xe3, 0xee, 0x6c, 0x2b, 0xd1, 0xe0, 0x27, 0xc2, 0xed, - 0x47, 0x11, 0x17, 0xf1, 0x0b, 0x3e, 0x82, 0x28, 0x25, 0x9f, 0x11, 0xee, 0xe4, 0x29, 0xe8, 0xc7, - 0x30, 0x11, 0x12, 0xc6, 0xf6, 0xb6, 0x8b, 0x8e, 0xd0, 0x71, 0xfb, 0xf4, 0x21, 0xbd, 0x42, 0x7c, - 0xfa, 0xf6, 0x6f, 0x17, 0xef, 0xc6, 0x62, 0xd9, 0xaf, 0x15, 0xcb, 0x7e, 0x67, 0x0b, 0x62, 0xdb, - 0x3d, 0xc9, 0x07, 0xbc, 0x9f, 0x42, 0x04, 0x7e, 0xa6, 0x74, 0x77, 0xc7, 0xf4, 0xbf, 0x43, 0xed, - 0x88, 0x74, 0x73, 0x44, 0x9a, 0x84, 0x81, 0x0d, 0x50, 0x8e, 0x48, 0x67, 0x43, 0x6a, 0xf4, 0x6f, - 0x2a, 0xa9, 0x77, 0x50, 0x2c, 0xfb, 0xfb, 0xeb, 0x8a, 0xfd, 0xb6, 0x1c, 0x7c, 0x43, 0xf8, 0xf0, - 0xd5, 0x47, 0x09, 0x9a, 0xc1, 0x04, 0x34, 0x48, 0x1f, 0xc8, 0x4d, 0xdc, 0x0c, 0xb4, 0xca, 0x13, - 0x33, 0x6e, 0xcb, 0xfb, 0xaf, 0x8a, 0xdb, 0x7c, 0x5a, 0x5e, 0x32, 0x8b, 0x91, 0x5b, 0x78, 0x6f, - 0x06, 0x3a, 0x15, 0x4a, 0x9a, 0x54, 0x2d, 0xef, 0xff, 0x8a, 0xb6, 0xf7, 0xce, 0x5e, 0xb3, 0x35, - 0x4e, 0x8e, 0x70, 0x23, 0x14, 0x72, 0xdc, 0xad, 0x1b, 0xde, 0x41, 0xc5, 0x6b, 0x3c, 0x17, 0x72, - 0xcc, 0x0c, 0x42, 0x5c, 0xdc, 0x92, 0x3c, 0x86, 0x34, 0xe1, 0x3e, 0x74, 0x1b, 0x86, 0xd6, 0xa9, - 0x68, 0xad, 0x97, 0x6b, 0x80, 0x5d, 0x72, 0x4a, 0xcb, 0xb2, 0xe8, 0x36, 0xff, 0xb4, 0x2c, 0xb9, - 0xcc, 0x20, 0x83, 0xaf, 0x08, 0x6f, 0xef, 0x97, 0x68, 0xbc, 0x1b, 0xad, 0x9f, 0xb2, 0x7e, 0xdc, - 0x3e, 0x7d, 0xf6, 0x6f, 0x4f, 0x69, 0x77, 0x9c, 0x3e, 0x91, 0x99, 0x9e, 0x7b, 0x87, 0x55, 0x8a, - 0xdd, 0xea, 0x2d, 0xab, 0x4e, 0xbd, 0x7b, 0xb8, 0xbd, 0x41, 0x23, 0xd7, 0x70, 0x3d, 0x84, 0xb9, - 0xdd, 0x2d, 0x2b, 0x8f, 0xe4, 0x3a, 0x6e, 0xce, 0x78, 0x94, 0x83, 0x5d, 0x24, 0xb3, 0xc5, 0xfd, - 0x9d, 0x33, 0xe4, 0xbd, 0x5e, 0xac, 0x9c, 0xda, 0xf9, 0xca, 0xa9, 0x5d, 0xac, 0x9c, 0xda, 0xa7, - 0xc2, 0x41, 0x8b, 0xc2, 0x41, 0xe7, 0x85, 0x83, 0x2e, 0x0a, 0x07, 0x7d, 0x2f, 0x1c, 0xf4, 0xe5, - 0x87, 0x53, 0x7b, 0x7f, 0x72, 0x85, 0x5f, 0xf1, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x5e, 0x02, - 0xae, 0x5d, 0xb8, 0x03, 0x00, 0x00, -} - -func (m *ClaimLabels) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ClaimLabels) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ClaimLabels) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Selector != nil { - { - size, err := m.Selector.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - { - size, err := m.UserDefinedLabels.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *OwnerReference) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *OwnerReference) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *OwnerReference) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x2a - i -= len(m.Namespace) - copy(dAtA[i:], m.Namespace) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Namespace))) - i-- - dAtA[i] = 0x22 - i -= len(m.Kind) - copy(dAtA[i:], m.Kind) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Kind))) - i-- - dAtA[i] = 0x1a - i -= len(m.Version) - copy(dAtA[i:], m.Version) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Version))) - i-- - dAtA[i] = 0x12 - i -= len(m.Group) - copy(dAtA[i:], m.Group) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Group))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *UserDefinedLabels) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *UserDefinedLabels) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *UserDefinedLabels) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Labels) > 0 { - keysForLabels := make([]string, 0, len(m.Labels)) - for k := range m.Labels { - keysForLabels = append(keysForLabels, string(k)) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForLabels) - for iNdEx := len(keysForLabels) - 1; iNdEx >= 0; iNdEx-- { - v := m.Labels[string(keysForLabels[iNdEx])] - baseI := i - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarintGenerated(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - i -= len(keysForLabels[iNdEx]) - copy(dAtA[i:], keysForLabels[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(keysForLabels[iNdEx]))) - i-- - dAtA[i] = 0xa - i = encodeVarintGenerated(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { - offset -= sovGenerated(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *ClaimLabels) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.UserDefinedLabels.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.Selector != nil { - l = m.Selector.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *OwnerReference) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Group) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Version) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Kind) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Namespace) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *UserDefinedLabels) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Labels) > 0 { - for k, v := range m.Labels { - _ = k - _ = v - mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + len(v) + sovGenerated(uint64(len(v))) - n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) - } - } - return n -} - -func sovGenerated(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenerated(x uint64) (n int) { - return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *ClaimLabels) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ClaimLabels{`, - `UserDefinedLabels:` + strings.Replace(strings.Replace(this.UserDefinedLabels.String(), "UserDefinedLabels", "UserDefinedLabels", 1), `&`, ``, 1) + `,`, - `Selector:` + strings.Replace(fmt.Sprintf("%v", this.Selector), "LabelSelector", "v1.LabelSelector", 1) + `,`, - `}`, - }, "") - return s -} -func (this *OwnerReference) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&OwnerReference{`, - `Group:` + fmt.Sprintf("%v", this.Group) + `,`, - `Version:` + fmt.Sprintf("%v", this.Version) + `,`, - `Kind:` + fmt.Sprintf("%v", this.Kind) + `,`, - `Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `}`, - }, "") - return s -} -func (this *UserDefinedLabels) String() string { - if this == nil { - return "nil" - } - keysForLabels := make([]string, 0, len(this.Labels)) - for k := range this.Labels { - keysForLabels = append(keysForLabels, k) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForLabels) - mapStringForLabels := "map[string]string{" - for _, k := range keysForLabels { - mapStringForLabels += fmt.Sprintf("%v: %v,", k, this.Labels[k]) - } - mapStringForLabels += "}" - s := strings.Join([]string{`&UserDefinedLabels{`, - `Labels:` + mapStringForLabels + `,`, - `}`, - }, "") - return s -} -func valueToStringGenerated(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *ClaimLabels) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ClaimLabels: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ClaimLabels: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UserDefinedLabels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.UserDefinedLabels.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Selector", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Selector == nil { - m.Selector = &v1.LabelSelector{} - } - if err := m.Selector.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *OwnerReference) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: OwnerReference: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: OwnerReference: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Group", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Group = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Version = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Kind", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Kind = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Namespace = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *UserDefinedLabels) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: UserDefinedLabels: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: UserDefinedLabels: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Labels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Labels == nil { - m.Labels = make(map[string]string) - } - var mapkey string - var mapvalue string - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthGenerated - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthGenerated - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var stringLenmapvalue uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapvalue |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapvalue := int(stringLenmapvalue) - if intStringLenmapvalue < 0 { - return ErrInvalidLengthGenerated - } - postStringIndexmapvalue := iNdEx + intStringLenmapvalue - if postStringIndexmapvalue < 0 { - return ErrInvalidLengthGenerated - } - if postStringIndexmapvalue > l { - return io.ErrUnexpectedEOF - } - mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) - iNdEx = postStringIndexmapvalue - } else { - iNdEx = entryPreIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.Labels[mapkey] = mapvalue - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenerated(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenerated - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenerated - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenerated - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") -) diff --git a/apis/common/v1alpha1/generated.proto b/apis/common/v1alpha1/generated.proto deleted file mode 100644 index 5d6d941..0000000 --- a/apis/common/v1alpha1/generated.proto +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright 2024 Nokia. - -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. -*/ -// This file was autogenerated by go-to-protobuf. Do not edit it manually! - -syntax = "proto2"; - -package github.com.kuidio.kuid.apis.common.v1alpha1; - -import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; - -// Package-wide variables from generator "generated". -option go_package = "github.com/kuidio/kuid/apis/common/v1alpha1"; - -// +k8s:openapi-gen=true -message ClaimLabels { - optional UserDefinedLabels userDefinedLabels = 1; - - // Selector defines the selector criterias - // +kubebuilder:validation:Optional - optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 2; -} - -// +k8s:openapi-gen=true -message OwnerReference { - optional string group = 1; - - optional string version = 2; - - optional string kind = 3; - - optional string namespace = 4; - - optional string name = 5; -} - -// +k8s:openapi-gen=true -// UserDefinedLabels define metadata to the resource. -message UserDefinedLabels { - // Labels as user defined labels - // +optional - map labels = 1; -} - diff --git a/apis/common/v1alpha1/labels.go b/apis/common/v1alpha1/labels.go index 67c6e87..a6c36eb 100644 --- a/apis/common/v1alpha1/labels.go +++ b/apis/common/v1alpha1/labels.go @@ -22,7 +22,6 @@ import ( "k8s.io/apimachinery/pkg/selection" ) -// +k8s:openapi-gen=true // UserDefinedLabels define metadata to the resource. type UserDefinedLabels struct { // Labels as user defined labels @@ -42,7 +41,6 @@ func (r *UserDefinedLabels) GetUserDefinedLabels() map[string]string { return l } -// +k8s:openapi-gen=true type ClaimLabels struct { UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=userDefinedLabels"` // Selector defines the selector criterias @@ -68,21 +66,6 @@ func (r *ClaimLabels) GetSelectorLabels() map[string]string { return l } -/* -// GetFullLabels returns a map with a copy of the -// user defined labels and the selector labels -func (r *ClaimLabels) GetFullLabels() map[string]string { - l := make(map[string]string) - for k, v := range r.GetUserDefinedLabels() { - l[k] = v - } - for k, v := range r.GetSelectorLabels() { - l[k] = v - } - return l -} -*/ - // GetLabelSelector returns a labels selector based // on the label selector func (r *ClaimLabels) GetLabelSelector() (labels.Selector, error) { @@ -97,27 +80,3 @@ func (r *ClaimLabels) GetLabelSelector() (labels.Selector, error) { } return fullselector, nil } - -/* -// GetOwnerSelector returns a label selector to select the owner -// of the claim in the backend -func (r *ClaimLabels) GetOwnerSelector() (labels.Selector, error) { - l := map[string]string{ - backend.KuidOwnerAPIVersionKey: r.Labels[backend.KuidOwnerAPIVersionKey], - backend.KuidOwnerKindKey: r.Labels[backend.KuidOwnerKindKey], - backend.KuidOwnerNamespaceKey: r.Labels[backend.KuidOwnerNamespaceKey], - backend.KuidOwnerNameKey: r.Labels[backend.KuidOwnerNameKey], - backend.KuidClaimNameKey: r.Labels[backend.KuidClaimNameKey], - } - - fullselector := labels.NewSelector() - for k, v := range l { - req, err := labels.NewRequirement(k, selection.Equals, []string{v}) - if err != nil { - return nil, err - } - fullselector = fullselector.Add(*req) - } - return fullselector, nil -} -*/ diff --git a/apis/common/v1alpha1/owner.go b/apis/common/v1alpha1/owner.go deleted file mode 100644 index 404ff7a..0000000 --- a/apis/common/v1alpha1/owner.go +++ /dev/null @@ -1,38 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import "sigs.k8s.io/controller-runtime/pkg/client" - -// +k8s:openapi-gen=true -type OwnerReference struct { - Group string `json:"group" yaml:"group" protobuf:"bytes,1,opt,name=group"` - Version string `json:"version" yaml:"version" protobuf:"bytes,2,opt,name=version"` - Kind string `json:"kind" yaml:"kind" protobuf:"bytes,3,opt,name=kind"` - Namespace string `json:"namespace" yaml:"namespace" protobuf:"bytes,4,opt,name=namespace"` - Name string `json:"name" yaml:"name" protobuf:"bytes,5,opt,name=name"` -} - -func GetOwnerReference(obj client.Object) *OwnerReference { - return &OwnerReference{ - Group: obj.GetObjectKind().GroupVersionKind().Group, - Version: obj.GetObjectKind().GroupVersionKind().Version, - Kind: obj.GetObjectKind().GroupVersionKind().Kind, - Namespace: obj.GetNamespace(), - Name: obj.GetName(), - } -} diff --git a/apis/common/v1alpha1/zz_generated.deepcopy.go b/apis/common/v1alpha1/zz_generated.deepcopy.go index 2ebb6ec..262c796 100644 --- a/apis/common/v1alpha1/zz_generated.deepcopy.go +++ b/apis/common/v1alpha1/zz_generated.deepcopy.go @@ -46,22 +46,6 @@ func (in *ClaimLabels) DeepCopy() *ClaimLabels { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OwnerReference) DeepCopyInto(out *OwnerReference) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OwnerReference. -func (in *OwnerReference) DeepCopy() *OwnerReference { - if in == nil { - return nil - } - out := new(OwnerReference) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *UserDefinedLabels) DeepCopyInto(out *UserDefinedLabels) { *out = *in diff --git a/apis/condition/v1alpha1/zz_generated.deepcopy.go b/apis/common/zz_generated.deepcopy.go similarity index 61% rename from apis/condition/v1alpha1/zz_generated.deepcopy.go rename to apis/common/zz_generated.deepcopy.go index e0b7bd6..fdc9a66 100644 --- a/apis/condition/v1alpha1/zz_generated.deepcopy.go +++ b/apis/common/zz_generated.deepcopy.go @@ -18,44 +18,53 @@ limitations under the License. */ // Code generated by deepcopy-gen. DO NOT EDIT. -package v1alpha1 +package common + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Condition) DeepCopyInto(out *Condition) { +func (in *ClaimLabels) DeepCopyInto(out *ClaimLabels) { *out = *in - in.Condition.DeepCopyInto(&out.Condition) + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + if in.Selector != nil { + in, out := &in.Selector, &out.Selector + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition. -func (in *Condition) DeepCopy() *Condition { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClaimLabels. +func (in *ClaimLabels) DeepCopy() *ClaimLabels { if in == nil { return nil } - out := new(Condition) + out := new(ClaimLabels) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ConditionedStatus) DeepCopyInto(out *ConditionedStatus) { +func (in *UserDefinedLabels) DeepCopyInto(out *UserDefinedLabels) { *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]Condition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val } } return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConditionedStatus. -func (in *ConditionedStatus) DeepCopy() *ConditionedStatus { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserDefinedLabels. +func (in *UserDefinedLabels) DeepCopy() *UserDefinedLabels { if in == nil { return nil } - out := new(ConditionedStatus) + out := new(UserDefinedLabels) in.DeepCopyInto(out) return out } diff --git a/apis/condition/v1alpha1/condition.go b/apis/condition/v1alpha1/condition.go deleted file mode 100644 index d91558a..0000000 --- a/apis/condition/v1alpha1/condition.go +++ /dev/null @@ -1,202 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "sort" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// A ConditionType represents a condition type for a given KRM resource -type ConditionType string - -// Condition Types. -const ( - // ConditionTypeReady represents the resource ready condition - ConditionTypeReady ConditionType = "Ready" - ConditionTypeDeviceConfigReady ConditionType = "DeviceConfigReady" -) - -// A ConditionReason represents the reason a resource is in a condition. -type ConditionReason string - -// Reasons a resource is ready or not -const ( - ConditionReasonReady ConditionReason = "Ready" - ConditionReasonFailed ConditionReason = "Failed" - ConditionReasonUnknown ConditionReason = "Unknown" - ConditionReasonProcessing ConditionReason = "processing" -) - -// +k8s:openapi-gen=true -type Condition struct { - metav1.Condition `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=condition"` -} - -// Equal returns true if the condition is identical to the supplied condition, -// ignoring the LastTransitionTime. -func (c Condition) Equal(other Condition) bool { - return c.Type == other.Type && - c.Status == other.Status && - c.Reason == other.Reason && - c.Message == other.Message -} - -// WithMessage returns a condition by adding the provided message to existing -// condition. -func (c Condition) WithMessage(msg string) Condition { - c.Message = msg - return c -} - -// +k8s:openapi-gen=true -// A ConditionedStatus reflects the observed status of a resource. Only -// one condition of each type may exist. -type ConditionedStatus struct { - // Conditions of the resource. - // +optional - Conditions []Condition `json:"conditions,omitempty" protobuf:"bytes,1,rep,name=conditions"` -} - -// NewConditionedStatus returns a stat with the supplied conditions set. -func NewConditionedStatus(c ...Condition) *ConditionedStatus { - r := &ConditionedStatus{} - r.SetConditions(c...) - return r -} - -// HasCondition returns if the condition is set -func (r *ConditionedStatus) HasCondition(t ConditionType) bool { - for _, c := range r.Conditions { - if c.Type == string(t) { - return true - } - } - return false -} - -// GetCondition returns the condition for the given ConditionKind if exists, -// otherwise returns nil -func (r *ConditionedStatus) GetCondition(t ConditionType) Condition { - for _, c := range r.Conditions { - if c.Type == string(t) { - return c - } - } - return Condition{metav1.Condition{Type: string(t), Status: metav1.ConditionFalse}} -} - -// SetConditions sets the supplied conditions, replacing any existing conditions -// of the same type. This is a no-op if all supplied conditions are identical, -// ignoring the last transition time, to those already set. -func (r *ConditionedStatus) SetConditions(c ...Condition) { - for _, new := range c { - exists := false - for i, existing := range r.Conditions { - if existing.Type != new.Type { - continue - } - - if existing.Equal(new) { - exists = true - continue - } - - r.Conditions[i] = new - exists = true - } - if !exists { - r.Conditions = append(r.Conditions, new) - } - } -} - -// Equal returns true if the status is identical to the supplied status, -// ignoring the LastTransitionTimes and order of statuses. -func (r *ConditionedStatus) Equal(other *ConditionedStatus) bool { - if r == nil || other == nil { - return r == nil && other == nil - } - - if len(other.Conditions) != len(r.Conditions) { - return false - } - - sc := make([]Condition, len(r.Conditions)) - copy(sc, r.Conditions) - - oc := make([]Condition, len(other.Conditions)) - copy(oc, other.Conditions) - - // We should not have more than one condition of each type. - sort.Slice(sc, func(i, j int) bool { return sc[i].Type < sc[j].Type }) - sort.Slice(oc, func(i, j int) bool { return oc[i].Type < oc[j].Type }) - - for i := range sc { - if !sc[i].Equal(oc[i]) { - return false - } - } - return true -} - -// Ready returns a condition that indicates the resource is -// ready for use. -func Ready() Condition { - return Condition{metav1.Condition{ - Type: string(ConditionTypeReady), - Status: metav1.ConditionTrue, - LastTransitionTime: metav1.Now(), - Reason: string(ConditionReasonReady), - }} -} - -// Unknown returns a condition that indicates the resource is in an -// unknown status. -func Unknown() Condition { - return Condition{metav1.Condition{ - Type: string(ConditionTypeReady), - Status: metav1.ConditionFalse, - LastTransitionTime: metav1.Now(), - Reason: string(ConditionReasonUnknown), - }} -} - -// Failed returns a condition that indicates the resource -// failed to get reconciled. -func Failed(msg string) Condition { - return Condition{metav1.Condition{ - Type: string(ConditionTypeReady), - Status: metav1.ConditionFalse, - LastTransitionTime: metav1.Now(), - Reason: string(ConditionReasonFailed), - Message: msg, - }} -} - -// Processing returns a condition that indicates the resource -// being reconciled. -func Processing(msg string) Condition { - return Condition{metav1.Condition{ - Type: string(ConditionTypeReady), - Status: metav1.ConditionFalse, - LastTransitionTime: metav1.Now(), - Reason: string(ConditionReasonProcessing), - Message: msg, - }} -} diff --git a/apis/condition/v1alpha1/generated.pb.go b/apis/condition/v1alpha1/generated.pb.go deleted file mode 100644 index ca48801..0000000 --- a/apis/condition/v1alpha1/generated.pb.go +++ /dev/null @@ -1,527 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 protoc-gen-gogo. DO NOT EDIT. -// source: github.com/kuidio/kuid/apis/condition/v1alpha1/generated.proto - -package v1alpha1 - -import ( - fmt "fmt" - - io "io" - math "math" - math_bits "math/bits" - reflect "reflect" - strings "strings" - - proto "github.com/gogo/protobuf/proto" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -func (m *Condition) Reset() { *m = Condition{} } -func (*Condition) ProtoMessage() {} -func (*Condition) Descriptor() ([]byte, []int) { - return fileDescriptor_a4ff95c4762e0ac7, []int{0} -} -func (m *Condition) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Condition) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *Condition) XXX_Merge(src proto.Message) { - xxx_messageInfo_Condition.Merge(m, src) -} -func (m *Condition) XXX_Size() int { - return m.Size() -} -func (m *Condition) XXX_DiscardUnknown() { - xxx_messageInfo_Condition.DiscardUnknown(m) -} - -var xxx_messageInfo_Condition proto.InternalMessageInfo - -func (m *ConditionedStatus) Reset() { *m = ConditionedStatus{} } -func (*ConditionedStatus) ProtoMessage() {} -func (*ConditionedStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_a4ff95c4762e0ac7, []int{1} -} -func (m *ConditionedStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ConditionedStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *ConditionedStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_ConditionedStatus.Merge(m, src) -} -func (m *ConditionedStatus) XXX_Size() int { - return m.Size() -} -func (m *ConditionedStatus) XXX_DiscardUnknown() { - xxx_messageInfo_ConditionedStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_ConditionedStatus proto.InternalMessageInfo - -func init() { - proto.RegisterType((*Condition)(nil), "github.com.kuidio.kuid.apis.condition.v1alpha1.Condition") - proto.RegisterType((*ConditionedStatus)(nil), "github.com.kuidio.kuid.apis.condition.v1alpha1.ConditionedStatus") -} - -func init() { - proto.RegisterFile("github.com/kuidio/kuid/apis/condition/v1alpha1/generated.proto", fileDescriptor_a4ff95c4762e0ac7) -} - -var fileDescriptor_a4ff95c4762e0ac7 = []byte{ - // 297 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x91, 0x31, 0x4e, 0xc3, 0x30, - 0x14, 0x86, 0x63, 0x31, 0xd5, 0x9d, 0x9a, 0xa9, 0xea, 0xe0, 0x56, 0x9d, 0xba, 0xf0, 0xac, 0x56, - 0x0c, 0xb0, 0x30, 0x94, 0x1b, 0x14, 0x26, 0x26, 0xdc, 0xc4, 0x38, 0x56, 0x48, 0x1c, 0x25, 0x4e, - 0x24, 0x36, 0xc4, 0x09, 0x38, 0x56, 0xc6, 0x8e, 0x9d, 0x2a, 0x62, 0x2e, 0x82, 0xe2, 0x50, 0x27, - 0x12, 0x53, 0xa7, 0xe7, 0x67, 0xfb, 0xff, 0xde, 0x27, 0x1b, 0xdf, 0x0b, 0xa9, 0xa3, 0x72, 0x0f, - 0x81, 0x4a, 0x68, 0x5c, 0xca, 0x50, 0x2a, 0x5b, 0x28, 0xcb, 0x64, 0x41, 0x03, 0x95, 0x86, 0x52, - 0x4b, 0x95, 0xd2, 0x6a, 0xcd, 0xde, 0xb2, 0x88, 0xad, 0xa9, 0xe0, 0x29, 0xcf, 0x99, 0xe6, 0x21, - 0x64, 0xb9, 0xd2, 0xca, 0x87, 0x3e, 0x0f, 0x5d, 0xde, 0x16, 0x68, 0xf3, 0xe0, 0xf2, 0x70, 0xce, - 0xcf, 0xae, 0x07, 0xf3, 0x84, 0x12, 0x8a, 0x5a, 0xcc, 0xbe, 0x7c, 0xb5, 0x9d, 0x6d, 0xec, 0xaa, - 0xc3, 0xcf, 0x6e, 0xe2, 0xdb, 0x02, 0xa4, 0x6a, 0x75, 0x12, 0x16, 0x44, 0x32, 0xe5, 0xf9, 0x3b, - 0xcd, 0x62, 0xd1, 0xf9, 0x25, 0x5c, 0x33, 0x5a, 0xfd, 0x93, 0x5a, 0x26, 0x78, 0xf4, 0x70, 0x1e, - 0xed, 0xbf, 0xe0, 0x91, 0xf3, 0x98, 0xa2, 0x05, 0x5a, 0x8d, 0x37, 0x14, 0x3a, 0x2c, 0x0c, 0xb1, - 0x90, 0xc5, 0xa2, 0xd3, 0x6e, 0xb1, 0x50, 0xad, 0xc1, 0x31, 0xb6, 0x93, 0xfa, 0x34, 0xf7, 0xcc, - 0x69, 0xde, 0x63, 0x77, 0x3d, 0x74, 0xf9, 0x89, 0xf0, 0xc4, 0x1d, 0xf0, 0xf0, 0x51, 0x33, 0x5d, - 0x16, 0x7e, 0x82, 0xb1, 0xbb, 0x52, 0x4c, 0xd1, 0xe2, 0x6a, 0x35, 0xde, 0xdc, 0x5d, 0xf8, 0x5c, - 0x03, 0x05, 0xff, 0x4f, 0x01, 0xbb, 0xad, 0x62, 0x37, 0x18, 0xb0, 0x7d, 0xaa, 0x1b, 0xe2, 0x1d, - 0x1a, 0xe2, 0x1d, 0x1b, 0xe2, 0x7d, 0x18, 0x82, 0x6a, 0x43, 0xd0, 0xc1, 0x10, 0x74, 0x34, 0x04, - 0x7d, 0x1b, 0x82, 0xbe, 0x7e, 0x88, 0xf7, 0x0c, 0x97, 0x7d, 0xf7, 0x6f, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x91, 0x25, 0x36, 0x7b, 0x1f, 0x02, 0x00, 0x00, -} - -func (m *Condition) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Condition) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Condition) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Condition.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ConditionedStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ConditionedStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ConditionedStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Conditions) > 0 { - for iNdEx := len(m.Conditions) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Conditions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { - offset -= sovGenerated(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Condition) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Condition.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ConditionedStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Conditions) > 0 { - for _, e := range m.Conditions { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func sovGenerated(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenerated(x uint64) (n int) { - return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *Condition) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Condition{`, - `Condition:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Condition), "Condition", "v1.Condition", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *ConditionedStatus) String() string { - if this == nil { - return "nil" - } - repeatedStringForConditions := "[]Condition{" - for _, f := range this.Conditions { - repeatedStringForConditions += strings.Replace(strings.Replace(f.String(), "Condition", "Condition", 1), `&`, ``, 1) + "," - } - repeatedStringForConditions += "}" - s := strings.Join([]string{`&ConditionedStatus{`, - `Conditions:` + repeatedStringForConditions + `,`, - `}`, - }, "") - return s -} -func valueToStringGenerated(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *Condition) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Condition: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Condition: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Condition", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Condition.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ConditionedStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ConditionedStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ConditionedStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Conditions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Conditions = append(m.Conditions, Condition{}) - if err := m.Conditions[len(m.Conditions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenerated(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenerated - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenerated - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenerated - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") -) diff --git a/apis/condition/v1alpha1/generated.proto b/apis/condition/v1alpha1/generated.proto deleted file mode 100644 index c5bcc65..0000000 --- a/apis/condition/v1alpha1/generated.proto +++ /dev/null @@ -1,40 +0,0 @@ -/* -Copyright 2024 Nokia. - -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. -*/ -// This file was autogenerated by go-to-protobuf. Do not edit it manually! - -syntax = "proto2"; - -package github.com.kuidio.kuid.apis.condition.v1alpha1; - -import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; - -// Package-wide variables from generator "generated". -option go_package = "github.com/kuidio/kuid/apis/condition/v1alpha1"; - -// +k8s:openapi-gen=true -message Condition { - optional k8s.io.apimachinery.pkg.apis.meta.v1.Condition condition = 1; -} - -// +k8s:openapi-gen=true -// A ConditionedStatus reflects the observed status of a resource. Only -// one condition of each type may exist. -message ConditionedStatus { - // Conditions of the resource. - // +optional - repeated Condition conditions = 1; -} - diff --git a/apis/generated/clientset/versioned/clientset.go b/apis/generated/clientset/versioned/clientset.go deleted file mode 100644 index 07d7ec5..0000000 --- a/apis/generated/clientset/versioned/clientset.go +++ /dev/null @@ -1,210 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 versioned - -import ( - "fmt" - "net/http" - - asv1alpha1 "github.com/kuidio/kuid/apis/generated/clientset/versioned/typed/as/v1alpha1" - esiv1alpha1 "github.com/kuidio/kuid/apis/generated/clientset/versioned/typed/esi/v1alpha1" - extcommv1alpha1 "github.com/kuidio/kuid/apis/generated/clientset/versioned/typed/extcomm/v1alpha1" - genidv1alpha1 "github.com/kuidio/kuid/apis/generated/clientset/versioned/typed/genid/v1alpha1" - infrav1alpha1 "github.com/kuidio/kuid/apis/generated/clientset/versioned/typed/infra/v1alpha1" - ipamv1alpha1 "github.com/kuidio/kuid/apis/generated/clientset/versioned/typed/ipam/v1alpha1" - vlanv1alpha1 "github.com/kuidio/kuid/apis/generated/clientset/versioned/typed/vlan/v1alpha1" - vxlanv1alpha1 "github.com/kuidio/kuid/apis/generated/clientset/versioned/typed/vxlan/v1alpha1" - discovery "k8s.io/client-go/discovery" - rest "k8s.io/client-go/rest" - flowcontrol "k8s.io/client-go/util/flowcontrol" -) - -type Interface interface { - Discovery() discovery.DiscoveryInterface - AsV1alpha1() asv1alpha1.AsV1alpha1Interface - EsiV1alpha1() esiv1alpha1.EsiV1alpha1Interface - ExtcommV1alpha1() extcommv1alpha1.ExtcommV1alpha1Interface - GenidV1alpha1() genidv1alpha1.GenidV1alpha1Interface - InfraV1alpha1() infrav1alpha1.InfraV1alpha1Interface - IpamV1alpha1() ipamv1alpha1.IpamV1alpha1Interface - VlanV1alpha1() vlanv1alpha1.VlanV1alpha1Interface - VxlanV1alpha1() vxlanv1alpha1.VxlanV1alpha1Interface -} - -// Clientset contains the clients for groups. -type Clientset struct { - *discovery.DiscoveryClient - asV1alpha1 *asv1alpha1.AsV1alpha1Client - esiV1alpha1 *esiv1alpha1.EsiV1alpha1Client - extcommV1alpha1 *extcommv1alpha1.ExtcommV1alpha1Client - genidV1alpha1 *genidv1alpha1.GenidV1alpha1Client - infraV1alpha1 *infrav1alpha1.InfraV1alpha1Client - ipamV1alpha1 *ipamv1alpha1.IpamV1alpha1Client - vlanV1alpha1 *vlanv1alpha1.VlanV1alpha1Client - vxlanV1alpha1 *vxlanv1alpha1.VxlanV1alpha1Client -} - -// AsV1alpha1 retrieves the AsV1alpha1Client -func (c *Clientset) AsV1alpha1() asv1alpha1.AsV1alpha1Interface { - return c.asV1alpha1 -} - -// EsiV1alpha1 retrieves the EsiV1alpha1Client -func (c *Clientset) EsiV1alpha1() esiv1alpha1.EsiV1alpha1Interface { - return c.esiV1alpha1 -} - -// ExtcommV1alpha1 retrieves the ExtcommV1alpha1Client -func (c *Clientset) ExtcommV1alpha1() extcommv1alpha1.ExtcommV1alpha1Interface { - return c.extcommV1alpha1 -} - -// GenidV1alpha1 retrieves the GenidV1alpha1Client -func (c *Clientset) GenidV1alpha1() genidv1alpha1.GenidV1alpha1Interface { - return c.genidV1alpha1 -} - -// InfraV1alpha1 retrieves the InfraV1alpha1Client -func (c *Clientset) InfraV1alpha1() infrav1alpha1.InfraV1alpha1Interface { - return c.infraV1alpha1 -} - -// IpamV1alpha1 retrieves the IpamV1alpha1Client -func (c *Clientset) IpamV1alpha1() ipamv1alpha1.IpamV1alpha1Interface { - return c.ipamV1alpha1 -} - -// VlanV1alpha1 retrieves the VlanV1alpha1Client -func (c *Clientset) VlanV1alpha1() vlanv1alpha1.VlanV1alpha1Interface { - return c.vlanV1alpha1 -} - -// VxlanV1alpha1 retrieves the VxlanV1alpha1Client -func (c *Clientset) VxlanV1alpha1() vxlanv1alpha1.VxlanV1alpha1Interface { - return c.vxlanV1alpha1 -} - -// Discovery retrieves the DiscoveryClient -func (c *Clientset) Discovery() discovery.DiscoveryInterface { - if c == nil { - return nil - } - return c.DiscoveryClient -} - -// NewForConfig creates a new Clientset for the given config. -// If config's RateLimiter is not set and QPS and Burst are acceptable, -// NewForConfig will generate a rate-limiter in configShallowCopy. -// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), -// where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*Clientset, error) { - configShallowCopy := *c - - if configShallowCopy.UserAgent == "" { - configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent() - } - - // share the transport between all clients - httpClient, err := rest.HTTPClientFor(&configShallowCopy) - if err != nil { - return nil, err - } - - return NewForConfigAndClient(&configShallowCopy, httpClient) -} - -// NewForConfigAndClient creates a new Clientset for the given config and http client. -// Note the http client provided takes precedence over the configured transport values. -// If config's RateLimiter is not set and QPS and Burst are acceptable, -// NewForConfigAndClient will generate a rate-limiter in configShallowCopy. -func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, error) { - configShallowCopy := *c - if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { - if configShallowCopy.Burst <= 0 { - return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0") - } - configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) - } - - var cs Clientset - var err error - cs.asV1alpha1, err = asv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) - if err != nil { - return nil, err - } - cs.esiV1alpha1, err = esiv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) - if err != nil { - return nil, err - } - cs.extcommV1alpha1, err = extcommv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) - if err != nil { - return nil, err - } - cs.genidV1alpha1, err = genidv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) - if err != nil { - return nil, err - } - cs.infraV1alpha1, err = infrav1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) - if err != nil { - return nil, err - } - cs.ipamV1alpha1, err = ipamv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) - if err != nil { - return nil, err - } - cs.vlanV1alpha1, err = vlanv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) - if err != nil { - return nil, err - } - cs.vxlanV1alpha1, err = vxlanv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) - if err != nil { - return nil, err - } - - cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient) - if err != nil { - return nil, err - } - return &cs, nil -} - -// NewForConfigOrDie creates a new Clientset for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *Clientset { - cs, err := NewForConfig(c) - if err != nil { - panic(err) - } - return cs -} - -// New creates a new Clientset for the given RESTClient. -func New(c rest.Interface) *Clientset { - var cs Clientset - cs.asV1alpha1 = asv1alpha1.New(c) - cs.esiV1alpha1 = esiv1alpha1.New(c) - cs.extcommV1alpha1 = extcommv1alpha1.New(c) - cs.genidV1alpha1 = genidv1alpha1.New(c) - cs.infraV1alpha1 = infrav1alpha1.New(c) - cs.ipamV1alpha1 = ipamv1alpha1.New(c) - cs.vlanV1alpha1 = vlanv1alpha1.New(c) - cs.vxlanV1alpha1 = vxlanv1alpha1.New(c) - - cs.DiscoveryClient = discovery.NewDiscoveryClient(c) - return &cs -} diff --git a/apis/generated/clientset/versioned/fake/clientset_generated.go b/apis/generated/clientset/versioned/fake/clientset_generated.go deleted file mode 100644 index e45b65a..0000000 --- a/apis/generated/clientset/versioned/fake/clientset_generated.go +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 ( - clientset "github.com/kuidio/kuid/apis/generated/clientset/versioned" - asv1alpha1 "github.com/kuidio/kuid/apis/generated/clientset/versioned/typed/as/v1alpha1" - fakeasv1alpha1 "github.com/kuidio/kuid/apis/generated/clientset/versioned/typed/as/v1alpha1/fake" - esiv1alpha1 "github.com/kuidio/kuid/apis/generated/clientset/versioned/typed/esi/v1alpha1" - fakeesiv1alpha1 "github.com/kuidio/kuid/apis/generated/clientset/versioned/typed/esi/v1alpha1/fake" - extcommv1alpha1 "github.com/kuidio/kuid/apis/generated/clientset/versioned/typed/extcomm/v1alpha1" - fakeextcommv1alpha1 "github.com/kuidio/kuid/apis/generated/clientset/versioned/typed/extcomm/v1alpha1/fake" - genidv1alpha1 "github.com/kuidio/kuid/apis/generated/clientset/versioned/typed/genid/v1alpha1" - fakegenidv1alpha1 "github.com/kuidio/kuid/apis/generated/clientset/versioned/typed/genid/v1alpha1/fake" - infrav1alpha1 "github.com/kuidio/kuid/apis/generated/clientset/versioned/typed/infra/v1alpha1" - fakeinfrav1alpha1 "github.com/kuidio/kuid/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake" - ipamv1alpha1 "github.com/kuidio/kuid/apis/generated/clientset/versioned/typed/ipam/v1alpha1" - fakeipamv1alpha1 "github.com/kuidio/kuid/apis/generated/clientset/versioned/typed/ipam/v1alpha1/fake" - vlanv1alpha1 "github.com/kuidio/kuid/apis/generated/clientset/versioned/typed/vlan/v1alpha1" - fakevlanv1alpha1 "github.com/kuidio/kuid/apis/generated/clientset/versioned/typed/vlan/v1alpha1/fake" - vxlanv1alpha1 "github.com/kuidio/kuid/apis/generated/clientset/versioned/typed/vxlan/v1alpha1" - fakevxlanv1alpha1 "github.com/kuidio/kuid/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/fake" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/watch" - "k8s.io/client-go/discovery" - fakediscovery "k8s.io/client-go/discovery/fake" - "k8s.io/client-go/testing" -) - -// NewSimpleClientset returns a clientset that will respond with the provided objects. -// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, -// without applying any validations and/or defaults. It shouldn't be considered a replacement -// for a real clientset and is mostly useful in simple unit tests. -func NewSimpleClientset(objects ...runtime.Object) *Clientset { - o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) - for _, obj := range objects { - if err := o.Add(obj); err != nil { - panic(err) - } - } - - cs := &Clientset{tracker: o} - cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} - cs.AddReactor("*", "*", testing.ObjectReaction(o)) - cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { - gvr := action.GetResource() - ns := action.GetNamespace() - watch, err := o.Watch(gvr, ns) - if err != nil { - return false, nil, err - } - return true, watch, nil - }) - - return cs -} - -// Clientset implements clientset.Interface. Meant to be embedded into a -// struct to get a default implementation. This makes faking out just the method -// you want to test easier. -type Clientset struct { - testing.Fake - discovery *fakediscovery.FakeDiscovery - tracker testing.ObjectTracker -} - -func (c *Clientset) Discovery() discovery.DiscoveryInterface { - return c.discovery -} - -func (c *Clientset) Tracker() testing.ObjectTracker { - return c.tracker -} - -var ( - _ clientset.Interface = &Clientset{} - _ testing.FakeClient = &Clientset{} -) - -// AsV1alpha1 retrieves the AsV1alpha1Client -func (c *Clientset) AsV1alpha1() asv1alpha1.AsV1alpha1Interface { - return &fakeasv1alpha1.FakeAsV1alpha1{Fake: &c.Fake} -} - -// EsiV1alpha1 retrieves the EsiV1alpha1Client -func (c *Clientset) EsiV1alpha1() esiv1alpha1.EsiV1alpha1Interface { - return &fakeesiv1alpha1.FakeEsiV1alpha1{Fake: &c.Fake} -} - -// ExtcommV1alpha1 retrieves the ExtcommV1alpha1Client -func (c *Clientset) ExtcommV1alpha1() extcommv1alpha1.ExtcommV1alpha1Interface { - return &fakeextcommv1alpha1.FakeExtcommV1alpha1{Fake: &c.Fake} -} - -// GenidV1alpha1 retrieves the GenidV1alpha1Client -func (c *Clientset) GenidV1alpha1() genidv1alpha1.GenidV1alpha1Interface { - return &fakegenidv1alpha1.FakeGenidV1alpha1{Fake: &c.Fake} -} - -// InfraV1alpha1 retrieves the InfraV1alpha1Client -func (c *Clientset) InfraV1alpha1() infrav1alpha1.InfraV1alpha1Interface { - return &fakeinfrav1alpha1.FakeInfraV1alpha1{Fake: &c.Fake} -} - -// IpamV1alpha1 retrieves the IpamV1alpha1Client -func (c *Clientset) IpamV1alpha1() ipamv1alpha1.IpamV1alpha1Interface { - return &fakeipamv1alpha1.FakeIpamV1alpha1{Fake: &c.Fake} -} - -// VlanV1alpha1 retrieves the VlanV1alpha1Client -func (c *Clientset) VlanV1alpha1() vlanv1alpha1.VlanV1alpha1Interface { - return &fakevlanv1alpha1.FakeVlanV1alpha1{Fake: &c.Fake} -} - -// VxlanV1alpha1 retrieves the VxlanV1alpha1Client -func (c *Clientset) VxlanV1alpha1() vxlanv1alpha1.VxlanV1alpha1Interface { - return &fakevxlanv1alpha1.FakeVxlanV1alpha1{Fake: &c.Fake} -} diff --git a/apis/generated/clientset/versioned/typed/as/v1alpha1/asclaim.go b/apis/generated/clientset/versioned/typed/as/v1alpha1/asclaim.go deleted file mode 100644 index 68d7b10..0000000 --- a/apis/generated/clientset/versioned/typed/as/v1alpha1/asclaim.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// ASClaimsGetter has a method to return a ASClaimInterface. -// A group's client should implement this interface. -type ASClaimsGetter interface { - ASClaims(namespace string) ASClaimInterface -} - -// ASClaimInterface has methods to work with ASClaim resources. -type ASClaimInterface interface { - Create(ctx context.Context, aSClaim *v1alpha1.ASClaim, opts v1.CreateOptions) (*v1alpha1.ASClaim, error) - Update(ctx context.Context, aSClaim *v1alpha1.ASClaim, opts v1.UpdateOptions) (*v1alpha1.ASClaim, error) - UpdateStatus(ctx context.Context, aSClaim *v1alpha1.ASClaim, opts v1.UpdateOptions) (*v1alpha1.ASClaim, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.ASClaim, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ASClaimList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ASClaim, err error) - ASClaimExpansion -} - -// aSClaims implements ASClaimInterface -type aSClaims struct { - client rest.Interface - ns string -} - -// newASClaims returns a ASClaims -func newASClaims(c *AsV1alpha1Client, namespace string) *aSClaims { - return &aSClaims{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the aSClaim, and returns the corresponding aSClaim object, and an error if there is any. -func (c *aSClaims) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ASClaim, err error) { - result = &v1alpha1.ASClaim{} - err = c.client.Get(). - Namespace(c.ns). - Resource("asclaims"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ASClaims that match those selectors. -func (c *aSClaims) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ASClaimList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.ASClaimList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("asclaims"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested aSClaims. -func (c *aSClaims) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("asclaims"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a aSClaim and creates it. Returns the server's representation of the aSClaim, and an error, if there is any. -func (c *aSClaims) Create(ctx context.Context, aSClaim *v1alpha1.ASClaim, opts v1.CreateOptions) (result *v1alpha1.ASClaim, err error) { - result = &v1alpha1.ASClaim{} - err = c.client.Post(). - Namespace(c.ns). - Resource("asclaims"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(aSClaim). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a aSClaim and updates it. Returns the server's representation of the aSClaim, and an error, if there is any. -func (c *aSClaims) Update(ctx context.Context, aSClaim *v1alpha1.ASClaim, opts v1.UpdateOptions) (result *v1alpha1.ASClaim, err error) { - result = &v1alpha1.ASClaim{} - err = c.client.Put(). - Namespace(c.ns). - Resource("asclaims"). - Name(aSClaim.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(aSClaim). - 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 *aSClaims) UpdateStatus(ctx context.Context, aSClaim *v1alpha1.ASClaim, opts v1.UpdateOptions) (result *v1alpha1.ASClaim, err error) { - result = &v1alpha1.ASClaim{} - err = c.client.Put(). - Namespace(c.ns). - Resource("asclaims"). - Name(aSClaim.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(aSClaim). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the aSClaim and deletes it. Returns an error if one occurs. -func (c *aSClaims) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("asclaims"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *aSClaims) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("asclaims"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched aSClaim. -func (c *aSClaims) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ASClaim, err error) { - result = &v1alpha1.ASClaim{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("asclaims"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/as/v1alpha1/asentry.go b/apis/generated/clientset/versioned/typed/as/v1alpha1/asentry.go deleted file mode 100644 index 093b887..0000000 --- a/apis/generated/clientset/versioned/typed/as/v1alpha1/asentry.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// ASEntriesGetter has a method to return a ASEntryInterface. -// A group's client should implement this interface. -type ASEntriesGetter interface { - ASEntries(namespace string) ASEntryInterface -} - -// ASEntryInterface has methods to work with ASEntry resources. -type ASEntryInterface interface { - Create(ctx context.Context, aSEntry *v1alpha1.ASEntry, opts v1.CreateOptions) (*v1alpha1.ASEntry, error) - Update(ctx context.Context, aSEntry *v1alpha1.ASEntry, opts v1.UpdateOptions) (*v1alpha1.ASEntry, error) - UpdateStatus(ctx context.Context, aSEntry *v1alpha1.ASEntry, opts v1.UpdateOptions) (*v1alpha1.ASEntry, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.ASEntry, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ASEntryList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ASEntry, err error) - ASEntryExpansion -} - -// aSEntries implements ASEntryInterface -type aSEntries struct { - client rest.Interface - ns string -} - -// newASEntries returns a ASEntries -func newASEntries(c *AsV1alpha1Client, namespace string) *aSEntries { - return &aSEntries{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the aSEntry, and returns the corresponding aSEntry object, and an error if there is any. -func (c *aSEntries) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ASEntry, err error) { - result = &v1alpha1.ASEntry{} - err = c.client.Get(). - Namespace(c.ns). - Resource("asentries"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ASEntries that match those selectors. -func (c *aSEntries) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ASEntryList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.ASEntryList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("asentries"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested aSEntries. -func (c *aSEntries) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("asentries"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a aSEntry and creates it. Returns the server's representation of the aSEntry, and an error, if there is any. -func (c *aSEntries) Create(ctx context.Context, aSEntry *v1alpha1.ASEntry, opts v1.CreateOptions) (result *v1alpha1.ASEntry, err error) { - result = &v1alpha1.ASEntry{} - err = c.client.Post(). - Namespace(c.ns). - Resource("asentries"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(aSEntry). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a aSEntry and updates it. Returns the server's representation of the aSEntry, and an error, if there is any. -func (c *aSEntries) Update(ctx context.Context, aSEntry *v1alpha1.ASEntry, opts v1.UpdateOptions) (result *v1alpha1.ASEntry, err error) { - result = &v1alpha1.ASEntry{} - err = c.client.Put(). - Namespace(c.ns). - Resource("asentries"). - Name(aSEntry.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(aSEntry). - 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 *aSEntries) UpdateStatus(ctx context.Context, aSEntry *v1alpha1.ASEntry, opts v1.UpdateOptions) (result *v1alpha1.ASEntry, err error) { - result = &v1alpha1.ASEntry{} - err = c.client.Put(). - Namespace(c.ns). - Resource("asentries"). - Name(aSEntry.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(aSEntry). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the aSEntry and deletes it. Returns an error if one occurs. -func (c *aSEntries) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("asentries"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *aSEntries) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("asentries"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched aSEntry. -func (c *aSEntries) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ASEntry, err error) { - result = &v1alpha1.ASEntry{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("asentries"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/as/v1alpha1/asindex.go b/apis/generated/clientset/versioned/typed/as/v1alpha1/asindex.go deleted file mode 100644 index 3f23104..0000000 --- a/apis/generated/clientset/versioned/typed/as/v1alpha1/asindex.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// ASIndexesGetter has a method to return a ASIndexInterface. -// A group's client should implement this interface. -type ASIndexesGetter interface { - ASIndexes(namespace string) ASIndexInterface -} - -// ASIndexInterface has methods to work with ASIndex resources. -type ASIndexInterface interface { - Create(ctx context.Context, aSIndex *v1alpha1.ASIndex, opts v1.CreateOptions) (*v1alpha1.ASIndex, error) - Update(ctx context.Context, aSIndex *v1alpha1.ASIndex, opts v1.UpdateOptions) (*v1alpha1.ASIndex, error) - UpdateStatus(ctx context.Context, aSIndex *v1alpha1.ASIndex, opts v1.UpdateOptions) (*v1alpha1.ASIndex, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.ASIndex, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ASIndexList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ASIndex, err error) - ASIndexExpansion -} - -// aSIndexes implements ASIndexInterface -type aSIndexes struct { - client rest.Interface - ns string -} - -// newASIndexes returns a ASIndexes -func newASIndexes(c *AsV1alpha1Client, namespace string) *aSIndexes { - return &aSIndexes{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the aSIndex, and returns the corresponding aSIndex object, and an error if there is any. -func (c *aSIndexes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ASIndex, err error) { - result = &v1alpha1.ASIndex{} - err = c.client.Get(). - Namespace(c.ns). - Resource("asindexes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ASIndexes that match those selectors. -func (c *aSIndexes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ASIndexList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.ASIndexList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("asindexes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested aSIndexes. -func (c *aSIndexes) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("asindexes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a aSIndex and creates it. Returns the server's representation of the aSIndex, and an error, if there is any. -func (c *aSIndexes) Create(ctx context.Context, aSIndex *v1alpha1.ASIndex, opts v1.CreateOptions) (result *v1alpha1.ASIndex, err error) { - result = &v1alpha1.ASIndex{} - err = c.client.Post(). - Namespace(c.ns). - Resource("asindexes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(aSIndex). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a aSIndex and updates it. Returns the server's representation of the aSIndex, and an error, if there is any. -func (c *aSIndexes) Update(ctx context.Context, aSIndex *v1alpha1.ASIndex, opts v1.UpdateOptions) (result *v1alpha1.ASIndex, err error) { - result = &v1alpha1.ASIndex{} - err = c.client.Put(). - Namespace(c.ns). - Resource("asindexes"). - Name(aSIndex.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(aSIndex). - 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 *aSIndexes) UpdateStatus(ctx context.Context, aSIndex *v1alpha1.ASIndex, opts v1.UpdateOptions) (result *v1alpha1.ASIndex, err error) { - result = &v1alpha1.ASIndex{} - err = c.client.Put(). - Namespace(c.ns). - Resource("asindexes"). - Name(aSIndex.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(aSIndex). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the aSIndex and deletes it. Returns an error if one occurs. -func (c *aSIndexes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("asindexes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *aSIndexes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("asindexes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched aSIndex. -func (c *aSIndexes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ASIndex, err error) { - result = &v1alpha1.ASIndex{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("asindexes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/esi/v1alpha1/doc.go b/apis/generated/clientset/versioned/typed/esi/v1alpha1/doc.go deleted file mode 100644 index cda7d5a..0000000 --- a/apis/generated/clientset/versioned/typed/esi/v1alpha1/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 diff --git a/apis/generated/clientset/versioned/typed/esi/v1alpha1/esi_client.go b/apis/generated/clientset/versioned/typed/esi/v1alpha1/esi_client.go deleted file mode 100644 index 96ebb42..0000000 --- a/apis/generated/clientset/versioned/typed/esi/v1alpha1/esi_client.go +++ /dev/null @@ -1,116 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "net/http" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/esi/v1alpha1" - "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - rest "k8s.io/client-go/rest" -) - -type EsiV1alpha1Interface interface { - RESTClient() rest.Interface - ESIClaimsGetter - ESIEntriesGetter - ESIIndexesGetter -} - -// EsiV1alpha1Client is used to interact with features provided by the esi.be.kuid.dev group. -type EsiV1alpha1Client struct { - restClient rest.Interface -} - -func (c *EsiV1alpha1Client) ESIClaims(namespace string) ESIClaimInterface { - return newESIClaims(c, namespace) -} - -func (c *EsiV1alpha1Client) ESIEntries(namespace string) ESIEntryInterface { - return newESIEntries(c, namespace) -} - -func (c *EsiV1alpha1Client) ESIIndexes(namespace string) ESIIndexInterface { - return newESIIndexes(c, namespace) -} - -// NewForConfig creates a new EsiV1alpha1Client for the given config. -// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), -// where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*EsiV1alpha1Client, 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 EsiV1alpha1Client 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) (*EsiV1alpha1Client, 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 &EsiV1alpha1Client{client}, nil -} - -// NewForConfigOrDie creates a new EsiV1alpha1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *EsiV1alpha1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new EsiV1alpha1Client for the given RESTClient. -func New(c rest.Interface) *EsiV1alpha1Client { - return &EsiV1alpha1Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v1alpha1.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 *EsiV1alpha1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/apis/generated/clientset/versioned/typed/esi/v1alpha1/esiclaim.go b/apis/generated/clientset/versioned/typed/esi/v1alpha1/esiclaim.go deleted file mode 100644 index 3f30030..0000000 --- a/apis/generated/clientset/versioned/typed/esi/v1alpha1/esiclaim.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/esi/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// ESIClaimsGetter has a method to return a ESIClaimInterface. -// A group's client should implement this interface. -type ESIClaimsGetter interface { - ESIClaims(namespace string) ESIClaimInterface -} - -// ESIClaimInterface has methods to work with ESIClaim resources. -type ESIClaimInterface interface { - Create(ctx context.Context, eSIClaim *v1alpha1.ESIClaim, opts v1.CreateOptions) (*v1alpha1.ESIClaim, error) - Update(ctx context.Context, eSIClaim *v1alpha1.ESIClaim, opts v1.UpdateOptions) (*v1alpha1.ESIClaim, error) - UpdateStatus(ctx context.Context, eSIClaim *v1alpha1.ESIClaim, opts v1.UpdateOptions) (*v1alpha1.ESIClaim, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.ESIClaim, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ESIClaimList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ESIClaim, err error) - ESIClaimExpansion -} - -// eSIClaims implements ESIClaimInterface -type eSIClaims struct { - client rest.Interface - ns string -} - -// newESIClaims returns a ESIClaims -func newESIClaims(c *EsiV1alpha1Client, namespace string) *eSIClaims { - return &eSIClaims{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the eSIClaim, and returns the corresponding eSIClaim object, and an error if there is any. -func (c *eSIClaims) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ESIClaim, err error) { - result = &v1alpha1.ESIClaim{} - err = c.client.Get(). - Namespace(c.ns). - Resource("esiclaims"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ESIClaims that match those selectors. -func (c *eSIClaims) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ESIClaimList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.ESIClaimList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("esiclaims"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested eSIClaims. -func (c *eSIClaims) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("esiclaims"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a eSIClaim and creates it. Returns the server's representation of the eSIClaim, and an error, if there is any. -func (c *eSIClaims) Create(ctx context.Context, eSIClaim *v1alpha1.ESIClaim, opts v1.CreateOptions) (result *v1alpha1.ESIClaim, err error) { - result = &v1alpha1.ESIClaim{} - err = c.client.Post(). - Namespace(c.ns). - Resource("esiclaims"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(eSIClaim). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a eSIClaim and updates it. Returns the server's representation of the eSIClaim, and an error, if there is any. -func (c *eSIClaims) Update(ctx context.Context, eSIClaim *v1alpha1.ESIClaim, opts v1.UpdateOptions) (result *v1alpha1.ESIClaim, err error) { - result = &v1alpha1.ESIClaim{} - err = c.client.Put(). - Namespace(c.ns). - Resource("esiclaims"). - Name(eSIClaim.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(eSIClaim). - 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 *eSIClaims) UpdateStatus(ctx context.Context, eSIClaim *v1alpha1.ESIClaim, opts v1.UpdateOptions) (result *v1alpha1.ESIClaim, err error) { - result = &v1alpha1.ESIClaim{} - err = c.client.Put(). - Namespace(c.ns). - Resource("esiclaims"). - Name(eSIClaim.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(eSIClaim). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the eSIClaim and deletes it. Returns an error if one occurs. -func (c *eSIClaims) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("esiclaims"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *eSIClaims) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("esiclaims"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched eSIClaim. -func (c *eSIClaims) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ESIClaim, err error) { - result = &v1alpha1.ESIClaim{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("esiclaims"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/esi/v1alpha1/esientry.go b/apis/generated/clientset/versioned/typed/esi/v1alpha1/esientry.go deleted file mode 100644 index d217763..0000000 --- a/apis/generated/clientset/versioned/typed/esi/v1alpha1/esientry.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/esi/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// ESIEntriesGetter has a method to return a ESIEntryInterface. -// A group's client should implement this interface. -type ESIEntriesGetter interface { - ESIEntries(namespace string) ESIEntryInterface -} - -// ESIEntryInterface has methods to work with ESIEntry resources. -type ESIEntryInterface interface { - Create(ctx context.Context, eSIEntry *v1alpha1.ESIEntry, opts v1.CreateOptions) (*v1alpha1.ESIEntry, error) - Update(ctx context.Context, eSIEntry *v1alpha1.ESIEntry, opts v1.UpdateOptions) (*v1alpha1.ESIEntry, error) - UpdateStatus(ctx context.Context, eSIEntry *v1alpha1.ESIEntry, opts v1.UpdateOptions) (*v1alpha1.ESIEntry, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.ESIEntry, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ESIEntryList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ESIEntry, err error) - ESIEntryExpansion -} - -// eSIEntries implements ESIEntryInterface -type eSIEntries struct { - client rest.Interface - ns string -} - -// newESIEntries returns a ESIEntries -func newESIEntries(c *EsiV1alpha1Client, namespace string) *eSIEntries { - return &eSIEntries{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the eSIEntry, and returns the corresponding eSIEntry object, and an error if there is any. -func (c *eSIEntries) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ESIEntry, err error) { - result = &v1alpha1.ESIEntry{} - err = c.client.Get(). - Namespace(c.ns). - Resource("esientries"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ESIEntries that match those selectors. -func (c *eSIEntries) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ESIEntryList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.ESIEntryList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("esientries"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested eSIEntries. -func (c *eSIEntries) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("esientries"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a eSIEntry and creates it. Returns the server's representation of the eSIEntry, and an error, if there is any. -func (c *eSIEntries) Create(ctx context.Context, eSIEntry *v1alpha1.ESIEntry, opts v1.CreateOptions) (result *v1alpha1.ESIEntry, err error) { - result = &v1alpha1.ESIEntry{} - err = c.client.Post(). - Namespace(c.ns). - Resource("esientries"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(eSIEntry). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a eSIEntry and updates it. Returns the server's representation of the eSIEntry, and an error, if there is any. -func (c *eSIEntries) Update(ctx context.Context, eSIEntry *v1alpha1.ESIEntry, opts v1.UpdateOptions) (result *v1alpha1.ESIEntry, err error) { - result = &v1alpha1.ESIEntry{} - err = c.client.Put(). - Namespace(c.ns). - Resource("esientries"). - Name(eSIEntry.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(eSIEntry). - 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 *eSIEntries) UpdateStatus(ctx context.Context, eSIEntry *v1alpha1.ESIEntry, opts v1.UpdateOptions) (result *v1alpha1.ESIEntry, err error) { - result = &v1alpha1.ESIEntry{} - err = c.client.Put(). - Namespace(c.ns). - Resource("esientries"). - Name(eSIEntry.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(eSIEntry). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the eSIEntry and deletes it. Returns an error if one occurs. -func (c *eSIEntries) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("esientries"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *eSIEntries) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("esientries"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched eSIEntry. -func (c *eSIEntries) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ESIEntry, err error) { - result = &v1alpha1.ESIEntry{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("esientries"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/esi/v1alpha1/esiindex.go b/apis/generated/clientset/versioned/typed/esi/v1alpha1/esiindex.go deleted file mode 100644 index 41ea238..0000000 --- a/apis/generated/clientset/versioned/typed/esi/v1alpha1/esiindex.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/esi/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// ESIIndexesGetter has a method to return a ESIIndexInterface. -// A group's client should implement this interface. -type ESIIndexesGetter interface { - ESIIndexes(namespace string) ESIIndexInterface -} - -// ESIIndexInterface has methods to work with ESIIndex resources. -type ESIIndexInterface interface { - Create(ctx context.Context, eSIIndex *v1alpha1.ESIIndex, opts v1.CreateOptions) (*v1alpha1.ESIIndex, error) - Update(ctx context.Context, eSIIndex *v1alpha1.ESIIndex, opts v1.UpdateOptions) (*v1alpha1.ESIIndex, error) - UpdateStatus(ctx context.Context, eSIIndex *v1alpha1.ESIIndex, opts v1.UpdateOptions) (*v1alpha1.ESIIndex, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.ESIIndex, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ESIIndexList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ESIIndex, err error) - ESIIndexExpansion -} - -// eSIIndexes implements ESIIndexInterface -type eSIIndexes struct { - client rest.Interface - ns string -} - -// newESIIndexes returns a ESIIndexes -func newESIIndexes(c *EsiV1alpha1Client, namespace string) *eSIIndexes { - return &eSIIndexes{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the eSIIndex, and returns the corresponding eSIIndex object, and an error if there is any. -func (c *eSIIndexes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ESIIndex, err error) { - result = &v1alpha1.ESIIndex{} - err = c.client.Get(). - Namespace(c.ns). - Resource("esiindexes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ESIIndexes that match those selectors. -func (c *eSIIndexes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ESIIndexList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.ESIIndexList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("esiindexes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested eSIIndexes. -func (c *eSIIndexes) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("esiindexes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a eSIIndex and creates it. Returns the server's representation of the eSIIndex, and an error, if there is any. -func (c *eSIIndexes) Create(ctx context.Context, eSIIndex *v1alpha1.ESIIndex, opts v1.CreateOptions) (result *v1alpha1.ESIIndex, err error) { - result = &v1alpha1.ESIIndex{} - err = c.client.Post(). - Namespace(c.ns). - Resource("esiindexes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(eSIIndex). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a eSIIndex and updates it. Returns the server's representation of the eSIIndex, and an error, if there is any. -func (c *eSIIndexes) Update(ctx context.Context, eSIIndex *v1alpha1.ESIIndex, opts v1.UpdateOptions) (result *v1alpha1.ESIIndex, err error) { - result = &v1alpha1.ESIIndex{} - err = c.client.Put(). - Namespace(c.ns). - Resource("esiindexes"). - Name(eSIIndex.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(eSIIndex). - 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 *eSIIndexes) UpdateStatus(ctx context.Context, eSIIndex *v1alpha1.ESIIndex, opts v1.UpdateOptions) (result *v1alpha1.ESIIndex, err error) { - result = &v1alpha1.ESIIndex{} - err = c.client.Put(). - Namespace(c.ns). - Resource("esiindexes"). - Name(eSIIndex.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(eSIIndex). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the eSIIndex and deletes it. Returns an error if one occurs. -func (c *eSIIndexes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("esiindexes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *eSIIndexes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("esiindexes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched eSIIndex. -func (c *eSIIndexes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ESIIndex, err error) { - result = &v1alpha1.ESIIndex{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("esiindexes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/esi/v1alpha1/fake/doc.go b/apis/generated/clientset/versioned/typed/esi/v1alpha1/fake/doc.go deleted file mode 100644 index d4601f1..0000000 --- a/apis/generated/clientset/versioned/typed/esi/v1alpha1/fake/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Copyright 2024 Nokia. - -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/apis/generated/clientset/versioned/typed/esi/v1alpha1/fake/fake_esi_client.go b/apis/generated/clientset/versioned/typed/esi/v1alpha1/fake/fake_esi_client.go deleted file mode 100644 index e7b2609..0000000 --- a/apis/generated/clientset/versioned/typed/esi/v1alpha1/fake/fake_esi_client.go +++ /dev/null @@ -1,47 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 ( - v1alpha1 "github.com/kuidio/kuid/apis/generated/clientset/versioned/typed/esi/v1alpha1" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakeEsiV1alpha1 struct { - *testing.Fake -} - -func (c *FakeEsiV1alpha1) ESIClaims(namespace string) v1alpha1.ESIClaimInterface { - return &FakeESIClaims{c, namespace} -} - -func (c *FakeEsiV1alpha1) ESIEntries(namespace string) v1alpha1.ESIEntryInterface { - return &FakeESIEntries{c, namespace} -} - -func (c *FakeEsiV1alpha1) ESIIndexes(namespace string) v1alpha1.ESIIndexInterface { - return &FakeESIIndexes{c, namespace} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeEsiV1alpha1) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/apis/generated/clientset/versioned/typed/esi/v1alpha1/fake/fake_esiclaim.go b/apis/generated/clientset/versioned/typed/esi/v1alpha1/fake/fake_esiclaim.go deleted file mode 100644 index bb5f4ce..0000000 --- a/apis/generated/clientset/versioned/typed/esi/v1alpha1/fake/fake_esiclaim.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2024 Nokia. - -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" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/esi/v1alpha1" - v1 "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" -) - -// FakeESIClaims implements ESIClaimInterface -type FakeESIClaims struct { - Fake *FakeEsiV1alpha1 - ns string -} - -var esiclaimsResource = v1alpha1.SchemeGroupVersion.WithResource("esiclaims") - -var esiclaimsKind = v1alpha1.SchemeGroupVersion.WithKind("ESIClaim") - -// Get takes name of the eSIClaim, and returns the corresponding eSIClaim object, and an error if there is any. -func (c *FakeESIClaims) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ESIClaim, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(esiclaimsResource, c.ns, name), &v1alpha1.ESIClaim{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.ESIClaim), err -} - -// List takes label and field selectors, and returns the list of ESIClaims that match those selectors. -func (c *FakeESIClaims) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ESIClaimList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(esiclaimsResource, esiclaimsKind, c.ns, opts), &v1alpha1.ESIClaimList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.ESIClaimList{ListMeta: obj.(*v1alpha1.ESIClaimList).ListMeta} - for _, item := range obj.(*v1alpha1.ESIClaimList).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 eSIClaims. -func (c *FakeESIClaims) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(esiclaimsResource, c.ns, opts)) - -} - -// Create takes the representation of a eSIClaim and creates it. Returns the server's representation of the eSIClaim, and an error, if there is any. -func (c *FakeESIClaims) Create(ctx context.Context, eSIClaim *v1alpha1.ESIClaim, opts v1.CreateOptions) (result *v1alpha1.ESIClaim, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(esiclaimsResource, c.ns, eSIClaim), &v1alpha1.ESIClaim{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.ESIClaim), err -} - -// Update takes the representation of a eSIClaim and updates it. Returns the server's representation of the eSIClaim, and an error, if there is any. -func (c *FakeESIClaims) Update(ctx context.Context, eSIClaim *v1alpha1.ESIClaim, opts v1.UpdateOptions) (result *v1alpha1.ESIClaim, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(esiclaimsResource, c.ns, eSIClaim), &v1alpha1.ESIClaim{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.ESIClaim), 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 *FakeESIClaims) UpdateStatus(ctx context.Context, eSIClaim *v1alpha1.ESIClaim, opts v1.UpdateOptions) (*v1alpha1.ESIClaim, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(esiclaimsResource, "status", c.ns, eSIClaim), &v1alpha1.ESIClaim{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.ESIClaim), err -} - -// Delete takes name of the eSIClaim and deletes it. Returns an error if one occurs. -func (c *FakeESIClaims) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(esiclaimsResource, c.ns, name, opts), &v1alpha1.ESIClaim{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeESIClaims) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(esiclaimsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.ESIClaimList{}) - return err -} - -// Patch applies the patch and returns the patched eSIClaim. -func (c *FakeESIClaims) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ESIClaim, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(esiclaimsResource, c.ns, name, pt, data, subresources...), &v1alpha1.ESIClaim{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.ESIClaim), err -} diff --git a/apis/generated/clientset/versioned/typed/esi/v1alpha1/fake/fake_esientry.go b/apis/generated/clientset/versioned/typed/esi/v1alpha1/fake/fake_esientry.go deleted file mode 100644 index 6968f0b..0000000 --- a/apis/generated/clientset/versioned/typed/esi/v1alpha1/fake/fake_esientry.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2024 Nokia. - -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" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/esi/v1alpha1" - v1 "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" -) - -// FakeESIEntries implements ESIEntryInterface -type FakeESIEntries struct { - Fake *FakeEsiV1alpha1 - ns string -} - -var esientriesResource = v1alpha1.SchemeGroupVersion.WithResource("esientries") - -var esientriesKind = v1alpha1.SchemeGroupVersion.WithKind("ESIEntry") - -// Get takes name of the eSIEntry, and returns the corresponding eSIEntry object, and an error if there is any. -func (c *FakeESIEntries) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ESIEntry, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(esientriesResource, c.ns, name), &v1alpha1.ESIEntry{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.ESIEntry), err -} - -// List takes label and field selectors, and returns the list of ESIEntries that match those selectors. -func (c *FakeESIEntries) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ESIEntryList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(esientriesResource, esientriesKind, c.ns, opts), &v1alpha1.ESIEntryList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.ESIEntryList{ListMeta: obj.(*v1alpha1.ESIEntryList).ListMeta} - for _, item := range obj.(*v1alpha1.ESIEntryList).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 eSIEntries. -func (c *FakeESIEntries) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(esientriesResource, c.ns, opts)) - -} - -// Create takes the representation of a eSIEntry and creates it. Returns the server's representation of the eSIEntry, and an error, if there is any. -func (c *FakeESIEntries) Create(ctx context.Context, eSIEntry *v1alpha1.ESIEntry, opts v1.CreateOptions) (result *v1alpha1.ESIEntry, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(esientriesResource, c.ns, eSIEntry), &v1alpha1.ESIEntry{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.ESIEntry), err -} - -// Update takes the representation of a eSIEntry and updates it. Returns the server's representation of the eSIEntry, and an error, if there is any. -func (c *FakeESIEntries) Update(ctx context.Context, eSIEntry *v1alpha1.ESIEntry, opts v1.UpdateOptions) (result *v1alpha1.ESIEntry, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(esientriesResource, c.ns, eSIEntry), &v1alpha1.ESIEntry{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.ESIEntry), 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 *FakeESIEntries) UpdateStatus(ctx context.Context, eSIEntry *v1alpha1.ESIEntry, opts v1.UpdateOptions) (*v1alpha1.ESIEntry, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(esientriesResource, "status", c.ns, eSIEntry), &v1alpha1.ESIEntry{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.ESIEntry), err -} - -// Delete takes name of the eSIEntry and deletes it. Returns an error if one occurs. -func (c *FakeESIEntries) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(esientriesResource, c.ns, name, opts), &v1alpha1.ESIEntry{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeESIEntries) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(esientriesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.ESIEntryList{}) - return err -} - -// Patch applies the patch and returns the patched eSIEntry. -func (c *FakeESIEntries) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ESIEntry, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(esientriesResource, c.ns, name, pt, data, subresources...), &v1alpha1.ESIEntry{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.ESIEntry), err -} diff --git a/apis/generated/clientset/versioned/typed/esi/v1alpha1/fake/fake_esiindex.go b/apis/generated/clientset/versioned/typed/esi/v1alpha1/fake/fake_esiindex.go deleted file mode 100644 index 3e0befd..0000000 --- a/apis/generated/clientset/versioned/typed/esi/v1alpha1/fake/fake_esiindex.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2024 Nokia. - -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" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/esi/v1alpha1" - v1 "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" -) - -// FakeESIIndexes implements ESIIndexInterface -type FakeESIIndexes struct { - Fake *FakeEsiV1alpha1 - ns string -} - -var esiindexesResource = v1alpha1.SchemeGroupVersion.WithResource("esiindexes") - -var esiindexesKind = v1alpha1.SchemeGroupVersion.WithKind("ESIIndex") - -// Get takes name of the eSIIndex, and returns the corresponding eSIIndex object, and an error if there is any. -func (c *FakeESIIndexes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ESIIndex, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(esiindexesResource, c.ns, name), &v1alpha1.ESIIndex{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.ESIIndex), err -} - -// List takes label and field selectors, and returns the list of ESIIndexes that match those selectors. -func (c *FakeESIIndexes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ESIIndexList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(esiindexesResource, esiindexesKind, c.ns, opts), &v1alpha1.ESIIndexList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.ESIIndexList{ListMeta: obj.(*v1alpha1.ESIIndexList).ListMeta} - for _, item := range obj.(*v1alpha1.ESIIndexList).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 eSIIndexes. -func (c *FakeESIIndexes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(esiindexesResource, c.ns, opts)) - -} - -// Create takes the representation of a eSIIndex and creates it. Returns the server's representation of the eSIIndex, and an error, if there is any. -func (c *FakeESIIndexes) Create(ctx context.Context, eSIIndex *v1alpha1.ESIIndex, opts v1.CreateOptions) (result *v1alpha1.ESIIndex, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(esiindexesResource, c.ns, eSIIndex), &v1alpha1.ESIIndex{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.ESIIndex), err -} - -// Update takes the representation of a eSIIndex and updates it. Returns the server's representation of the eSIIndex, and an error, if there is any. -func (c *FakeESIIndexes) Update(ctx context.Context, eSIIndex *v1alpha1.ESIIndex, opts v1.UpdateOptions) (result *v1alpha1.ESIIndex, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(esiindexesResource, c.ns, eSIIndex), &v1alpha1.ESIIndex{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.ESIIndex), 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 *FakeESIIndexes) UpdateStatus(ctx context.Context, eSIIndex *v1alpha1.ESIIndex, opts v1.UpdateOptions) (*v1alpha1.ESIIndex, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(esiindexesResource, "status", c.ns, eSIIndex), &v1alpha1.ESIIndex{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.ESIIndex), err -} - -// Delete takes name of the eSIIndex and deletes it. Returns an error if one occurs. -func (c *FakeESIIndexes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(esiindexesResource, c.ns, name, opts), &v1alpha1.ESIIndex{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeESIIndexes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(esiindexesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.ESIIndexList{}) - return err -} - -// Patch applies the patch and returns the patched eSIIndex. -func (c *FakeESIIndexes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ESIIndex, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(esiindexesResource, c.ns, name, pt, data, subresources...), &v1alpha1.ESIIndex{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.ESIIndex), err -} diff --git a/apis/generated/clientset/versioned/typed/esi/v1alpha1/generated_expansion.go b/apis/generated/clientset/versioned/typed/esi/v1alpha1/generated_expansion.go deleted file mode 100644 index bb524b0..0000000 --- a/apis/generated/clientset/versioned/typed/esi/v1alpha1/generated_expansion.go +++ /dev/null @@ -1,24 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -type ESIClaimExpansion interface{} - -type ESIEntryExpansion interface{} - -type ESIIndexExpansion interface{} diff --git a/apis/generated/clientset/versioned/typed/extcomm/v1alpha1/doc.go b/apis/generated/clientset/versioned/typed/extcomm/v1alpha1/doc.go deleted file mode 100644 index cda7d5a..0000000 --- a/apis/generated/clientset/versioned/typed/extcomm/v1alpha1/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 diff --git a/apis/generated/clientset/versioned/typed/extcomm/v1alpha1/extcomm_client.go b/apis/generated/clientset/versioned/typed/extcomm/v1alpha1/extcomm_client.go deleted file mode 100644 index 940d1eb..0000000 --- a/apis/generated/clientset/versioned/typed/extcomm/v1alpha1/extcomm_client.go +++ /dev/null @@ -1,116 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "net/http" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" - "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - rest "k8s.io/client-go/rest" -) - -type ExtcommV1alpha1Interface interface { - RESTClient() rest.Interface - EXTCOMMClaimsGetter - EXTCOMMEntriesGetter - EXTCOMMIndexesGetter -} - -// ExtcommV1alpha1Client is used to interact with features provided by the extcomm.be.kuid.dev group. -type ExtcommV1alpha1Client struct { - restClient rest.Interface -} - -func (c *ExtcommV1alpha1Client) EXTCOMMClaims(namespace string) EXTCOMMClaimInterface { - return newEXTCOMMClaims(c, namespace) -} - -func (c *ExtcommV1alpha1Client) EXTCOMMEntries(namespace string) EXTCOMMEntryInterface { - return newEXTCOMMEntries(c, namespace) -} - -func (c *ExtcommV1alpha1Client) EXTCOMMIndexes(namespace string) EXTCOMMIndexInterface { - return newEXTCOMMIndexes(c, namespace) -} - -// NewForConfig creates a new ExtcommV1alpha1Client for the given config. -// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), -// where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*ExtcommV1alpha1Client, 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 ExtcommV1alpha1Client 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) (*ExtcommV1alpha1Client, 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 &ExtcommV1alpha1Client{client}, nil -} - -// NewForConfigOrDie creates a new ExtcommV1alpha1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *ExtcommV1alpha1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new ExtcommV1alpha1Client for the given RESTClient. -func New(c rest.Interface) *ExtcommV1alpha1Client { - return &ExtcommV1alpha1Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v1alpha1.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 *ExtcommV1alpha1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/apis/generated/clientset/versioned/typed/extcomm/v1alpha1/extcommclaim.go b/apis/generated/clientset/versioned/typed/extcomm/v1alpha1/extcommclaim.go deleted file mode 100644 index aa58eef..0000000 --- a/apis/generated/clientset/versioned/typed/extcomm/v1alpha1/extcommclaim.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// EXTCOMMClaimsGetter has a method to return a EXTCOMMClaimInterface. -// A group's client should implement this interface. -type EXTCOMMClaimsGetter interface { - EXTCOMMClaims(namespace string) EXTCOMMClaimInterface -} - -// EXTCOMMClaimInterface has methods to work with EXTCOMMClaim resources. -type EXTCOMMClaimInterface interface { - Create(ctx context.Context, eXTCOMMClaim *v1alpha1.EXTCOMMClaim, opts v1.CreateOptions) (*v1alpha1.EXTCOMMClaim, error) - Update(ctx context.Context, eXTCOMMClaim *v1alpha1.EXTCOMMClaim, opts v1.UpdateOptions) (*v1alpha1.EXTCOMMClaim, error) - UpdateStatus(ctx context.Context, eXTCOMMClaim *v1alpha1.EXTCOMMClaim, opts v1.UpdateOptions) (*v1alpha1.EXTCOMMClaim, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.EXTCOMMClaim, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.EXTCOMMClaimList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.EXTCOMMClaim, err error) - EXTCOMMClaimExpansion -} - -// eXTCOMMClaims implements EXTCOMMClaimInterface -type eXTCOMMClaims struct { - client rest.Interface - ns string -} - -// newEXTCOMMClaims returns a EXTCOMMClaims -func newEXTCOMMClaims(c *ExtcommV1alpha1Client, namespace string) *eXTCOMMClaims { - return &eXTCOMMClaims{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the eXTCOMMClaim, and returns the corresponding eXTCOMMClaim object, and an error if there is any. -func (c *eXTCOMMClaims) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.EXTCOMMClaim, err error) { - result = &v1alpha1.EXTCOMMClaim{} - err = c.client.Get(). - Namespace(c.ns). - Resource("extcommclaims"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of EXTCOMMClaims that match those selectors. -func (c *eXTCOMMClaims) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.EXTCOMMClaimList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.EXTCOMMClaimList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("extcommclaims"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested eXTCOMMClaims. -func (c *eXTCOMMClaims) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("extcommclaims"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a eXTCOMMClaim and creates it. Returns the server's representation of the eXTCOMMClaim, and an error, if there is any. -func (c *eXTCOMMClaims) Create(ctx context.Context, eXTCOMMClaim *v1alpha1.EXTCOMMClaim, opts v1.CreateOptions) (result *v1alpha1.EXTCOMMClaim, err error) { - result = &v1alpha1.EXTCOMMClaim{} - err = c.client.Post(). - Namespace(c.ns). - Resource("extcommclaims"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(eXTCOMMClaim). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a eXTCOMMClaim and updates it. Returns the server's representation of the eXTCOMMClaim, and an error, if there is any. -func (c *eXTCOMMClaims) Update(ctx context.Context, eXTCOMMClaim *v1alpha1.EXTCOMMClaim, opts v1.UpdateOptions) (result *v1alpha1.EXTCOMMClaim, err error) { - result = &v1alpha1.EXTCOMMClaim{} - err = c.client.Put(). - Namespace(c.ns). - Resource("extcommclaims"). - Name(eXTCOMMClaim.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(eXTCOMMClaim). - 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 *eXTCOMMClaims) UpdateStatus(ctx context.Context, eXTCOMMClaim *v1alpha1.EXTCOMMClaim, opts v1.UpdateOptions) (result *v1alpha1.EXTCOMMClaim, err error) { - result = &v1alpha1.EXTCOMMClaim{} - err = c.client.Put(). - Namespace(c.ns). - Resource("extcommclaims"). - Name(eXTCOMMClaim.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(eXTCOMMClaim). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the eXTCOMMClaim and deletes it. Returns an error if one occurs. -func (c *eXTCOMMClaims) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("extcommclaims"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *eXTCOMMClaims) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("extcommclaims"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched eXTCOMMClaim. -func (c *eXTCOMMClaims) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.EXTCOMMClaim, err error) { - result = &v1alpha1.EXTCOMMClaim{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("extcommclaims"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/extcomm/v1alpha1/extcommentry.go b/apis/generated/clientset/versioned/typed/extcomm/v1alpha1/extcommentry.go deleted file mode 100644 index 3e28a36..0000000 --- a/apis/generated/clientset/versioned/typed/extcomm/v1alpha1/extcommentry.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// EXTCOMMEntriesGetter has a method to return a EXTCOMMEntryInterface. -// A group's client should implement this interface. -type EXTCOMMEntriesGetter interface { - EXTCOMMEntries(namespace string) EXTCOMMEntryInterface -} - -// EXTCOMMEntryInterface has methods to work with EXTCOMMEntry resources. -type EXTCOMMEntryInterface interface { - Create(ctx context.Context, eXTCOMMEntry *v1alpha1.EXTCOMMEntry, opts v1.CreateOptions) (*v1alpha1.EXTCOMMEntry, error) - Update(ctx context.Context, eXTCOMMEntry *v1alpha1.EXTCOMMEntry, opts v1.UpdateOptions) (*v1alpha1.EXTCOMMEntry, error) - UpdateStatus(ctx context.Context, eXTCOMMEntry *v1alpha1.EXTCOMMEntry, opts v1.UpdateOptions) (*v1alpha1.EXTCOMMEntry, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.EXTCOMMEntry, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.EXTCOMMEntryList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.EXTCOMMEntry, err error) - EXTCOMMEntryExpansion -} - -// eXTCOMMEntries implements EXTCOMMEntryInterface -type eXTCOMMEntries struct { - client rest.Interface - ns string -} - -// newEXTCOMMEntries returns a EXTCOMMEntries -func newEXTCOMMEntries(c *ExtcommV1alpha1Client, namespace string) *eXTCOMMEntries { - return &eXTCOMMEntries{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the eXTCOMMEntry, and returns the corresponding eXTCOMMEntry object, and an error if there is any. -func (c *eXTCOMMEntries) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.EXTCOMMEntry, err error) { - result = &v1alpha1.EXTCOMMEntry{} - err = c.client.Get(). - Namespace(c.ns). - Resource("extcommentries"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of EXTCOMMEntries that match those selectors. -func (c *eXTCOMMEntries) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.EXTCOMMEntryList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.EXTCOMMEntryList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("extcommentries"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested eXTCOMMEntries. -func (c *eXTCOMMEntries) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("extcommentries"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a eXTCOMMEntry and creates it. Returns the server's representation of the eXTCOMMEntry, and an error, if there is any. -func (c *eXTCOMMEntries) Create(ctx context.Context, eXTCOMMEntry *v1alpha1.EXTCOMMEntry, opts v1.CreateOptions) (result *v1alpha1.EXTCOMMEntry, err error) { - result = &v1alpha1.EXTCOMMEntry{} - err = c.client.Post(). - Namespace(c.ns). - Resource("extcommentries"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(eXTCOMMEntry). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a eXTCOMMEntry and updates it. Returns the server's representation of the eXTCOMMEntry, and an error, if there is any. -func (c *eXTCOMMEntries) Update(ctx context.Context, eXTCOMMEntry *v1alpha1.EXTCOMMEntry, opts v1.UpdateOptions) (result *v1alpha1.EXTCOMMEntry, err error) { - result = &v1alpha1.EXTCOMMEntry{} - err = c.client.Put(). - Namespace(c.ns). - Resource("extcommentries"). - Name(eXTCOMMEntry.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(eXTCOMMEntry). - 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 *eXTCOMMEntries) UpdateStatus(ctx context.Context, eXTCOMMEntry *v1alpha1.EXTCOMMEntry, opts v1.UpdateOptions) (result *v1alpha1.EXTCOMMEntry, err error) { - result = &v1alpha1.EXTCOMMEntry{} - err = c.client.Put(). - Namespace(c.ns). - Resource("extcommentries"). - Name(eXTCOMMEntry.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(eXTCOMMEntry). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the eXTCOMMEntry and deletes it. Returns an error if one occurs. -func (c *eXTCOMMEntries) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("extcommentries"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *eXTCOMMEntries) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("extcommentries"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched eXTCOMMEntry. -func (c *eXTCOMMEntries) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.EXTCOMMEntry, err error) { - result = &v1alpha1.EXTCOMMEntry{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("extcommentries"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/extcomm/v1alpha1/extcommindex.go b/apis/generated/clientset/versioned/typed/extcomm/v1alpha1/extcommindex.go deleted file mode 100644 index 0ef3664..0000000 --- a/apis/generated/clientset/versioned/typed/extcomm/v1alpha1/extcommindex.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// EXTCOMMIndexesGetter has a method to return a EXTCOMMIndexInterface. -// A group's client should implement this interface. -type EXTCOMMIndexesGetter interface { - EXTCOMMIndexes(namespace string) EXTCOMMIndexInterface -} - -// EXTCOMMIndexInterface has methods to work with EXTCOMMIndex resources. -type EXTCOMMIndexInterface interface { - Create(ctx context.Context, eXTCOMMIndex *v1alpha1.EXTCOMMIndex, opts v1.CreateOptions) (*v1alpha1.EXTCOMMIndex, error) - Update(ctx context.Context, eXTCOMMIndex *v1alpha1.EXTCOMMIndex, opts v1.UpdateOptions) (*v1alpha1.EXTCOMMIndex, error) - UpdateStatus(ctx context.Context, eXTCOMMIndex *v1alpha1.EXTCOMMIndex, opts v1.UpdateOptions) (*v1alpha1.EXTCOMMIndex, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.EXTCOMMIndex, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.EXTCOMMIndexList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.EXTCOMMIndex, err error) - EXTCOMMIndexExpansion -} - -// eXTCOMMIndexes implements EXTCOMMIndexInterface -type eXTCOMMIndexes struct { - client rest.Interface - ns string -} - -// newEXTCOMMIndexes returns a EXTCOMMIndexes -func newEXTCOMMIndexes(c *ExtcommV1alpha1Client, namespace string) *eXTCOMMIndexes { - return &eXTCOMMIndexes{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the eXTCOMMIndex, and returns the corresponding eXTCOMMIndex object, and an error if there is any. -func (c *eXTCOMMIndexes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.EXTCOMMIndex, err error) { - result = &v1alpha1.EXTCOMMIndex{} - err = c.client.Get(). - Namespace(c.ns). - Resource("extcommindexes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of EXTCOMMIndexes that match those selectors. -func (c *eXTCOMMIndexes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.EXTCOMMIndexList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.EXTCOMMIndexList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("extcommindexes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested eXTCOMMIndexes. -func (c *eXTCOMMIndexes) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("extcommindexes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a eXTCOMMIndex and creates it. Returns the server's representation of the eXTCOMMIndex, and an error, if there is any. -func (c *eXTCOMMIndexes) Create(ctx context.Context, eXTCOMMIndex *v1alpha1.EXTCOMMIndex, opts v1.CreateOptions) (result *v1alpha1.EXTCOMMIndex, err error) { - result = &v1alpha1.EXTCOMMIndex{} - err = c.client.Post(). - Namespace(c.ns). - Resource("extcommindexes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(eXTCOMMIndex). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a eXTCOMMIndex and updates it. Returns the server's representation of the eXTCOMMIndex, and an error, if there is any. -func (c *eXTCOMMIndexes) Update(ctx context.Context, eXTCOMMIndex *v1alpha1.EXTCOMMIndex, opts v1.UpdateOptions) (result *v1alpha1.EXTCOMMIndex, err error) { - result = &v1alpha1.EXTCOMMIndex{} - err = c.client.Put(). - Namespace(c.ns). - Resource("extcommindexes"). - Name(eXTCOMMIndex.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(eXTCOMMIndex). - 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 *eXTCOMMIndexes) UpdateStatus(ctx context.Context, eXTCOMMIndex *v1alpha1.EXTCOMMIndex, opts v1.UpdateOptions) (result *v1alpha1.EXTCOMMIndex, err error) { - result = &v1alpha1.EXTCOMMIndex{} - err = c.client.Put(). - Namespace(c.ns). - Resource("extcommindexes"). - Name(eXTCOMMIndex.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(eXTCOMMIndex). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the eXTCOMMIndex and deletes it. Returns an error if one occurs. -func (c *eXTCOMMIndexes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("extcommindexes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *eXTCOMMIndexes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("extcommindexes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched eXTCOMMIndex. -func (c *eXTCOMMIndexes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.EXTCOMMIndex, err error) { - result = &v1alpha1.EXTCOMMIndex{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("extcommindexes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/doc.go b/apis/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/doc.go deleted file mode 100644 index d4601f1..0000000 --- a/apis/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Copyright 2024 Nokia. - -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/apis/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/fake_extcomm_client.go b/apis/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/fake_extcomm_client.go deleted file mode 100644 index d5f1374..0000000 --- a/apis/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/fake_extcomm_client.go +++ /dev/null @@ -1,47 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 ( - v1alpha1 "github.com/kuidio/kuid/apis/generated/clientset/versioned/typed/extcomm/v1alpha1" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakeExtcommV1alpha1 struct { - *testing.Fake -} - -func (c *FakeExtcommV1alpha1) EXTCOMMClaims(namespace string) v1alpha1.EXTCOMMClaimInterface { - return &FakeEXTCOMMClaims{c, namespace} -} - -func (c *FakeExtcommV1alpha1) EXTCOMMEntries(namespace string) v1alpha1.EXTCOMMEntryInterface { - return &FakeEXTCOMMEntries{c, namespace} -} - -func (c *FakeExtcommV1alpha1) EXTCOMMIndexes(namespace string) v1alpha1.EXTCOMMIndexInterface { - return &FakeEXTCOMMIndexes{c, namespace} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeExtcommV1alpha1) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/apis/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/fake_extcommclaim.go b/apis/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/fake_extcommclaim.go deleted file mode 100644 index d225e01..0000000 --- a/apis/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/fake_extcommclaim.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2024 Nokia. - -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" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" - v1 "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" -) - -// FakeEXTCOMMClaims implements EXTCOMMClaimInterface -type FakeEXTCOMMClaims struct { - Fake *FakeExtcommV1alpha1 - ns string -} - -var extcommclaimsResource = v1alpha1.SchemeGroupVersion.WithResource("extcommclaims") - -var extcommclaimsKind = v1alpha1.SchemeGroupVersion.WithKind("EXTCOMMClaim") - -// Get takes name of the eXTCOMMClaim, and returns the corresponding eXTCOMMClaim object, and an error if there is any. -func (c *FakeEXTCOMMClaims) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.EXTCOMMClaim, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(extcommclaimsResource, c.ns, name), &v1alpha1.EXTCOMMClaim{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.EXTCOMMClaim), err -} - -// List takes label and field selectors, and returns the list of EXTCOMMClaims that match those selectors. -func (c *FakeEXTCOMMClaims) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.EXTCOMMClaimList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(extcommclaimsResource, extcommclaimsKind, c.ns, opts), &v1alpha1.EXTCOMMClaimList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.EXTCOMMClaimList{ListMeta: obj.(*v1alpha1.EXTCOMMClaimList).ListMeta} - for _, item := range obj.(*v1alpha1.EXTCOMMClaimList).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 eXTCOMMClaims. -func (c *FakeEXTCOMMClaims) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(extcommclaimsResource, c.ns, opts)) - -} - -// Create takes the representation of a eXTCOMMClaim and creates it. Returns the server's representation of the eXTCOMMClaim, and an error, if there is any. -func (c *FakeEXTCOMMClaims) Create(ctx context.Context, eXTCOMMClaim *v1alpha1.EXTCOMMClaim, opts v1.CreateOptions) (result *v1alpha1.EXTCOMMClaim, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(extcommclaimsResource, c.ns, eXTCOMMClaim), &v1alpha1.EXTCOMMClaim{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.EXTCOMMClaim), err -} - -// Update takes the representation of a eXTCOMMClaim and updates it. Returns the server's representation of the eXTCOMMClaim, and an error, if there is any. -func (c *FakeEXTCOMMClaims) Update(ctx context.Context, eXTCOMMClaim *v1alpha1.EXTCOMMClaim, opts v1.UpdateOptions) (result *v1alpha1.EXTCOMMClaim, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(extcommclaimsResource, c.ns, eXTCOMMClaim), &v1alpha1.EXTCOMMClaim{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.EXTCOMMClaim), 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 *FakeEXTCOMMClaims) UpdateStatus(ctx context.Context, eXTCOMMClaim *v1alpha1.EXTCOMMClaim, opts v1.UpdateOptions) (*v1alpha1.EXTCOMMClaim, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(extcommclaimsResource, "status", c.ns, eXTCOMMClaim), &v1alpha1.EXTCOMMClaim{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.EXTCOMMClaim), err -} - -// Delete takes name of the eXTCOMMClaim and deletes it. Returns an error if one occurs. -func (c *FakeEXTCOMMClaims) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(extcommclaimsResource, c.ns, name, opts), &v1alpha1.EXTCOMMClaim{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeEXTCOMMClaims) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(extcommclaimsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.EXTCOMMClaimList{}) - return err -} - -// Patch applies the patch and returns the patched eXTCOMMClaim. -func (c *FakeEXTCOMMClaims) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.EXTCOMMClaim, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(extcommclaimsResource, c.ns, name, pt, data, subresources...), &v1alpha1.EXTCOMMClaim{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.EXTCOMMClaim), err -} diff --git a/apis/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/fake_extcommentry.go b/apis/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/fake_extcommentry.go deleted file mode 100644 index 3bcfcef..0000000 --- a/apis/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/fake_extcommentry.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2024 Nokia. - -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" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" - v1 "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" -) - -// FakeEXTCOMMEntries implements EXTCOMMEntryInterface -type FakeEXTCOMMEntries struct { - Fake *FakeExtcommV1alpha1 - ns string -} - -var extcommentriesResource = v1alpha1.SchemeGroupVersion.WithResource("extcommentries") - -var extcommentriesKind = v1alpha1.SchemeGroupVersion.WithKind("EXTCOMMEntry") - -// Get takes name of the eXTCOMMEntry, and returns the corresponding eXTCOMMEntry object, and an error if there is any. -func (c *FakeEXTCOMMEntries) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.EXTCOMMEntry, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(extcommentriesResource, c.ns, name), &v1alpha1.EXTCOMMEntry{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.EXTCOMMEntry), err -} - -// List takes label and field selectors, and returns the list of EXTCOMMEntries that match those selectors. -func (c *FakeEXTCOMMEntries) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.EXTCOMMEntryList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(extcommentriesResource, extcommentriesKind, c.ns, opts), &v1alpha1.EXTCOMMEntryList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.EXTCOMMEntryList{ListMeta: obj.(*v1alpha1.EXTCOMMEntryList).ListMeta} - for _, item := range obj.(*v1alpha1.EXTCOMMEntryList).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 eXTCOMMEntries. -func (c *FakeEXTCOMMEntries) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(extcommentriesResource, c.ns, opts)) - -} - -// Create takes the representation of a eXTCOMMEntry and creates it. Returns the server's representation of the eXTCOMMEntry, and an error, if there is any. -func (c *FakeEXTCOMMEntries) Create(ctx context.Context, eXTCOMMEntry *v1alpha1.EXTCOMMEntry, opts v1.CreateOptions) (result *v1alpha1.EXTCOMMEntry, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(extcommentriesResource, c.ns, eXTCOMMEntry), &v1alpha1.EXTCOMMEntry{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.EXTCOMMEntry), err -} - -// Update takes the representation of a eXTCOMMEntry and updates it. Returns the server's representation of the eXTCOMMEntry, and an error, if there is any. -func (c *FakeEXTCOMMEntries) Update(ctx context.Context, eXTCOMMEntry *v1alpha1.EXTCOMMEntry, opts v1.UpdateOptions) (result *v1alpha1.EXTCOMMEntry, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(extcommentriesResource, c.ns, eXTCOMMEntry), &v1alpha1.EXTCOMMEntry{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.EXTCOMMEntry), 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 *FakeEXTCOMMEntries) UpdateStatus(ctx context.Context, eXTCOMMEntry *v1alpha1.EXTCOMMEntry, opts v1.UpdateOptions) (*v1alpha1.EXTCOMMEntry, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(extcommentriesResource, "status", c.ns, eXTCOMMEntry), &v1alpha1.EXTCOMMEntry{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.EXTCOMMEntry), err -} - -// Delete takes name of the eXTCOMMEntry and deletes it. Returns an error if one occurs. -func (c *FakeEXTCOMMEntries) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(extcommentriesResource, c.ns, name, opts), &v1alpha1.EXTCOMMEntry{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeEXTCOMMEntries) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(extcommentriesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.EXTCOMMEntryList{}) - return err -} - -// Patch applies the patch and returns the patched eXTCOMMEntry. -func (c *FakeEXTCOMMEntries) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.EXTCOMMEntry, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(extcommentriesResource, c.ns, name, pt, data, subresources...), &v1alpha1.EXTCOMMEntry{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.EXTCOMMEntry), err -} diff --git a/apis/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/fake_extcommindex.go b/apis/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/fake_extcommindex.go deleted file mode 100644 index 0c3b05f..0000000 --- a/apis/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/fake_extcommindex.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2024 Nokia. - -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" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" - v1 "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" -) - -// FakeEXTCOMMIndexes implements EXTCOMMIndexInterface -type FakeEXTCOMMIndexes struct { - Fake *FakeExtcommV1alpha1 - ns string -} - -var extcommindexesResource = v1alpha1.SchemeGroupVersion.WithResource("extcommindexes") - -var extcommindexesKind = v1alpha1.SchemeGroupVersion.WithKind("EXTCOMMIndex") - -// Get takes name of the eXTCOMMIndex, and returns the corresponding eXTCOMMIndex object, and an error if there is any. -func (c *FakeEXTCOMMIndexes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.EXTCOMMIndex, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(extcommindexesResource, c.ns, name), &v1alpha1.EXTCOMMIndex{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.EXTCOMMIndex), err -} - -// List takes label and field selectors, and returns the list of EXTCOMMIndexes that match those selectors. -func (c *FakeEXTCOMMIndexes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.EXTCOMMIndexList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(extcommindexesResource, extcommindexesKind, c.ns, opts), &v1alpha1.EXTCOMMIndexList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.EXTCOMMIndexList{ListMeta: obj.(*v1alpha1.EXTCOMMIndexList).ListMeta} - for _, item := range obj.(*v1alpha1.EXTCOMMIndexList).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 eXTCOMMIndexes. -func (c *FakeEXTCOMMIndexes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(extcommindexesResource, c.ns, opts)) - -} - -// Create takes the representation of a eXTCOMMIndex and creates it. Returns the server's representation of the eXTCOMMIndex, and an error, if there is any. -func (c *FakeEXTCOMMIndexes) Create(ctx context.Context, eXTCOMMIndex *v1alpha1.EXTCOMMIndex, opts v1.CreateOptions) (result *v1alpha1.EXTCOMMIndex, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(extcommindexesResource, c.ns, eXTCOMMIndex), &v1alpha1.EXTCOMMIndex{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.EXTCOMMIndex), err -} - -// Update takes the representation of a eXTCOMMIndex and updates it. Returns the server's representation of the eXTCOMMIndex, and an error, if there is any. -func (c *FakeEXTCOMMIndexes) Update(ctx context.Context, eXTCOMMIndex *v1alpha1.EXTCOMMIndex, opts v1.UpdateOptions) (result *v1alpha1.EXTCOMMIndex, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(extcommindexesResource, c.ns, eXTCOMMIndex), &v1alpha1.EXTCOMMIndex{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.EXTCOMMIndex), 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 *FakeEXTCOMMIndexes) UpdateStatus(ctx context.Context, eXTCOMMIndex *v1alpha1.EXTCOMMIndex, opts v1.UpdateOptions) (*v1alpha1.EXTCOMMIndex, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(extcommindexesResource, "status", c.ns, eXTCOMMIndex), &v1alpha1.EXTCOMMIndex{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.EXTCOMMIndex), err -} - -// Delete takes name of the eXTCOMMIndex and deletes it. Returns an error if one occurs. -func (c *FakeEXTCOMMIndexes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(extcommindexesResource, c.ns, name, opts), &v1alpha1.EXTCOMMIndex{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeEXTCOMMIndexes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(extcommindexesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.EXTCOMMIndexList{}) - return err -} - -// Patch applies the patch and returns the patched eXTCOMMIndex. -func (c *FakeEXTCOMMIndexes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.EXTCOMMIndex, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(extcommindexesResource, c.ns, name, pt, data, subresources...), &v1alpha1.EXTCOMMIndex{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.EXTCOMMIndex), err -} diff --git a/apis/generated/clientset/versioned/typed/genid/v1alpha1/doc.go b/apis/generated/clientset/versioned/typed/genid/v1alpha1/doc.go deleted file mode 100644 index cda7d5a..0000000 --- a/apis/generated/clientset/versioned/typed/genid/v1alpha1/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 diff --git a/apis/generated/clientset/versioned/typed/genid/v1alpha1/fake/doc.go b/apis/generated/clientset/versioned/typed/genid/v1alpha1/fake/doc.go deleted file mode 100644 index d4601f1..0000000 --- a/apis/generated/clientset/versioned/typed/genid/v1alpha1/fake/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Copyright 2024 Nokia. - -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/apis/generated/clientset/versioned/typed/genid/v1alpha1/fake/fake_genid_client.go b/apis/generated/clientset/versioned/typed/genid/v1alpha1/fake/fake_genid_client.go deleted file mode 100644 index d9265a1..0000000 --- a/apis/generated/clientset/versioned/typed/genid/v1alpha1/fake/fake_genid_client.go +++ /dev/null @@ -1,47 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 ( - v1alpha1 "github.com/kuidio/kuid/apis/generated/clientset/versioned/typed/genid/v1alpha1" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakeGenidV1alpha1 struct { - *testing.Fake -} - -func (c *FakeGenidV1alpha1) GENIDClaims(namespace string) v1alpha1.GENIDClaimInterface { - return &FakeGENIDClaims{c, namespace} -} - -func (c *FakeGenidV1alpha1) GENIDEntries(namespace string) v1alpha1.GENIDEntryInterface { - return &FakeGENIDEntries{c, namespace} -} - -func (c *FakeGenidV1alpha1) GENIDIndexes(namespace string) v1alpha1.GENIDIndexInterface { - return &FakeGENIDIndexes{c, namespace} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeGenidV1alpha1) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/apis/generated/clientset/versioned/typed/genid/v1alpha1/fake/fake_genidclaim.go b/apis/generated/clientset/versioned/typed/genid/v1alpha1/fake/fake_genidclaim.go deleted file mode 100644 index ef3a410..0000000 --- a/apis/generated/clientset/versioned/typed/genid/v1alpha1/fake/fake_genidclaim.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2024 Nokia. - -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" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/genid/v1alpha1" - v1 "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" -) - -// FakeGENIDClaims implements GENIDClaimInterface -type FakeGENIDClaims struct { - Fake *FakeGenidV1alpha1 - ns string -} - -var genidclaimsResource = v1alpha1.SchemeGroupVersion.WithResource("genidclaims") - -var genidclaimsKind = v1alpha1.SchemeGroupVersion.WithKind("GENIDClaim") - -// Get takes name of the gENIDClaim, and returns the corresponding gENIDClaim object, and an error if there is any. -func (c *FakeGENIDClaims) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.GENIDClaim, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(genidclaimsResource, c.ns, name), &v1alpha1.GENIDClaim{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.GENIDClaim), err -} - -// List takes label and field selectors, and returns the list of GENIDClaims that match those selectors. -func (c *FakeGENIDClaims) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.GENIDClaimList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(genidclaimsResource, genidclaimsKind, c.ns, opts), &v1alpha1.GENIDClaimList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.GENIDClaimList{ListMeta: obj.(*v1alpha1.GENIDClaimList).ListMeta} - for _, item := range obj.(*v1alpha1.GENIDClaimList).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 gENIDClaims. -func (c *FakeGENIDClaims) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(genidclaimsResource, c.ns, opts)) - -} - -// Create takes the representation of a gENIDClaim and creates it. Returns the server's representation of the gENIDClaim, and an error, if there is any. -func (c *FakeGENIDClaims) Create(ctx context.Context, gENIDClaim *v1alpha1.GENIDClaim, opts v1.CreateOptions) (result *v1alpha1.GENIDClaim, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(genidclaimsResource, c.ns, gENIDClaim), &v1alpha1.GENIDClaim{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.GENIDClaim), err -} - -// Update takes the representation of a gENIDClaim and updates it. Returns the server's representation of the gENIDClaim, and an error, if there is any. -func (c *FakeGENIDClaims) Update(ctx context.Context, gENIDClaim *v1alpha1.GENIDClaim, opts v1.UpdateOptions) (result *v1alpha1.GENIDClaim, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(genidclaimsResource, c.ns, gENIDClaim), &v1alpha1.GENIDClaim{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.GENIDClaim), 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 *FakeGENIDClaims) UpdateStatus(ctx context.Context, gENIDClaim *v1alpha1.GENIDClaim, opts v1.UpdateOptions) (*v1alpha1.GENIDClaim, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(genidclaimsResource, "status", c.ns, gENIDClaim), &v1alpha1.GENIDClaim{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.GENIDClaim), err -} - -// Delete takes name of the gENIDClaim and deletes it. Returns an error if one occurs. -func (c *FakeGENIDClaims) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(genidclaimsResource, c.ns, name, opts), &v1alpha1.GENIDClaim{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeGENIDClaims) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(genidclaimsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.GENIDClaimList{}) - return err -} - -// Patch applies the patch and returns the patched gENIDClaim. -func (c *FakeGENIDClaims) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.GENIDClaim, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(genidclaimsResource, c.ns, name, pt, data, subresources...), &v1alpha1.GENIDClaim{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.GENIDClaim), err -} diff --git a/apis/generated/clientset/versioned/typed/genid/v1alpha1/fake/fake_genidentry.go b/apis/generated/clientset/versioned/typed/genid/v1alpha1/fake/fake_genidentry.go deleted file mode 100644 index bc0f976..0000000 --- a/apis/generated/clientset/versioned/typed/genid/v1alpha1/fake/fake_genidentry.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2024 Nokia. - -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" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/genid/v1alpha1" - v1 "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" -) - -// FakeGENIDEntries implements GENIDEntryInterface -type FakeGENIDEntries struct { - Fake *FakeGenidV1alpha1 - ns string -} - -var genidentriesResource = v1alpha1.SchemeGroupVersion.WithResource("genidentries") - -var genidentriesKind = v1alpha1.SchemeGroupVersion.WithKind("GENIDEntry") - -// Get takes name of the gENIDEntry, and returns the corresponding gENIDEntry object, and an error if there is any. -func (c *FakeGENIDEntries) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.GENIDEntry, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(genidentriesResource, c.ns, name), &v1alpha1.GENIDEntry{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.GENIDEntry), err -} - -// List takes label and field selectors, and returns the list of GENIDEntries that match those selectors. -func (c *FakeGENIDEntries) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.GENIDEntryList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(genidentriesResource, genidentriesKind, c.ns, opts), &v1alpha1.GENIDEntryList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.GENIDEntryList{ListMeta: obj.(*v1alpha1.GENIDEntryList).ListMeta} - for _, item := range obj.(*v1alpha1.GENIDEntryList).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 gENIDEntries. -func (c *FakeGENIDEntries) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(genidentriesResource, c.ns, opts)) - -} - -// Create takes the representation of a gENIDEntry and creates it. Returns the server's representation of the gENIDEntry, and an error, if there is any. -func (c *FakeGENIDEntries) Create(ctx context.Context, gENIDEntry *v1alpha1.GENIDEntry, opts v1.CreateOptions) (result *v1alpha1.GENIDEntry, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(genidentriesResource, c.ns, gENIDEntry), &v1alpha1.GENIDEntry{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.GENIDEntry), err -} - -// Update takes the representation of a gENIDEntry and updates it. Returns the server's representation of the gENIDEntry, and an error, if there is any. -func (c *FakeGENIDEntries) Update(ctx context.Context, gENIDEntry *v1alpha1.GENIDEntry, opts v1.UpdateOptions) (result *v1alpha1.GENIDEntry, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(genidentriesResource, c.ns, gENIDEntry), &v1alpha1.GENIDEntry{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.GENIDEntry), 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 *FakeGENIDEntries) UpdateStatus(ctx context.Context, gENIDEntry *v1alpha1.GENIDEntry, opts v1.UpdateOptions) (*v1alpha1.GENIDEntry, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(genidentriesResource, "status", c.ns, gENIDEntry), &v1alpha1.GENIDEntry{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.GENIDEntry), err -} - -// Delete takes name of the gENIDEntry and deletes it. Returns an error if one occurs. -func (c *FakeGENIDEntries) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(genidentriesResource, c.ns, name, opts), &v1alpha1.GENIDEntry{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeGENIDEntries) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(genidentriesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.GENIDEntryList{}) - return err -} - -// Patch applies the patch and returns the patched gENIDEntry. -func (c *FakeGENIDEntries) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.GENIDEntry, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(genidentriesResource, c.ns, name, pt, data, subresources...), &v1alpha1.GENIDEntry{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.GENIDEntry), err -} diff --git a/apis/generated/clientset/versioned/typed/genid/v1alpha1/fake/fake_genidindex.go b/apis/generated/clientset/versioned/typed/genid/v1alpha1/fake/fake_genidindex.go deleted file mode 100644 index 411bcc3..0000000 --- a/apis/generated/clientset/versioned/typed/genid/v1alpha1/fake/fake_genidindex.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2024 Nokia. - -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" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/genid/v1alpha1" - v1 "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" -) - -// FakeGENIDIndexes implements GENIDIndexInterface -type FakeGENIDIndexes struct { - Fake *FakeGenidV1alpha1 - ns string -} - -var genidindexesResource = v1alpha1.SchemeGroupVersion.WithResource("genidindexes") - -var genidindexesKind = v1alpha1.SchemeGroupVersion.WithKind("GENIDIndex") - -// Get takes name of the gENIDIndex, and returns the corresponding gENIDIndex object, and an error if there is any. -func (c *FakeGENIDIndexes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.GENIDIndex, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(genidindexesResource, c.ns, name), &v1alpha1.GENIDIndex{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.GENIDIndex), err -} - -// List takes label and field selectors, and returns the list of GENIDIndexes that match those selectors. -func (c *FakeGENIDIndexes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.GENIDIndexList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(genidindexesResource, genidindexesKind, c.ns, opts), &v1alpha1.GENIDIndexList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.GENIDIndexList{ListMeta: obj.(*v1alpha1.GENIDIndexList).ListMeta} - for _, item := range obj.(*v1alpha1.GENIDIndexList).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 gENIDIndexes. -func (c *FakeGENIDIndexes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(genidindexesResource, c.ns, opts)) - -} - -// Create takes the representation of a gENIDIndex and creates it. Returns the server's representation of the gENIDIndex, and an error, if there is any. -func (c *FakeGENIDIndexes) Create(ctx context.Context, gENIDIndex *v1alpha1.GENIDIndex, opts v1.CreateOptions) (result *v1alpha1.GENIDIndex, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(genidindexesResource, c.ns, gENIDIndex), &v1alpha1.GENIDIndex{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.GENIDIndex), err -} - -// Update takes the representation of a gENIDIndex and updates it. Returns the server's representation of the gENIDIndex, and an error, if there is any. -func (c *FakeGENIDIndexes) Update(ctx context.Context, gENIDIndex *v1alpha1.GENIDIndex, opts v1.UpdateOptions) (result *v1alpha1.GENIDIndex, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(genidindexesResource, c.ns, gENIDIndex), &v1alpha1.GENIDIndex{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.GENIDIndex), 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 *FakeGENIDIndexes) UpdateStatus(ctx context.Context, gENIDIndex *v1alpha1.GENIDIndex, opts v1.UpdateOptions) (*v1alpha1.GENIDIndex, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(genidindexesResource, "status", c.ns, gENIDIndex), &v1alpha1.GENIDIndex{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.GENIDIndex), err -} - -// Delete takes name of the gENIDIndex and deletes it. Returns an error if one occurs. -func (c *FakeGENIDIndexes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(genidindexesResource, c.ns, name, opts), &v1alpha1.GENIDIndex{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeGENIDIndexes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(genidindexesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.GENIDIndexList{}) - return err -} - -// Patch applies the patch and returns the patched gENIDIndex. -func (c *FakeGENIDIndexes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.GENIDIndex, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(genidindexesResource, c.ns, name, pt, data, subresources...), &v1alpha1.GENIDIndex{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.GENIDIndex), err -} diff --git a/apis/generated/clientset/versioned/typed/genid/v1alpha1/generated_expansion.go b/apis/generated/clientset/versioned/typed/genid/v1alpha1/generated_expansion.go deleted file mode 100644 index 5a2bdd4..0000000 --- a/apis/generated/clientset/versioned/typed/genid/v1alpha1/generated_expansion.go +++ /dev/null @@ -1,24 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -type GENIDClaimExpansion interface{} - -type GENIDEntryExpansion interface{} - -type GENIDIndexExpansion interface{} diff --git a/apis/generated/clientset/versioned/typed/genid/v1alpha1/genid_client.go b/apis/generated/clientset/versioned/typed/genid/v1alpha1/genid_client.go deleted file mode 100644 index fbc8f4d..0000000 --- a/apis/generated/clientset/versioned/typed/genid/v1alpha1/genid_client.go +++ /dev/null @@ -1,116 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "net/http" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/genid/v1alpha1" - "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - rest "k8s.io/client-go/rest" -) - -type GenidV1alpha1Interface interface { - RESTClient() rest.Interface - GENIDClaimsGetter - GENIDEntriesGetter - GENIDIndexesGetter -} - -// GenidV1alpha1Client is used to interact with features provided by the genid.be.kuid.dev group. -type GenidV1alpha1Client struct { - restClient rest.Interface -} - -func (c *GenidV1alpha1Client) GENIDClaims(namespace string) GENIDClaimInterface { - return newGENIDClaims(c, namespace) -} - -func (c *GenidV1alpha1Client) GENIDEntries(namespace string) GENIDEntryInterface { - return newGENIDEntries(c, namespace) -} - -func (c *GenidV1alpha1Client) GENIDIndexes(namespace string) GENIDIndexInterface { - return newGENIDIndexes(c, namespace) -} - -// NewForConfig creates a new GenidV1alpha1Client for the given config. -// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), -// where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*GenidV1alpha1Client, 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 GenidV1alpha1Client 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) (*GenidV1alpha1Client, 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 &GenidV1alpha1Client{client}, nil -} - -// NewForConfigOrDie creates a new GenidV1alpha1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *GenidV1alpha1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new GenidV1alpha1Client for the given RESTClient. -func New(c rest.Interface) *GenidV1alpha1Client { - return &GenidV1alpha1Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v1alpha1.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 *GenidV1alpha1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/apis/generated/clientset/versioned/typed/genid/v1alpha1/genidclaim.go b/apis/generated/clientset/versioned/typed/genid/v1alpha1/genidclaim.go deleted file mode 100644 index 519ea07..0000000 --- a/apis/generated/clientset/versioned/typed/genid/v1alpha1/genidclaim.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/genid/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// GENIDClaimsGetter has a method to return a GENIDClaimInterface. -// A group's client should implement this interface. -type GENIDClaimsGetter interface { - GENIDClaims(namespace string) GENIDClaimInterface -} - -// GENIDClaimInterface has methods to work with GENIDClaim resources. -type GENIDClaimInterface interface { - Create(ctx context.Context, gENIDClaim *v1alpha1.GENIDClaim, opts v1.CreateOptions) (*v1alpha1.GENIDClaim, error) - Update(ctx context.Context, gENIDClaim *v1alpha1.GENIDClaim, opts v1.UpdateOptions) (*v1alpha1.GENIDClaim, error) - UpdateStatus(ctx context.Context, gENIDClaim *v1alpha1.GENIDClaim, opts v1.UpdateOptions) (*v1alpha1.GENIDClaim, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.GENIDClaim, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.GENIDClaimList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.GENIDClaim, err error) - GENIDClaimExpansion -} - -// gENIDClaims implements GENIDClaimInterface -type gENIDClaims struct { - client rest.Interface - ns string -} - -// newGENIDClaims returns a GENIDClaims -func newGENIDClaims(c *GenidV1alpha1Client, namespace string) *gENIDClaims { - return &gENIDClaims{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the gENIDClaim, and returns the corresponding gENIDClaim object, and an error if there is any. -func (c *gENIDClaims) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.GENIDClaim, err error) { - result = &v1alpha1.GENIDClaim{} - err = c.client.Get(). - Namespace(c.ns). - Resource("genidclaims"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of GENIDClaims that match those selectors. -func (c *gENIDClaims) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.GENIDClaimList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.GENIDClaimList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("genidclaims"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested gENIDClaims. -func (c *gENIDClaims) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("genidclaims"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a gENIDClaim and creates it. Returns the server's representation of the gENIDClaim, and an error, if there is any. -func (c *gENIDClaims) Create(ctx context.Context, gENIDClaim *v1alpha1.GENIDClaim, opts v1.CreateOptions) (result *v1alpha1.GENIDClaim, err error) { - result = &v1alpha1.GENIDClaim{} - err = c.client.Post(). - Namespace(c.ns). - Resource("genidclaims"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(gENIDClaim). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a gENIDClaim and updates it. Returns the server's representation of the gENIDClaim, and an error, if there is any. -func (c *gENIDClaims) Update(ctx context.Context, gENIDClaim *v1alpha1.GENIDClaim, opts v1.UpdateOptions) (result *v1alpha1.GENIDClaim, err error) { - result = &v1alpha1.GENIDClaim{} - err = c.client.Put(). - Namespace(c.ns). - Resource("genidclaims"). - Name(gENIDClaim.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(gENIDClaim). - 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 *gENIDClaims) UpdateStatus(ctx context.Context, gENIDClaim *v1alpha1.GENIDClaim, opts v1.UpdateOptions) (result *v1alpha1.GENIDClaim, err error) { - result = &v1alpha1.GENIDClaim{} - err = c.client.Put(). - Namespace(c.ns). - Resource("genidclaims"). - Name(gENIDClaim.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(gENIDClaim). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the gENIDClaim and deletes it. Returns an error if one occurs. -func (c *gENIDClaims) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("genidclaims"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *gENIDClaims) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("genidclaims"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched gENIDClaim. -func (c *gENIDClaims) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.GENIDClaim, err error) { - result = &v1alpha1.GENIDClaim{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("genidclaims"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/genid/v1alpha1/genidentry.go b/apis/generated/clientset/versioned/typed/genid/v1alpha1/genidentry.go deleted file mode 100644 index 62591e2..0000000 --- a/apis/generated/clientset/versioned/typed/genid/v1alpha1/genidentry.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/genid/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// GENIDEntriesGetter has a method to return a GENIDEntryInterface. -// A group's client should implement this interface. -type GENIDEntriesGetter interface { - GENIDEntries(namespace string) GENIDEntryInterface -} - -// GENIDEntryInterface has methods to work with GENIDEntry resources. -type GENIDEntryInterface interface { - Create(ctx context.Context, gENIDEntry *v1alpha1.GENIDEntry, opts v1.CreateOptions) (*v1alpha1.GENIDEntry, error) - Update(ctx context.Context, gENIDEntry *v1alpha1.GENIDEntry, opts v1.UpdateOptions) (*v1alpha1.GENIDEntry, error) - UpdateStatus(ctx context.Context, gENIDEntry *v1alpha1.GENIDEntry, opts v1.UpdateOptions) (*v1alpha1.GENIDEntry, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.GENIDEntry, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.GENIDEntryList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.GENIDEntry, err error) - GENIDEntryExpansion -} - -// gENIDEntries implements GENIDEntryInterface -type gENIDEntries struct { - client rest.Interface - ns string -} - -// newGENIDEntries returns a GENIDEntries -func newGENIDEntries(c *GenidV1alpha1Client, namespace string) *gENIDEntries { - return &gENIDEntries{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the gENIDEntry, and returns the corresponding gENIDEntry object, and an error if there is any. -func (c *gENIDEntries) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.GENIDEntry, err error) { - result = &v1alpha1.GENIDEntry{} - err = c.client.Get(). - Namespace(c.ns). - Resource("genidentries"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of GENIDEntries that match those selectors. -func (c *gENIDEntries) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.GENIDEntryList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.GENIDEntryList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("genidentries"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested gENIDEntries. -func (c *gENIDEntries) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("genidentries"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a gENIDEntry and creates it. Returns the server's representation of the gENIDEntry, and an error, if there is any. -func (c *gENIDEntries) Create(ctx context.Context, gENIDEntry *v1alpha1.GENIDEntry, opts v1.CreateOptions) (result *v1alpha1.GENIDEntry, err error) { - result = &v1alpha1.GENIDEntry{} - err = c.client.Post(). - Namespace(c.ns). - Resource("genidentries"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(gENIDEntry). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a gENIDEntry and updates it. Returns the server's representation of the gENIDEntry, and an error, if there is any. -func (c *gENIDEntries) Update(ctx context.Context, gENIDEntry *v1alpha1.GENIDEntry, opts v1.UpdateOptions) (result *v1alpha1.GENIDEntry, err error) { - result = &v1alpha1.GENIDEntry{} - err = c.client.Put(). - Namespace(c.ns). - Resource("genidentries"). - Name(gENIDEntry.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(gENIDEntry). - 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 *gENIDEntries) UpdateStatus(ctx context.Context, gENIDEntry *v1alpha1.GENIDEntry, opts v1.UpdateOptions) (result *v1alpha1.GENIDEntry, err error) { - result = &v1alpha1.GENIDEntry{} - err = c.client.Put(). - Namespace(c.ns). - Resource("genidentries"). - Name(gENIDEntry.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(gENIDEntry). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the gENIDEntry and deletes it. Returns an error if one occurs. -func (c *gENIDEntries) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("genidentries"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *gENIDEntries) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("genidentries"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched gENIDEntry. -func (c *gENIDEntries) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.GENIDEntry, err error) { - result = &v1alpha1.GENIDEntry{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("genidentries"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/genid/v1alpha1/genidindex.go b/apis/generated/clientset/versioned/typed/genid/v1alpha1/genidindex.go deleted file mode 100644 index c9e7022..0000000 --- a/apis/generated/clientset/versioned/typed/genid/v1alpha1/genidindex.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/genid/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// GENIDIndexesGetter has a method to return a GENIDIndexInterface. -// A group's client should implement this interface. -type GENIDIndexesGetter interface { - GENIDIndexes(namespace string) GENIDIndexInterface -} - -// GENIDIndexInterface has methods to work with GENIDIndex resources. -type GENIDIndexInterface interface { - Create(ctx context.Context, gENIDIndex *v1alpha1.GENIDIndex, opts v1.CreateOptions) (*v1alpha1.GENIDIndex, error) - Update(ctx context.Context, gENIDIndex *v1alpha1.GENIDIndex, opts v1.UpdateOptions) (*v1alpha1.GENIDIndex, error) - UpdateStatus(ctx context.Context, gENIDIndex *v1alpha1.GENIDIndex, opts v1.UpdateOptions) (*v1alpha1.GENIDIndex, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.GENIDIndex, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.GENIDIndexList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.GENIDIndex, err error) - GENIDIndexExpansion -} - -// gENIDIndexes implements GENIDIndexInterface -type gENIDIndexes struct { - client rest.Interface - ns string -} - -// newGENIDIndexes returns a GENIDIndexes -func newGENIDIndexes(c *GenidV1alpha1Client, namespace string) *gENIDIndexes { - return &gENIDIndexes{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the gENIDIndex, and returns the corresponding gENIDIndex object, and an error if there is any. -func (c *gENIDIndexes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.GENIDIndex, err error) { - result = &v1alpha1.GENIDIndex{} - err = c.client.Get(). - Namespace(c.ns). - Resource("genidindexes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of GENIDIndexes that match those selectors. -func (c *gENIDIndexes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.GENIDIndexList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.GENIDIndexList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("genidindexes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested gENIDIndexes. -func (c *gENIDIndexes) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("genidindexes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a gENIDIndex and creates it. Returns the server's representation of the gENIDIndex, and an error, if there is any. -func (c *gENIDIndexes) Create(ctx context.Context, gENIDIndex *v1alpha1.GENIDIndex, opts v1.CreateOptions) (result *v1alpha1.GENIDIndex, err error) { - result = &v1alpha1.GENIDIndex{} - err = c.client.Post(). - Namespace(c.ns). - Resource("genidindexes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(gENIDIndex). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a gENIDIndex and updates it. Returns the server's representation of the gENIDIndex, and an error, if there is any. -func (c *gENIDIndexes) Update(ctx context.Context, gENIDIndex *v1alpha1.GENIDIndex, opts v1.UpdateOptions) (result *v1alpha1.GENIDIndex, err error) { - result = &v1alpha1.GENIDIndex{} - err = c.client.Put(). - Namespace(c.ns). - Resource("genidindexes"). - Name(gENIDIndex.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(gENIDIndex). - 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 *gENIDIndexes) UpdateStatus(ctx context.Context, gENIDIndex *v1alpha1.GENIDIndex, opts v1.UpdateOptions) (result *v1alpha1.GENIDIndex, err error) { - result = &v1alpha1.GENIDIndex{} - err = c.client.Put(). - Namespace(c.ns). - Resource("genidindexes"). - Name(gENIDIndex.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(gENIDIndex). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the gENIDIndex and deletes it. Returns an error if one occurs. -func (c *gENIDIndexes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("genidindexes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *gENIDIndexes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("genidindexes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched gENIDIndex. -func (c *gENIDIndexes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.GENIDIndex, err error) { - result = &v1alpha1.GENIDIndex{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("genidindexes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/infra/v1alpha1/cluster.go b/apis/generated/clientset/versioned/typed/infra/v1alpha1/cluster.go deleted file mode 100644 index b268a22..0000000 --- a/apis/generated/clientset/versioned/typed/infra/v1alpha1/cluster.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// ClustersGetter has a method to return a ClusterInterface. -// A group's client should implement this interface. -type ClustersGetter interface { - Clusters(namespace string) ClusterInterface -} - -// ClusterInterface has methods to work with Cluster resources. -type ClusterInterface interface { - Create(ctx context.Context, cluster *v1alpha1.Cluster, opts v1.CreateOptions) (*v1alpha1.Cluster, error) - Update(ctx context.Context, cluster *v1alpha1.Cluster, opts v1.UpdateOptions) (*v1alpha1.Cluster, error) - UpdateStatus(ctx context.Context, cluster *v1alpha1.Cluster, opts v1.UpdateOptions) (*v1alpha1.Cluster, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.Cluster, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ClusterList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Cluster, err error) - ClusterExpansion -} - -// clusters implements ClusterInterface -type clusters struct { - client rest.Interface - ns string -} - -// newClusters returns a Clusters -func newClusters(c *InfraV1alpha1Client, namespace string) *clusters { - return &clusters{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the cluster, and returns the corresponding cluster object, and an error if there is any. -func (c *clusters) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Cluster, err error) { - result = &v1alpha1.Cluster{} - err = c.client.Get(). - Namespace(c.ns). - Resource("clusters"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Clusters that match those selectors. -func (c *clusters) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.ClusterList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("clusters"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested clusters. -func (c *clusters) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("clusters"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a cluster and creates it. Returns the server's representation of the cluster, and an error, if there is any. -func (c *clusters) Create(ctx context.Context, cluster *v1alpha1.Cluster, opts v1.CreateOptions) (result *v1alpha1.Cluster, err error) { - result = &v1alpha1.Cluster{} - err = c.client.Post(). - Namespace(c.ns). - Resource("clusters"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cluster). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a cluster and updates it. Returns the server's representation of the cluster, and an error, if there is any. -func (c *clusters) Update(ctx context.Context, cluster *v1alpha1.Cluster, opts v1.UpdateOptions) (result *v1alpha1.Cluster, err error) { - result = &v1alpha1.Cluster{} - err = c.client.Put(). - Namespace(c.ns). - Resource("clusters"). - Name(cluster.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cluster). - 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 *clusters) UpdateStatus(ctx context.Context, cluster *v1alpha1.Cluster, opts v1.UpdateOptions) (result *v1alpha1.Cluster, err error) { - result = &v1alpha1.Cluster{} - err = c.client.Put(). - Namespace(c.ns). - Resource("clusters"). - Name(cluster.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cluster). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the cluster and deletes it. Returns an error if one occurs. -func (c *clusters) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("clusters"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *clusters) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("clusters"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched cluster. -func (c *clusters) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Cluster, err error) { - result = &v1alpha1.Cluster{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("clusters"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/infra/v1alpha1/doc.go b/apis/generated/clientset/versioned/typed/infra/v1alpha1/doc.go deleted file mode 100644 index cda7d5a..0000000 --- a/apis/generated/clientset/versioned/typed/infra/v1alpha1/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 diff --git a/apis/generated/clientset/versioned/typed/infra/v1alpha1/endpoint.go b/apis/generated/clientset/versioned/typed/infra/v1alpha1/endpoint.go deleted file mode 100644 index 4880157..0000000 --- a/apis/generated/clientset/versioned/typed/infra/v1alpha1/endpoint.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// EndpointsGetter has a method to return a EndpointInterface. -// A group's client should implement this interface. -type EndpointsGetter interface { - Endpoints(namespace string) EndpointInterface -} - -// EndpointInterface has methods to work with Endpoint resources. -type EndpointInterface interface { - Create(ctx context.Context, endpoint *v1alpha1.Endpoint, opts v1.CreateOptions) (*v1alpha1.Endpoint, error) - Update(ctx context.Context, endpoint *v1alpha1.Endpoint, opts v1.UpdateOptions) (*v1alpha1.Endpoint, error) - UpdateStatus(ctx context.Context, endpoint *v1alpha1.Endpoint, opts v1.UpdateOptions) (*v1alpha1.Endpoint, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.Endpoint, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.EndpointList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Endpoint, err error) - EndpointExpansion -} - -// endpoints implements EndpointInterface -type endpoints struct { - client rest.Interface - ns string -} - -// newEndpoints returns a Endpoints -func newEndpoints(c *InfraV1alpha1Client, namespace string) *endpoints { - return &endpoints{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the endpoint, and returns the corresponding endpoint object, and an error if there is any. -func (c *endpoints) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Endpoint, err error) { - result = &v1alpha1.Endpoint{} - err = c.client.Get(). - Namespace(c.ns). - Resource("endpoints"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Endpoints that match those selectors. -func (c *endpoints) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.EndpointList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.EndpointList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("endpoints"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested endpoints. -func (c *endpoints) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("endpoints"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a endpoint and creates it. Returns the server's representation of the endpoint, and an error, if there is any. -func (c *endpoints) Create(ctx context.Context, endpoint *v1alpha1.Endpoint, opts v1.CreateOptions) (result *v1alpha1.Endpoint, err error) { - result = &v1alpha1.Endpoint{} - err = c.client.Post(). - Namespace(c.ns). - Resource("endpoints"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(endpoint). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a endpoint and updates it. Returns the server's representation of the endpoint, and an error, if there is any. -func (c *endpoints) Update(ctx context.Context, endpoint *v1alpha1.Endpoint, opts v1.UpdateOptions) (result *v1alpha1.Endpoint, err error) { - result = &v1alpha1.Endpoint{} - err = c.client.Put(). - Namespace(c.ns). - Resource("endpoints"). - Name(endpoint.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(endpoint). - 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 *endpoints) UpdateStatus(ctx context.Context, endpoint *v1alpha1.Endpoint, opts v1.UpdateOptions) (result *v1alpha1.Endpoint, err error) { - result = &v1alpha1.Endpoint{} - err = c.client.Put(). - Namespace(c.ns). - Resource("endpoints"). - Name(endpoint.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(endpoint). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the endpoint and deletes it. Returns an error if one occurs. -func (c *endpoints) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("endpoints"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *endpoints) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("endpoints"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched endpoint. -func (c *endpoints) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Endpoint, err error) { - result = &v1alpha1.Endpoint{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("endpoints"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/infra/v1alpha1/endpointset.go b/apis/generated/clientset/versioned/typed/infra/v1alpha1/endpointset.go deleted file mode 100644 index d7ec5f9..0000000 --- a/apis/generated/clientset/versioned/typed/infra/v1alpha1/endpointset.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// EndpointSetsGetter has a method to return a EndpointSetInterface. -// A group's client should implement this interface. -type EndpointSetsGetter interface { - EndpointSets(namespace string) EndpointSetInterface -} - -// EndpointSetInterface has methods to work with EndpointSet resources. -type EndpointSetInterface interface { - Create(ctx context.Context, endpointSet *v1alpha1.EndpointSet, opts v1.CreateOptions) (*v1alpha1.EndpointSet, error) - Update(ctx context.Context, endpointSet *v1alpha1.EndpointSet, opts v1.UpdateOptions) (*v1alpha1.EndpointSet, error) - UpdateStatus(ctx context.Context, endpointSet *v1alpha1.EndpointSet, opts v1.UpdateOptions) (*v1alpha1.EndpointSet, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.EndpointSet, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.EndpointSetList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.EndpointSet, err error) - EndpointSetExpansion -} - -// endpointSets implements EndpointSetInterface -type endpointSets struct { - client rest.Interface - ns string -} - -// newEndpointSets returns a EndpointSets -func newEndpointSets(c *InfraV1alpha1Client, namespace string) *endpointSets { - return &endpointSets{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the endpointSet, and returns the corresponding endpointSet object, and an error if there is any. -func (c *endpointSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.EndpointSet, err error) { - result = &v1alpha1.EndpointSet{} - err = c.client.Get(). - Namespace(c.ns). - Resource("endpointsets"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of EndpointSets that match those selectors. -func (c *endpointSets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.EndpointSetList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.EndpointSetList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("endpointsets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested endpointSets. -func (c *endpointSets) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("endpointsets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a endpointSet and creates it. Returns the server's representation of the endpointSet, and an error, if there is any. -func (c *endpointSets) Create(ctx context.Context, endpointSet *v1alpha1.EndpointSet, opts v1.CreateOptions) (result *v1alpha1.EndpointSet, err error) { - result = &v1alpha1.EndpointSet{} - err = c.client.Post(). - Namespace(c.ns). - Resource("endpointsets"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(endpointSet). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a endpointSet and updates it. Returns the server's representation of the endpointSet, and an error, if there is any. -func (c *endpointSets) Update(ctx context.Context, endpointSet *v1alpha1.EndpointSet, opts v1.UpdateOptions) (result *v1alpha1.EndpointSet, err error) { - result = &v1alpha1.EndpointSet{} - err = c.client.Put(). - Namespace(c.ns). - Resource("endpointsets"). - Name(endpointSet.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(endpointSet). - 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 *endpointSets) UpdateStatus(ctx context.Context, endpointSet *v1alpha1.EndpointSet, opts v1.UpdateOptions) (result *v1alpha1.EndpointSet, err error) { - result = &v1alpha1.EndpointSet{} - err = c.client.Put(). - Namespace(c.ns). - Resource("endpointsets"). - Name(endpointSet.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(endpointSet). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the endpointSet and deletes it. Returns an error if one occurs. -func (c *endpointSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("endpointsets"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *endpointSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("endpointsets"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched endpointSet. -func (c *endpointSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.EndpointSet, err error) { - result = &v1alpha1.EndpointSet{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("endpointsets"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/doc.go b/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/doc.go deleted file mode 100644 index d4601f1..0000000 --- a/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Copyright 2024 Nokia. - -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/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_cluster.go b/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_cluster.go deleted file mode 100644 index 99faa42..0000000 --- a/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_cluster.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2024 Nokia. - -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" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - v1 "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" -) - -// FakeClusters implements ClusterInterface -type FakeClusters struct { - Fake *FakeInfraV1alpha1 - ns string -} - -var clustersResource = v1alpha1.SchemeGroupVersion.WithResource("clusters") - -var clustersKind = v1alpha1.SchemeGroupVersion.WithKind("Cluster") - -// Get takes name of the cluster, and returns the corresponding cluster object, and an error if there is any. -func (c *FakeClusters) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Cluster, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(clustersResource, c.ns, name), &v1alpha1.Cluster{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Cluster), err -} - -// List takes label and field selectors, and returns the list of Clusters that match those selectors. -func (c *FakeClusters) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(clustersResource, clustersKind, c.ns, opts), &v1alpha1.ClusterList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.ClusterList{ListMeta: obj.(*v1alpha1.ClusterList).ListMeta} - for _, item := range obj.(*v1alpha1.ClusterList).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 clusters. -func (c *FakeClusters) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(clustersResource, c.ns, opts)) - -} - -// Create takes the representation of a cluster and creates it. Returns the server's representation of the cluster, and an error, if there is any. -func (c *FakeClusters) Create(ctx context.Context, cluster *v1alpha1.Cluster, opts v1.CreateOptions) (result *v1alpha1.Cluster, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(clustersResource, c.ns, cluster), &v1alpha1.Cluster{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Cluster), err -} - -// Update takes the representation of a cluster and updates it. Returns the server's representation of the cluster, and an error, if there is any. -func (c *FakeClusters) Update(ctx context.Context, cluster *v1alpha1.Cluster, opts v1.UpdateOptions) (result *v1alpha1.Cluster, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(clustersResource, c.ns, cluster), &v1alpha1.Cluster{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Cluster), 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 *FakeClusters) UpdateStatus(ctx context.Context, cluster *v1alpha1.Cluster, opts v1.UpdateOptions) (*v1alpha1.Cluster, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(clustersResource, "status", c.ns, cluster), &v1alpha1.Cluster{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Cluster), err -} - -// Delete takes name of the cluster and deletes it. Returns an error if one occurs. -func (c *FakeClusters) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(clustersResource, c.ns, name, opts), &v1alpha1.Cluster{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeClusters) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(clustersResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.ClusterList{}) - return err -} - -// Patch applies the patch and returns the patched cluster. -func (c *FakeClusters) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Cluster, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(clustersResource, c.ns, name, pt, data, subresources...), &v1alpha1.Cluster{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Cluster), err -} diff --git a/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_endpoint.go b/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_endpoint.go deleted file mode 100644 index 32b0b36..0000000 --- a/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_endpoint.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2024 Nokia. - -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" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - v1 "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" -) - -// FakeEndpoints implements EndpointInterface -type FakeEndpoints struct { - Fake *FakeInfraV1alpha1 - ns string -} - -var endpointsResource = v1alpha1.SchemeGroupVersion.WithResource("endpoints") - -var endpointsKind = v1alpha1.SchemeGroupVersion.WithKind("Endpoint") - -// Get takes name of the endpoint, and returns the corresponding endpoint object, and an error if there is any. -func (c *FakeEndpoints) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Endpoint, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(endpointsResource, c.ns, name), &v1alpha1.Endpoint{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Endpoint), err -} - -// List takes label and field selectors, and returns the list of Endpoints that match those selectors. -func (c *FakeEndpoints) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.EndpointList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(endpointsResource, endpointsKind, c.ns, opts), &v1alpha1.EndpointList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.EndpointList{ListMeta: obj.(*v1alpha1.EndpointList).ListMeta} - for _, item := range obj.(*v1alpha1.EndpointList).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 endpoints. -func (c *FakeEndpoints) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(endpointsResource, c.ns, opts)) - -} - -// Create takes the representation of a endpoint and creates it. Returns the server's representation of the endpoint, and an error, if there is any. -func (c *FakeEndpoints) Create(ctx context.Context, endpoint *v1alpha1.Endpoint, opts v1.CreateOptions) (result *v1alpha1.Endpoint, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(endpointsResource, c.ns, endpoint), &v1alpha1.Endpoint{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Endpoint), err -} - -// Update takes the representation of a endpoint and updates it. Returns the server's representation of the endpoint, and an error, if there is any. -func (c *FakeEndpoints) Update(ctx context.Context, endpoint *v1alpha1.Endpoint, opts v1.UpdateOptions) (result *v1alpha1.Endpoint, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(endpointsResource, c.ns, endpoint), &v1alpha1.Endpoint{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Endpoint), 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 *FakeEndpoints) UpdateStatus(ctx context.Context, endpoint *v1alpha1.Endpoint, opts v1.UpdateOptions) (*v1alpha1.Endpoint, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(endpointsResource, "status", c.ns, endpoint), &v1alpha1.Endpoint{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Endpoint), err -} - -// Delete takes name of the endpoint and deletes it. Returns an error if one occurs. -func (c *FakeEndpoints) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(endpointsResource, c.ns, name, opts), &v1alpha1.Endpoint{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeEndpoints) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(endpointsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.EndpointList{}) - return err -} - -// Patch applies the patch and returns the patched endpoint. -func (c *FakeEndpoints) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Endpoint, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(endpointsResource, c.ns, name, pt, data, subresources...), &v1alpha1.Endpoint{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Endpoint), err -} diff --git a/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_endpointset.go b/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_endpointset.go deleted file mode 100644 index a8567f6..0000000 --- a/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_endpointset.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2024 Nokia. - -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" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - v1 "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" -) - -// FakeEndpointSets implements EndpointSetInterface -type FakeEndpointSets struct { - Fake *FakeInfraV1alpha1 - ns string -} - -var endpointsetsResource = v1alpha1.SchemeGroupVersion.WithResource("endpointsets") - -var endpointsetsKind = v1alpha1.SchemeGroupVersion.WithKind("EndpointSet") - -// Get takes name of the endpointSet, and returns the corresponding endpointSet object, and an error if there is any. -func (c *FakeEndpointSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.EndpointSet, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(endpointsetsResource, c.ns, name), &v1alpha1.EndpointSet{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.EndpointSet), err -} - -// List takes label and field selectors, and returns the list of EndpointSets that match those selectors. -func (c *FakeEndpointSets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.EndpointSetList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(endpointsetsResource, endpointsetsKind, c.ns, opts), &v1alpha1.EndpointSetList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.EndpointSetList{ListMeta: obj.(*v1alpha1.EndpointSetList).ListMeta} - for _, item := range obj.(*v1alpha1.EndpointSetList).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 endpointSets. -func (c *FakeEndpointSets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(endpointsetsResource, c.ns, opts)) - -} - -// Create takes the representation of a endpointSet and creates it. Returns the server's representation of the endpointSet, and an error, if there is any. -func (c *FakeEndpointSets) Create(ctx context.Context, endpointSet *v1alpha1.EndpointSet, opts v1.CreateOptions) (result *v1alpha1.EndpointSet, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(endpointsetsResource, c.ns, endpointSet), &v1alpha1.EndpointSet{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.EndpointSet), err -} - -// Update takes the representation of a endpointSet and updates it. Returns the server's representation of the endpointSet, and an error, if there is any. -func (c *FakeEndpointSets) Update(ctx context.Context, endpointSet *v1alpha1.EndpointSet, opts v1.UpdateOptions) (result *v1alpha1.EndpointSet, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(endpointsetsResource, c.ns, endpointSet), &v1alpha1.EndpointSet{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.EndpointSet), 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 *FakeEndpointSets) UpdateStatus(ctx context.Context, endpointSet *v1alpha1.EndpointSet, opts v1.UpdateOptions) (*v1alpha1.EndpointSet, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(endpointsetsResource, "status", c.ns, endpointSet), &v1alpha1.EndpointSet{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.EndpointSet), err -} - -// Delete takes name of the endpointSet and deletes it. Returns an error if one occurs. -func (c *FakeEndpointSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(endpointsetsResource, c.ns, name, opts), &v1alpha1.EndpointSet{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeEndpointSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(endpointsetsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.EndpointSetList{}) - return err -} - -// Patch applies the patch and returns the patched endpointSet. -func (c *FakeEndpointSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.EndpointSet, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(endpointsetsResource, c.ns, name, pt, data, subresources...), &v1alpha1.EndpointSet{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.EndpointSet), err -} diff --git a/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_infra_client.go b/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_infra_client.go deleted file mode 100644 index cf69568..0000000 --- a/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_infra_client.go +++ /dev/null @@ -1,91 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 ( - v1alpha1 "github.com/kuidio/kuid/apis/generated/clientset/versioned/typed/infra/v1alpha1" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakeInfraV1alpha1 struct { - *testing.Fake -} - -func (c *FakeInfraV1alpha1) Clusters(namespace string) v1alpha1.ClusterInterface { - return &FakeClusters{c, namespace} -} - -func (c *FakeInfraV1alpha1) Endpoints(namespace string) v1alpha1.EndpointInterface { - return &FakeEndpoints{c, namespace} -} - -func (c *FakeInfraV1alpha1) EndpointSets(namespace string) v1alpha1.EndpointSetInterface { - return &FakeEndpointSets{c, namespace} -} - -func (c *FakeInfraV1alpha1) Links(namespace string) v1alpha1.LinkInterface { - return &FakeLinks{c, namespace} -} - -func (c *FakeInfraV1alpha1) LinkSets(namespace string) v1alpha1.LinkSetInterface { - return &FakeLinkSets{c, namespace} -} - -func (c *FakeInfraV1alpha1) Modules(namespace string) v1alpha1.ModuleInterface { - return &FakeModules{c, namespace} -} - -func (c *FakeInfraV1alpha1) ModuleBays(namespace string) v1alpha1.ModuleBayInterface { - return &FakeModuleBays{c, namespace} -} - -func (c *FakeInfraV1alpha1) Nodes(namespace string) v1alpha1.NodeInterface { - return &FakeNodes{c, namespace} -} - -func (c *FakeInfraV1alpha1) NodeGroups(namespace string) v1alpha1.NodeGroupInterface { - return &FakeNodeGroups{c, namespace} -} - -func (c *FakeInfraV1alpha1) NodeItems(namespace string) v1alpha1.NodeItemInterface { - return &FakeNodeItems{c, namespace} -} - -func (c *FakeInfraV1alpha1) NodeSets(namespace string) v1alpha1.NodeSetInterface { - return &FakeNodeSets{c, namespace} -} - -func (c *FakeInfraV1alpha1) Racks(namespace string) v1alpha1.RackInterface { - return &FakeRacks{c, namespace} -} - -func (c *FakeInfraV1alpha1) Regions(namespace string) v1alpha1.RegionInterface { - return &FakeRegions{c, namespace} -} - -func (c *FakeInfraV1alpha1) Sites(namespace string) v1alpha1.SiteInterface { - return &FakeSites{c, namespace} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeInfraV1alpha1) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_link.go b/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_link.go deleted file mode 100644 index d682660..0000000 --- a/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_link.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2024 Nokia. - -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" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - v1 "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" -) - -// FakeLinks implements LinkInterface -type FakeLinks struct { - Fake *FakeInfraV1alpha1 - ns string -} - -var linksResource = v1alpha1.SchemeGroupVersion.WithResource("links") - -var linksKind = v1alpha1.SchemeGroupVersion.WithKind("Link") - -// Get takes name of the link, and returns the corresponding link object, and an error if there is any. -func (c *FakeLinks) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Link, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(linksResource, c.ns, name), &v1alpha1.Link{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Link), err -} - -// List takes label and field selectors, and returns the list of Links that match those selectors. -func (c *FakeLinks) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.LinkList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(linksResource, linksKind, c.ns, opts), &v1alpha1.LinkList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.LinkList{ListMeta: obj.(*v1alpha1.LinkList).ListMeta} - for _, item := range obj.(*v1alpha1.LinkList).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 links. -func (c *FakeLinks) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(linksResource, c.ns, opts)) - -} - -// Create takes the representation of a link and creates it. Returns the server's representation of the link, and an error, if there is any. -func (c *FakeLinks) Create(ctx context.Context, link *v1alpha1.Link, opts v1.CreateOptions) (result *v1alpha1.Link, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(linksResource, c.ns, link), &v1alpha1.Link{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Link), err -} - -// Update takes the representation of a link and updates it. Returns the server's representation of the link, and an error, if there is any. -func (c *FakeLinks) Update(ctx context.Context, link *v1alpha1.Link, opts v1.UpdateOptions) (result *v1alpha1.Link, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(linksResource, c.ns, link), &v1alpha1.Link{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Link), 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 *FakeLinks) UpdateStatus(ctx context.Context, link *v1alpha1.Link, opts v1.UpdateOptions) (*v1alpha1.Link, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(linksResource, "status", c.ns, link), &v1alpha1.Link{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Link), err -} - -// Delete takes name of the link and deletes it. Returns an error if one occurs. -func (c *FakeLinks) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(linksResource, c.ns, name, opts), &v1alpha1.Link{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeLinks) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(linksResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.LinkList{}) - return err -} - -// Patch applies the patch and returns the patched link. -func (c *FakeLinks) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Link, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(linksResource, c.ns, name, pt, data, subresources...), &v1alpha1.Link{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Link), err -} diff --git a/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_linkset.go b/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_linkset.go deleted file mode 100644 index 6e74021..0000000 --- a/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_linkset.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2024 Nokia. - -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" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - v1 "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" -) - -// FakeLinkSets implements LinkSetInterface -type FakeLinkSets struct { - Fake *FakeInfraV1alpha1 - ns string -} - -var linksetsResource = v1alpha1.SchemeGroupVersion.WithResource("linksets") - -var linksetsKind = v1alpha1.SchemeGroupVersion.WithKind("LinkSet") - -// Get takes name of the linkSet, and returns the corresponding linkSet object, and an error if there is any. -func (c *FakeLinkSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.LinkSet, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(linksetsResource, c.ns, name), &v1alpha1.LinkSet{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.LinkSet), err -} - -// List takes label and field selectors, and returns the list of LinkSets that match those selectors. -func (c *FakeLinkSets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.LinkSetList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(linksetsResource, linksetsKind, c.ns, opts), &v1alpha1.LinkSetList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.LinkSetList{ListMeta: obj.(*v1alpha1.LinkSetList).ListMeta} - for _, item := range obj.(*v1alpha1.LinkSetList).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 linkSets. -func (c *FakeLinkSets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(linksetsResource, c.ns, opts)) - -} - -// Create takes the representation of a linkSet and creates it. Returns the server's representation of the linkSet, and an error, if there is any. -func (c *FakeLinkSets) Create(ctx context.Context, linkSet *v1alpha1.LinkSet, opts v1.CreateOptions) (result *v1alpha1.LinkSet, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(linksetsResource, c.ns, linkSet), &v1alpha1.LinkSet{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.LinkSet), err -} - -// Update takes the representation of a linkSet and updates it. Returns the server's representation of the linkSet, and an error, if there is any. -func (c *FakeLinkSets) Update(ctx context.Context, linkSet *v1alpha1.LinkSet, opts v1.UpdateOptions) (result *v1alpha1.LinkSet, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(linksetsResource, c.ns, linkSet), &v1alpha1.LinkSet{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.LinkSet), 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 *FakeLinkSets) UpdateStatus(ctx context.Context, linkSet *v1alpha1.LinkSet, opts v1.UpdateOptions) (*v1alpha1.LinkSet, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(linksetsResource, "status", c.ns, linkSet), &v1alpha1.LinkSet{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.LinkSet), err -} - -// Delete takes name of the linkSet and deletes it. Returns an error if one occurs. -func (c *FakeLinkSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(linksetsResource, c.ns, name, opts), &v1alpha1.LinkSet{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeLinkSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(linksetsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.LinkSetList{}) - return err -} - -// Patch applies the patch and returns the patched linkSet. -func (c *FakeLinkSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.LinkSet, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(linksetsResource, c.ns, name, pt, data, subresources...), &v1alpha1.LinkSet{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.LinkSet), err -} diff --git a/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_module.go b/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_module.go deleted file mode 100644 index 021b2ff..0000000 --- a/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_module.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2024 Nokia. - -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" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - v1 "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" -) - -// FakeModules implements ModuleInterface -type FakeModules struct { - Fake *FakeInfraV1alpha1 - ns string -} - -var modulesResource = v1alpha1.SchemeGroupVersion.WithResource("modules") - -var modulesKind = v1alpha1.SchemeGroupVersion.WithKind("Module") - -// Get takes name of the module, and returns the corresponding module object, and an error if there is any. -func (c *FakeModules) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Module, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(modulesResource, c.ns, name), &v1alpha1.Module{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Module), err -} - -// List takes label and field selectors, and returns the list of Modules that match those selectors. -func (c *FakeModules) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ModuleList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(modulesResource, modulesKind, c.ns, opts), &v1alpha1.ModuleList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.ModuleList{ListMeta: obj.(*v1alpha1.ModuleList).ListMeta} - for _, item := range obj.(*v1alpha1.ModuleList).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 modules. -func (c *FakeModules) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(modulesResource, c.ns, opts)) - -} - -// Create takes the representation of a module and creates it. Returns the server's representation of the module, and an error, if there is any. -func (c *FakeModules) Create(ctx context.Context, module *v1alpha1.Module, opts v1.CreateOptions) (result *v1alpha1.Module, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(modulesResource, c.ns, module), &v1alpha1.Module{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Module), err -} - -// Update takes the representation of a module and updates it. Returns the server's representation of the module, and an error, if there is any. -func (c *FakeModules) Update(ctx context.Context, module *v1alpha1.Module, opts v1.UpdateOptions) (result *v1alpha1.Module, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(modulesResource, c.ns, module), &v1alpha1.Module{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Module), 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 *FakeModules) UpdateStatus(ctx context.Context, module *v1alpha1.Module, opts v1.UpdateOptions) (*v1alpha1.Module, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(modulesResource, "status", c.ns, module), &v1alpha1.Module{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Module), err -} - -// Delete takes name of the module and deletes it. Returns an error if one occurs. -func (c *FakeModules) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(modulesResource, c.ns, name, opts), &v1alpha1.Module{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeModules) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(modulesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.ModuleList{}) - return err -} - -// Patch applies the patch and returns the patched module. -func (c *FakeModules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Module, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(modulesResource, c.ns, name, pt, data, subresources...), &v1alpha1.Module{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Module), err -} diff --git a/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_modulebay.go b/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_modulebay.go deleted file mode 100644 index c2ef7b4..0000000 --- a/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_modulebay.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2024 Nokia. - -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" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - v1 "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" -) - -// FakeModuleBays implements ModuleBayInterface -type FakeModuleBays struct { - Fake *FakeInfraV1alpha1 - ns string -} - -var modulebaysResource = v1alpha1.SchemeGroupVersion.WithResource("modulebays") - -var modulebaysKind = v1alpha1.SchemeGroupVersion.WithKind("ModuleBay") - -// Get takes name of the moduleBay, and returns the corresponding moduleBay object, and an error if there is any. -func (c *FakeModuleBays) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ModuleBay, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(modulebaysResource, c.ns, name), &v1alpha1.ModuleBay{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.ModuleBay), err -} - -// List takes label and field selectors, and returns the list of ModuleBays that match those selectors. -func (c *FakeModuleBays) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ModuleBayList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(modulebaysResource, modulebaysKind, c.ns, opts), &v1alpha1.ModuleBayList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.ModuleBayList{ListMeta: obj.(*v1alpha1.ModuleBayList).ListMeta} - for _, item := range obj.(*v1alpha1.ModuleBayList).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 moduleBays. -func (c *FakeModuleBays) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(modulebaysResource, c.ns, opts)) - -} - -// Create takes the representation of a moduleBay and creates it. Returns the server's representation of the moduleBay, and an error, if there is any. -func (c *FakeModuleBays) Create(ctx context.Context, moduleBay *v1alpha1.ModuleBay, opts v1.CreateOptions) (result *v1alpha1.ModuleBay, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(modulebaysResource, c.ns, moduleBay), &v1alpha1.ModuleBay{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.ModuleBay), err -} - -// Update takes the representation of a moduleBay and updates it. Returns the server's representation of the moduleBay, and an error, if there is any. -func (c *FakeModuleBays) Update(ctx context.Context, moduleBay *v1alpha1.ModuleBay, opts v1.UpdateOptions) (result *v1alpha1.ModuleBay, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(modulebaysResource, c.ns, moduleBay), &v1alpha1.ModuleBay{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.ModuleBay), 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 *FakeModuleBays) UpdateStatus(ctx context.Context, moduleBay *v1alpha1.ModuleBay, opts v1.UpdateOptions) (*v1alpha1.ModuleBay, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(modulebaysResource, "status", c.ns, moduleBay), &v1alpha1.ModuleBay{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.ModuleBay), err -} - -// Delete takes name of the moduleBay and deletes it. Returns an error if one occurs. -func (c *FakeModuleBays) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(modulebaysResource, c.ns, name, opts), &v1alpha1.ModuleBay{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeModuleBays) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(modulebaysResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.ModuleBayList{}) - return err -} - -// Patch applies the patch and returns the patched moduleBay. -func (c *FakeModuleBays) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ModuleBay, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(modulebaysResource, c.ns, name, pt, data, subresources...), &v1alpha1.ModuleBay{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.ModuleBay), err -} diff --git a/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_node.go b/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_node.go deleted file mode 100644 index a7bb0ff..0000000 --- a/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_node.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2024 Nokia. - -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" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - v1 "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" -) - -// FakeNodes implements NodeInterface -type FakeNodes struct { - Fake *FakeInfraV1alpha1 - ns string -} - -var nodesResource = v1alpha1.SchemeGroupVersion.WithResource("nodes") - -var nodesKind = v1alpha1.SchemeGroupVersion.WithKind("Node") - -// Get takes name of the node, and returns the corresponding node object, and an error if there is any. -func (c *FakeNodes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Node, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(nodesResource, c.ns, name), &v1alpha1.Node{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Node), err -} - -// List takes label and field selectors, and returns the list of Nodes that match those selectors. -func (c *FakeNodes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NodeList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(nodesResource, nodesKind, c.ns, opts), &v1alpha1.NodeList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.NodeList{ListMeta: obj.(*v1alpha1.NodeList).ListMeta} - for _, item := range obj.(*v1alpha1.NodeList).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 nodes. -func (c *FakeNodes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(nodesResource, c.ns, opts)) - -} - -// Create takes the representation of a node and creates it. Returns the server's representation of the node, and an error, if there is any. -func (c *FakeNodes) Create(ctx context.Context, node *v1alpha1.Node, opts v1.CreateOptions) (result *v1alpha1.Node, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(nodesResource, c.ns, node), &v1alpha1.Node{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Node), err -} - -// Update takes the representation of a node and updates it. Returns the server's representation of the node, and an error, if there is any. -func (c *FakeNodes) Update(ctx context.Context, node *v1alpha1.Node, opts v1.UpdateOptions) (result *v1alpha1.Node, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(nodesResource, c.ns, node), &v1alpha1.Node{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Node), 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 *FakeNodes) UpdateStatus(ctx context.Context, node *v1alpha1.Node, opts v1.UpdateOptions) (*v1alpha1.Node, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(nodesResource, "status", c.ns, node), &v1alpha1.Node{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Node), err -} - -// Delete takes name of the node and deletes it. Returns an error if one occurs. -func (c *FakeNodes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(nodesResource, c.ns, name, opts), &v1alpha1.Node{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeNodes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(nodesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.NodeList{}) - return err -} - -// Patch applies the patch and returns the patched node. -func (c *FakeNodes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Node, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(nodesResource, c.ns, name, pt, data, subresources...), &v1alpha1.Node{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Node), err -} diff --git a/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_nodegroup.go b/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_nodegroup.go deleted file mode 100644 index 2ca8d5c..0000000 --- a/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_nodegroup.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2024 Nokia. - -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" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - v1 "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" -) - -// FakeNodeGroups implements NodeGroupInterface -type FakeNodeGroups struct { - Fake *FakeInfraV1alpha1 - ns string -} - -var nodegroupsResource = v1alpha1.SchemeGroupVersion.WithResource("nodegroups") - -var nodegroupsKind = v1alpha1.SchemeGroupVersion.WithKind("NodeGroup") - -// Get takes name of the nodeGroup, and returns the corresponding nodeGroup object, and an error if there is any. -func (c *FakeNodeGroups) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NodeGroup, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(nodegroupsResource, c.ns, name), &v1alpha1.NodeGroup{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.NodeGroup), err -} - -// List takes label and field selectors, and returns the list of NodeGroups that match those selectors. -func (c *FakeNodeGroups) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NodeGroupList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(nodegroupsResource, nodegroupsKind, c.ns, opts), &v1alpha1.NodeGroupList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.NodeGroupList{ListMeta: obj.(*v1alpha1.NodeGroupList).ListMeta} - for _, item := range obj.(*v1alpha1.NodeGroupList).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 nodeGroups. -func (c *FakeNodeGroups) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(nodegroupsResource, c.ns, opts)) - -} - -// Create takes the representation of a nodeGroup and creates it. Returns the server's representation of the nodeGroup, and an error, if there is any. -func (c *FakeNodeGroups) Create(ctx context.Context, nodeGroup *v1alpha1.NodeGroup, opts v1.CreateOptions) (result *v1alpha1.NodeGroup, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(nodegroupsResource, c.ns, nodeGroup), &v1alpha1.NodeGroup{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.NodeGroup), err -} - -// Update takes the representation of a nodeGroup and updates it. Returns the server's representation of the nodeGroup, and an error, if there is any. -func (c *FakeNodeGroups) Update(ctx context.Context, nodeGroup *v1alpha1.NodeGroup, opts v1.UpdateOptions) (result *v1alpha1.NodeGroup, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(nodegroupsResource, c.ns, nodeGroup), &v1alpha1.NodeGroup{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.NodeGroup), 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 *FakeNodeGroups) UpdateStatus(ctx context.Context, nodeGroup *v1alpha1.NodeGroup, opts v1.UpdateOptions) (*v1alpha1.NodeGroup, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(nodegroupsResource, "status", c.ns, nodeGroup), &v1alpha1.NodeGroup{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.NodeGroup), err -} - -// Delete takes name of the nodeGroup and deletes it. Returns an error if one occurs. -func (c *FakeNodeGroups) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(nodegroupsResource, c.ns, name, opts), &v1alpha1.NodeGroup{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeNodeGroups) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(nodegroupsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.NodeGroupList{}) - return err -} - -// Patch applies the patch and returns the patched nodeGroup. -func (c *FakeNodeGroups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.NodeGroup, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(nodegroupsResource, c.ns, name, pt, data, subresources...), &v1alpha1.NodeGroup{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.NodeGroup), err -} diff --git a/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_nodeitem.go b/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_nodeitem.go deleted file mode 100644 index 6680ba1..0000000 --- a/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_nodeitem.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2024 Nokia. - -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" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - v1 "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" -) - -// FakeNodeItems implements NodeItemInterface -type FakeNodeItems struct { - Fake *FakeInfraV1alpha1 - ns string -} - -var nodeitemsResource = v1alpha1.SchemeGroupVersion.WithResource("nodeitems") - -var nodeitemsKind = v1alpha1.SchemeGroupVersion.WithKind("NodeItem") - -// Get takes name of the nodeItem, and returns the corresponding nodeItem object, and an error if there is any. -func (c *FakeNodeItems) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NodeItem, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(nodeitemsResource, c.ns, name), &v1alpha1.NodeItem{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.NodeItem), err -} - -// List takes label and field selectors, and returns the list of NodeItems that match those selectors. -func (c *FakeNodeItems) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NodeItemList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(nodeitemsResource, nodeitemsKind, c.ns, opts), &v1alpha1.NodeItemList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.NodeItemList{ListMeta: obj.(*v1alpha1.NodeItemList).ListMeta} - for _, item := range obj.(*v1alpha1.NodeItemList).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 nodeItems. -func (c *FakeNodeItems) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(nodeitemsResource, c.ns, opts)) - -} - -// Create takes the representation of a nodeItem and creates it. Returns the server's representation of the nodeItem, and an error, if there is any. -func (c *FakeNodeItems) Create(ctx context.Context, nodeItem *v1alpha1.NodeItem, opts v1.CreateOptions) (result *v1alpha1.NodeItem, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(nodeitemsResource, c.ns, nodeItem), &v1alpha1.NodeItem{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.NodeItem), err -} - -// Update takes the representation of a nodeItem and updates it. Returns the server's representation of the nodeItem, and an error, if there is any. -func (c *FakeNodeItems) Update(ctx context.Context, nodeItem *v1alpha1.NodeItem, opts v1.UpdateOptions) (result *v1alpha1.NodeItem, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(nodeitemsResource, c.ns, nodeItem), &v1alpha1.NodeItem{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.NodeItem), 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 *FakeNodeItems) UpdateStatus(ctx context.Context, nodeItem *v1alpha1.NodeItem, opts v1.UpdateOptions) (*v1alpha1.NodeItem, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(nodeitemsResource, "status", c.ns, nodeItem), &v1alpha1.NodeItem{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.NodeItem), err -} - -// Delete takes name of the nodeItem and deletes it. Returns an error if one occurs. -func (c *FakeNodeItems) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(nodeitemsResource, c.ns, name, opts), &v1alpha1.NodeItem{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeNodeItems) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(nodeitemsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.NodeItemList{}) - return err -} - -// Patch applies the patch and returns the patched nodeItem. -func (c *FakeNodeItems) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.NodeItem, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(nodeitemsResource, c.ns, name, pt, data, subresources...), &v1alpha1.NodeItem{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.NodeItem), err -} diff --git a/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_nodeset.go b/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_nodeset.go deleted file mode 100644 index 01f8861..0000000 --- a/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_nodeset.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2024 Nokia. - -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" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - v1 "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" -) - -// FakeNodeSets implements NodeSetInterface -type FakeNodeSets struct { - Fake *FakeInfraV1alpha1 - ns string -} - -var nodesetsResource = v1alpha1.SchemeGroupVersion.WithResource("nodesets") - -var nodesetsKind = v1alpha1.SchemeGroupVersion.WithKind("NodeSet") - -// Get takes name of the nodeSet, and returns the corresponding nodeSet object, and an error if there is any. -func (c *FakeNodeSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NodeSet, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(nodesetsResource, c.ns, name), &v1alpha1.NodeSet{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.NodeSet), err -} - -// List takes label and field selectors, and returns the list of NodeSets that match those selectors. -func (c *FakeNodeSets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NodeSetList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(nodesetsResource, nodesetsKind, c.ns, opts), &v1alpha1.NodeSetList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.NodeSetList{ListMeta: obj.(*v1alpha1.NodeSetList).ListMeta} - for _, item := range obj.(*v1alpha1.NodeSetList).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 nodeSets. -func (c *FakeNodeSets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(nodesetsResource, c.ns, opts)) - -} - -// Create takes the representation of a nodeSet and creates it. Returns the server's representation of the nodeSet, and an error, if there is any. -func (c *FakeNodeSets) Create(ctx context.Context, nodeSet *v1alpha1.NodeSet, opts v1.CreateOptions) (result *v1alpha1.NodeSet, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(nodesetsResource, c.ns, nodeSet), &v1alpha1.NodeSet{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.NodeSet), err -} - -// Update takes the representation of a nodeSet and updates it. Returns the server's representation of the nodeSet, and an error, if there is any. -func (c *FakeNodeSets) Update(ctx context.Context, nodeSet *v1alpha1.NodeSet, opts v1.UpdateOptions) (result *v1alpha1.NodeSet, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(nodesetsResource, c.ns, nodeSet), &v1alpha1.NodeSet{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.NodeSet), 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 *FakeNodeSets) UpdateStatus(ctx context.Context, nodeSet *v1alpha1.NodeSet, opts v1.UpdateOptions) (*v1alpha1.NodeSet, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(nodesetsResource, "status", c.ns, nodeSet), &v1alpha1.NodeSet{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.NodeSet), err -} - -// Delete takes name of the nodeSet and deletes it. Returns an error if one occurs. -func (c *FakeNodeSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(nodesetsResource, c.ns, name, opts), &v1alpha1.NodeSet{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeNodeSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(nodesetsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.NodeSetList{}) - return err -} - -// Patch applies the patch and returns the patched nodeSet. -func (c *FakeNodeSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.NodeSet, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(nodesetsResource, c.ns, name, pt, data, subresources...), &v1alpha1.NodeSet{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.NodeSet), err -} diff --git a/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_rack.go b/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_rack.go deleted file mode 100644 index 0ef4c0a..0000000 --- a/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_rack.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2024 Nokia. - -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" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - v1 "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" -) - -// FakeRacks implements RackInterface -type FakeRacks struct { - Fake *FakeInfraV1alpha1 - ns string -} - -var racksResource = v1alpha1.SchemeGroupVersion.WithResource("racks") - -var racksKind = v1alpha1.SchemeGroupVersion.WithKind("Rack") - -// Get takes name of the rack, and returns the corresponding rack object, and an error if there is any. -func (c *FakeRacks) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Rack, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(racksResource, c.ns, name), &v1alpha1.Rack{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Rack), err -} - -// List takes label and field selectors, and returns the list of Racks that match those selectors. -func (c *FakeRacks) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.RackList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(racksResource, racksKind, c.ns, opts), &v1alpha1.RackList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.RackList{ListMeta: obj.(*v1alpha1.RackList).ListMeta} - for _, item := range obj.(*v1alpha1.RackList).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 racks. -func (c *FakeRacks) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(racksResource, c.ns, opts)) - -} - -// Create takes the representation of a rack and creates it. Returns the server's representation of the rack, and an error, if there is any. -func (c *FakeRacks) Create(ctx context.Context, rack *v1alpha1.Rack, opts v1.CreateOptions) (result *v1alpha1.Rack, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(racksResource, c.ns, rack), &v1alpha1.Rack{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Rack), err -} - -// Update takes the representation of a rack and updates it. Returns the server's representation of the rack, and an error, if there is any. -func (c *FakeRacks) Update(ctx context.Context, rack *v1alpha1.Rack, opts v1.UpdateOptions) (result *v1alpha1.Rack, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(racksResource, c.ns, rack), &v1alpha1.Rack{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Rack), 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 *FakeRacks) UpdateStatus(ctx context.Context, rack *v1alpha1.Rack, opts v1.UpdateOptions) (*v1alpha1.Rack, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(racksResource, "status", c.ns, rack), &v1alpha1.Rack{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Rack), err -} - -// Delete takes name of the rack and deletes it. Returns an error if one occurs. -func (c *FakeRacks) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(racksResource, c.ns, name, opts), &v1alpha1.Rack{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeRacks) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(racksResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.RackList{}) - return err -} - -// Patch applies the patch and returns the patched rack. -func (c *FakeRacks) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Rack, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(racksResource, c.ns, name, pt, data, subresources...), &v1alpha1.Rack{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Rack), err -} diff --git a/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_region.go b/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_region.go deleted file mode 100644 index 222dda2..0000000 --- a/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_region.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2024 Nokia. - -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" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - v1 "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" -) - -// FakeRegions implements RegionInterface -type FakeRegions struct { - Fake *FakeInfraV1alpha1 - ns string -} - -var regionsResource = v1alpha1.SchemeGroupVersion.WithResource("regions") - -var regionsKind = v1alpha1.SchemeGroupVersion.WithKind("Region") - -// Get takes name of the region, and returns the corresponding region object, and an error if there is any. -func (c *FakeRegions) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Region, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(regionsResource, c.ns, name), &v1alpha1.Region{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Region), err -} - -// List takes label and field selectors, and returns the list of Regions that match those selectors. -func (c *FakeRegions) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.RegionList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(regionsResource, regionsKind, c.ns, opts), &v1alpha1.RegionList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.RegionList{ListMeta: obj.(*v1alpha1.RegionList).ListMeta} - for _, item := range obj.(*v1alpha1.RegionList).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 regions. -func (c *FakeRegions) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(regionsResource, c.ns, opts)) - -} - -// Create takes the representation of a region and creates it. Returns the server's representation of the region, and an error, if there is any. -func (c *FakeRegions) Create(ctx context.Context, region *v1alpha1.Region, opts v1.CreateOptions) (result *v1alpha1.Region, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(regionsResource, c.ns, region), &v1alpha1.Region{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Region), err -} - -// Update takes the representation of a region and updates it. Returns the server's representation of the region, and an error, if there is any. -func (c *FakeRegions) Update(ctx context.Context, region *v1alpha1.Region, opts v1.UpdateOptions) (result *v1alpha1.Region, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(regionsResource, c.ns, region), &v1alpha1.Region{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Region), 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 *FakeRegions) UpdateStatus(ctx context.Context, region *v1alpha1.Region, opts v1.UpdateOptions) (*v1alpha1.Region, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(regionsResource, "status", c.ns, region), &v1alpha1.Region{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Region), err -} - -// Delete takes name of the region and deletes it. Returns an error if one occurs. -func (c *FakeRegions) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(regionsResource, c.ns, name, opts), &v1alpha1.Region{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeRegions) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(regionsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.RegionList{}) - return err -} - -// Patch applies the patch and returns the patched region. -func (c *FakeRegions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Region, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(regionsResource, c.ns, name, pt, data, subresources...), &v1alpha1.Region{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Region), err -} diff --git a/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_site.go b/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_site.go deleted file mode 100644 index 0f0d28d..0000000 --- a/apis/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_site.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2024 Nokia. - -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" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - v1 "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" -) - -// FakeSites implements SiteInterface -type FakeSites struct { - Fake *FakeInfraV1alpha1 - ns string -} - -var sitesResource = v1alpha1.SchemeGroupVersion.WithResource("sites") - -var sitesKind = v1alpha1.SchemeGroupVersion.WithKind("Site") - -// Get takes name of the site, and returns the corresponding site object, and an error if there is any. -func (c *FakeSites) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Site, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(sitesResource, c.ns, name), &v1alpha1.Site{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Site), err -} - -// List takes label and field selectors, and returns the list of Sites that match those selectors. -func (c *FakeSites) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.SiteList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(sitesResource, sitesKind, c.ns, opts), &v1alpha1.SiteList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.SiteList{ListMeta: obj.(*v1alpha1.SiteList).ListMeta} - for _, item := range obj.(*v1alpha1.SiteList).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 sites. -func (c *FakeSites) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(sitesResource, c.ns, opts)) - -} - -// Create takes the representation of a site and creates it. Returns the server's representation of the site, and an error, if there is any. -func (c *FakeSites) Create(ctx context.Context, site *v1alpha1.Site, opts v1.CreateOptions) (result *v1alpha1.Site, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(sitesResource, c.ns, site), &v1alpha1.Site{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Site), err -} - -// Update takes the representation of a site and updates it. Returns the server's representation of the site, and an error, if there is any. -func (c *FakeSites) Update(ctx context.Context, site *v1alpha1.Site, opts v1.UpdateOptions) (result *v1alpha1.Site, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(sitesResource, c.ns, site), &v1alpha1.Site{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Site), 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 *FakeSites) UpdateStatus(ctx context.Context, site *v1alpha1.Site, opts v1.UpdateOptions) (*v1alpha1.Site, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(sitesResource, "status", c.ns, site), &v1alpha1.Site{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Site), err -} - -// Delete takes name of the site and deletes it. Returns an error if one occurs. -func (c *FakeSites) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(sitesResource, c.ns, name, opts), &v1alpha1.Site{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeSites) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(sitesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.SiteList{}) - return err -} - -// Patch applies the patch and returns the patched site. -func (c *FakeSites) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Site, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(sitesResource, c.ns, name, pt, data, subresources...), &v1alpha1.Site{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Site), err -} diff --git a/apis/generated/clientset/versioned/typed/infra/v1alpha1/generated_expansion.go b/apis/generated/clientset/versioned/typed/infra/v1alpha1/generated_expansion.go deleted file mode 100644 index 759ff53..0000000 --- a/apis/generated/clientset/versioned/typed/infra/v1alpha1/generated_expansion.go +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -type ClusterExpansion interface{} - -type EndpointExpansion interface{} - -type EndpointSetExpansion interface{} - -type LinkExpansion interface{} - -type LinkSetExpansion interface{} - -type ModuleExpansion interface{} - -type ModuleBayExpansion interface{} - -type NodeExpansion interface{} - -type NodeGroupExpansion interface{} - -type NodeItemExpansion interface{} - -type NodeSetExpansion interface{} - -type RackExpansion interface{} - -type RegionExpansion interface{} - -type SiteExpansion interface{} diff --git a/apis/generated/clientset/versioned/typed/infra/v1alpha1/infra_client.go b/apis/generated/clientset/versioned/typed/infra/v1alpha1/infra_client.go deleted file mode 100644 index deb87a3..0000000 --- a/apis/generated/clientset/versioned/typed/infra/v1alpha1/infra_client.go +++ /dev/null @@ -1,171 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "net/http" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - rest "k8s.io/client-go/rest" -) - -type InfraV1alpha1Interface interface { - RESTClient() rest.Interface - ClustersGetter - EndpointsGetter - EndpointSetsGetter - LinksGetter - LinkSetsGetter - ModulesGetter - ModuleBaysGetter - NodesGetter - NodeGroupsGetter - NodeItemsGetter - NodeSetsGetter - RacksGetter - RegionsGetter - SitesGetter -} - -// InfraV1alpha1Client is used to interact with features provided by the infra.be.kuid.dev group. -type InfraV1alpha1Client struct { - restClient rest.Interface -} - -func (c *InfraV1alpha1Client) Clusters(namespace string) ClusterInterface { - return newClusters(c, namespace) -} - -func (c *InfraV1alpha1Client) Endpoints(namespace string) EndpointInterface { - return newEndpoints(c, namespace) -} - -func (c *InfraV1alpha1Client) EndpointSets(namespace string) EndpointSetInterface { - return newEndpointSets(c, namespace) -} - -func (c *InfraV1alpha1Client) Links(namespace string) LinkInterface { - return newLinks(c, namespace) -} - -func (c *InfraV1alpha1Client) LinkSets(namespace string) LinkSetInterface { - return newLinkSets(c, namespace) -} - -func (c *InfraV1alpha1Client) Modules(namespace string) ModuleInterface { - return newModules(c, namespace) -} - -func (c *InfraV1alpha1Client) ModuleBays(namespace string) ModuleBayInterface { - return newModuleBays(c, namespace) -} - -func (c *InfraV1alpha1Client) Nodes(namespace string) NodeInterface { - return newNodes(c, namespace) -} - -func (c *InfraV1alpha1Client) NodeGroups(namespace string) NodeGroupInterface { - return newNodeGroups(c, namespace) -} - -func (c *InfraV1alpha1Client) NodeItems(namespace string) NodeItemInterface { - return newNodeItems(c, namespace) -} - -func (c *InfraV1alpha1Client) NodeSets(namespace string) NodeSetInterface { - return newNodeSets(c, namespace) -} - -func (c *InfraV1alpha1Client) Racks(namespace string) RackInterface { - return newRacks(c, namespace) -} - -func (c *InfraV1alpha1Client) Regions(namespace string) RegionInterface { - return newRegions(c, namespace) -} - -func (c *InfraV1alpha1Client) Sites(namespace string) SiteInterface { - return newSites(c, namespace) -} - -// NewForConfig creates a new InfraV1alpha1Client for the given config. -// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), -// where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*InfraV1alpha1Client, 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 InfraV1alpha1Client 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) (*InfraV1alpha1Client, 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 &InfraV1alpha1Client{client}, nil -} - -// NewForConfigOrDie creates a new InfraV1alpha1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *InfraV1alpha1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new InfraV1alpha1Client for the given RESTClient. -func New(c rest.Interface) *InfraV1alpha1Client { - return &InfraV1alpha1Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v1alpha1.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 *InfraV1alpha1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/apis/generated/clientset/versioned/typed/infra/v1alpha1/link.go b/apis/generated/clientset/versioned/typed/infra/v1alpha1/link.go deleted file mode 100644 index 584d28d..0000000 --- a/apis/generated/clientset/versioned/typed/infra/v1alpha1/link.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// LinksGetter has a method to return a LinkInterface. -// A group's client should implement this interface. -type LinksGetter interface { - Links(namespace string) LinkInterface -} - -// LinkInterface has methods to work with Link resources. -type LinkInterface interface { - Create(ctx context.Context, link *v1alpha1.Link, opts v1.CreateOptions) (*v1alpha1.Link, error) - Update(ctx context.Context, link *v1alpha1.Link, opts v1.UpdateOptions) (*v1alpha1.Link, error) - UpdateStatus(ctx context.Context, link *v1alpha1.Link, opts v1.UpdateOptions) (*v1alpha1.Link, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.Link, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.LinkList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Link, err error) - LinkExpansion -} - -// links implements LinkInterface -type links struct { - client rest.Interface - ns string -} - -// newLinks returns a Links -func newLinks(c *InfraV1alpha1Client, namespace string) *links { - return &links{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the link, and returns the corresponding link object, and an error if there is any. -func (c *links) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Link, err error) { - result = &v1alpha1.Link{} - err = c.client.Get(). - Namespace(c.ns). - Resource("links"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Links that match those selectors. -func (c *links) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.LinkList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.LinkList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("links"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested links. -func (c *links) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("links"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a link and creates it. Returns the server's representation of the link, and an error, if there is any. -func (c *links) Create(ctx context.Context, link *v1alpha1.Link, opts v1.CreateOptions) (result *v1alpha1.Link, err error) { - result = &v1alpha1.Link{} - err = c.client.Post(). - Namespace(c.ns). - Resource("links"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(link). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a link and updates it. Returns the server's representation of the link, and an error, if there is any. -func (c *links) Update(ctx context.Context, link *v1alpha1.Link, opts v1.UpdateOptions) (result *v1alpha1.Link, err error) { - result = &v1alpha1.Link{} - err = c.client.Put(). - Namespace(c.ns). - Resource("links"). - Name(link.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(link). - 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 *links) UpdateStatus(ctx context.Context, link *v1alpha1.Link, opts v1.UpdateOptions) (result *v1alpha1.Link, err error) { - result = &v1alpha1.Link{} - err = c.client.Put(). - Namespace(c.ns). - Resource("links"). - Name(link.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(link). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the link and deletes it. Returns an error if one occurs. -func (c *links) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("links"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *links) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("links"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched link. -func (c *links) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Link, err error) { - result = &v1alpha1.Link{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("links"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/infra/v1alpha1/linkset.go b/apis/generated/clientset/versioned/typed/infra/v1alpha1/linkset.go deleted file mode 100644 index 5c363b3..0000000 --- a/apis/generated/clientset/versioned/typed/infra/v1alpha1/linkset.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// LinkSetsGetter has a method to return a LinkSetInterface. -// A group's client should implement this interface. -type LinkSetsGetter interface { - LinkSets(namespace string) LinkSetInterface -} - -// LinkSetInterface has methods to work with LinkSet resources. -type LinkSetInterface interface { - Create(ctx context.Context, linkSet *v1alpha1.LinkSet, opts v1.CreateOptions) (*v1alpha1.LinkSet, error) - Update(ctx context.Context, linkSet *v1alpha1.LinkSet, opts v1.UpdateOptions) (*v1alpha1.LinkSet, error) - UpdateStatus(ctx context.Context, linkSet *v1alpha1.LinkSet, opts v1.UpdateOptions) (*v1alpha1.LinkSet, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.LinkSet, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.LinkSetList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.LinkSet, err error) - LinkSetExpansion -} - -// linkSets implements LinkSetInterface -type linkSets struct { - client rest.Interface - ns string -} - -// newLinkSets returns a LinkSets -func newLinkSets(c *InfraV1alpha1Client, namespace string) *linkSets { - return &linkSets{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the linkSet, and returns the corresponding linkSet object, and an error if there is any. -func (c *linkSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.LinkSet, err error) { - result = &v1alpha1.LinkSet{} - err = c.client.Get(). - Namespace(c.ns). - Resource("linksets"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of LinkSets that match those selectors. -func (c *linkSets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.LinkSetList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.LinkSetList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("linksets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested linkSets. -func (c *linkSets) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("linksets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a linkSet and creates it. Returns the server's representation of the linkSet, and an error, if there is any. -func (c *linkSets) Create(ctx context.Context, linkSet *v1alpha1.LinkSet, opts v1.CreateOptions) (result *v1alpha1.LinkSet, err error) { - result = &v1alpha1.LinkSet{} - err = c.client.Post(). - Namespace(c.ns). - Resource("linksets"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(linkSet). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a linkSet and updates it. Returns the server's representation of the linkSet, and an error, if there is any. -func (c *linkSets) Update(ctx context.Context, linkSet *v1alpha1.LinkSet, opts v1.UpdateOptions) (result *v1alpha1.LinkSet, err error) { - result = &v1alpha1.LinkSet{} - err = c.client.Put(). - Namespace(c.ns). - Resource("linksets"). - Name(linkSet.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(linkSet). - 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 *linkSets) UpdateStatus(ctx context.Context, linkSet *v1alpha1.LinkSet, opts v1.UpdateOptions) (result *v1alpha1.LinkSet, err error) { - result = &v1alpha1.LinkSet{} - err = c.client.Put(). - Namespace(c.ns). - Resource("linksets"). - Name(linkSet.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(linkSet). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the linkSet and deletes it. Returns an error if one occurs. -func (c *linkSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("linksets"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *linkSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("linksets"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched linkSet. -func (c *linkSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.LinkSet, err error) { - result = &v1alpha1.LinkSet{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("linksets"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/infra/v1alpha1/module.go b/apis/generated/clientset/versioned/typed/infra/v1alpha1/module.go deleted file mode 100644 index 2cb6379..0000000 --- a/apis/generated/clientset/versioned/typed/infra/v1alpha1/module.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// ModulesGetter has a method to return a ModuleInterface. -// A group's client should implement this interface. -type ModulesGetter interface { - Modules(namespace string) ModuleInterface -} - -// ModuleInterface has methods to work with Module resources. -type ModuleInterface interface { - Create(ctx context.Context, module *v1alpha1.Module, opts v1.CreateOptions) (*v1alpha1.Module, error) - Update(ctx context.Context, module *v1alpha1.Module, opts v1.UpdateOptions) (*v1alpha1.Module, error) - UpdateStatus(ctx context.Context, module *v1alpha1.Module, opts v1.UpdateOptions) (*v1alpha1.Module, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.Module, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ModuleList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Module, err error) - ModuleExpansion -} - -// modules implements ModuleInterface -type modules struct { - client rest.Interface - ns string -} - -// newModules returns a Modules -func newModules(c *InfraV1alpha1Client, namespace string) *modules { - return &modules{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the module, and returns the corresponding module object, and an error if there is any. -func (c *modules) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Module, err error) { - result = &v1alpha1.Module{} - err = c.client.Get(). - Namespace(c.ns). - Resource("modules"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Modules that match those selectors. -func (c *modules) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ModuleList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.ModuleList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("modules"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested modules. -func (c *modules) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("modules"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a module and creates it. Returns the server's representation of the module, and an error, if there is any. -func (c *modules) Create(ctx context.Context, module *v1alpha1.Module, opts v1.CreateOptions) (result *v1alpha1.Module, err error) { - result = &v1alpha1.Module{} - err = c.client.Post(). - Namespace(c.ns). - Resource("modules"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(module). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a module and updates it. Returns the server's representation of the module, and an error, if there is any. -func (c *modules) Update(ctx context.Context, module *v1alpha1.Module, opts v1.UpdateOptions) (result *v1alpha1.Module, err error) { - result = &v1alpha1.Module{} - err = c.client.Put(). - Namespace(c.ns). - Resource("modules"). - Name(module.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(module). - 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 *modules) UpdateStatus(ctx context.Context, module *v1alpha1.Module, opts v1.UpdateOptions) (result *v1alpha1.Module, err error) { - result = &v1alpha1.Module{} - err = c.client.Put(). - Namespace(c.ns). - Resource("modules"). - Name(module.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(module). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the module and deletes it. Returns an error if one occurs. -func (c *modules) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("modules"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *modules) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("modules"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched module. -func (c *modules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Module, err error) { - result = &v1alpha1.Module{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("modules"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/infra/v1alpha1/modulebay.go b/apis/generated/clientset/versioned/typed/infra/v1alpha1/modulebay.go deleted file mode 100644 index 7dab673..0000000 --- a/apis/generated/clientset/versioned/typed/infra/v1alpha1/modulebay.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// ModuleBaysGetter has a method to return a ModuleBayInterface. -// A group's client should implement this interface. -type ModuleBaysGetter interface { - ModuleBays(namespace string) ModuleBayInterface -} - -// ModuleBayInterface has methods to work with ModuleBay resources. -type ModuleBayInterface interface { - Create(ctx context.Context, moduleBay *v1alpha1.ModuleBay, opts v1.CreateOptions) (*v1alpha1.ModuleBay, error) - Update(ctx context.Context, moduleBay *v1alpha1.ModuleBay, opts v1.UpdateOptions) (*v1alpha1.ModuleBay, error) - UpdateStatus(ctx context.Context, moduleBay *v1alpha1.ModuleBay, opts v1.UpdateOptions) (*v1alpha1.ModuleBay, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.ModuleBay, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ModuleBayList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ModuleBay, err error) - ModuleBayExpansion -} - -// moduleBays implements ModuleBayInterface -type moduleBays struct { - client rest.Interface - ns string -} - -// newModuleBays returns a ModuleBays -func newModuleBays(c *InfraV1alpha1Client, namespace string) *moduleBays { - return &moduleBays{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the moduleBay, and returns the corresponding moduleBay object, and an error if there is any. -func (c *moduleBays) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ModuleBay, err error) { - result = &v1alpha1.ModuleBay{} - err = c.client.Get(). - Namespace(c.ns). - Resource("modulebays"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ModuleBays that match those selectors. -func (c *moduleBays) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ModuleBayList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.ModuleBayList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("modulebays"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested moduleBays. -func (c *moduleBays) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("modulebays"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a moduleBay and creates it. Returns the server's representation of the moduleBay, and an error, if there is any. -func (c *moduleBays) Create(ctx context.Context, moduleBay *v1alpha1.ModuleBay, opts v1.CreateOptions) (result *v1alpha1.ModuleBay, err error) { - result = &v1alpha1.ModuleBay{} - err = c.client.Post(). - Namespace(c.ns). - Resource("modulebays"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(moduleBay). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a moduleBay and updates it. Returns the server's representation of the moduleBay, and an error, if there is any. -func (c *moduleBays) Update(ctx context.Context, moduleBay *v1alpha1.ModuleBay, opts v1.UpdateOptions) (result *v1alpha1.ModuleBay, err error) { - result = &v1alpha1.ModuleBay{} - err = c.client.Put(). - Namespace(c.ns). - Resource("modulebays"). - Name(moduleBay.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(moduleBay). - 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 *moduleBays) UpdateStatus(ctx context.Context, moduleBay *v1alpha1.ModuleBay, opts v1.UpdateOptions) (result *v1alpha1.ModuleBay, err error) { - result = &v1alpha1.ModuleBay{} - err = c.client.Put(). - Namespace(c.ns). - Resource("modulebays"). - Name(moduleBay.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(moduleBay). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the moduleBay and deletes it. Returns an error if one occurs. -func (c *moduleBays) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("modulebays"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *moduleBays) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("modulebays"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched moduleBay. -func (c *moduleBays) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ModuleBay, err error) { - result = &v1alpha1.ModuleBay{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("modulebays"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/infra/v1alpha1/node.go b/apis/generated/clientset/versioned/typed/infra/v1alpha1/node.go deleted file mode 100644 index fe01bad..0000000 --- a/apis/generated/clientset/versioned/typed/infra/v1alpha1/node.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// NodesGetter has a method to return a NodeInterface. -// A group's client should implement this interface. -type NodesGetter interface { - Nodes(namespace string) NodeInterface -} - -// NodeInterface has methods to work with Node resources. -type NodeInterface interface { - Create(ctx context.Context, node *v1alpha1.Node, opts v1.CreateOptions) (*v1alpha1.Node, error) - Update(ctx context.Context, node *v1alpha1.Node, opts v1.UpdateOptions) (*v1alpha1.Node, error) - UpdateStatus(ctx context.Context, node *v1alpha1.Node, opts v1.UpdateOptions) (*v1alpha1.Node, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.Node, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.NodeList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Node, err error) - NodeExpansion -} - -// nodes implements NodeInterface -type nodes struct { - client rest.Interface - ns string -} - -// newNodes returns a Nodes -func newNodes(c *InfraV1alpha1Client, namespace string) *nodes { - return &nodes{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the node, and returns the corresponding node object, and an error if there is any. -func (c *nodes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Node, err error) { - result = &v1alpha1.Node{} - err = c.client.Get(). - Namespace(c.ns). - Resource("nodes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Nodes that match those selectors. -func (c *nodes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NodeList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.NodeList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("nodes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested nodes. -func (c *nodes) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("nodes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a node and creates it. Returns the server's representation of the node, and an error, if there is any. -func (c *nodes) Create(ctx context.Context, node *v1alpha1.Node, opts v1.CreateOptions) (result *v1alpha1.Node, err error) { - result = &v1alpha1.Node{} - err = c.client.Post(). - Namespace(c.ns). - Resource("nodes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(node). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a node and updates it. Returns the server's representation of the node, and an error, if there is any. -func (c *nodes) Update(ctx context.Context, node *v1alpha1.Node, opts v1.UpdateOptions) (result *v1alpha1.Node, err error) { - result = &v1alpha1.Node{} - err = c.client.Put(). - Namespace(c.ns). - Resource("nodes"). - Name(node.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(node). - 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 *nodes) UpdateStatus(ctx context.Context, node *v1alpha1.Node, opts v1.UpdateOptions) (result *v1alpha1.Node, err error) { - result = &v1alpha1.Node{} - err = c.client.Put(). - Namespace(c.ns). - Resource("nodes"). - Name(node.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(node). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the node and deletes it. Returns an error if one occurs. -func (c *nodes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("nodes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *nodes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("nodes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched node. -func (c *nodes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Node, err error) { - result = &v1alpha1.Node{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("nodes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/infra/v1alpha1/nodegroup.go b/apis/generated/clientset/versioned/typed/infra/v1alpha1/nodegroup.go deleted file mode 100644 index 374781e..0000000 --- a/apis/generated/clientset/versioned/typed/infra/v1alpha1/nodegroup.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// NodeGroupsGetter has a method to return a NodeGroupInterface. -// A group's client should implement this interface. -type NodeGroupsGetter interface { - NodeGroups(namespace string) NodeGroupInterface -} - -// NodeGroupInterface has methods to work with NodeGroup resources. -type NodeGroupInterface interface { - Create(ctx context.Context, nodeGroup *v1alpha1.NodeGroup, opts v1.CreateOptions) (*v1alpha1.NodeGroup, error) - Update(ctx context.Context, nodeGroup *v1alpha1.NodeGroup, opts v1.UpdateOptions) (*v1alpha1.NodeGroup, error) - UpdateStatus(ctx context.Context, nodeGroup *v1alpha1.NodeGroup, opts v1.UpdateOptions) (*v1alpha1.NodeGroup, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.NodeGroup, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.NodeGroupList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.NodeGroup, err error) - NodeGroupExpansion -} - -// nodeGroups implements NodeGroupInterface -type nodeGroups struct { - client rest.Interface - ns string -} - -// newNodeGroups returns a NodeGroups -func newNodeGroups(c *InfraV1alpha1Client, namespace string) *nodeGroups { - return &nodeGroups{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the nodeGroup, and returns the corresponding nodeGroup object, and an error if there is any. -func (c *nodeGroups) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NodeGroup, err error) { - result = &v1alpha1.NodeGroup{} - err = c.client.Get(). - Namespace(c.ns). - Resource("nodegroups"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of NodeGroups that match those selectors. -func (c *nodeGroups) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NodeGroupList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.NodeGroupList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("nodegroups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested nodeGroups. -func (c *nodeGroups) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("nodegroups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a nodeGroup and creates it. Returns the server's representation of the nodeGroup, and an error, if there is any. -func (c *nodeGroups) Create(ctx context.Context, nodeGroup *v1alpha1.NodeGroup, opts v1.CreateOptions) (result *v1alpha1.NodeGroup, err error) { - result = &v1alpha1.NodeGroup{} - err = c.client.Post(). - Namespace(c.ns). - Resource("nodegroups"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(nodeGroup). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a nodeGroup and updates it. Returns the server's representation of the nodeGroup, and an error, if there is any. -func (c *nodeGroups) Update(ctx context.Context, nodeGroup *v1alpha1.NodeGroup, opts v1.UpdateOptions) (result *v1alpha1.NodeGroup, err error) { - result = &v1alpha1.NodeGroup{} - err = c.client.Put(). - Namespace(c.ns). - Resource("nodegroups"). - Name(nodeGroup.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(nodeGroup). - 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 *nodeGroups) UpdateStatus(ctx context.Context, nodeGroup *v1alpha1.NodeGroup, opts v1.UpdateOptions) (result *v1alpha1.NodeGroup, err error) { - result = &v1alpha1.NodeGroup{} - err = c.client.Put(). - Namespace(c.ns). - Resource("nodegroups"). - Name(nodeGroup.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(nodeGroup). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the nodeGroup and deletes it. Returns an error if one occurs. -func (c *nodeGroups) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("nodegroups"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *nodeGroups) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("nodegroups"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched nodeGroup. -func (c *nodeGroups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.NodeGroup, err error) { - result = &v1alpha1.NodeGroup{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("nodegroups"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/infra/v1alpha1/nodeitem.go b/apis/generated/clientset/versioned/typed/infra/v1alpha1/nodeitem.go deleted file mode 100644 index ab395a6..0000000 --- a/apis/generated/clientset/versioned/typed/infra/v1alpha1/nodeitem.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// NodeItemsGetter has a method to return a NodeItemInterface. -// A group's client should implement this interface. -type NodeItemsGetter interface { - NodeItems(namespace string) NodeItemInterface -} - -// NodeItemInterface has methods to work with NodeItem resources. -type NodeItemInterface interface { - Create(ctx context.Context, nodeItem *v1alpha1.NodeItem, opts v1.CreateOptions) (*v1alpha1.NodeItem, error) - Update(ctx context.Context, nodeItem *v1alpha1.NodeItem, opts v1.UpdateOptions) (*v1alpha1.NodeItem, error) - UpdateStatus(ctx context.Context, nodeItem *v1alpha1.NodeItem, opts v1.UpdateOptions) (*v1alpha1.NodeItem, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.NodeItem, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.NodeItemList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.NodeItem, err error) - NodeItemExpansion -} - -// nodeItems implements NodeItemInterface -type nodeItems struct { - client rest.Interface - ns string -} - -// newNodeItems returns a NodeItems -func newNodeItems(c *InfraV1alpha1Client, namespace string) *nodeItems { - return &nodeItems{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the nodeItem, and returns the corresponding nodeItem object, and an error if there is any. -func (c *nodeItems) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NodeItem, err error) { - result = &v1alpha1.NodeItem{} - err = c.client.Get(). - Namespace(c.ns). - Resource("nodeitems"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of NodeItems that match those selectors. -func (c *nodeItems) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NodeItemList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.NodeItemList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("nodeitems"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested nodeItems. -func (c *nodeItems) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("nodeitems"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a nodeItem and creates it. Returns the server's representation of the nodeItem, and an error, if there is any. -func (c *nodeItems) Create(ctx context.Context, nodeItem *v1alpha1.NodeItem, opts v1.CreateOptions) (result *v1alpha1.NodeItem, err error) { - result = &v1alpha1.NodeItem{} - err = c.client.Post(). - Namespace(c.ns). - Resource("nodeitems"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(nodeItem). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a nodeItem and updates it. Returns the server's representation of the nodeItem, and an error, if there is any. -func (c *nodeItems) Update(ctx context.Context, nodeItem *v1alpha1.NodeItem, opts v1.UpdateOptions) (result *v1alpha1.NodeItem, err error) { - result = &v1alpha1.NodeItem{} - err = c.client.Put(). - Namespace(c.ns). - Resource("nodeitems"). - Name(nodeItem.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(nodeItem). - 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 *nodeItems) UpdateStatus(ctx context.Context, nodeItem *v1alpha1.NodeItem, opts v1.UpdateOptions) (result *v1alpha1.NodeItem, err error) { - result = &v1alpha1.NodeItem{} - err = c.client.Put(). - Namespace(c.ns). - Resource("nodeitems"). - Name(nodeItem.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(nodeItem). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the nodeItem and deletes it. Returns an error if one occurs. -func (c *nodeItems) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("nodeitems"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *nodeItems) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("nodeitems"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched nodeItem. -func (c *nodeItems) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.NodeItem, err error) { - result = &v1alpha1.NodeItem{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("nodeitems"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/infra/v1alpha1/nodeset.go b/apis/generated/clientset/versioned/typed/infra/v1alpha1/nodeset.go deleted file mode 100644 index a477647..0000000 --- a/apis/generated/clientset/versioned/typed/infra/v1alpha1/nodeset.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// NodeSetsGetter has a method to return a NodeSetInterface. -// A group's client should implement this interface. -type NodeSetsGetter interface { - NodeSets(namespace string) NodeSetInterface -} - -// NodeSetInterface has methods to work with NodeSet resources. -type NodeSetInterface interface { - Create(ctx context.Context, nodeSet *v1alpha1.NodeSet, opts v1.CreateOptions) (*v1alpha1.NodeSet, error) - Update(ctx context.Context, nodeSet *v1alpha1.NodeSet, opts v1.UpdateOptions) (*v1alpha1.NodeSet, error) - UpdateStatus(ctx context.Context, nodeSet *v1alpha1.NodeSet, opts v1.UpdateOptions) (*v1alpha1.NodeSet, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.NodeSet, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.NodeSetList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.NodeSet, err error) - NodeSetExpansion -} - -// nodeSets implements NodeSetInterface -type nodeSets struct { - client rest.Interface - ns string -} - -// newNodeSets returns a NodeSets -func newNodeSets(c *InfraV1alpha1Client, namespace string) *nodeSets { - return &nodeSets{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the nodeSet, and returns the corresponding nodeSet object, and an error if there is any. -func (c *nodeSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NodeSet, err error) { - result = &v1alpha1.NodeSet{} - err = c.client.Get(). - Namespace(c.ns). - Resource("nodesets"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of NodeSets that match those selectors. -func (c *nodeSets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NodeSetList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.NodeSetList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("nodesets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested nodeSets. -func (c *nodeSets) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("nodesets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a nodeSet and creates it. Returns the server's representation of the nodeSet, and an error, if there is any. -func (c *nodeSets) Create(ctx context.Context, nodeSet *v1alpha1.NodeSet, opts v1.CreateOptions) (result *v1alpha1.NodeSet, err error) { - result = &v1alpha1.NodeSet{} - err = c.client.Post(). - Namespace(c.ns). - Resource("nodesets"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(nodeSet). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a nodeSet and updates it. Returns the server's representation of the nodeSet, and an error, if there is any. -func (c *nodeSets) Update(ctx context.Context, nodeSet *v1alpha1.NodeSet, opts v1.UpdateOptions) (result *v1alpha1.NodeSet, err error) { - result = &v1alpha1.NodeSet{} - err = c.client.Put(). - Namespace(c.ns). - Resource("nodesets"). - Name(nodeSet.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(nodeSet). - 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 *nodeSets) UpdateStatus(ctx context.Context, nodeSet *v1alpha1.NodeSet, opts v1.UpdateOptions) (result *v1alpha1.NodeSet, err error) { - result = &v1alpha1.NodeSet{} - err = c.client.Put(). - Namespace(c.ns). - Resource("nodesets"). - Name(nodeSet.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(nodeSet). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the nodeSet and deletes it. Returns an error if one occurs. -func (c *nodeSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("nodesets"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *nodeSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("nodesets"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched nodeSet. -func (c *nodeSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.NodeSet, err error) { - result = &v1alpha1.NodeSet{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("nodesets"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/infra/v1alpha1/rack.go b/apis/generated/clientset/versioned/typed/infra/v1alpha1/rack.go deleted file mode 100644 index 8157e6d..0000000 --- a/apis/generated/clientset/versioned/typed/infra/v1alpha1/rack.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// RacksGetter has a method to return a RackInterface. -// A group's client should implement this interface. -type RacksGetter interface { - Racks(namespace string) RackInterface -} - -// RackInterface has methods to work with Rack resources. -type RackInterface interface { - Create(ctx context.Context, rack *v1alpha1.Rack, opts v1.CreateOptions) (*v1alpha1.Rack, error) - Update(ctx context.Context, rack *v1alpha1.Rack, opts v1.UpdateOptions) (*v1alpha1.Rack, error) - UpdateStatus(ctx context.Context, rack *v1alpha1.Rack, opts v1.UpdateOptions) (*v1alpha1.Rack, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.Rack, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.RackList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Rack, err error) - RackExpansion -} - -// racks implements RackInterface -type racks struct { - client rest.Interface - ns string -} - -// newRacks returns a Racks -func newRacks(c *InfraV1alpha1Client, namespace string) *racks { - return &racks{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the rack, and returns the corresponding rack object, and an error if there is any. -func (c *racks) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Rack, err error) { - result = &v1alpha1.Rack{} - err = c.client.Get(). - Namespace(c.ns). - Resource("racks"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Racks that match those selectors. -func (c *racks) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.RackList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.RackList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("racks"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested racks. -func (c *racks) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("racks"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a rack and creates it. Returns the server's representation of the rack, and an error, if there is any. -func (c *racks) Create(ctx context.Context, rack *v1alpha1.Rack, opts v1.CreateOptions) (result *v1alpha1.Rack, err error) { - result = &v1alpha1.Rack{} - err = c.client.Post(). - Namespace(c.ns). - Resource("racks"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(rack). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a rack and updates it. Returns the server's representation of the rack, and an error, if there is any. -func (c *racks) Update(ctx context.Context, rack *v1alpha1.Rack, opts v1.UpdateOptions) (result *v1alpha1.Rack, err error) { - result = &v1alpha1.Rack{} - err = c.client.Put(). - Namespace(c.ns). - Resource("racks"). - Name(rack.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(rack). - 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 *racks) UpdateStatus(ctx context.Context, rack *v1alpha1.Rack, opts v1.UpdateOptions) (result *v1alpha1.Rack, err error) { - result = &v1alpha1.Rack{} - err = c.client.Put(). - Namespace(c.ns). - Resource("racks"). - Name(rack.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(rack). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the rack and deletes it. Returns an error if one occurs. -func (c *racks) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("racks"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *racks) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("racks"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched rack. -func (c *racks) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Rack, err error) { - result = &v1alpha1.Rack{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("racks"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/infra/v1alpha1/region.go b/apis/generated/clientset/versioned/typed/infra/v1alpha1/region.go deleted file mode 100644 index 583a23b..0000000 --- a/apis/generated/clientset/versioned/typed/infra/v1alpha1/region.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// RegionsGetter has a method to return a RegionInterface. -// A group's client should implement this interface. -type RegionsGetter interface { - Regions(namespace string) RegionInterface -} - -// RegionInterface has methods to work with Region resources. -type RegionInterface interface { - Create(ctx context.Context, region *v1alpha1.Region, opts v1.CreateOptions) (*v1alpha1.Region, error) - Update(ctx context.Context, region *v1alpha1.Region, opts v1.UpdateOptions) (*v1alpha1.Region, error) - UpdateStatus(ctx context.Context, region *v1alpha1.Region, opts v1.UpdateOptions) (*v1alpha1.Region, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.Region, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.RegionList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Region, err error) - RegionExpansion -} - -// regions implements RegionInterface -type regions struct { - client rest.Interface - ns string -} - -// newRegions returns a Regions -func newRegions(c *InfraV1alpha1Client, namespace string) *regions { - return ®ions{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the region, and returns the corresponding region object, and an error if there is any. -func (c *regions) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Region, err error) { - result = &v1alpha1.Region{} - err = c.client.Get(). - Namespace(c.ns). - Resource("regions"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Regions that match those selectors. -func (c *regions) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.RegionList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.RegionList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("regions"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested regions. -func (c *regions) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("regions"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a region and creates it. Returns the server's representation of the region, and an error, if there is any. -func (c *regions) Create(ctx context.Context, region *v1alpha1.Region, opts v1.CreateOptions) (result *v1alpha1.Region, err error) { - result = &v1alpha1.Region{} - err = c.client.Post(). - Namespace(c.ns). - Resource("regions"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(region). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a region and updates it. Returns the server's representation of the region, and an error, if there is any. -func (c *regions) Update(ctx context.Context, region *v1alpha1.Region, opts v1.UpdateOptions) (result *v1alpha1.Region, err error) { - result = &v1alpha1.Region{} - err = c.client.Put(). - Namespace(c.ns). - Resource("regions"). - Name(region.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(region). - 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 *regions) UpdateStatus(ctx context.Context, region *v1alpha1.Region, opts v1.UpdateOptions) (result *v1alpha1.Region, err error) { - result = &v1alpha1.Region{} - err = c.client.Put(). - Namespace(c.ns). - Resource("regions"). - Name(region.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(region). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the region and deletes it. Returns an error if one occurs. -func (c *regions) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("regions"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *regions) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("regions"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched region. -func (c *regions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Region, err error) { - result = &v1alpha1.Region{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("regions"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/infra/v1alpha1/site.go b/apis/generated/clientset/versioned/typed/infra/v1alpha1/site.go deleted file mode 100644 index b9e2522..0000000 --- a/apis/generated/clientset/versioned/typed/infra/v1alpha1/site.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// SitesGetter has a method to return a SiteInterface. -// A group's client should implement this interface. -type SitesGetter interface { - Sites(namespace string) SiteInterface -} - -// SiteInterface has methods to work with Site resources. -type SiteInterface interface { - Create(ctx context.Context, site *v1alpha1.Site, opts v1.CreateOptions) (*v1alpha1.Site, error) - Update(ctx context.Context, site *v1alpha1.Site, opts v1.UpdateOptions) (*v1alpha1.Site, error) - UpdateStatus(ctx context.Context, site *v1alpha1.Site, opts v1.UpdateOptions) (*v1alpha1.Site, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.Site, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.SiteList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Site, err error) - SiteExpansion -} - -// sites implements SiteInterface -type sites struct { - client rest.Interface - ns string -} - -// newSites returns a Sites -func newSites(c *InfraV1alpha1Client, namespace string) *sites { - return &sites{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the site, and returns the corresponding site object, and an error if there is any. -func (c *sites) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Site, err error) { - result = &v1alpha1.Site{} - err = c.client.Get(). - Namespace(c.ns). - Resource("sites"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Sites that match those selectors. -func (c *sites) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.SiteList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.SiteList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("sites"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested sites. -func (c *sites) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("sites"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a site and creates it. Returns the server's representation of the site, and an error, if there is any. -func (c *sites) Create(ctx context.Context, site *v1alpha1.Site, opts v1.CreateOptions) (result *v1alpha1.Site, err error) { - result = &v1alpha1.Site{} - err = c.client.Post(). - Namespace(c.ns). - Resource("sites"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(site). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a site and updates it. Returns the server's representation of the site, and an error, if there is any. -func (c *sites) Update(ctx context.Context, site *v1alpha1.Site, opts v1.UpdateOptions) (result *v1alpha1.Site, err error) { - result = &v1alpha1.Site{} - err = c.client.Put(). - Namespace(c.ns). - Resource("sites"). - Name(site.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(site). - 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 *sites) UpdateStatus(ctx context.Context, site *v1alpha1.Site, opts v1.UpdateOptions) (result *v1alpha1.Site, err error) { - result = &v1alpha1.Site{} - err = c.client.Put(). - Namespace(c.ns). - Resource("sites"). - Name(site.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(site). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the site and deletes it. Returns an error if one occurs. -func (c *sites) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("sites"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *sites) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("sites"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched site. -func (c *sites) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Site, err error) { - result = &v1alpha1.Site{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("sites"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/ipam/v1alpha1/doc.go b/apis/generated/clientset/versioned/typed/ipam/v1alpha1/doc.go deleted file mode 100644 index cda7d5a..0000000 --- a/apis/generated/clientset/versioned/typed/ipam/v1alpha1/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 diff --git a/apis/generated/clientset/versioned/typed/ipam/v1alpha1/fake/doc.go b/apis/generated/clientset/versioned/typed/ipam/v1alpha1/fake/doc.go deleted file mode 100644 index d4601f1..0000000 --- a/apis/generated/clientset/versioned/typed/ipam/v1alpha1/fake/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Copyright 2024 Nokia. - -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/apis/generated/clientset/versioned/typed/ipam/v1alpha1/fake/fake_ipam_client.go b/apis/generated/clientset/versioned/typed/ipam/v1alpha1/fake/fake_ipam_client.go deleted file mode 100644 index e3b8720..0000000 --- a/apis/generated/clientset/versioned/typed/ipam/v1alpha1/fake/fake_ipam_client.go +++ /dev/null @@ -1,47 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 ( - v1alpha1 "github.com/kuidio/kuid/apis/generated/clientset/versioned/typed/ipam/v1alpha1" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakeIpamV1alpha1 struct { - *testing.Fake -} - -func (c *FakeIpamV1alpha1) IPClaims(namespace string) v1alpha1.IPClaimInterface { - return &FakeIPClaims{c, namespace} -} - -func (c *FakeIpamV1alpha1) IPEntries(namespace string) v1alpha1.IPEntryInterface { - return &FakeIPEntries{c, namespace} -} - -func (c *FakeIpamV1alpha1) IPIndexes(namespace string) v1alpha1.IPIndexInterface { - return &FakeIPIndexes{c, namespace} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeIpamV1alpha1) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/apis/generated/clientset/versioned/typed/ipam/v1alpha1/fake/fake_ipclaim.go b/apis/generated/clientset/versioned/typed/ipam/v1alpha1/fake/fake_ipclaim.go deleted file mode 100644 index 38dc7d1..0000000 --- a/apis/generated/clientset/versioned/typed/ipam/v1alpha1/fake/fake_ipclaim.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2024 Nokia. - -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" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" - v1 "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" -) - -// FakeIPClaims implements IPClaimInterface -type FakeIPClaims struct { - Fake *FakeIpamV1alpha1 - ns string -} - -var ipclaimsResource = v1alpha1.SchemeGroupVersion.WithResource("ipclaims") - -var ipclaimsKind = v1alpha1.SchemeGroupVersion.WithKind("IPClaim") - -// Get takes name of the iPClaim, and returns the corresponding iPClaim object, and an error if there is any. -func (c *FakeIPClaims) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.IPClaim, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(ipclaimsResource, c.ns, name), &v1alpha1.IPClaim{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.IPClaim), err -} - -// List takes label and field selectors, and returns the list of IPClaims that match those selectors. -func (c *FakeIPClaims) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.IPClaimList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(ipclaimsResource, ipclaimsKind, c.ns, opts), &v1alpha1.IPClaimList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.IPClaimList{ListMeta: obj.(*v1alpha1.IPClaimList).ListMeta} - for _, item := range obj.(*v1alpha1.IPClaimList).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 iPClaims. -func (c *FakeIPClaims) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(ipclaimsResource, c.ns, opts)) - -} - -// Create takes the representation of a iPClaim and creates it. Returns the server's representation of the iPClaim, and an error, if there is any. -func (c *FakeIPClaims) Create(ctx context.Context, iPClaim *v1alpha1.IPClaim, opts v1.CreateOptions) (result *v1alpha1.IPClaim, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(ipclaimsResource, c.ns, iPClaim), &v1alpha1.IPClaim{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.IPClaim), err -} - -// Update takes the representation of a iPClaim and updates it. Returns the server's representation of the iPClaim, and an error, if there is any. -func (c *FakeIPClaims) Update(ctx context.Context, iPClaim *v1alpha1.IPClaim, opts v1.UpdateOptions) (result *v1alpha1.IPClaim, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(ipclaimsResource, c.ns, iPClaim), &v1alpha1.IPClaim{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.IPClaim), 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 *FakeIPClaims) UpdateStatus(ctx context.Context, iPClaim *v1alpha1.IPClaim, opts v1.UpdateOptions) (*v1alpha1.IPClaim, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(ipclaimsResource, "status", c.ns, iPClaim), &v1alpha1.IPClaim{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.IPClaim), err -} - -// Delete takes name of the iPClaim and deletes it. Returns an error if one occurs. -func (c *FakeIPClaims) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(ipclaimsResource, c.ns, name, opts), &v1alpha1.IPClaim{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeIPClaims) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(ipclaimsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.IPClaimList{}) - return err -} - -// Patch applies the patch and returns the patched iPClaim. -func (c *FakeIPClaims) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IPClaim, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(ipclaimsResource, c.ns, name, pt, data, subresources...), &v1alpha1.IPClaim{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.IPClaim), err -} diff --git a/apis/generated/clientset/versioned/typed/ipam/v1alpha1/fake/fake_ipentry.go b/apis/generated/clientset/versioned/typed/ipam/v1alpha1/fake/fake_ipentry.go deleted file mode 100644 index 61fd86d..0000000 --- a/apis/generated/clientset/versioned/typed/ipam/v1alpha1/fake/fake_ipentry.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2024 Nokia. - -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" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" - v1 "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" -) - -// FakeIPEntries implements IPEntryInterface -type FakeIPEntries struct { - Fake *FakeIpamV1alpha1 - ns string -} - -var ipentriesResource = v1alpha1.SchemeGroupVersion.WithResource("ipentries") - -var ipentriesKind = v1alpha1.SchemeGroupVersion.WithKind("IPEntry") - -// Get takes name of the iPEntry, and returns the corresponding iPEntry object, and an error if there is any. -func (c *FakeIPEntries) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.IPEntry, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(ipentriesResource, c.ns, name), &v1alpha1.IPEntry{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.IPEntry), err -} - -// List takes label and field selectors, and returns the list of IPEntries that match those selectors. -func (c *FakeIPEntries) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.IPEntryList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(ipentriesResource, ipentriesKind, c.ns, opts), &v1alpha1.IPEntryList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.IPEntryList{ListMeta: obj.(*v1alpha1.IPEntryList).ListMeta} - for _, item := range obj.(*v1alpha1.IPEntryList).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 iPEntries. -func (c *FakeIPEntries) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(ipentriesResource, c.ns, opts)) - -} - -// Create takes the representation of a iPEntry and creates it. Returns the server's representation of the iPEntry, and an error, if there is any. -func (c *FakeIPEntries) Create(ctx context.Context, iPEntry *v1alpha1.IPEntry, opts v1.CreateOptions) (result *v1alpha1.IPEntry, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(ipentriesResource, c.ns, iPEntry), &v1alpha1.IPEntry{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.IPEntry), err -} - -// Update takes the representation of a iPEntry and updates it. Returns the server's representation of the iPEntry, and an error, if there is any. -func (c *FakeIPEntries) Update(ctx context.Context, iPEntry *v1alpha1.IPEntry, opts v1.UpdateOptions) (result *v1alpha1.IPEntry, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(ipentriesResource, c.ns, iPEntry), &v1alpha1.IPEntry{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.IPEntry), 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 *FakeIPEntries) UpdateStatus(ctx context.Context, iPEntry *v1alpha1.IPEntry, opts v1.UpdateOptions) (*v1alpha1.IPEntry, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(ipentriesResource, "status", c.ns, iPEntry), &v1alpha1.IPEntry{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.IPEntry), err -} - -// Delete takes name of the iPEntry and deletes it. Returns an error if one occurs. -func (c *FakeIPEntries) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(ipentriesResource, c.ns, name, opts), &v1alpha1.IPEntry{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeIPEntries) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(ipentriesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.IPEntryList{}) - return err -} - -// Patch applies the patch and returns the patched iPEntry. -func (c *FakeIPEntries) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IPEntry, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(ipentriesResource, c.ns, name, pt, data, subresources...), &v1alpha1.IPEntry{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.IPEntry), err -} diff --git a/apis/generated/clientset/versioned/typed/ipam/v1alpha1/fake/fake_ipindex.go b/apis/generated/clientset/versioned/typed/ipam/v1alpha1/fake/fake_ipindex.go deleted file mode 100644 index 9d3b491..0000000 --- a/apis/generated/clientset/versioned/typed/ipam/v1alpha1/fake/fake_ipindex.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2024 Nokia. - -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" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" - v1 "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" -) - -// FakeIPIndexes implements IPIndexInterface -type FakeIPIndexes struct { - Fake *FakeIpamV1alpha1 - ns string -} - -var ipindexesResource = v1alpha1.SchemeGroupVersion.WithResource("ipindexes") - -var ipindexesKind = v1alpha1.SchemeGroupVersion.WithKind("IPIndex") - -// Get takes name of the iPIndex, and returns the corresponding iPIndex object, and an error if there is any. -func (c *FakeIPIndexes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.IPIndex, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(ipindexesResource, c.ns, name), &v1alpha1.IPIndex{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.IPIndex), err -} - -// List takes label and field selectors, and returns the list of IPIndexes that match those selectors. -func (c *FakeIPIndexes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.IPIndexList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(ipindexesResource, ipindexesKind, c.ns, opts), &v1alpha1.IPIndexList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.IPIndexList{ListMeta: obj.(*v1alpha1.IPIndexList).ListMeta} - for _, item := range obj.(*v1alpha1.IPIndexList).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 iPIndexes. -func (c *FakeIPIndexes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(ipindexesResource, c.ns, opts)) - -} - -// Create takes the representation of a iPIndex and creates it. Returns the server's representation of the iPIndex, and an error, if there is any. -func (c *FakeIPIndexes) Create(ctx context.Context, iPIndex *v1alpha1.IPIndex, opts v1.CreateOptions) (result *v1alpha1.IPIndex, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(ipindexesResource, c.ns, iPIndex), &v1alpha1.IPIndex{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.IPIndex), err -} - -// Update takes the representation of a iPIndex and updates it. Returns the server's representation of the iPIndex, and an error, if there is any. -func (c *FakeIPIndexes) Update(ctx context.Context, iPIndex *v1alpha1.IPIndex, opts v1.UpdateOptions) (result *v1alpha1.IPIndex, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(ipindexesResource, c.ns, iPIndex), &v1alpha1.IPIndex{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.IPIndex), 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 *FakeIPIndexes) UpdateStatus(ctx context.Context, iPIndex *v1alpha1.IPIndex, opts v1.UpdateOptions) (*v1alpha1.IPIndex, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(ipindexesResource, "status", c.ns, iPIndex), &v1alpha1.IPIndex{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.IPIndex), err -} - -// Delete takes name of the iPIndex and deletes it. Returns an error if one occurs. -func (c *FakeIPIndexes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(ipindexesResource, c.ns, name, opts), &v1alpha1.IPIndex{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeIPIndexes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(ipindexesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.IPIndexList{}) - return err -} - -// Patch applies the patch and returns the patched iPIndex. -func (c *FakeIPIndexes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IPIndex, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(ipindexesResource, c.ns, name, pt, data, subresources...), &v1alpha1.IPIndex{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.IPIndex), err -} diff --git a/apis/generated/clientset/versioned/typed/ipam/v1alpha1/generated_expansion.go b/apis/generated/clientset/versioned/typed/ipam/v1alpha1/generated_expansion.go deleted file mode 100644 index fbe21ea..0000000 --- a/apis/generated/clientset/versioned/typed/ipam/v1alpha1/generated_expansion.go +++ /dev/null @@ -1,24 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -type IPClaimExpansion interface{} - -type IPEntryExpansion interface{} - -type IPIndexExpansion interface{} diff --git a/apis/generated/clientset/versioned/typed/ipam/v1alpha1/ipam_client.go b/apis/generated/clientset/versioned/typed/ipam/v1alpha1/ipam_client.go deleted file mode 100644 index f2e52ab..0000000 --- a/apis/generated/clientset/versioned/typed/ipam/v1alpha1/ipam_client.go +++ /dev/null @@ -1,116 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "net/http" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" - "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - rest "k8s.io/client-go/rest" -) - -type IpamV1alpha1Interface interface { - RESTClient() rest.Interface - IPClaimsGetter - IPEntriesGetter - IPIndexesGetter -} - -// IpamV1alpha1Client is used to interact with features provided by the ipam.be.kuid.dev group. -type IpamV1alpha1Client struct { - restClient rest.Interface -} - -func (c *IpamV1alpha1Client) IPClaims(namespace string) IPClaimInterface { - return newIPClaims(c, namespace) -} - -func (c *IpamV1alpha1Client) IPEntries(namespace string) IPEntryInterface { - return newIPEntries(c, namespace) -} - -func (c *IpamV1alpha1Client) IPIndexes(namespace string) IPIndexInterface { - return newIPIndexes(c, namespace) -} - -// NewForConfig creates a new IpamV1alpha1Client for the given config. -// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), -// where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*IpamV1alpha1Client, 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 IpamV1alpha1Client 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) (*IpamV1alpha1Client, 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 &IpamV1alpha1Client{client}, nil -} - -// NewForConfigOrDie creates a new IpamV1alpha1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *IpamV1alpha1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new IpamV1alpha1Client for the given RESTClient. -func New(c rest.Interface) *IpamV1alpha1Client { - return &IpamV1alpha1Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v1alpha1.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 *IpamV1alpha1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/apis/generated/clientset/versioned/typed/ipam/v1alpha1/ipclaim.go b/apis/generated/clientset/versioned/typed/ipam/v1alpha1/ipclaim.go deleted file mode 100644 index 68f53f0..0000000 --- a/apis/generated/clientset/versioned/typed/ipam/v1alpha1/ipclaim.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// IPClaimsGetter has a method to return a IPClaimInterface. -// A group's client should implement this interface. -type IPClaimsGetter interface { - IPClaims(namespace string) IPClaimInterface -} - -// IPClaimInterface has methods to work with IPClaim resources. -type IPClaimInterface interface { - Create(ctx context.Context, iPClaim *v1alpha1.IPClaim, opts v1.CreateOptions) (*v1alpha1.IPClaim, error) - Update(ctx context.Context, iPClaim *v1alpha1.IPClaim, opts v1.UpdateOptions) (*v1alpha1.IPClaim, error) - UpdateStatus(ctx context.Context, iPClaim *v1alpha1.IPClaim, opts v1.UpdateOptions) (*v1alpha1.IPClaim, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.IPClaim, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.IPClaimList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IPClaim, err error) - IPClaimExpansion -} - -// iPClaims implements IPClaimInterface -type iPClaims struct { - client rest.Interface - ns string -} - -// newIPClaims returns a IPClaims -func newIPClaims(c *IpamV1alpha1Client, namespace string) *iPClaims { - return &iPClaims{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the iPClaim, and returns the corresponding iPClaim object, and an error if there is any. -func (c *iPClaims) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.IPClaim, err error) { - result = &v1alpha1.IPClaim{} - err = c.client.Get(). - Namespace(c.ns). - Resource("ipclaims"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of IPClaims that match those selectors. -func (c *iPClaims) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.IPClaimList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.IPClaimList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("ipclaims"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested iPClaims. -func (c *iPClaims) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("ipclaims"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a iPClaim and creates it. Returns the server's representation of the iPClaim, and an error, if there is any. -func (c *iPClaims) Create(ctx context.Context, iPClaim *v1alpha1.IPClaim, opts v1.CreateOptions) (result *v1alpha1.IPClaim, err error) { - result = &v1alpha1.IPClaim{} - err = c.client.Post(). - Namespace(c.ns). - Resource("ipclaims"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(iPClaim). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a iPClaim and updates it. Returns the server's representation of the iPClaim, and an error, if there is any. -func (c *iPClaims) Update(ctx context.Context, iPClaim *v1alpha1.IPClaim, opts v1.UpdateOptions) (result *v1alpha1.IPClaim, err error) { - result = &v1alpha1.IPClaim{} - err = c.client.Put(). - Namespace(c.ns). - Resource("ipclaims"). - Name(iPClaim.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(iPClaim). - 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 *iPClaims) UpdateStatus(ctx context.Context, iPClaim *v1alpha1.IPClaim, opts v1.UpdateOptions) (result *v1alpha1.IPClaim, err error) { - result = &v1alpha1.IPClaim{} - err = c.client.Put(). - Namespace(c.ns). - Resource("ipclaims"). - Name(iPClaim.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(iPClaim). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the iPClaim and deletes it. Returns an error if one occurs. -func (c *iPClaims) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("ipclaims"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *iPClaims) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("ipclaims"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched iPClaim. -func (c *iPClaims) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IPClaim, err error) { - result = &v1alpha1.IPClaim{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("ipclaims"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/ipam/v1alpha1/ipentry.go b/apis/generated/clientset/versioned/typed/ipam/v1alpha1/ipentry.go deleted file mode 100644 index e33d46e..0000000 --- a/apis/generated/clientset/versioned/typed/ipam/v1alpha1/ipentry.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// IPEntriesGetter has a method to return a IPEntryInterface. -// A group's client should implement this interface. -type IPEntriesGetter interface { - IPEntries(namespace string) IPEntryInterface -} - -// IPEntryInterface has methods to work with IPEntry resources. -type IPEntryInterface interface { - Create(ctx context.Context, iPEntry *v1alpha1.IPEntry, opts v1.CreateOptions) (*v1alpha1.IPEntry, error) - Update(ctx context.Context, iPEntry *v1alpha1.IPEntry, opts v1.UpdateOptions) (*v1alpha1.IPEntry, error) - UpdateStatus(ctx context.Context, iPEntry *v1alpha1.IPEntry, opts v1.UpdateOptions) (*v1alpha1.IPEntry, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.IPEntry, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.IPEntryList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IPEntry, err error) - IPEntryExpansion -} - -// iPEntries implements IPEntryInterface -type iPEntries struct { - client rest.Interface - ns string -} - -// newIPEntries returns a IPEntries -func newIPEntries(c *IpamV1alpha1Client, namespace string) *iPEntries { - return &iPEntries{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the iPEntry, and returns the corresponding iPEntry object, and an error if there is any. -func (c *iPEntries) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.IPEntry, err error) { - result = &v1alpha1.IPEntry{} - err = c.client.Get(). - Namespace(c.ns). - Resource("ipentries"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of IPEntries that match those selectors. -func (c *iPEntries) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.IPEntryList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.IPEntryList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("ipentries"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested iPEntries. -func (c *iPEntries) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("ipentries"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a iPEntry and creates it. Returns the server's representation of the iPEntry, and an error, if there is any. -func (c *iPEntries) Create(ctx context.Context, iPEntry *v1alpha1.IPEntry, opts v1.CreateOptions) (result *v1alpha1.IPEntry, err error) { - result = &v1alpha1.IPEntry{} - err = c.client.Post(). - Namespace(c.ns). - Resource("ipentries"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(iPEntry). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a iPEntry and updates it. Returns the server's representation of the iPEntry, and an error, if there is any. -func (c *iPEntries) Update(ctx context.Context, iPEntry *v1alpha1.IPEntry, opts v1.UpdateOptions) (result *v1alpha1.IPEntry, err error) { - result = &v1alpha1.IPEntry{} - err = c.client.Put(). - Namespace(c.ns). - Resource("ipentries"). - Name(iPEntry.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(iPEntry). - 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 *iPEntries) UpdateStatus(ctx context.Context, iPEntry *v1alpha1.IPEntry, opts v1.UpdateOptions) (result *v1alpha1.IPEntry, err error) { - result = &v1alpha1.IPEntry{} - err = c.client.Put(). - Namespace(c.ns). - Resource("ipentries"). - Name(iPEntry.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(iPEntry). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the iPEntry and deletes it. Returns an error if one occurs. -func (c *iPEntries) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("ipentries"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *iPEntries) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("ipentries"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched iPEntry. -func (c *iPEntries) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IPEntry, err error) { - result = &v1alpha1.IPEntry{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("ipentries"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/ipam/v1alpha1/ipindex.go b/apis/generated/clientset/versioned/typed/ipam/v1alpha1/ipindex.go deleted file mode 100644 index 32be7ff..0000000 --- a/apis/generated/clientset/versioned/typed/ipam/v1alpha1/ipindex.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// IPIndexesGetter has a method to return a IPIndexInterface. -// A group's client should implement this interface. -type IPIndexesGetter interface { - IPIndexes(namespace string) IPIndexInterface -} - -// IPIndexInterface has methods to work with IPIndex resources. -type IPIndexInterface interface { - Create(ctx context.Context, iPIndex *v1alpha1.IPIndex, opts v1.CreateOptions) (*v1alpha1.IPIndex, error) - Update(ctx context.Context, iPIndex *v1alpha1.IPIndex, opts v1.UpdateOptions) (*v1alpha1.IPIndex, error) - UpdateStatus(ctx context.Context, iPIndex *v1alpha1.IPIndex, opts v1.UpdateOptions) (*v1alpha1.IPIndex, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.IPIndex, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.IPIndexList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IPIndex, err error) - IPIndexExpansion -} - -// iPIndexes implements IPIndexInterface -type iPIndexes struct { - client rest.Interface - ns string -} - -// newIPIndexes returns a IPIndexes -func newIPIndexes(c *IpamV1alpha1Client, namespace string) *iPIndexes { - return &iPIndexes{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the iPIndex, and returns the corresponding iPIndex object, and an error if there is any. -func (c *iPIndexes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.IPIndex, err error) { - result = &v1alpha1.IPIndex{} - err = c.client.Get(). - Namespace(c.ns). - Resource("ipindexes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of IPIndexes that match those selectors. -func (c *iPIndexes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.IPIndexList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.IPIndexList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("ipindexes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested iPIndexes. -func (c *iPIndexes) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("ipindexes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a iPIndex and creates it. Returns the server's representation of the iPIndex, and an error, if there is any. -func (c *iPIndexes) Create(ctx context.Context, iPIndex *v1alpha1.IPIndex, opts v1.CreateOptions) (result *v1alpha1.IPIndex, err error) { - result = &v1alpha1.IPIndex{} - err = c.client.Post(). - Namespace(c.ns). - Resource("ipindexes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(iPIndex). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a iPIndex and updates it. Returns the server's representation of the iPIndex, and an error, if there is any. -func (c *iPIndexes) Update(ctx context.Context, iPIndex *v1alpha1.IPIndex, opts v1.UpdateOptions) (result *v1alpha1.IPIndex, err error) { - result = &v1alpha1.IPIndex{} - err = c.client.Put(). - Namespace(c.ns). - Resource("ipindexes"). - Name(iPIndex.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(iPIndex). - 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 *iPIndexes) UpdateStatus(ctx context.Context, iPIndex *v1alpha1.IPIndex, opts v1.UpdateOptions) (result *v1alpha1.IPIndex, err error) { - result = &v1alpha1.IPIndex{} - err = c.client.Put(). - Namespace(c.ns). - Resource("ipindexes"). - Name(iPIndex.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(iPIndex). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the iPIndex and deletes it. Returns an error if one occurs. -func (c *iPIndexes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("ipindexes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *iPIndexes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("ipindexes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched iPIndex. -func (c *iPIndexes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IPIndex, err error) { - result = &v1alpha1.IPIndex{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("ipindexes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/vlan/v1alpha1/doc.go b/apis/generated/clientset/versioned/typed/vlan/v1alpha1/doc.go deleted file mode 100644 index cda7d5a..0000000 --- a/apis/generated/clientset/versioned/typed/vlan/v1alpha1/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 diff --git a/apis/generated/clientset/versioned/typed/vlan/v1alpha1/fake/doc.go b/apis/generated/clientset/versioned/typed/vlan/v1alpha1/fake/doc.go deleted file mode 100644 index d4601f1..0000000 --- a/apis/generated/clientset/versioned/typed/vlan/v1alpha1/fake/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Copyright 2024 Nokia. - -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/apis/generated/clientset/versioned/typed/vlan/v1alpha1/fake/fake_vlan_client.go b/apis/generated/clientset/versioned/typed/vlan/v1alpha1/fake/fake_vlan_client.go deleted file mode 100644 index 5cd0d39..0000000 --- a/apis/generated/clientset/versioned/typed/vlan/v1alpha1/fake/fake_vlan_client.go +++ /dev/null @@ -1,47 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 ( - v1alpha1 "github.com/kuidio/kuid/apis/generated/clientset/versioned/typed/vlan/v1alpha1" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakeVlanV1alpha1 struct { - *testing.Fake -} - -func (c *FakeVlanV1alpha1) VLANClaims(namespace string) v1alpha1.VLANClaimInterface { - return &FakeVLANClaims{c, namespace} -} - -func (c *FakeVlanV1alpha1) VLANEntries(namespace string) v1alpha1.VLANEntryInterface { - return &FakeVLANEntries{c, namespace} -} - -func (c *FakeVlanV1alpha1) VLANIndexes(namespace string) v1alpha1.VLANIndexInterface { - return &FakeVLANIndexes{c, namespace} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeVlanV1alpha1) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/apis/generated/clientset/versioned/typed/vlan/v1alpha1/fake/fake_vlanclaim.go b/apis/generated/clientset/versioned/typed/vlan/v1alpha1/fake/fake_vlanclaim.go deleted file mode 100644 index 972fcf5..0000000 --- a/apis/generated/clientset/versioned/typed/vlan/v1alpha1/fake/fake_vlanclaim.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2024 Nokia. - -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" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" - v1 "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" -) - -// FakeVLANClaims implements VLANClaimInterface -type FakeVLANClaims struct { - Fake *FakeVlanV1alpha1 - ns string -} - -var vlanclaimsResource = v1alpha1.SchemeGroupVersion.WithResource("vlanclaims") - -var vlanclaimsKind = v1alpha1.SchemeGroupVersion.WithKind("VLANClaim") - -// Get takes name of the vLANClaim, and returns the corresponding vLANClaim object, and an error if there is any. -func (c *FakeVLANClaims) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VLANClaim, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(vlanclaimsResource, c.ns, name), &v1alpha1.VLANClaim{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VLANClaim), err -} - -// List takes label and field selectors, and returns the list of VLANClaims that match those selectors. -func (c *FakeVLANClaims) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VLANClaimList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(vlanclaimsResource, vlanclaimsKind, c.ns, opts), &v1alpha1.VLANClaimList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.VLANClaimList{ListMeta: obj.(*v1alpha1.VLANClaimList).ListMeta} - for _, item := range obj.(*v1alpha1.VLANClaimList).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 vLANClaims. -func (c *FakeVLANClaims) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(vlanclaimsResource, c.ns, opts)) - -} - -// Create takes the representation of a vLANClaim and creates it. Returns the server's representation of the vLANClaim, and an error, if there is any. -func (c *FakeVLANClaims) Create(ctx context.Context, vLANClaim *v1alpha1.VLANClaim, opts v1.CreateOptions) (result *v1alpha1.VLANClaim, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(vlanclaimsResource, c.ns, vLANClaim), &v1alpha1.VLANClaim{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VLANClaim), err -} - -// Update takes the representation of a vLANClaim and updates it. Returns the server's representation of the vLANClaim, and an error, if there is any. -func (c *FakeVLANClaims) Update(ctx context.Context, vLANClaim *v1alpha1.VLANClaim, opts v1.UpdateOptions) (result *v1alpha1.VLANClaim, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(vlanclaimsResource, c.ns, vLANClaim), &v1alpha1.VLANClaim{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VLANClaim), 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 *FakeVLANClaims) UpdateStatus(ctx context.Context, vLANClaim *v1alpha1.VLANClaim, opts v1.UpdateOptions) (*v1alpha1.VLANClaim, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(vlanclaimsResource, "status", c.ns, vLANClaim), &v1alpha1.VLANClaim{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VLANClaim), err -} - -// Delete takes name of the vLANClaim and deletes it. Returns an error if one occurs. -func (c *FakeVLANClaims) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(vlanclaimsResource, c.ns, name, opts), &v1alpha1.VLANClaim{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeVLANClaims) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(vlanclaimsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.VLANClaimList{}) - return err -} - -// Patch applies the patch and returns the patched vLANClaim. -func (c *FakeVLANClaims) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VLANClaim, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(vlanclaimsResource, c.ns, name, pt, data, subresources...), &v1alpha1.VLANClaim{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VLANClaim), err -} diff --git a/apis/generated/clientset/versioned/typed/vlan/v1alpha1/fake/fake_vlanentry.go b/apis/generated/clientset/versioned/typed/vlan/v1alpha1/fake/fake_vlanentry.go deleted file mode 100644 index 18a273e..0000000 --- a/apis/generated/clientset/versioned/typed/vlan/v1alpha1/fake/fake_vlanentry.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2024 Nokia. - -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" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" - v1 "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" -) - -// FakeVLANEntries implements VLANEntryInterface -type FakeVLANEntries struct { - Fake *FakeVlanV1alpha1 - ns string -} - -var vlanentriesResource = v1alpha1.SchemeGroupVersion.WithResource("vlanentries") - -var vlanentriesKind = v1alpha1.SchemeGroupVersion.WithKind("VLANEntry") - -// Get takes name of the vLANEntry, and returns the corresponding vLANEntry object, and an error if there is any. -func (c *FakeVLANEntries) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VLANEntry, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(vlanentriesResource, c.ns, name), &v1alpha1.VLANEntry{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VLANEntry), err -} - -// List takes label and field selectors, and returns the list of VLANEntries that match those selectors. -func (c *FakeVLANEntries) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VLANEntryList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(vlanentriesResource, vlanentriesKind, c.ns, opts), &v1alpha1.VLANEntryList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.VLANEntryList{ListMeta: obj.(*v1alpha1.VLANEntryList).ListMeta} - for _, item := range obj.(*v1alpha1.VLANEntryList).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 vLANEntries. -func (c *FakeVLANEntries) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(vlanentriesResource, c.ns, opts)) - -} - -// Create takes the representation of a vLANEntry and creates it. Returns the server's representation of the vLANEntry, and an error, if there is any. -func (c *FakeVLANEntries) Create(ctx context.Context, vLANEntry *v1alpha1.VLANEntry, opts v1.CreateOptions) (result *v1alpha1.VLANEntry, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(vlanentriesResource, c.ns, vLANEntry), &v1alpha1.VLANEntry{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VLANEntry), err -} - -// Update takes the representation of a vLANEntry and updates it. Returns the server's representation of the vLANEntry, and an error, if there is any. -func (c *FakeVLANEntries) Update(ctx context.Context, vLANEntry *v1alpha1.VLANEntry, opts v1.UpdateOptions) (result *v1alpha1.VLANEntry, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(vlanentriesResource, c.ns, vLANEntry), &v1alpha1.VLANEntry{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VLANEntry), 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 *FakeVLANEntries) UpdateStatus(ctx context.Context, vLANEntry *v1alpha1.VLANEntry, opts v1.UpdateOptions) (*v1alpha1.VLANEntry, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(vlanentriesResource, "status", c.ns, vLANEntry), &v1alpha1.VLANEntry{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VLANEntry), err -} - -// Delete takes name of the vLANEntry and deletes it. Returns an error if one occurs. -func (c *FakeVLANEntries) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(vlanentriesResource, c.ns, name, opts), &v1alpha1.VLANEntry{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeVLANEntries) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(vlanentriesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.VLANEntryList{}) - return err -} - -// Patch applies the patch and returns the patched vLANEntry. -func (c *FakeVLANEntries) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VLANEntry, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(vlanentriesResource, c.ns, name, pt, data, subresources...), &v1alpha1.VLANEntry{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VLANEntry), err -} diff --git a/apis/generated/clientset/versioned/typed/vlan/v1alpha1/fake/fake_vlanindex.go b/apis/generated/clientset/versioned/typed/vlan/v1alpha1/fake/fake_vlanindex.go deleted file mode 100644 index 068d380..0000000 --- a/apis/generated/clientset/versioned/typed/vlan/v1alpha1/fake/fake_vlanindex.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2024 Nokia. - -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" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" - v1 "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" -) - -// FakeVLANIndexes implements VLANIndexInterface -type FakeVLANIndexes struct { - Fake *FakeVlanV1alpha1 - ns string -} - -var vlanindexesResource = v1alpha1.SchemeGroupVersion.WithResource("vlanindexes") - -var vlanindexesKind = v1alpha1.SchemeGroupVersion.WithKind("VLANIndex") - -// Get takes name of the vLANIndex, and returns the corresponding vLANIndex object, and an error if there is any. -func (c *FakeVLANIndexes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VLANIndex, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(vlanindexesResource, c.ns, name), &v1alpha1.VLANIndex{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VLANIndex), err -} - -// List takes label and field selectors, and returns the list of VLANIndexes that match those selectors. -func (c *FakeVLANIndexes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VLANIndexList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(vlanindexesResource, vlanindexesKind, c.ns, opts), &v1alpha1.VLANIndexList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.VLANIndexList{ListMeta: obj.(*v1alpha1.VLANIndexList).ListMeta} - for _, item := range obj.(*v1alpha1.VLANIndexList).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 vLANIndexes. -func (c *FakeVLANIndexes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(vlanindexesResource, c.ns, opts)) - -} - -// Create takes the representation of a vLANIndex and creates it. Returns the server's representation of the vLANIndex, and an error, if there is any. -func (c *FakeVLANIndexes) Create(ctx context.Context, vLANIndex *v1alpha1.VLANIndex, opts v1.CreateOptions) (result *v1alpha1.VLANIndex, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(vlanindexesResource, c.ns, vLANIndex), &v1alpha1.VLANIndex{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VLANIndex), err -} - -// Update takes the representation of a vLANIndex and updates it. Returns the server's representation of the vLANIndex, and an error, if there is any. -func (c *FakeVLANIndexes) Update(ctx context.Context, vLANIndex *v1alpha1.VLANIndex, opts v1.UpdateOptions) (result *v1alpha1.VLANIndex, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(vlanindexesResource, c.ns, vLANIndex), &v1alpha1.VLANIndex{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VLANIndex), 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 *FakeVLANIndexes) UpdateStatus(ctx context.Context, vLANIndex *v1alpha1.VLANIndex, opts v1.UpdateOptions) (*v1alpha1.VLANIndex, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(vlanindexesResource, "status", c.ns, vLANIndex), &v1alpha1.VLANIndex{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VLANIndex), err -} - -// Delete takes name of the vLANIndex and deletes it. Returns an error if one occurs. -func (c *FakeVLANIndexes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(vlanindexesResource, c.ns, name, opts), &v1alpha1.VLANIndex{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeVLANIndexes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(vlanindexesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.VLANIndexList{}) - return err -} - -// Patch applies the patch and returns the patched vLANIndex. -func (c *FakeVLANIndexes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VLANIndex, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(vlanindexesResource, c.ns, name, pt, data, subresources...), &v1alpha1.VLANIndex{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VLANIndex), err -} diff --git a/apis/generated/clientset/versioned/typed/vlan/v1alpha1/generated_expansion.go b/apis/generated/clientset/versioned/typed/vlan/v1alpha1/generated_expansion.go deleted file mode 100644 index 3854756..0000000 --- a/apis/generated/clientset/versioned/typed/vlan/v1alpha1/generated_expansion.go +++ /dev/null @@ -1,24 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -type VLANClaimExpansion interface{} - -type VLANEntryExpansion interface{} - -type VLANIndexExpansion interface{} diff --git a/apis/generated/clientset/versioned/typed/vlan/v1alpha1/vlan_client.go b/apis/generated/clientset/versioned/typed/vlan/v1alpha1/vlan_client.go deleted file mode 100644 index bc461e9..0000000 --- a/apis/generated/clientset/versioned/typed/vlan/v1alpha1/vlan_client.go +++ /dev/null @@ -1,116 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "net/http" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" - "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - rest "k8s.io/client-go/rest" -) - -type VlanV1alpha1Interface interface { - RESTClient() rest.Interface - VLANClaimsGetter - VLANEntriesGetter - VLANIndexesGetter -} - -// VlanV1alpha1Client is used to interact with features provided by the vlan.be.kuid.dev group. -type VlanV1alpha1Client struct { - restClient rest.Interface -} - -func (c *VlanV1alpha1Client) VLANClaims(namespace string) VLANClaimInterface { - return newVLANClaims(c, namespace) -} - -func (c *VlanV1alpha1Client) VLANEntries(namespace string) VLANEntryInterface { - return newVLANEntries(c, namespace) -} - -func (c *VlanV1alpha1Client) VLANIndexes(namespace string) VLANIndexInterface { - return newVLANIndexes(c, namespace) -} - -// NewForConfig creates a new VlanV1alpha1Client for the given config. -// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), -// where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*VlanV1alpha1Client, 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 VlanV1alpha1Client 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) (*VlanV1alpha1Client, 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 &VlanV1alpha1Client{client}, nil -} - -// NewForConfigOrDie creates a new VlanV1alpha1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *VlanV1alpha1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new VlanV1alpha1Client for the given RESTClient. -func New(c rest.Interface) *VlanV1alpha1Client { - return &VlanV1alpha1Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v1alpha1.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 *VlanV1alpha1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/apis/generated/clientset/versioned/typed/vlan/v1alpha1/vlanclaim.go b/apis/generated/clientset/versioned/typed/vlan/v1alpha1/vlanclaim.go deleted file mode 100644 index 4e7476e..0000000 --- a/apis/generated/clientset/versioned/typed/vlan/v1alpha1/vlanclaim.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// VLANClaimsGetter has a method to return a VLANClaimInterface. -// A group's client should implement this interface. -type VLANClaimsGetter interface { - VLANClaims(namespace string) VLANClaimInterface -} - -// VLANClaimInterface has methods to work with VLANClaim resources. -type VLANClaimInterface interface { - Create(ctx context.Context, vLANClaim *v1alpha1.VLANClaim, opts v1.CreateOptions) (*v1alpha1.VLANClaim, error) - Update(ctx context.Context, vLANClaim *v1alpha1.VLANClaim, opts v1.UpdateOptions) (*v1alpha1.VLANClaim, error) - UpdateStatus(ctx context.Context, vLANClaim *v1alpha1.VLANClaim, opts v1.UpdateOptions) (*v1alpha1.VLANClaim, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.VLANClaim, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.VLANClaimList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VLANClaim, err error) - VLANClaimExpansion -} - -// vLANClaims implements VLANClaimInterface -type vLANClaims struct { - client rest.Interface - ns string -} - -// newVLANClaims returns a VLANClaims -func newVLANClaims(c *VlanV1alpha1Client, namespace string) *vLANClaims { - return &vLANClaims{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the vLANClaim, and returns the corresponding vLANClaim object, and an error if there is any. -func (c *vLANClaims) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VLANClaim, err error) { - result = &v1alpha1.VLANClaim{} - err = c.client.Get(). - Namespace(c.ns). - Resource("vlanclaims"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of VLANClaims that match those selectors. -func (c *vLANClaims) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VLANClaimList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.VLANClaimList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("vlanclaims"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested vLANClaims. -func (c *vLANClaims) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("vlanclaims"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a vLANClaim and creates it. Returns the server's representation of the vLANClaim, and an error, if there is any. -func (c *vLANClaims) Create(ctx context.Context, vLANClaim *v1alpha1.VLANClaim, opts v1.CreateOptions) (result *v1alpha1.VLANClaim, err error) { - result = &v1alpha1.VLANClaim{} - err = c.client.Post(). - Namespace(c.ns). - Resource("vlanclaims"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(vLANClaim). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a vLANClaim and updates it. Returns the server's representation of the vLANClaim, and an error, if there is any. -func (c *vLANClaims) Update(ctx context.Context, vLANClaim *v1alpha1.VLANClaim, opts v1.UpdateOptions) (result *v1alpha1.VLANClaim, err error) { - result = &v1alpha1.VLANClaim{} - err = c.client.Put(). - Namespace(c.ns). - Resource("vlanclaims"). - Name(vLANClaim.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(vLANClaim). - 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 *vLANClaims) UpdateStatus(ctx context.Context, vLANClaim *v1alpha1.VLANClaim, opts v1.UpdateOptions) (result *v1alpha1.VLANClaim, err error) { - result = &v1alpha1.VLANClaim{} - err = c.client.Put(). - Namespace(c.ns). - Resource("vlanclaims"). - Name(vLANClaim.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(vLANClaim). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the vLANClaim and deletes it. Returns an error if one occurs. -func (c *vLANClaims) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("vlanclaims"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *vLANClaims) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("vlanclaims"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched vLANClaim. -func (c *vLANClaims) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VLANClaim, err error) { - result = &v1alpha1.VLANClaim{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("vlanclaims"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/vlan/v1alpha1/vlanentry.go b/apis/generated/clientset/versioned/typed/vlan/v1alpha1/vlanentry.go deleted file mode 100644 index a64852a..0000000 --- a/apis/generated/clientset/versioned/typed/vlan/v1alpha1/vlanentry.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// VLANEntriesGetter has a method to return a VLANEntryInterface. -// A group's client should implement this interface. -type VLANEntriesGetter interface { - VLANEntries(namespace string) VLANEntryInterface -} - -// VLANEntryInterface has methods to work with VLANEntry resources. -type VLANEntryInterface interface { - Create(ctx context.Context, vLANEntry *v1alpha1.VLANEntry, opts v1.CreateOptions) (*v1alpha1.VLANEntry, error) - Update(ctx context.Context, vLANEntry *v1alpha1.VLANEntry, opts v1.UpdateOptions) (*v1alpha1.VLANEntry, error) - UpdateStatus(ctx context.Context, vLANEntry *v1alpha1.VLANEntry, opts v1.UpdateOptions) (*v1alpha1.VLANEntry, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.VLANEntry, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.VLANEntryList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VLANEntry, err error) - VLANEntryExpansion -} - -// vLANEntries implements VLANEntryInterface -type vLANEntries struct { - client rest.Interface - ns string -} - -// newVLANEntries returns a VLANEntries -func newVLANEntries(c *VlanV1alpha1Client, namespace string) *vLANEntries { - return &vLANEntries{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the vLANEntry, and returns the corresponding vLANEntry object, and an error if there is any. -func (c *vLANEntries) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VLANEntry, err error) { - result = &v1alpha1.VLANEntry{} - err = c.client.Get(). - Namespace(c.ns). - Resource("vlanentries"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of VLANEntries that match those selectors. -func (c *vLANEntries) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VLANEntryList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.VLANEntryList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("vlanentries"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested vLANEntries. -func (c *vLANEntries) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("vlanentries"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a vLANEntry and creates it. Returns the server's representation of the vLANEntry, and an error, if there is any. -func (c *vLANEntries) Create(ctx context.Context, vLANEntry *v1alpha1.VLANEntry, opts v1.CreateOptions) (result *v1alpha1.VLANEntry, err error) { - result = &v1alpha1.VLANEntry{} - err = c.client.Post(). - Namespace(c.ns). - Resource("vlanentries"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(vLANEntry). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a vLANEntry and updates it. Returns the server's representation of the vLANEntry, and an error, if there is any. -func (c *vLANEntries) Update(ctx context.Context, vLANEntry *v1alpha1.VLANEntry, opts v1.UpdateOptions) (result *v1alpha1.VLANEntry, err error) { - result = &v1alpha1.VLANEntry{} - err = c.client.Put(). - Namespace(c.ns). - Resource("vlanentries"). - Name(vLANEntry.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(vLANEntry). - 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 *vLANEntries) UpdateStatus(ctx context.Context, vLANEntry *v1alpha1.VLANEntry, opts v1.UpdateOptions) (result *v1alpha1.VLANEntry, err error) { - result = &v1alpha1.VLANEntry{} - err = c.client.Put(). - Namespace(c.ns). - Resource("vlanentries"). - Name(vLANEntry.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(vLANEntry). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the vLANEntry and deletes it. Returns an error if one occurs. -func (c *vLANEntries) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("vlanentries"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *vLANEntries) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("vlanentries"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched vLANEntry. -func (c *vLANEntries) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VLANEntry, err error) { - result = &v1alpha1.VLANEntry{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("vlanentries"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/vlan/v1alpha1/vlanindex.go b/apis/generated/clientset/versioned/typed/vlan/v1alpha1/vlanindex.go deleted file mode 100644 index 277951d..0000000 --- a/apis/generated/clientset/versioned/typed/vlan/v1alpha1/vlanindex.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// VLANIndexesGetter has a method to return a VLANIndexInterface. -// A group's client should implement this interface. -type VLANIndexesGetter interface { - VLANIndexes(namespace string) VLANIndexInterface -} - -// VLANIndexInterface has methods to work with VLANIndex resources. -type VLANIndexInterface interface { - Create(ctx context.Context, vLANIndex *v1alpha1.VLANIndex, opts v1.CreateOptions) (*v1alpha1.VLANIndex, error) - Update(ctx context.Context, vLANIndex *v1alpha1.VLANIndex, opts v1.UpdateOptions) (*v1alpha1.VLANIndex, error) - UpdateStatus(ctx context.Context, vLANIndex *v1alpha1.VLANIndex, opts v1.UpdateOptions) (*v1alpha1.VLANIndex, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.VLANIndex, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.VLANIndexList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VLANIndex, err error) - VLANIndexExpansion -} - -// vLANIndexes implements VLANIndexInterface -type vLANIndexes struct { - client rest.Interface - ns string -} - -// newVLANIndexes returns a VLANIndexes -func newVLANIndexes(c *VlanV1alpha1Client, namespace string) *vLANIndexes { - return &vLANIndexes{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the vLANIndex, and returns the corresponding vLANIndex object, and an error if there is any. -func (c *vLANIndexes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VLANIndex, err error) { - result = &v1alpha1.VLANIndex{} - err = c.client.Get(). - Namespace(c.ns). - Resource("vlanindexes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of VLANIndexes that match those selectors. -func (c *vLANIndexes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VLANIndexList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.VLANIndexList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("vlanindexes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested vLANIndexes. -func (c *vLANIndexes) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("vlanindexes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a vLANIndex and creates it. Returns the server's representation of the vLANIndex, and an error, if there is any. -func (c *vLANIndexes) Create(ctx context.Context, vLANIndex *v1alpha1.VLANIndex, opts v1.CreateOptions) (result *v1alpha1.VLANIndex, err error) { - result = &v1alpha1.VLANIndex{} - err = c.client.Post(). - Namespace(c.ns). - Resource("vlanindexes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(vLANIndex). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a vLANIndex and updates it. Returns the server's representation of the vLANIndex, and an error, if there is any. -func (c *vLANIndexes) Update(ctx context.Context, vLANIndex *v1alpha1.VLANIndex, opts v1.UpdateOptions) (result *v1alpha1.VLANIndex, err error) { - result = &v1alpha1.VLANIndex{} - err = c.client.Put(). - Namespace(c.ns). - Resource("vlanindexes"). - Name(vLANIndex.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(vLANIndex). - 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 *vLANIndexes) UpdateStatus(ctx context.Context, vLANIndex *v1alpha1.VLANIndex, opts v1.UpdateOptions) (result *v1alpha1.VLANIndex, err error) { - result = &v1alpha1.VLANIndex{} - err = c.client.Put(). - Namespace(c.ns). - Resource("vlanindexes"). - Name(vLANIndex.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(vLANIndex). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the vLANIndex and deletes it. Returns an error if one occurs. -func (c *vLANIndexes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("vlanindexes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *vLANIndexes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("vlanindexes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched vLANIndex. -func (c *vLANIndexes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VLANIndex, err error) { - result = &v1alpha1.VLANIndex{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("vlanindexes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/doc.go b/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/doc.go deleted file mode 100644 index cda7d5a..0000000 --- a/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 diff --git a/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/fake/doc.go b/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/fake/doc.go deleted file mode 100644 index d4601f1..0000000 --- a/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/fake/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Copyright 2024 Nokia. - -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/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/fake/fake_vxlan_client.go b/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/fake/fake_vxlan_client.go deleted file mode 100644 index ef955c6..0000000 --- a/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/fake/fake_vxlan_client.go +++ /dev/null @@ -1,47 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 ( - v1alpha1 "github.com/kuidio/kuid/apis/generated/clientset/versioned/typed/vxlan/v1alpha1" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakeVxlanV1alpha1 struct { - *testing.Fake -} - -func (c *FakeVxlanV1alpha1) VXLANClaims(namespace string) v1alpha1.VXLANClaimInterface { - return &FakeVXLANClaims{c, namespace} -} - -func (c *FakeVxlanV1alpha1) VXLANEntries(namespace string) v1alpha1.VXLANEntryInterface { - return &FakeVXLANEntries{c, namespace} -} - -func (c *FakeVxlanV1alpha1) VXLANIndexes(namespace string) v1alpha1.VXLANIndexInterface { - return &FakeVXLANIndexes{c, namespace} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeVxlanV1alpha1) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/fake/fake_vxlanclaim.go b/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/fake/fake_vxlanclaim.go deleted file mode 100644 index b866afb..0000000 --- a/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/fake/fake_vxlanclaim.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2024 Nokia. - -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" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1" - v1 "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" -) - -// FakeVXLANClaims implements VXLANClaimInterface -type FakeVXLANClaims struct { - Fake *FakeVxlanV1alpha1 - ns string -} - -var vxlanclaimsResource = v1alpha1.SchemeGroupVersion.WithResource("vxlanclaims") - -var vxlanclaimsKind = v1alpha1.SchemeGroupVersion.WithKind("VXLANClaim") - -// Get takes name of the vXLANClaim, and returns the corresponding vXLANClaim object, and an error if there is any. -func (c *FakeVXLANClaims) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VXLANClaim, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(vxlanclaimsResource, c.ns, name), &v1alpha1.VXLANClaim{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VXLANClaim), err -} - -// List takes label and field selectors, and returns the list of VXLANClaims that match those selectors. -func (c *FakeVXLANClaims) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VXLANClaimList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(vxlanclaimsResource, vxlanclaimsKind, c.ns, opts), &v1alpha1.VXLANClaimList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.VXLANClaimList{ListMeta: obj.(*v1alpha1.VXLANClaimList).ListMeta} - for _, item := range obj.(*v1alpha1.VXLANClaimList).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 vXLANClaims. -func (c *FakeVXLANClaims) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(vxlanclaimsResource, c.ns, opts)) - -} - -// Create takes the representation of a vXLANClaim and creates it. Returns the server's representation of the vXLANClaim, and an error, if there is any. -func (c *FakeVXLANClaims) Create(ctx context.Context, vXLANClaim *v1alpha1.VXLANClaim, opts v1.CreateOptions) (result *v1alpha1.VXLANClaim, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(vxlanclaimsResource, c.ns, vXLANClaim), &v1alpha1.VXLANClaim{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VXLANClaim), err -} - -// Update takes the representation of a vXLANClaim and updates it. Returns the server's representation of the vXLANClaim, and an error, if there is any. -func (c *FakeVXLANClaims) Update(ctx context.Context, vXLANClaim *v1alpha1.VXLANClaim, opts v1.UpdateOptions) (result *v1alpha1.VXLANClaim, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(vxlanclaimsResource, c.ns, vXLANClaim), &v1alpha1.VXLANClaim{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VXLANClaim), 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 *FakeVXLANClaims) UpdateStatus(ctx context.Context, vXLANClaim *v1alpha1.VXLANClaim, opts v1.UpdateOptions) (*v1alpha1.VXLANClaim, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(vxlanclaimsResource, "status", c.ns, vXLANClaim), &v1alpha1.VXLANClaim{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VXLANClaim), err -} - -// Delete takes name of the vXLANClaim and deletes it. Returns an error if one occurs. -func (c *FakeVXLANClaims) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(vxlanclaimsResource, c.ns, name, opts), &v1alpha1.VXLANClaim{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeVXLANClaims) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(vxlanclaimsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.VXLANClaimList{}) - return err -} - -// Patch applies the patch and returns the patched vXLANClaim. -func (c *FakeVXLANClaims) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VXLANClaim, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(vxlanclaimsResource, c.ns, name, pt, data, subresources...), &v1alpha1.VXLANClaim{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VXLANClaim), err -} diff --git a/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/fake/fake_vxlanentry.go b/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/fake/fake_vxlanentry.go deleted file mode 100644 index f60620f..0000000 --- a/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/fake/fake_vxlanentry.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2024 Nokia. - -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" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1" - v1 "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" -) - -// FakeVXLANEntries implements VXLANEntryInterface -type FakeVXLANEntries struct { - Fake *FakeVxlanV1alpha1 - ns string -} - -var vxlanentriesResource = v1alpha1.SchemeGroupVersion.WithResource("vxlanentries") - -var vxlanentriesKind = v1alpha1.SchemeGroupVersion.WithKind("VXLANEntry") - -// Get takes name of the vXLANEntry, and returns the corresponding vXLANEntry object, and an error if there is any. -func (c *FakeVXLANEntries) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VXLANEntry, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(vxlanentriesResource, c.ns, name), &v1alpha1.VXLANEntry{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VXLANEntry), err -} - -// List takes label and field selectors, and returns the list of VXLANEntries that match those selectors. -func (c *FakeVXLANEntries) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VXLANEntryList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(vxlanentriesResource, vxlanentriesKind, c.ns, opts), &v1alpha1.VXLANEntryList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.VXLANEntryList{ListMeta: obj.(*v1alpha1.VXLANEntryList).ListMeta} - for _, item := range obj.(*v1alpha1.VXLANEntryList).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 vXLANEntries. -func (c *FakeVXLANEntries) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(vxlanentriesResource, c.ns, opts)) - -} - -// Create takes the representation of a vXLANEntry and creates it. Returns the server's representation of the vXLANEntry, and an error, if there is any. -func (c *FakeVXLANEntries) Create(ctx context.Context, vXLANEntry *v1alpha1.VXLANEntry, opts v1.CreateOptions) (result *v1alpha1.VXLANEntry, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(vxlanentriesResource, c.ns, vXLANEntry), &v1alpha1.VXLANEntry{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VXLANEntry), err -} - -// Update takes the representation of a vXLANEntry and updates it. Returns the server's representation of the vXLANEntry, and an error, if there is any. -func (c *FakeVXLANEntries) Update(ctx context.Context, vXLANEntry *v1alpha1.VXLANEntry, opts v1.UpdateOptions) (result *v1alpha1.VXLANEntry, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(vxlanentriesResource, c.ns, vXLANEntry), &v1alpha1.VXLANEntry{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VXLANEntry), 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 *FakeVXLANEntries) UpdateStatus(ctx context.Context, vXLANEntry *v1alpha1.VXLANEntry, opts v1.UpdateOptions) (*v1alpha1.VXLANEntry, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(vxlanentriesResource, "status", c.ns, vXLANEntry), &v1alpha1.VXLANEntry{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VXLANEntry), err -} - -// Delete takes name of the vXLANEntry and deletes it. Returns an error if one occurs. -func (c *FakeVXLANEntries) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(vxlanentriesResource, c.ns, name, opts), &v1alpha1.VXLANEntry{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeVXLANEntries) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(vxlanentriesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.VXLANEntryList{}) - return err -} - -// Patch applies the patch and returns the patched vXLANEntry. -func (c *FakeVXLANEntries) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VXLANEntry, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(vxlanentriesResource, c.ns, name, pt, data, subresources...), &v1alpha1.VXLANEntry{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VXLANEntry), err -} diff --git a/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/fake/fake_vxlanindex.go b/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/fake/fake_vxlanindex.go deleted file mode 100644 index f21d9db..0000000 --- a/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/fake/fake_vxlanindex.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2024 Nokia. - -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" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1" - v1 "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" -) - -// FakeVXLANIndexes implements VXLANIndexInterface -type FakeVXLANIndexes struct { - Fake *FakeVxlanV1alpha1 - ns string -} - -var vxlanindexesResource = v1alpha1.SchemeGroupVersion.WithResource("vxlanindexes") - -var vxlanindexesKind = v1alpha1.SchemeGroupVersion.WithKind("VXLANIndex") - -// Get takes name of the vXLANIndex, and returns the corresponding vXLANIndex object, and an error if there is any. -func (c *FakeVXLANIndexes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VXLANIndex, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(vxlanindexesResource, c.ns, name), &v1alpha1.VXLANIndex{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VXLANIndex), err -} - -// List takes label and field selectors, and returns the list of VXLANIndexes that match those selectors. -func (c *FakeVXLANIndexes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VXLANIndexList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(vxlanindexesResource, vxlanindexesKind, c.ns, opts), &v1alpha1.VXLANIndexList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.VXLANIndexList{ListMeta: obj.(*v1alpha1.VXLANIndexList).ListMeta} - for _, item := range obj.(*v1alpha1.VXLANIndexList).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 vXLANIndexes. -func (c *FakeVXLANIndexes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(vxlanindexesResource, c.ns, opts)) - -} - -// Create takes the representation of a vXLANIndex and creates it. Returns the server's representation of the vXLANIndex, and an error, if there is any. -func (c *FakeVXLANIndexes) Create(ctx context.Context, vXLANIndex *v1alpha1.VXLANIndex, opts v1.CreateOptions) (result *v1alpha1.VXLANIndex, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(vxlanindexesResource, c.ns, vXLANIndex), &v1alpha1.VXLANIndex{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VXLANIndex), err -} - -// Update takes the representation of a vXLANIndex and updates it. Returns the server's representation of the vXLANIndex, and an error, if there is any. -func (c *FakeVXLANIndexes) Update(ctx context.Context, vXLANIndex *v1alpha1.VXLANIndex, opts v1.UpdateOptions) (result *v1alpha1.VXLANIndex, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(vxlanindexesResource, c.ns, vXLANIndex), &v1alpha1.VXLANIndex{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VXLANIndex), 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 *FakeVXLANIndexes) UpdateStatus(ctx context.Context, vXLANIndex *v1alpha1.VXLANIndex, opts v1.UpdateOptions) (*v1alpha1.VXLANIndex, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(vxlanindexesResource, "status", c.ns, vXLANIndex), &v1alpha1.VXLANIndex{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VXLANIndex), err -} - -// Delete takes name of the vXLANIndex and deletes it. Returns an error if one occurs. -func (c *FakeVXLANIndexes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(vxlanindexesResource, c.ns, name, opts), &v1alpha1.VXLANIndex{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeVXLANIndexes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(vxlanindexesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.VXLANIndexList{}) - return err -} - -// Patch applies the patch and returns the patched vXLANIndex. -func (c *FakeVXLANIndexes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VXLANIndex, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(vxlanindexesResource, c.ns, name, pt, data, subresources...), &v1alpha1.VXLANIndex{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.VXLANIndex), err -} diff --git a/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/generated_expansion.go b/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/generated_expansion.go deleted file mode 100644 index 4e3bf41..0000000 --- a/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/generated_expansion.go +++ /dev/null @@ -1,24 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -type VXLANClaimExpansion interface{} - -type VXLANEntryExpansion interface{} - -type VXLANIndexExpansion interface{} diff --git a/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/vxlan_client.go b/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/vxlan_client.go deleted file mode 100644 index d88bc27..0000000 --- a/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/vxlan_client.go +++ /dev/null @@ -1,116 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "net/http" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1" - "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - rest "k8s.io/client-go/rest" -) - -type VxlanV1alpha1Interface interface { - RESTClient() rest.Interface - VXLANClaimsGetter - VXLANEntriesGetter - VXLANIndexesGetter -} - -// VxlanV1alpha1Client is used to interact with features provided by the vxlan.be.kuid.dev group. -type VxlanV1alpha1Client struct { - restClient rest.Interface -} - -func (c *VxlanV1alpha1Client) VXLANClaims(namespace string) VXLANClaimInterface { - return newVXLANClaims(c, namespace) -} - -func (c *VxlanV1alpha1Client) VXLANEntries(namespace string) VXLANEntryInterface { - return newVXLANEntries(c, namespace) -} - -func (c *VxlanV1alpha1Client) VXLANIndexes(namespace string) VXLANIndexInterface { - return newVXLANIndexes(c, namespace) -} - -// NewForConfig creates a new VxlanV1alpha1Client for the given config. -// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), -// where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*VxlanV1alpha1Client, 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 VxlanV1alpha1Client 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) (*VxlanV1alpha1Client, 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 &VxlanV1alpha1Client{client}, nil -} - -// NewForConfigOrDie creates a new VxlanV1alpha1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *VxlanV1alpha1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new VxlanV1alpha1Client for the given RESTClient. -func New(c rest.Interface) *VxlanV1alpha1Client { - return &VxlanV1alpha1Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v1alpha1.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 *VxlanV1alpha1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/vxlanclaim.go b/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/vxlanclaim.go deleted file mode 100644 index 34d146d..0000000 --- a/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/vxlanclaim.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// VXLANClaimsGetter has a method to return a VXLANClaimInterface. -// A group's client should implement this interface. -type VXLANClaimsGetter interface { - VXLANClaims(namespace string) VXLANClaimInterface -} - -// VXLANClaimInterface has methods to work with VXLANClaim resources. -type VXLANClaimInterface interface { - Create(ctx context.Context, vXLANClaim *v1alpha1.VXLANClaim, opts v1.CreateOptions) (*v1alpha1.VXLANClaim, error) - Update(ctx context.Context, vXLANClaim *v1alpha1.VXLANClaim, opts v1.UpdateOptions) (*v1alpha1.VXLANClaim, error) - UpdateStatus(ctx context.Context, vXLANClaim *v1alpha1.VXLANClaim, opts v1.UpdateOptions) (*v1alpha1.VXLANClaim, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.VXLANClaim, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.VXLANClaimList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VXLANClaim, err error) - VXLANClaimExpansion -} - -// vXLANClaims implements VXLANClaimInterface -type vXLANClaims struct { - client rest.Interface - ns string -} - -// newVXLANClaims returns a VXLANClaims -func newVXLANClaims(c *VxlanV1alpha1Client, namespace string) *vXLANClaims { - return &vXLANClaims{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the vXLANClaim, and returns the corresponding vXLANClaim object, and an error if there is any. -func (c *vXLANClaims) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VXLANClaim, err error) { - result = &v1alpha1.VXLANClaim{} - err = c.client.Get(). - Namespace(c.ns). - Resource("vxlanclaims"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of VXLANClaims that match those selectors. -func (c *vXLANClaims) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VXLANClaimList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.VXLANClaimList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("vxlanclaims"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested vXLANClaims. -func (c *vXLANClaims) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("vxlanclaims"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a vXLANClaim and creates it. Returns the server's representation of the vXLANClaim, and an error, if there is any. -func (c *vXLANClaims) Create(ctx context.Context, vXLANClaim *v1alpha1.VXLANClaim, opts v1.CreateOptions) (result *v1alpha1.VXLANClaim, err error) { - result = &v1alpha1.VXLANClaim{} - err = c.client.Post(). - Namespace(c.ns). - Resource("vxlanclaims"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(vXLANClaim). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a vXLANClaim and updates it. Returns the server's representation of the vXLANClaim, and an error, if there is any. -func (c *vXLANClaims) Update(ctx context.Context, vXLANClaim *v1alpha1.VXLANClaim, opts v1.UpdateOptions) (result *v1alpha1.VXLANClaim, err error) { - result = &v1alpha1.VXLANClaim{} - err = c.client.Put(). - Namespace(c.ns). - Resource("vxlanclaims"). - Name(vXLANClaim.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(vXLANClaim). - 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 *vXLANClaims) UpdateStatus(ctx context.Context, vXLANClaim *v1alpha1.VXLANClaim, opts v1.UpdateOptions) (result *v1alpha1.VXLANClaim, err error) { - result = &v1alpha1.VXLANClaim{} - err = c.client.Put(). - Namespace(c.ns). - Resource("vxlanclaims"). - Name(vXLANClaim.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(vXLANClaim). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the vXLANClaim and deletes it. Returns an error if one occurs. -func (c *vXLANClaims) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("vxlanclaims"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *vXLANClaims) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("vxlanclaims"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched vXLANClaim. -func (c *vXLANClaims) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VXLANClaim, err error) { - result = &v1alpha1.VXLANClaim{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("vxlanclaims"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/vxlanentry.go b/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/vxlanentry.go deleted file mode 100644 index 2c42247..0000000 --- a/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/vxlanentry.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// VXLANEntriesGetter has a method to return a VXLANEntryInterface. -// A group's client should implement this interface. -type VXLANEntriesGetter interface { - VXLANEntries(namespace string) VXLANEntryInterface -} - -// VXLANEntryInterface has methods to work with VXLANEntry resources. -type VXLANEntryInterface interface { - Create(ctx context.Context, vXLANEntry *v1alpha1.VXLANEntry, opts v1.CreateOptions) (*v1alpha1.VXLANEntry, error) - Update(ctx context.Context, vXLANEntry *v1alpha1.VXLANEntry, opts v1.UpdateOptions) (*v1alpha1.VXLANEntry, error) - UpdateStatus(ctx context.Context, vXLANEntry *v1alpha1.VXLANEntry, opts v1.UpdateOptions) (*v1alpha1.VXLANEntry, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.VXLANEntry, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.VXLANEntryList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VXLANEntry, err error) - VXLANEntryExpansion -} - -// vXLANEntries implements VXLANEntryInterface -type vXLANEntries struct { - client rest.Interface - ns string -} - -// newVXLANEntries returns a VXLANEntries -func newVXLANEntries(c *VxlanV1alpha1Client, namespace string) *vXLANEntries { - return &vXLANEntries{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the vXLANEntry, and returns the corresponding vXLANEntry object, and an error if there is any. -func (c *vXLANEntries) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VXLANEntry, err error) { - result = &v1alpha1.VXLANEntry{} - err = c.client.Get(). - Namespace(c.ns). - Resource("vxlanentries"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of VXLANEntries that match those selectors. -func (c *vXLANEntries) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VXLANEntryList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.VXLANEntryList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("vxlanentries"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested vXLANEntries. -func (c *vXLANEntries) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("vxlanentries"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a vXLANEntry and creates it. Returns the server's representation of the vXLANEntry, and an error, if there is any. -func (c *vXLANEntries) Create(ctx context.Context, vXLANEntry *v1alpha1.VXLANEntry, opts v1.CreateOptions) (result *v1alpha1.VXLANEntry, err error) { - result = &v1alpha1.VXLANEntry{} - err = c.client.Post(). - Namespace(c.ns). - Resource("vxlanentries"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(vXLANEntry). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a vXLANEntry and updates it. Returns the server's representation of the vXLANEntry, and an error, if there is any. -func (c *vXLANEntries) Update(ctx context.Context, vXLANEntry *v1alpha1.VXLANEntry, opts v1.UpdateOptions) (result *v1alpha1.VXLANEntry, err error) { - result = &v1alpha1.VXLANEntry{} - err = c.client.Put(). - Namespace(c.ns). - Resource("vxlanentries"). - Name(vXLANEntry.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(vXLANEntry). - 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 *vXLANEntries) UpdateStatus(ctx context.Context, vXLANEntry *v1alpha1.VXLANEntry, opts v1.UpdateOptions) (result *v1alpha1.VXLANEntry, err error) { - result = &v1alpha1.VXLANEntry{} - err = c.client.Put(). - Namespace(c.ns). - Resource("vxlanentries"). - Name(vXLANEntry.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(vXLANEntry). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the vXLANEntry and deletes it. Returns an error if one occurs. -func (c *vXLANEntries) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("vxlanentries"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *vXLANEntries) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("vxlanentries"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched vXLANEntry. -func (c *vXLANEntries) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VXLANEntry, err error) { - result = &v1alpha1.VXLANEntry{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("vxlanentries"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/vxlanindex.go b/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/vxlanindex.go deleted file mode 100644 index 4c12d9f..0000000 --- a/apis/generated/clientset/versioned/typed/vxlan/v1alpha1/vxlanindex.go +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - "time" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1" - scheme "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - v1 "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" -) - -// VXLANIndexesGetter has a method to return a VXLANIndexInterface. -// A group's client should implement this interface. -type VXLANIndexesGetter interface { - VXLANIndexes(namespace string) VXLANIndexInterface -} - -// VXLANIndexInterface has methods to work with VXLANIndex resources. -type VXLANIndexInterface interface { - Create(ctx context.Context, vXLANIndex *v1alpha1.VXLANIndex, opts v1.CreateOptions) (*v1alpha1.VXLANIndex, error) - Update(ctx context.Context, vXLANIndex *v1alpha1.VXLANIndex, opts v1.UpdateOptions) (*v1alpha1.VXLANIndex, error) - UpdateStatus(ctx context.Context, vXLANIndex *v1alpha1.VXLANIndex, opts v1.UpdateOptions) (*v1alpha1.VXLANIndex, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.VXLANIndex, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.VXLANIndexList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VXLANIndex, err error) - VXLANIndexExpansion -} - -// vXLANIndexes implements VXLANIndexInterface -type vXLANIndexes struct { - client rest.Interface - ns string -} - -// newVXLANIndexes returns a VXLANIndexes -func newVXLANIndexes(c *VxlanV1alpha1Client, namespace string) *vXLANIndexes { - return &vXLANIndexes{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the vXLANIndex, and returns the corresponding vXLANIndex object, and an error if there is any. -func (c *vXLANIndexes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VXLANIndex, err error) { - result = &v1alpha1.VXLANIndex{} - err = c.client.Get(). - Namespace(c.ns). - Resource("vxlanindexes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of VXLANIndexes that match those selectors. -func (c *vXLANIndexes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VXLANIndexList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.VXLANIndexList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("vxlanindexes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested vXLANIndexes. -func (c *vXLANIndexes) Watch(ctx context.Context, opts v1.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(). - Namespace(c.ns). - Resource("vxlanindexes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a vXLANIndex and creates it. Returns the server's representation of the vXLANIndex, and an error, if there is any. -func (c *vXLANIndexes) Create(ctx context.Context, vXLANIndex *v1alpha1.VXLANIndex, opts v1.CreateOptions) (result *v1alpha1.VXLANIndex, err error) { - result = &v1alpha1.VXLANIndex{} - err = c.client.Post(). - Namespace(c.ns). - Resource("vxlanindexes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(vXLANIndex). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a vXLANIndex and updates it. Returns the server's representation of the vXLANIndex, and an error, if there is any. -func (c *vXLANIndexes) Update(ctx context.Context, vXLANIndex *v1alpha1.VXLANIndex, opts v1.UpdateOptions) (result *v1alpha1.VXLANIndex, err error) { - result = &v1alpha1.VXLANIndex{} - err = c.client.Put(). - Namespace(c.ns). - Resource("vxlanindexes"). - Name(vXLANIndex.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(vXLANIndex). - 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 *vXLANIndexes) UpdateStatus(ctx context.Context, vXLANIndex *v1alpha1.VXLANIndex, opts v1.UpdateOptions) (result *v1alpha1.VXLANIndex, err error) { - result = &v1alpha1.VXLANIndex{} - err = c.client.Put(). - Namespace(c.ns). - Resource("vxlanindexes"). - Name(vXLANIndex.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(vXLANIndex). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the vXLANIndex and deletes it. Returns an error if one occurs. -func (c *vXLANIndexes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("vxlanindexes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *vXLANIndexes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("vxlanindexes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched vXLANIndex. -func (c *vXLANIndexes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VXLANIndex, err error) { - result = &v1alpha1.VXLANIndex{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("vxlanindexes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/apis/generated/informers/externalversions/esi/interface.go b/apis/generated/informers/externalversions/esi/interface.go deleted file mode 100644 index 87feec7..0000000 --- a/apis/generated/informers/externalversions/esi/interface.go +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 esi - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/generated/informers/externalversions/esi/v1alpha1" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" -) - -// Interface provides access to each of this group's versions. -type Interface interface { - // V1alpha1 provides access to shared informers for resources in V1alpha1. - V1alpha1() v1alpha1.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} -} - -// V1alpha1 returns a new v1alpha1.Interface. -func (g *group) V1alpha1() v1alpha1.Interface { - return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) -} diff --git a/apis/generated/informers/externalversions/esi/v1alpha1/esiclaim.go b/apis/generated/informers/externalversions/esi/v1alpha1/esiclaim.go deleted file mode 100644 index bc1cf8d..0000000 --- a/apis/generated/informers/externalversions/esi/v1alpha1/esiclaim.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - time "time" - - esiv1alpha1 "github.com/kuidio/kuid/apis/backend/esi/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/esi/v1alpha1" - v1 "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" -) - -// ESIClaimInformer provides access to a shared informer and lister for -// ESIClaims. -type ESIClaimInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.ESIClaimLister -} - -type eSIClaimInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewESIClaimInformer constructs a new informer for ESIClaim 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 NewESIClaimInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredESIClaimInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredESIClaimInformer constructs a new informer for ESIClaim 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 NewFilteredESIClaimInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.EsiV1alpha1().ESIClaims(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.EsiV1alpha1().ESIClaims(namespace).Watch(context.TODO(), options) - }, - }, - &esiv1alpha1.ESIClaim{}, - resyncPeriod, - indexers, - ) -} - -func (f *eSIClaimInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredESIClaimInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *eSIClaimInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&esiv1alpha1.ESIClaim{}, f.defaultInformer) -} - -func (f *eSIClaimInformer) Lister() v1alpha1.ESIClaimLister { - return v1alpha1.NewESIClaimLister(f.Informer().GetIndexer()) -} diff --git a/apis/generated/informers/externalversions/esi/v1alpha1/esientry.go b/apis/generated/informers/externalversions/esi/v1alpha1/esientry.go deleted file mode 100644 index 3871615..0000000 --- a/apis/generated/informers/externalversions/esi/v1alpha1/esientry.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - time "time" - - esiv1alpha1 "github.com/kuidio/kuid/apis/backend/esi/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/esi/v1alpha1" - v1 "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" -) - -// ESIEntryInformer provides access to a shared informer and lister for -// ESIEntries. -type ESIEntryInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.ESIEntryLister -} - -type eSIEntryInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewESIEntryInformer constructs a new informer for ESIEntry 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 NewESIEntryInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredESIEntryInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredESIEntryInformer constructs a new informer for ESIEntry 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 NewFilteredESIEntryInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.EsiV1alpha1().ESIEntries(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.EsiV1alpha1().ESIEntries(namespace).Watch(context.TODO(), options) - }, - }, - &esiv1alpha1.ESIEntry{}, - resyncPeriod, - indexers, - ) -} - -func (f *eSIEntryInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredESIEntryInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *eSIEntryInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&esiv1alpha1.ESIEntry{}, f.defaultInformer) -} - -func (f *eSIEntryInformer) Lister() v1alpha1.ESIEntryLister { - return v1alpha1.NewESIEntryLister(f.Informer().GetIndexer()) -} diff --git a/apis/generated/informers/externalversions/esi/v1alpha1/esiindex.go b/apis/generated/informers/externalversions/esi/v1alpha1/esiindex.go deleted file mode 100644 index 681522a..0000000 --- a/apis/generated/informers/externalversions/esi/v1alpha1/esiindex.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - time "time" - - esiv1alpha1 "github.com/kuidio/kuid/apis/backend/esi/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/esi/v1alpha1" - v1 "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" -) - -// ESIIndexInformer provides access to a shared informer and lister for -// ESIIndexes. -type ESIIndexInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.ESIIndexLister -} - -type eSIIndexInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewESIIndexInformer constructs a new informer for ESIIndex 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 NewESIIndexInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredESIIndexInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredESIIndexInformer constructs a new informer for ESIIndex 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 NewFilteredESIIndexInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.EsiV1alpha1().ESIIndexes(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.EsiV1alpha1().ESIIndexes(namespace).Watch(context.TODO(), options) - }, - }, - &esiv1alpha1.ESIIndex{}, - resyncPeriod, - indexers, - ) -} - -func (f *eSIIndexInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredESIIndexInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *eSIIndexInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&esiv1alpha1.ESIIndex{}, f.defaultInformer) -} - -func (f *eSIIndexInformer) Lister() v1alpha1.ESIIndexLister { - return v1alpha1.NewESIIndexLister(f.Informer().GetIndexer()) -} diff --git a/apis/generated/informers/externalversions/esi/v1alpha1/interface.go b/apis/generated/informers/externalversions/esi/v1alpha1/interface.go deleted file mode 100644 index 2a75411..0000000 --- a/apis/generated/informers/externalversions/esi/v1alpha1/interface.go +++ /dev/null @@ -1,58 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // ESIClaims returns a ESIClaimInformer. - ESIClaims() ESIClaimInformer - // ESIEntries returns a ESIEntryInformer. - ESIEntries() ESIEntryInformer - // ESIIndexes returns a ESIIndexInformer. - ESIIndexes() ESIIndexInformer -} - -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} -} - -// ESIClaims returns a ESIClaimInformer. -func (v *version) ESIClaims() ESIClaimInformer { - return &eSIClaimInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// ESIEntries returns a ESIEntryInformer. -func (v *version) ESIEntries() ESIEntryInformer { - return &eSIEntryInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// ESIIndexes returns a ESIIndexInformer. -func (v *version) ESIIndexes() ESIIndexInformer { - return &eSIIndexInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} diff --git a/apis/generated/informers/externalversions/extcomm/interface.go b/apis/generated/informers/externalversions/extcomm/interface.go deleted file mode 100644 index 707391b..0000000 --- a/apis/generated/informers/externalversions/extcomm/interface.go +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 extcomm - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/generated/informers/externalversions/extcomm/v1alpha1" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" -) - -// Interface provides access to each of this group's versions. -type Interface interface { - // V1alpha1 provides access to shared informers for resources in V1alpha1. - V1alpha1() v1alpha1.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} -} - -// V1alpha1 returns a new v1alpha1.Interface. -func (g *group) V1alpha1() v1alpha1.Interface { - return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) -} diff --git a/apis/generated/informers/externalversions/extcomm/v1alpha1/extcommclaim.go b/apis/generated/informers/externalversions/extcomm/v1alpha1/extcommclaim.go deleted file mode 100644 index 0288b6b..0000000 --- a/apis/generated/informers/externalversions/extcomm/v1alpha1/extcommclaim.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - time "time" - - extcommv1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/extcomm/v1alpha1" - v1 "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" -) - -// EXTCOMMClaimInformer provides access to a shared informer and lister for -// EXTCOMMClaims. -type EXTCOMMClaimInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.EXTCOMMClaimLister -} - -type eXTCOMMClaimInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewEXTCOMMClaimInformer constructs a new informer for EXTCOMMClaim 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 NewEXTCOMMClaimInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredEXTCOMMClaimInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredEXTCOMMClaimInformer constructs a new informer for EXTCOMMClaim 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 NewFilteredEXTCOMMClaimInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.ExtcommV1alpha1().EXTCOMMClaims(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.ExtcommV1alpha1().EXTCOMMClaims(namespace).Watch(context.TODO(), options) - }, - }, - &extcommv1alpha1.EXTCOMMClaim{}, - resyncPeriod, - indexers, - ) -} - -func (f *eXTCOMMClaimInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredEXTCOMMClaimInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *eXTCOMMClaimInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&extcommv1alpha1.EXTCOMMClaim{}, f.defaultInformer) -} - -func (f *eXTCOMMClaimInformer) Lister() v1alpha1.EXTCOMMClaimLister { - return v1alpha1.NewEXTCOMMClaimLister(f.Informer().GetIndexer()) -} diff --git a/apis/generated/informers/externalversions/extcomm/v1alpha1/extcommentry.go b/apis/generated/informers/externalversions/extcomm/v1alpha1/extcommentry.go deleted file mode 100644 index f725b71..0000000 --- a/apis/generated/informers/externalversions/extcomm/v1alpha1/extcommentry.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - time "time" - - extcommv1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/extcomm/v1alpha1" - v1 "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" -) - -// EXTCOMMEntryInformer provides access to a shared informer and lister for -// EXTCOMMEntries. -type EXTCOMMEntryInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.EXTCOMMEntryLister -} - -type eXTCOMMEntryInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewEXTCOMMEntryInformer constructs a new informer for EXTCOMMEntry 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 NewEXTCOMMEntryInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredEXTCOMMEntryInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredEXTCOMMEntryInformer constructs a new informer for EXTCOMMEntry 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 NewFilteredEXTCOMMEntryInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.ExtcommV1alpha1().EXTCOMMEntries(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.ExtcommV1alpha1().EXTCOMMEntries(namespace).Watch(context.TODO(), options) - }, - }, - &extcommv1alpha1.EXTCOMMEntry{}, - resyncPeriod, - indexers, - ) -} - -func (f *eXTCOMMEntryInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredEXTCOMMEntryInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *eXTCOMMEntryInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&extcommv1alpha1.EXTCOMMEntry{}, f.defaultInformer) -} - -func (f *eXTCOMMEntryInformer) Lister() v1alpha1.EXTCOMMEntryLister { - return v1alpha1.NewEXTCOMMEntryLister(f.Informer().GetIndexer()) -} diff --git a/apis/generated/informers/externalversions/extcomm/v1alpha1/extcommindex.go b/apis/generated/informers/externalversions/extcomm/v1alpha1/extcommindex.go deleted file mode 100644 index 357c9ea..0000000 --- a/apis/generated/informers/externalversions/extcomm/v1alpha1/extcommindex.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - time "time" - - extcommv1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/extcomm/v1alpha1" - v1 "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" -) - -// EXTCOMMIndexInformer provides access to a shared informer and lister for -// EXTCOMMIndexes. -type EXTCOMMIndexInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.EXTCOMMIndexLister -} - -type eXTCOMMIndexInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewEXTCOMMIndexInformer constructs a new informer for EXTCOMMIndex 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 NewEXTCOMMIndexInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredEXTCOMMIndexInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredEXTCOMMIndexInformer constructs a new informer for EXTCOMMIndex 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 NewFilteredEXTCOMMIndexInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.ExtcommV1alpha1().EXTCOMMIndexes(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.ExtcommV1alpha1().EXTCOMMIndexes(namespace).Watch(context.TODO(), options) - }, - }, - &extcommv1alpha1.EXTCOMMIndex{}, - resyncPeriod, - indexers, - ) -} - -func (f *eXTCOMMIndexInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredEXTCOMMIndexInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *eXTCOMMIndexInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&extcommv1alpha1.EXTCOMMIndex{}, f.defaultInformer) -} - -func (f *eXTCOMMIndexInformer) Lister() v1alpha1.EXTCOMMIndexLister { - return v1alpha1.NewEXTCOMMIndexLister(f.Informer().GetIndexer()) -} diff --git a/apis/generated/informers/externalversions/extcomm/v1alpha1/interface.go b/apis/generated/informers/externalversions/extcomm/v1alpha1/interface.go deleted file mode 100644 index 88a1793..0000000 --- a/apis/generated/informers/externalversions/extcomm/v1alpha1/interface.go +++ /dev/null @@ -1,58 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // EXTCOMMClaims returns a EXTCOMMClaimInformer. - EXTCOMMClaims() EXTCOMMClaimInformer - // EXTCOMMEntries returns a EXTCOMMEntryInformer. - EXTCOMMEntries() EXTCOMMEntryInformer - // EXTCOMMIndexes returns a EXTCOMMIndexInformer. - EXTCOMMIndexes() EXTCOMMIndexInformer -} - -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} -} - -// EXTCOMMClaims returns a EXTCOMMClaimInformer. -func (v *version) EXTCOMMClaims() EXTCOMMClaimInformer { - return &eXTCOMMClaimInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// EXTCOMMEntries returns a EXTCOMMEntryInformer. -func (v *version) EXTCOMMEntries() EXTCOMMEntryInformer { - return &eXTCOMMEntryInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// EXTCOMMIndexes returns a EXTCOMMIndexInformer. -func (v *version) EXTCOMMIndexes() EXTCOMMIndexInformer { - return &eXTCOMMIndexInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} diff --git a/apis/generated/informers/externalversions/generic.go b/apis/generated/informers/externalversions/generic.go deleted file mode 100644 index ac9a2e0..0000000 --- a/apis/generated/informers/externalversions/generic.go +++ /dev/null @@ -1,150 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 externalversions - -import ( - "fmt" - - v1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" - esiv1alpha1 "github.com/kuidio/kuid/apis/backend/esi/v1alpha1" - extcommv1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" - genidv1alpha1 "github.com/kuidio/kuid/apis/backend/genid/v1alpha1" - infrav1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - ipamv1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" - vlanv1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" - vxlanv1alpha1 "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1" - schema "k8s.io/apimachinery/pkg/runtime/schema" - cache "k8s.io/client-go/tools/cache" -) - -// GenericInformer is type of SharedIndexInformer which will locate and delegate to other -// sharedInformers based on type -type GenericInformer interface { - Informer() cache.SharedIndexInformer - Lister() cache.GenericLister -} - -type genericInformer struct { - informer cache.SharedIndexInformer - resource schema.GroupResource -} - -// Informer returns the SharedIndexInformer. -func (f *genericInformer) Informer() cache.SharedIndexInformer { - return f.informer -} - -// Lister returns the GenericLister. -func (f *genericInformer) Lister() cache.GenericLister { - return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) -} - -// ForResource gives generic access to a shared informer of the matching type -// TODO extend this to unknown resources with a client pool -func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { - switch resource { - // Group=as.be.kuid.dev, Version=v1alpha1 - case v1alpha1.SchemeGroupVersion.WithResource("asclaims"): - return &genericInformer{resource: resource.GroupResource(), informer: f.As().V1alpha1().ASClaims().Informer()}, nil - case v1alpha1.SchemeGroupVersion.WithResource("asentries"): - return &genericInformer{resource: resource.GroupResource(), informer: f.As().V1alpha1().ASEntries().Informer()}, nil - case v1alpha1.SchemeGroupVersion.WithResource("asindexes"): - return &genericInformer{resource: resource.GroupResource(), informer: f.As().V1alpha1().ASIndexes().Informer()}, nil - - // Group=esi.be.kuid.dev, Version=v1alpha1 - case esiv1alpha1.SchemeGroupVersion.WithResource("esiclaims"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Esi().V1alpha1().ESIClaims().Informer()}, nil - case esiv1alpha1.SchemeGroupVersion.WithResource("esientries"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Esi().V1alpha1().ESIEntries().Informer()}, nil - case esiv1alpha1.SchemeGroupVersion.WithResource("esiindexes"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Esi().V1alpha1().ESIIndexes().Informer()}, nil - - // Group=extcomm.be.kuid.dev, Version=v1alpha1 - case extcommv1alpha1.SchemeGroupVersion.WithResource("extcommclaims"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Extcomm().V1alpha1().EXTCOMMClaims().Informer()}, nil - case extcommv1alpha1.SchemeGroupVersion.WithResource("extcommentries"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Extcomm().V1alpha1().EXTCOMMEntries().Informer()}, nil - case extcommv1alpha1.SchemeGroupVersion.WithResource("extcommindexes"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Extcomm().V1alpha1().EXTCOMMIndexes().Informer()}, nil - - // Group=genid.be.kuid.dev, Version=v1alpha1 - case genidv1alpha1.SchemeGroupVersion.WithResource("genidclaims"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Genid().V1alpha1().GENIDClaims().Informer()}, nil - case genidv1alpha1.SchemeGroupVersion.WithResource("genidentries"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Genid().V1alpha1().GENIDEntries().Informer()}, nil - case genidv1alpha1.SchemeGroupVersion.WithResource("genidindexes"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Genid().V1alpha1().GENIDIndexes().Informer()}, nil - - // Group=infra.be.kuid.dev, Version=v1alpha1 - case infrav1alpha1.SchemeGroupVersion.WithResource("clusters"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().Clusters().Informer()}, nil - case infrav1alpha1.SchemeGroupVersion.WithResource("endpoints"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().Endpoints().Informer()}, nil - case infrav1alpha1.SchemeGroupVersion.WithResource("endpointsets"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().EndpointSets().Informer()}, nil - case infrav1alpha1.SchemeGroupVersion.WithResource("links"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().Links().Informer()}, nil - case infrav1alpha1.SchemeGroupVersion.WithResource("linksets"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().LinkSets().Informer()}, nil - case infrav1alpha1.SchemeGroupVersion.WithResource("modules"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().Modules().Informer()}, nil - case infrav1alpha1.SchemeGroupVersion.WithResource("modulebays"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().ModuleBays().Informer()}, nil - case infrav1alpha1.SchemeGroupVersion.WithResource("nodes"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().Nodes().Informer()}, nil - case infrav1alpha1.SchemeGroupVersion.WithResource("nodegroups"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().NodeGroups().Informer()}, nil - case infrav1alpha1.SchemeGroupVersion.WithResource("nodeitems"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().NodeItems().Informer()}, nil - case infrav1alpha1.SchemeGroupVersion.WithResource("nodesets"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().NodeSets().Informer()}, nil - case infrav1alpha1.SchemeGroupVersion.WithResource("racks"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().Racks().Informer()}, nil - case infrav1alpha1.SchemeGroupVersion.WithResource("regions"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().Regions().Informer()}, nil - case infrav1alpha1.SchemeGroupVersion.WithResource("sites"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().Sites().Informer()}, nil - - // Group=ipam.be.kuid.dev, Version=v1alpha1 - case ipamv1alpha1.SchemeGroupVersion.WithResource("ipclaims"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Ipam().V1alpha1().IPClaims().Informer()}, nil - case ipamv1alpha1.SchemeGroupVersion.WithResource("ipentries"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Ipam().V1alpha1().IPEntries().Informer()}, nil - case ipamv1alpha1.SchemeGroupVersion.WithResource("ipindexes"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Ipam().V1alpha1().IPIndexes().Informer()}, nil - - // Group=vlan.be.kuid.dev, Version=v1alpha1 - case vlanv1alpha1.SchemeGroupVersion.WithResource("vlanclaims"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Vlan().V1alpha1().VLANClaims().Informer()}, nil - case vlanv1alpha1.SchemeGroupVersion.WithResource("vlanentries"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Vlan().V1alpha1().VLANEntries().Informer()}, nil - case vlanv1alpha1.SchemeGroupVersion.WithResource("vlanindexes"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Vlan().V1alpha1().VLANIndexes().Informer()}, nil - - // Group=vxlan.be.kuid.dev, Version=v1alpha1 - case vxlanv1alpha1.SchemeGroupVersion.WithResource("vxlanclaims"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Vxlan().V1alpha1().VXLANClaims().Informer()}, nil - case vxlanv1alpha1.SchemeGroupVersion.WithResource("vxlanentries"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Vxlan().V1alpha1().VXLANEntries().Informer()}, nil - case vxlanv1alpha1.SchemeGroupVersion.WithResource("vxlanindexes"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Vxlan().V1alpha1().VXLANIndexes().Informer()}, nil - - } - - return nil, fmt.Errorf("no informer found for %v", resource) -} diff --git a/apis/generated/informers/externalversions/genid/interface.go b/apis/generated/informers/externalversions/genid/interface.go deleted file mode 100644 index ffbbfb1..0000000 --- a/apis/generated/informers/externalversions/genid/interface.go +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 genid - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/generated/informers/externalversions/genid/v1alpha1" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" -) - -// Interface provides access to each of this group's versions. -type Interface interface { - // V1alpha1 provides access to shared informers for resources in V1alpha1. - V1alpha1() v1alpha1.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} -} - -// V1alpha1 returns a new v1alpha1.Interface. -func (g *group) V1alpha1() v1alpha1.Interface { - return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) -} diff --git a/apis/generated/informers/externalversions/genid/v1alpha1/genidclaim.go b/apis/generated/informers/externalversions/genid/v1alpha1/genidclaim.go deleted file mode 100644 index 21f4269..0000000 --- a/apis/generated/informers/externalversions/genid/v1alpha1/genidclaim.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - time "time" - - genidv1alpha1 "github.com/kuidio/kuid/apis/backend/genid/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/genid/v1alpha1" - v1 "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" -) - -// GENIDClaimInformer provides access to a shared informer and lister for -// GENIDClaims. -type GENIDClaimInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.GENIDClaimLister -} - -type gENIDClaimInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewGENIDClaimInformer constructs a new informer for GENIDClaim 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 NewGENIDClaimInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredGENIDClaimInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredGENIDClaimInformer constructs a new informer for GENIDClaim 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 NewFilteredGENIDClaimInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.GenidV1alpha1().GENIDClaims(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.GenidV1alpha1().GENIDClaims(namespace).Watch(context.TODO(), options) - }, - }, - &genidv1alpha1.GENIDClaim{}, - resyncPeriod, - indexers, - ) -} - -func (f *gENIDClaimInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredGENIDClaimInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *gENIDClaimInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&genidv1alpha1.GENIDClaim{}, f.defaultInformer) -} - -func (f *gENIDClaimInformer) Lister() v1alpha1.GENIDClaimLister { - return v1alpha1.NewGENIDClaimLister(f.Informer().GetIndexer()) -} diff --git a/apis/generated/informers/externalversions/genid/v1alpha1/genidentry.go b/apis/generated/informers/externalversions/genid/v1alpha1/genidentry.go deleted file mode 100644 index a736ec9..0000000 --- a/apis/generated/informers/externalversions/genid/v1alpha1/genidentry.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - time "time" - - genidv1alpha1 "github.com/kuidio/kuid/apis/backend/genid/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/genid/v1alpha1" - v1 "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" -) - -// GENIDEntryInformer provides access to a shared informer and lister for -// GENIDEntries. -type GENIDEntryInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.GENIDEntryLister -} - -type gENIDEntryInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewGENIDEntryInformer constructs a new informer for GENIDEntry 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 NewGENIDEntryInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredGENIDEntryInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredGENIDEntryInformer constructs a new informer for GENIDEntry 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 NewFilteredGENIDEntryInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.GenidV1alpha1().GENIDEntries(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.GenidV1alpha1().GENIDEntries(namespace).Watch(context.TODO(), options) - }, - }, - &genidv1alpha1.GENIDEntry{}, - resyncPeriod, - indexers, - ) -} - -func (f *gENIDEntryInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredGENIDEntryInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *gENIDEntryInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&genidv1alpha1.GENIDEntry{}, f.defaultInformer) -} - -func (f *gENIDEntryInformer) Lister() v1alpha1.GENIDEntryLister { - return v1alpha1.NewGENIDEntryLister(f.Informer().GetIndexer()) -} diff --git a/apis/generated/informers/externalversions/genid/v1alpha1/genidindex.go b/apis/generated/informers/externalversions/genid/v1alpha1/genidindex.go deleted file mode 100644 index 7867a10..0000000 --- a/apis/generated/informers/externalversions/genid/v1alpha1/genidindex.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - time "time" - - genidv1alpha1 "github.com/kuidio/kuid/apis/backend/genid/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/genid/v1alpha1" - v1 "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" -) - -// GENIDIndexInformer provides access to a shared informer and lister for -// GENIDIndexes. -type GENIDIndexInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.GENIDIndexLister -} - -type gENIDIndexInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewGENIDIndexInformer constructs a new informer for GENIDIndex 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 NewGENIDIndexInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredGENIDIndexInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredGENIDIndexInformer constructs a new informer for GENIDIndex 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 NewFilteredGENIDIndexInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.GenidV1alpha1().GENIDIndexes(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.GenidV1alpha1().GENIDIndexes(namespace).Watch(context.TODO(), options) - }, - }, - &genidv1alpha1.GENIDIndex{}, - resyncPeriod, - indexers, - ) -} - -func (f *gENIDIndexInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredGENIDIndexInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *gENIDIndexInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&genidv1alpha1.GENIDIndex{}, f.defaultInformer) -} - -func (f *gENIDIndexInformer) Lister() v1alpha1.GENIDIndexLister { - return v1alpha1.NewGENIDIndexLister(f.Informer().GetIndexer()) -} diff --git a/apis/generated/informers/externalversions/genid/v1alpha1/interface.go b/apis/generated/informers/externalversions/genid/v1alpha1/interface.go deleted file mode 100644 index a67bc41..0000000 --- a/apis/generated/informers/externalversions/genid/v1alpha1/interface.go +++ /dev/null @@ -1,58 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // GENIDClaims returns a GENIDClaimInformer. - GENIDClaims() GENIDClaimInformer - // GENIDEntries returns a GENIDEntryInformer. - GENIDEntries() GENIDEntryInformer - // GENIDIndexes returns a GENIDIndexInformer. - GENIDIndexes() GENIDIndexInformer -} - -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} -} - -// GENIDClaims returns a GENIDClaimInformer. -func (v *version) GENIDClaims() GENIDClaimInformer { - return &gENIDClaimInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// GENIDEntries returns a GENIDEntryInformer. -func (v *version) GENIDEntries() GENIDEntryInformer { - return &gENIDEntryInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// GENIDIndexes returns a GENIDIndexInformer. -func (v *version) GENIDIndexes() GENIDIndexInformer { - return &gENIDIndexInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} diff --git a/apis/generated/informers/externalversions/infra/interface.go b/apis/generated/informers/externalversions/infra/interface.go deleted file mode 100644 index 22eff83..0000000 --- a/apis/generated/informers/externalversions/infra/interface.go +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 infra - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/generated/informers/externalversions/infra/v1alpha1" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" -) - -// Interface provides access to each of this group's versions. -type Interface interface { - // V1alpha1 provides access to shared informers for resources in V1alpha1. - V1alpha1() v1alpha1.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} -} - -// V1alpha1 returns a new v1alpha1.Interface. -func (g *group) V1alpha1() v1alpha1.Interface { - return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) -} diff --git a/apis/generated/informers/externalversions/infra/v1alpha1/cluster.go b/apis/generated/informers/externalversions/infra/v1alpha1/cluster.go deleted file mode 100644 index f3d848c..0000000 --- a/apis/generated/informers/externalversions/infra/v1alpha1/cluster.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - time "time" - - infrav1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/infra/v1alpha1" - v1 "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" -) - -// ClusterInformer provides access to a shared informer and lister for -// Clusters. -type ClusterInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.ClusterLister -} - -type clusterInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewClusterInformer constructs a new informer for Cluster 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 NewClusterInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredClusterInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredClusterInformer constructs a new informer for Cluster 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 NewFilteredClusterInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.InfraV1alpha1().Clusters(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.InfraV1alpha1().Clusters(namespace).Watch(context.TODO(), options) - }, - }, - &infrav1alpha1.Cluster{}, - resyncPeriod, - indexers, - ) -} - -func (f *clusterInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredClusterInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *clusterInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&infrav1alpha1.Cluster{}, f.defaultInformer) -} - -func (f *clusterInformer) Lister() v1alpha1.ClusterLister { - return v1alpha1.NewClusterLister(f.Informer().GetIndexer()) -} diff --git a/apis/generated/informers/externalversions/infra/v1alpha1/endpoint.go b/apis/generated/informers/externalversions/infra/v1alpha1/endpoint.go deleted file mode 100644 index 1c8efd8..0000000 --- a/apis/generated/informers/externalversions/infra/v1alpha1/endpoint.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - time "time" - - infrav1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/infra/v1alpha1" - v1 "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" -) - -// EndpointInformer provides access to a shared informer and lister for -// Endpoints. -type EndpointInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.EndpointLister -} - -type endpointInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewEndpointInformer constructs a new informer for Endpoint 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 NewEndpointInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredEndpointInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredEndpointInformer constructs a new informer for Endpoint 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 NewFilteredEndpointInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.InfraV1alpha1().Endpoints(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.InfraV1alpha1().Endpoints(namespace).Watch(context.TODO(), options) - }, - }, - &infrav1alpha1.Endpoint{}, - resyncPeriod, - indexers, - ) -} - -func (f *endpointInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredEndpointInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *endpointInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&infrav1alpha1.Endpoint{}, f.defaultInformer) -} - -func (f *endpointInformer) Lister() v1alpha1.EndpointLister { - return v1alpha1.NewEndpointLister(f.Informer().GetIndexer()) -} diff --git a/apis/generated/informers/externalversions/infra/v1alpha1/endpointset.go b/apis/generated/informers/externalversions/infra/v1alpha1/endpointset.go deleted file mode 100644 index 2de316b..0000000 --- a/apis/generated/informers/externalversions/infra/v1alpha1/endpointset.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - time "time" - - infrav1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/infra/v1alpha1" - v1 "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" -) - -// EndpointSetInformer provides access to a shared informer and lister for -// EndpointSets. -type EndpointSetInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.EndpointSetLister -} - -type endpointSetInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewEndpointSetInformer constructs a new informer for EndpointSet 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 NewEndpointSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredEndpointSetInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredEndpointSetInformer constructs a new informer for EndpointSet 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 NewFilteredEndpointSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.InfraV1alpha1().EndpointSets(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.InfraV1alpha1().EndpointSets(namespace).Watch(context.TODO(), options) - }, - }, - &infrav1alpha1.EndpointSet{}, - resyncPeriod, - indexers, - ) -} - -func (f *endpointSetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredEndpointSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *endpointSetInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&infrav1alpha1.EndpointSet{}, f.defaultInformer) -} - -func (f *endpointSetInformer) Lister() v1alpha1.EndpointSetLister { - return v1alpha1.NewEndpointSetLister(f.Informer().GetIndexer()) -} diff --git a/apis/generated/informers/externalversions/infra/v1alpha1/interface.go b/apis/generated/informers/externalversions/infra/v1alpha1/interface.go deleted file mode 100644 index 2957e9b..0000000 --- a/apis/generated/informers/externalversions/infra/v1alpha1/interface.go +++ /dev/null @@ -1,135 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // Clusters returns a ClusterInformer. - Clusters() ClusterInformer - // Endpoints returns a EndpointInformer. - Endpoints() EndpointInformer - // EndpointSets returns a EndpointSetInformer. - EndpointSets() EndpointSetInformer - // Links returns a LinkInformer. - Links() LinkInformer - // LinkSets returns a LinkSetInformer. - LinkSets() LinkSetInformer - // Modules returns a ModuleInformer. - Modules() ModuleInformer - // ModuleBays returns a ModuleBayInformer. - ModuleBays() ModuleBayInformer - // Nodes returns a NodeInformer. - Nodes() NodeInformer - // NodeGroups returns a NodeGroupInformer. - NodeGroups() NodeGroupInformer - // NodeItems returns a NodeItemInformer. - NodeItems() NodeItemInformer - // NodeSets returns a NodeSetInformer. - NodeSets() NodeSetInformer - // Racks returns a RackInformer. - Racks() RackInformer - // Regions returns a RegionInformer. - Regions() RegionInformer - // Sites returns a SiteInformer. - Sites() SiteInformer -} - -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} -} - -// Clusters returns a ClusterInformer. -func (v *version) Clusters() ClusterInformer { - return &clusterInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// Endpoints returns a EndpointInformer. -func (v *version) Endpoints() EndpointInformer { - return &endpointInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// EndpointSets returns a EndpointSetInformer. -func (v *version) EndpointSets() EndpointSetInformer { - return &endpointSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// Links returns a LinkInformer. -func (v *version) Links() LinkInformer { - return &linkInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// LinkSets returns a LinkSetInformer. -func (v *version) LinkSets() LinkSetInformer { - return &linkSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// Modules returns a ModuleInformer. -func (v *version) Modules() ModuleInformer { - return &moduleInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// ModuleBays returns a ModuleBayInformer. -func (v *version) ModuleBays() ModuleBayInformer { - return &moduleBayInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// Nodes returns a NodeInformer. -func (v *version) Nodes() NodeInformer { - return &nodeInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// NodeGroups returns a NodeGroupInformer. -func (v *version) NodeGroups() NodeGroupInformer { - return &nodeGroupInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// NodeItems returns a NodeItemInformer. -func (v *version) NodeItems() NodeItemInformer { - return &nodeItemInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// NodeSets returns a NodeSetInformer. -func (v *version) NodeSets() NodeSetInformer { - return &nodeSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// Racks returns a RackInformer. -func (v *version) Racks() RackInformer { - return &rackInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// Regions returns a RegionInformer. -func (v *version) Regions() RegionInformer { - return ®ionInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// Sites returns a SiteInformer. -func (v *version) Sites() SiteInformer { - return &siteInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} diff --git a/apis/generated/informers/externalversions/infra/v1alpha1/link.go b/apis/generated/informers/externalversions/infra/v1alpha1/link.go deleted file mode 100644 index e26cc35..0000000 --- a/apis/generated/informers/externalversions/infra/v1alpha1/link.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - time "time" - - infrav1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/infra/v1alpha1" - v1 "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" -) - -// LinkInformer provides access to a shared informer and lister for -// Links. -type LinkInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.LinkLister -} - -type linkInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewLinkInformer constructs a new informer for Link 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 NewLinkInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredLinkInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredLinkInformer constructs a new informer for Link 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 NewFilteredLinkInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.InfraV1alpha1().Links(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.InfraV1alpha1().Links(namespace).Watch(context.TODO(), options) - }, - }, - &infrav1alpha1.Link{}, - resyncPeriod, - indexers, - ) -} - -func (f *linkInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredLinkInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *linkInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&infrav1alpha1.Link{}, f.defaultInformer) -} - -func (f *linkInformer) Lister() v1alpha1.LinkLister { - return v1alpha1.NewLinkLister(f.Informer().GetIndexer()) -} diff --git a/apis/generated/informers/externalversions/infra/v1alpha1/linkset.go b/apis/generated/informers/externalversions/infra/v1alpha1/linkset.go deleted file mode 100644 index 0119060..0000000 --- a/apis/generated/informers/externalversions/infra/v1alpha1/linkset.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - time "time" - - infrav1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/infra/v1alpha1" - v1 "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" -) - -// LinkSetInformer provides access to a shared informer and lister for -// LinkSets. -type LinkSetInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.LinkSetLister -} - -type linkSetInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewLinkSetInformer constructs a new informer for LinkSet 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 NewLinkSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredLinkSetInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredLinkSetInformer constructs a new informer for LinkSet 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 NewFilteredLinkSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.InfraV1alpha1().LinkSets(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.InfraV1alpha1().LinkSets(namespace).Watch(context.TODO(), options) - }, - }, - &infrav1alpha1.LinkSet{}, - resyncPeriod, - indexers, - ) -} - -func (f *linkSetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredLinkSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *linkSetInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&infrav1alpha1.LinkSet{}, f.defaultInformer) -} - -func (f *linkSetInformer) Lister() v1alpha1.LinkSetLister { - return v1alpha1.NewLinkSetLister(f.Informer().GetIndexer()) -} diff --git a/apis/generated/informers/externalversions/infra/v1alpha1/module.go b/apis/generated/informers/externalversions/infra/v1alpha1/module.go deleted file mode 100644 index e00d42c..0000000 --- a/apis/generated/informers/externalversions/infra/v1alpha1/module.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - time "time" - - infrav1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/infra/v1alpha1" - v1 "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" -) - -// ModuleInformer provides access to a shared informer and lister for -// Modules. -type ModuleInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.ModuleLister -} - -type moduleInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewModuleInformer constructs a new informer for Module 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 NewModuleInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredModuleInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredModuleInformer constructs a new informer for Module 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 NewFilteredModuleInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.InfraV1alpha1().Modules(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.InfraV1alpha1().Modules(namespace).Watch(context.TODO(), options) - }, - }, - &infrav1alpha1.Module{}, - resyncPeriod, - indexers, - ) -} - -func (f *moduleInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredModuleInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *moduleInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&infrav1alpha1.Module{}, f.defaultInformer) -} - -func (f *moduleInformer) Lister() v1alpha1.ModuleLister { - return v1alpha1.NewModuleLister(f.Informer().GetIndexer()) -} diff --git a/apis/generated/informers/externalversions/infra/v1alpha1/modulebay.go b/apis/generated/informers/externalversions/infra/v1alpha1/modulebay.go deleted file mode 100644 index 7d59b73..0000000 --- a/apis/generated/informers/externalversions/infra/v1alpha1/modulebay.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - time "time" - - infrav1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/infra/v1alpha1" - v1 "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" -) - -// ModuleBayInformer provides access to a shared informer and lister for -// ModuleBays. -type ModuleBayInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.ModuleBayLister -} - -type moduleBayInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewModuleBayInformer constructs a new informer for ModuleBay 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 NewModuleBayInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredModuleBayInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredModuleBayInformer constructs a new informer for ModuleBay 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 NewFilteredModuleBayInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.InfraV1alpha1().ModuleBays(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.InfraV1alpha1().ModuleBays(namespace).Watch(context.TODO(), options) - }, - }, - &infrav1alpha1.ModuleBay{}, - resyncPeriod, - indexers, - ) -} - -func (f *moduleBayInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredModuleBayInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *moduleBayInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&infrav1alpha1.ModuleBay{}, f.defaultInformer) -} - -func (f *moduleBayInformer) Lister() v1alpha1.ModuleBayLister { - return v1alpha1.NewModuleBayLister(f.Informer().GetIndexer()) -} diff --git a/apis/generated/informers/externalversions/infra/v1alpha1/node.go b/apis/generated/informers/externalversions/infra/v1alpha1/node.go deleted file mode 100644 index e3fedaa..0000000 --- a/apis/generated/informers/externalversions/infra/v1alpha1/node.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - time "time" - - infrav1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/infra/v1alpha1" - v1 "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" -) - -// NodeInformer provides access to a shared informer and lister for -// Nodes. -type NodeInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.NodeLister -} - -type nodeInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewNodeInformer constructs a new informer for Node 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 NewNodeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredNodeInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredNodeInformer constructs a new informer for Node 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 NewFilteredNodeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.InfraV1alpha1().Nodes(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.InfraV1alpha1().Nodes(namespace).Watch(context.TODO(), options) - }, - }, - &infrav1alpha1.Node{}, - resyncPeriod, - indexers, - ) -} - -func (f *nodeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredNodeInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *nodeInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&infrav1alpha1.Node{}, f.defaultInformer) -} - -func (f *nodeInformer) Lister() v1alpha1.NodeLister { - return v1alpha1.NewNodeLister(f.Informer().GetIndexer()) -} diff --git a/apis/generated/informers/externalversions/infra/v1alpha1/nodegroup.go b/apis/generated/informers/externalversions/infra/v1alpha1/nodegroup.go deleted file mode 100644 index f456f08..0000000 --- a/apis/generated/informers/externalversions/infra/v1alpha1/nodegroup.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - time "time" - - infrav1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/infra/v1alpha1" - v1 "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" -) - -// NodeGroupInformer provides access to a shared informer and lister for -// NodeGroups. -type NodeGroupInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.NodeGroupLister -} - -type nodeGroupInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewNodeGroupInformer constructs a new informer for NodeGroup 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 NewNodeGroupInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredNodeGroupInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredNodeGroupInformer constructs a new informer for NodeGroup 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 NewFilteredNodeGroupInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.InfraV1alpha1().NodeGroups(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.InfraV1alpha1().NodeGroups(namespace).Watch(context.TODO(), options) - }, - }, - &infrav1alpha1.NodeGroup{}, - resyncPeriod, - indexers, - ) -} - -func (f *nodeGroupInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredNodeGroupInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *nodeGroupInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&infrav1alpha1.NodeGroup{}, f.defaultInformer) -} - -func (f *nodeGroupInformer) Lister() v1alpha1.NodeGroupLister { - return v1alpha1.NewNodeGroupLister(f.Informer().GetIndexer()) -} diff --git a/apis/generated/informers/externalversions/infra/v1alpha1/nodeitem.go b/apis/generated/informers/externalversions/infra/v1alpha1/nodeitem.go deleted file mode 100644 index f62f0ab..0000000 --- a/apis/generated/informers/externalversions/infra/v1alpha1/nodeitem.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - time "time" - - infrav1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/infra/v1alpha1" - v1 "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" -) - -// NodeItemInformer provides access to a shared informer and lister for -// NodeItems. -type NodeItemInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.NodeItemLister -} - -type nodeItemInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewNodeItemInformer constructs a new informer for NodeItem 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 NewNodeItemInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredNodeItemInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredNodeItemInformer constructs a new informer for NodeItem 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 NewFilteredNodeItemInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.InfraV1alpha1().NodeItems(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.InfraV1alpha1().NodeItems(namespace).Watch(context.TODO(), options) - }, - }, - &infrav1alpha1.NodeItem{}, - resyncPeriod, - indexers, - ) -} - -func (f *nodeItemInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredNodeItemInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *nodeItemInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&infrav1alpha1.NodeItem{}, f.defaultInformer) -} - -func (f *nodeItemInformer) Lister() v1alpha1.NodeItemLister { - return v1alpha1.NewNodeItemLister(f.Informer().GetIndexer()) -} diff --git a/apis/generated/informers/externalversions/infra/v1alpha1/nodeset.go b/apis/generated/informers/externalversions/infra/v1alpha1/nodeset.go deleted file mode 100644 index 72f2e15..0000000 --- a/apis/generated/informers/externalversions/infra/v1alpha1/nodeset.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - time "time" - - infrav1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/infra/v1alpha1" - v1 "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" -) - -// NodeSetInformer provides access to a shared informer and lister for -// NodeSets. -type NodeSetInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.NodeSetLister -} - -type nodeSetInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewNodeSetInformer constructs a new informer for NodeSet 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 NewNodeSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredNodeSetInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredNodeSetInformer constructs a new informer for NodeSet 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 NewFilteredNodeSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.InfraV1alpha1().NodeSets(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.InfraV1alpha1().NodeSets(namespace).Watch(context.TODO(), options) - }, - }, - &infrav1alpha1.NodeSet{}, - resyncPeriod, - indexers, - ) -} - -func (f *nodeSetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredNodeSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *nodeSetInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&infrav1alpha1.NodeSet{}, f.defaultInformer) -} - -func (f *nodeSetInformer) Lister() v1alpha1.NodeSetLister { - return v1alpha1.NewNodeSetLister(f.Informer().GetIndexer()) -} diff --git a/apis/generated/informers/externalversions/infra/v1alpha1/rack.go b/apis/generated/informers/externalversions/infra/v1alpha1/rack.go deleted file mode 100644 index 8962548..0000000 --- a/apis/generated/informers/externalversions/infra/v1alpha1/rack.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - time "time" - - infrav1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/infra/v1alpha1" - v1 "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" -) - -// RackInformer provides access to a shared informer and lister for -// Racks. -type RackInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.RackLister -} - -type rackInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewRackInformer constructs a new informer for Rack 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 NewRackInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredRackInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredRackInformer constructs a new informer for Rack 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 NewFilteredRackInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.InfraV1alpha1().Racks(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.InfraV1alpha1().Racks(namespace).Watch(context.TODO(), options) - }, - }, - &infrav1alpha1.Rack{}, - resyncPeriod, - indexers, - ) -} - -func (f *rackInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredRackInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *rackInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&infrav1alpha1.Rack{}, f.defaultInformer) -} - -func (f *rackInformer) Lister() v1alpha1.RackLister { - return v1alpha1.NewRackLister(f.Informer().GetIndexer()) -} diff --git a/apis/generated/informers/externalversions/infra/v1alpha1/region.go b/apis/generated/informers/externalversions/infra/v1alpha1/region.go deleted file mode 100644 index de3d26e..0000000 --- a/apis/generated/informers/externalversions/infra/v1alpha1/region.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - time "time" - - infrav1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/infra/v1alpha1" - v1 "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" -) - -// RegionInformer provides access to a shared informer and lister for -// Regions. -type RegionInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.RegionLister -} - -type regionInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewRegionInformer constructs a new informer for Region 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 NewRegionInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredRegionInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredRegionInformer constructs a new informer for Region 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 NewFilteredRegionInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.InfraV1alpha1().Regions(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.InfraV1alpha1().Regions(namespace).Watch(context.TODO(), options) - }, - }, - &infrav1alpha1.Region{}, - resyncPeriod, - indexers, - ) -} - -func (f *regionInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredRegionInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *regionInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&infrav1alpha1.Region{}, f.defaultInformer) -} - -func (f *regionInformer) Lister() v1alpha1.RegionLister { - return v1alpha1.NewRegionLister(f.Informer().GetIndexer()) -} diff --git a/apis/generated/informers/externalversions/infra/v1alpha1/site.go b/apis/generated/informers/externalversions/infra/v1alpha1/site.go deleted file mode 100644 index d7cd4f4..0000000 --- a/apis/generated/informers/externalversions/infra/v1alpha1/site.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - time "time" - - infrav1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/infra/v1alpha1" - v1 "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" -) - -// SiteInformer provides access to a shared informer and lister for -// Sites. -type SiteInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.SiteLister -} - -type siteInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewSiteInformer constructs a new informer for Site 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 NewSiteInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredSiteInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredSiteInformer constructs a new informer for Site 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 NewFilteredSiteInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.InfraV1alpha1().Sites(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.InfraV1alpha1().Sites(namespace).Watch(context.TODO(), options) - }, - }, - &infrav1alpha1.Site{}, - resyncPeriod, - indexers, - ) -} - -func (f *siteInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredSiteInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *siteInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&infrav1alpha1.Site{}, f.defaultInformer) -} - -func (f *siteInformer) Lister() v1alpha1.SiteLister { - return v1alpha1.NewSiteLister(f.Informer().GetIndexer()) -} diff --git a/apis/generated/informers/externalversions/ipam/interface.go b/apis/generated/informers/externalversions/ipam/interface.go deleted file mode 100644 index 9298c18..0000000 --- a/apis/generated/informers/externalversions/ipam/interface.go +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 ipam - -import ( - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/informers/externalversions/ipam/v1alpha1" -) - -// Interface provides access to each of this group's versions. -type Interface interface { - // V1alpha1 provides access to shared informers for resources in V1alpha1. - V1alpha1() v1alpha1.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} -} - -// V1alpha1 returns a new v1alpha1.Interface. -func (g *group) V1alpha1() v1alpha1.Interface { - return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) -} diff --git a/apis/generated/informers/externalversions/ipam/v1alpha1/interface.go b/apis/generated/informers/externalversions/ipam/v1alpha1/interface.go deleted file mode 100644 index 93089fa..0000000 --- a/apis/generated/informers/externalversions/ipam/v1alpha1/interface.go +++ /dev/null @@ -1,58 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // IPClaims returns a IPClaimInformer. - IPClaims() IPClaimInformer - // IPEntries returns a IPEntryInformer. - IPEntries() IPEntryInformer - // IPIndexes returns a IPIndexInformer. - IPIndexes() IPIndexInformer -} - -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} -} - -// IPClaims returns a IPClaimInformer. -func (v *version) IPClaims() IPClaimInformer { - return &iPClaimInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// IPEntries returns a IPEntryInformer. -func (v *version) IPEntries() IPEntryInformer { - return &iPEntryInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// IPIndexes returns a IPIndexInformer. -func (v *version) IPIndexes() IPIndexInformer { - return &iPIndexInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} diff --git a/apis/generated/informers/externalversions/ipam/v1alpha1/ipclaim.go b/apis/generated/informers/externalversions/ipam/v1alpha1/ipclaim.go deleted file mode 100644 index 49020ab..0000000 --- a/apis/generated/informers/externalversions/ipam/v1alpha1/ipclaim.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - time "time" - - ipamv1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/ipam/v1alpha1" - v1 "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" -) - -// IPClaimInformer provides access to a shared informer and lister for -// IPClaims. -type IPClaimInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.IPClaimLister -} - -type iPClaimInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewIPClaimInformer constructs a new informer for IPClaim 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 NewIPClaimInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredIPClaimInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredIPClaimInformer constructs a new informer for IPClaim 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 NewFilteredIPClaimInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.IpamV1alpha1().IPClaims(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.IpamV1alpha1().IPClaims(namespace).Watch(context.TODO(), options) - }, - }, - &ipamv1alpha1.IPClaim{}, - resyncPeriod, - indexers, - ) -} - -func (f *iPClaimInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredIPClaimInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *iPClaimInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&ipamv1alpha1.IPClaim{}, f.defaultInformer) -} - -func (f *iPClaimInformer) Lister() v1alpha1.IPClaimLister { - return v1alpha1.NewIPClaimLister(f.Informer().GetIndexer()) -} diff --git a/apis/generated/informers/externalversions/ipam/v1alpha1/ipentry.go b/apis/generated/informers/externalversions/ipam/v1alpha1/ipentry.go deleted file mode 100644 index 62a9d1c..0000000 --- a/apis/generated/informers/externalversions/ipam/v1alpha1/ipentry.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - time "time" - - ipamv1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/ipam/v1alpha1" - v1 "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" -) - -// IPEntryInformer provides access to a shared informer and lister for -// IPEntries. -type IPEntryInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.IPEntryLister -} - -type iPEntryInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewIPEntryInformer constructs a new informer for IPEntry 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 NewIPEntryInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredIPEntryInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredIPEntryInformer constructs a new informer for IPEntry 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 NewFilteredIPEntryInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.IpamV1alpha1().IPEntries(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.IpamV1alpha1().IPEntries(namespace).Watch(context.TODO(), options) - }, - }, - &ipamv1alpha1.IPEntry{}, - resyncPeriod, - indexers, - ) -} - -func (f *iPEntryInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredIPEntryInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *iPEntryInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&ipamv1alpha1.IPEntry{}, f.defaultInformer) -} - -func (f *iPEntryInformer) Lister() v1alpha1.IPEntryLister { - return v1alpha1.NewIPEntryLister(f.Informer().GetIndexer()) -} diff --git a/apis/generated/informers/externalversions/ipam/v1alpha1/ipindex.go b/apis/generated/informers/externalversions/ipam/v1alpha1/ipindex.go deleted file mode 100644 index f612a24..0000000 --- a/apis/generated/informers/externalversions/ipam/v1alpha1/ipindex.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - time "time" - - ipamv1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/ipam/v1alpha1" - v1 "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" -) - -// IPIndexInformer provides access to a shared informer and lister for -// IPIndexes. -type IPIndexInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.IPIndexLister -} - -type iPIndexInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewIPIndexInformer constructs a new informer for IPIndex 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 NewIPIndexInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredIPIndexInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredIPIndexInformer constructs a new informer for IPIndex 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 NewFilteredIPIndexInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.IpamV1alpha1().IPIndexes(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.IpamV1alpha1().IPIndexes(namespace).Watch(context.TODO(), options) - }, - }, - &ipamv1alpha1.IPIndex{}, - resyncPeriod, - indexers, - ) -} - -func (f *iPIndexInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredIPIndexInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *iPIndexInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&ipamv1alpha1.IPIndex{}, f.defaultInformer) -} - -func (f *iPIndexInformer) Lister() v1alpha1.IPIndexLister { - return v1alpha1.NewIPIndexLister(f.Informer().GetIndexer()) -} diff --git a/apis/generated/informers/externalversions/vlan/interface.go b/apis/generated/informers/externalversions/vlan/interface.go deleted file mode 100644 index f9524a3..0000000 --- a/apis/generated/informers/externalversions/vlan/interface.go +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 vlan - -import ( - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/informers/externalversions/vlan/v1alpha1" -) - -// Interface provides access to each of this group's versions. -type Interface interface { - // V1alpha1 provides access to shared informers for resources in V1alpha1. - V1alpha1() v1alpha1.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} -} - -// V1alpha1 returns a new v1alpha1.Interface. -func (g *group) V1alpha1() v1alpha1.Interface { - return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) -} diff --git a/apis/generated/informers/externalversions/vlan/v1alpha1/interface.go b/apis/generated/informers/externalversions/vlan/v1alpha1/interface.go deleted file mode 100644 index 975f97e..0000000 --- a/apis/generated/informers/externalversions/vlan/v1alpha1/interface.go +++ /dev/null @@ -1,58 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // VLANClaims returns a VLANClaimInformer. - VLANClaims() VLANClaimInformer - // VLANEntries returns a VLANEntryInformer. - VLANEntries() VLANEntryInformer - // VLANIndexes returns a VLANIndexInformer. - VLANIndexes() VLANIndexInformer -} - -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} -} - -// VLANClaims returns a VLANClaimInformer. -func (v *version) VLANClaims() VLANClaimInformer { - return &vLANClaimInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// VLANEntries returns a VLANEntryInformer. -func (v *version) VLANEntries() VLANEntryInformer { - return &vLANEntryInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// VLANIndexes returns a VLANIndexInformer. -func (v *version) VLANIndexes() VLANIndexInformer { - return &vLANIndexInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} diff --git a/apis/generated/informers/externalversions/vlan/v1alpha1/vlanclaim.go b/apis/generated/informers/externalversions/vlan/v1alpha1/vlanclaim.go deleted file mode 100644 index c4132ff..0000000 --- a/apis/generated/informers/externalversions/vlan/v1alpha1/vlanclaim.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - time "time" - - vlanv1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/vlan/v1alpha1" - v1 "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" -) - -// VLANClaimInformer provides access to a shared informer and lister for -// VLANClaims. -type VLANClaimInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.VLANClaimLister -} - -type vLANClaimInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewVLANClaimInformer constructs a new informer for VLANClaim 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 NewVLANClaimInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredVLANClaimInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredVLANClaimInformer constructs a new informer for VLANClaim 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 NewFilteredVLANClaimInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VlanV1alpha1().VLANClaims(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VlanV1alpha1().VLANClaims(namespace).Watch(context.TODO(), options) - }, - }, - &vlanv1alpha1.VLANClaim{}, - resyncPeriod, - indexers, - ) -} - -func (f *vLANClaimInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredVLANClaimInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *vLANClaimInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&vlanv1alpha1.VLANClaim{}, f.defaultInformer) -} - -func (f *vLANClaimInformer) Lister() v1alpha1.VLANClaimLister { - return v1alpha1.NewVLANClaimLister(f.Informer().GetIndexer()) -} diff --git a/apis/generated/informers/externalversions/vlan/v1alpha1/vlanentry.go b/apis/generated/informers/externalversions/vlan/v1alpha1/vlanentry.go deleted file mode 100644 index 790b8b5..0000000 --- a/apis/generated/informers/externalversions/vlan/v1alpha1/vlanentry.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - time "time" - - vlanv1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/vlan/v1alpha1" - v1 "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" -) - -// VLANEntryInformer provides access to a shared informer and lister for -// VLANEntries. -type VLANEntryInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.VLANEntryLister -} - -type vLANEntryInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewVLANEntryInformer constructs a new informer for VLANEntry 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 NewVLANEntryInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredVLANEntryInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredVLANEntryInformer constructs a new informer for VLANEntry 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 NewFilteredVLANEntryInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VlanV1alpha1().VLANEntries(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VlanV1alpha1().VLANEntries(namespace).Watch(context.TODO(), options) - }, - }, - &vlanv1alpha1.VLANEntry{}, - resyncPeriod, - indexers, - ) -} - -func (f *vLANEntryInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredVLANEntryInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *vLANEntryInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&vlanv1alpha1.VLANEntry{}, f.defaultInformer) -} - -func (f *vLANEntryInformer) Lister() v1alpha1.VLANEntryLister { - return v1alpha1.NewVLANEntryLister(f.Informer().GetIndexer()) -} diff --git a/apis/generated/informers/externalversions/vlan/v1alpha1/vlanindex.go b/apis/generated/informers/externalversions/vlan/v1alpha1/vlanindex.go deleted file mode 100644 index a3b70be..0000000 --- a/apis/generated/informers/externalversions/vlan/v1alpha1/vlanindex.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - time "time" - - vlanv1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/vlan/v1alpha1" - v1 "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" -) - -// VLANIndexInformer provides access to a shared informer and lister for -// VLANIndexes. -type VLANIndexInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.VLANIndexLister -} - -type vLANIndexInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewVLANIndexInformer constructs a new informer for VLANIndex 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 NewVLANIndexInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredVLANIndexInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredVLANIndexInformer constructs a new informer for VLANIndex 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 NewFilteredVLANIndexInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VlanV1alpha1().VLANIndexes(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VlanV1alpha1().VLANIndexes(namespace).Watch(context.TODO(), options) - }, - }, - &vlanv1alpha1.VLANIndex{}, - resyncPeriod, - indexers, - ) -} - -func (f *vLANIndexInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredVLANIndexInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *vLANIndexInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&vlanv1alpha1.VLANIndex{}, f.defaultInformer) -} - -func (f *vLANIndexInformer) Lister() v1alpha1.VLANIndexLister { - return v1alpha1.NewVLANIndexLister(f.Informer().GetIndexer()) -} diff --git a/apis/generated/informers/externalversions/vxlan/interface.go b/apis/generated/informers/externalversions/vxlan/interface.go deleted file mode 100644 index 653ef52..0000000 --- a/apis/generated/informers/externalversions/vxlan/interface.go +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 vxlan - -import ( - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/informers/externalversions/vxlan/v1alpha1" -) - -// Interface provides access to each of this group's versions. -type Interface interface { - // V1alpha1 provides access to shared informers for resources in V1alpha1. - V1alpha1() v1alpha1.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} -} - -// V1alpha1 returns a new v1alpha1.Interface. -func (g *group) V1alpha1() v1alpha1.Interface { - return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) -} diff --git a/apis/generated/informers/externalversions/vxlan/v1alpha1/interface.go b/apis/generated/informers/externalversions/vxlan/v1alpha1/interface.go deleted file mode 100644 index e3b8935..0000000 --- a/apis/generated/informers/externalversions/vxlan/v1alpha1/interface.go +++ /dev/null @@ -1,58 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // VXLANClaims returns a VXLANClaimInformer. - VXLANClaims() VXLANClaimInformer - // VXLANEntries returns a VXLANEntryInformer. - VXLANEntries() VXLANEntryInformer - // VXLANIndexes returns a VXLANIndexInformer. - VXLANIndexes() VXLANIndexInformer -} - -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} -} - -// VXLANClaims returns a VXLANClaimInformer. -func (v *version) VXLANClaims() VXLANClaimInformer { - return &vXLANClaimInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// VXLANEntries returns a VXLANEntryInformer. -func (v *version) VXLANEntries() VXLANEntryInformer { - return &vXLANEntryInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// VXLANIndexes returns a VXLANIndexInformer. -func (v *version) VXLANIndexes() VXLANIndexInformer { - return &vXLANIndexInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} diff --git a/apis/generated/informers/externalversions/vxlan/v1alpha1/vxlanclaim.go b/apis/generated/informers/externalversions/vxlan/v1alpha1/vxlanclaim.go deleted file mode 100644 index 0fcc008..0000000 --- a/apis/generated/informers/externalversions/vxlan/v1alpha1/vxlanclaim.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - time "time" - - vxlanv1alpha1 "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/vxlan/v1alpha1" - v1 "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" -) - -// VXLANClaimInformer provides access to a shared informer and lister for -// VXLANClaims. -type VXLANClaimInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.VXLANClaimLister -} - -type vXLANClaimInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewVXLANClaimInformer constructs a new informer for VXLANClaim 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 NewVXLANClaimInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredVXLANClaimInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredVXLANClaimInformer constructs a new informer for VXLANClaim 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 NewFilteredVXLANClaimInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VxlanV1alpha1().VXLANClaims(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VxlanV1alpha1().VXLANClaims(namespace).Watch(context.TODO(), options) - }, - }, - &vxlanv1alpha1.VXLANClaim{}, - resyncPeriod, - indexers, - ) -} - -func (f *vXLANClaimInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredVXLANClaimInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *vXLANClaimInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&vxlanv1alpha1.VXLANClaim{}, f.defaultInformer) -} - -func (f *vXLANClaimInformer) Lister() v1alpha1.VXLANClaimLister { - return v1alpha1.NewVXLANClaimLister(f.Informer().GetIndexer()) -} diff --git a/apis/generated/informers/externalversions/vxlan/v1alpha1/vxlanentry.go b/apis/generated/informers/externalversions/vxlan/v1alpha1/vxlanentry.go deleted file mode 100644 index 214d3f1..0000000 --- a/apis/generated/informers/externalversions/vxlan/v1alpha1/vxlanentry.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - time "time" - - vxlanv1alpha1 "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/vxlan/v1alpha1" - v1 "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" -) - -// VXLANEntryInformer provides access to a shared informer and lister for -// VXLANEntries. -type VXLANEntryInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.VXLANEntryLister -} - -type vXLANEntryInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewVXLANEntryInformer constructs a new informer for VXLANEntry 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 NewVXLANEntryInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredVXLANEntryInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredVXLANEntryInformer constructs a new informer for VXLANEntry 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 NewFilteredVXLANEntryInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VxlanV1alpha1().VXLANEntries(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VxlanV1alpha1().VXLANEntries(namespace).Watch(context.TODO(), options) - }, - }, - &vxlanv1alpha1.VXLANEntry{}, - resyncPeriod, - indexers, - ) -} - -func (f *vXLANEntryInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredVXLANEntryInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *vXLANEntryInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&vxlanv1alpha1.VXLANEntry{}, f.defaultInformer) -} - -func (f *vXLANEntryInformer) Lister() v1alpha1.VXLANEntryLister { - return v1alpha1.NewVXLANEntryLister(f.Informer().GetIndexer()) -} diff --git a/apis/generated/informers/externalversions/vxlan/v1alpha1/vxlanindex.go b/apis/generated/informers/externalversions/vxlan/v1alpha1/vxlanindex.go deleted file mode 100644 index b9ee3a3..0000000 --- a/apis/generated/informers/externalversions/vxlan/v1alpha1/vxlanindex.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - "context" - time "time" - - vxlanv1alpha1 "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/vxlan/v1alpha1" - v1 "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" -) - -// VXLANIndexInformer provides access to a shared informer and lister for -// VXLANIndexes. -type VXLANIndexInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.VXLANIndexLister -} - -type vXLANIndexInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewVXLANIndexInformer constructs a new informer for VXLANIndex 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 NewVXLANIndexInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredVXLANIndexInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredVXLANIndexInformer constructs a new informer for VXLANIndex 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 NewFilteredVXLANIndexInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VxlanV1alpha1().VXLANIndexes(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.VxlanV1alpha1().VXLANIndexes(namespace).Watch(context.TODO(), options) - }, - }, - &vxlanv1alpha1.VXLANIndex{}, - resyncPeriod, - indexers, - ) -} - -func (f *vXLANIndexInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredVXLANIndexInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *vXLANIndexInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&vxlanv1alpha1.VXLANIndex{}, f.defaultInformer) -} - -func (f *vXLANIndexInformer) Lister() v1alpha1.VXLANIndexLister { - return v1alpha1.NewVXLANIndexLister(f.Informer().GetIndexer()) -} diff --git a/apis/generated/listers/esi/v1alpha1/esiclaim.go b/apis/generated/listers/esi/v1alpha1/esiclaim.go deleted file mode 100644 index 2775601..0000000 --- a/apis/generated/listers/esi/v1alpha1/esiclaim.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/backend/esi/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// ESIClaimLister helps list ESIClaims. -// All objects returned here must be treated as read-only. -type ESIClaimLister interface { - // List lists all ESIClaims in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.ESIClaim, err error) - // ESIClaims returns an object that can list and get ESIClaims. - ESIClaims(namespace string) ESIClaimNamespaceLister - ESIClaimListerExpansion -} - -// eSIClaimLister implements the ESIClaimLister interface. -type eSIClaimLister struct { - indexer cache.Indexer -} - -// NewESIClaimLister returns a new ESIClaimLister. -func NewESIClaimLister(indexer cache.Indexer) ESIClaimLister { - return &eSIClaimLister{indexer: indexer} -} - -// List lists all ESIClaims in the indexer. -func (s *eSIClaimLister) List(selector labels.Selector) (ret []*v1alpha1.ESIClaim, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ESIClaim)) - }) - return ret, err -} - -// ESIClaims returns an object that can list and get ESIClaims. -func (s *eSIClaimLister) ESIClaims(namespace string) ESIClaimNamespaceLister { - return eSIClaimNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// ESIClaimNamespaceLister helps list and get ESIClaims. -// All objects returned here must be treated as read-only. -type ESIClaimNamespaceLister interface { - // List lists all ESIClaims in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.ESIClaim, err error) - // Get retrieves the ESIClaim from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.ESIClaim, error) - ESIClaimNamespaceListerExpansion -} - -// eSIClaimNamespaceLister implements the ESIClaimNamespaceLister -// interface. -type eSIClaimNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all ESIClaims in the indexer for a given namespace. -func (s eSIClaimNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ESIClaim, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ESIClaim)) - }) - return ret, err -} - -// Get retrieves the ESIClaim from the indexer for a given namespace and name. -func (s eSIClaimNamespaceLister) Get(name string) (*v1alpha1.ESIClaim, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("esiclaim"), name) - } - return obj.(*v1alpha1.ESIClaim), nil -} diff --git a/apis/generated/listers/esi/v1alpha1/esientry.go b/apis/generated/listers/esi/v1alpha1/esientry.go deleted file mode 100644 index fe492a0..0000000 --- a/apis/generated/listers/esi/v1alpha1/esientry.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/backend/esi/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// ESIEntryLister helps list ESIEntries. -// All objects returned here must be treated as read-only. -type ESIEntryLister interface { - // List lists all ESIEntries in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.ESIEntry, err error) - // ESIEntries returns an object that can list and get ESIEntries. - ESIEntries(namespace string) ESIEntryNamespaceLister - ESIEntryListerExpansion -} - -// eSIEntryLister implements the ESIEntryLister interface. -type eSIEntryLister struct { - indexer cache.Indexer -} - -// NewESIEntryLister returns a new ESIEntryLister. -func NewESIEntryLister(indexer cache.Indexer) ESIEntryLister { - return &eSIEntryLister{indexer: indexer} -} - -// List lists all ESIEntries in the indexer. -func (s *eSIEntryLister) List(selector labels.Selector) (ret []*v1alpha1.ESIEntry, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ESIEntry)) - }) - return ret, err -} - -// ESIEntries returns an object that can list and get ESIEntries. -func (s *eSIEntryLister) ESIEntries(namespace string) ESIEntryNamespaceLister { - return eSIEntryNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// ESIEntryNamespaceLister helps list and get ESIEntries. -// All objects returned here must be treated as read-only. -type ESIEntryNamespaceLister interface { - // List lists all ESIEntries in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.ESIEntry, err error) - // Get retrieves the ESIEntry from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.ESIEntry, error) - ESIEntryNamespaceListerExpansion -} - -// eSIEntryNamespaceLister implements the ESIEntryNamespaceLister -// interface. -type eSIEntryNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all ESIEntries in the indexer for a given namespace. -func (s eSIEntryNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ESIEntry, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ESIEntry)) - }) - return ret, err -} - -// Get retrieves the ESIEntry from the indexer for a given namespace and name. -func (s eSIEntryNamespaceLister) Get(name string) (*v1alpha1.ESIEntry, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("esientry"), name) - } - return obj.(*v1alpha1.ESIEntry), nil -} diff --git a/apis/generated/listers/esi/v1alpha1/esiindex.go b/apis/generated/listers/esi/v1alpha1/esiindex.go deleted file mode 100644 index 35f2977..0000000 --- a/apis/generated/listers/esi/v1alpha1/esiindex.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/backend/esi/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// ESIIndexLister helps list ESIIndexes. -// All objects returned here must be treated as read-only. -type ESIIndexLister interface { - // List lists all ESIIndexes in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.ESIIndex, err error) - // ESIIndexes returns an object that can list and get ESIIndexes. - ESIIndexes(namespace string) ESIIndexNamespaceLister - ESIIndexListerExpansion -} - -// eSIIndexLister implements the ESIIndexLister interface. -type eSIIndexLister struct { - indexer cache.Indexer -} - -// NewESIIndexLister returns a new ESIIndexLister. -func NewESIIndexLister(indexer cache.Indexer) ESIIndexLister { - return &eSIIndexLister{indexer: indexer} -} - -// List lists all ESIIndexes in the indexer. -func (s *eSIIndexLister) List(selector labels.Selector) (ret []*v1alpha1.ESIIndex, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ESIIndex)) - }) - return ret, err -} - -// ESIIndexes returns an object that can list and get ESIIndexes. -func (s *eSIIndexLister) ESIIndexes(namespace string) ESIIndexNamespaceLister { - return eSIIndexNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// ESIIndexNamespaceLister helps list and get ESIIndexes. -// All objects returned here must be treated as read-only. -type ESIIndexNamespaceLister interface { - // List lists all ESIIndexes in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.ESIIndex, err error) - // Get retrieves the ESIIndex from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.ESIIndex, error) - ESIIndexNamespaceListerExpansion -} - -// eSIIndexNamespaceLister implements the ESIIndexNamespaceLister -// interface. -type eSIIndexNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all ESIIndexes in the indexer for a given namespace. -func (s eSIIndexNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ESIIndex, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ESIIndex)) - }) - return ret, err -} - -// Get retrieves the ESIIndex from the indexer for a given namespace and name. -func (s eSIIndexNamespaceLister) Get(name string) (*v1alpha1.ESIIndex, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("esiindex"), name) - } - return obj.(*v1alpha1.ESIIndex), nil -} diff --git a/apis/generated/listers/esi/v1alpha1/expansion_generated.go b/apis/generated/listers/esi/v1alpha1/expansion_generated.go deleted file mode 100644 index 8347e1a..0000000 --- a/apis/generated/listers/esi/v1alpha1/expansion_generated.go +++ /dev/null @@ -1,42 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -// ESIClaimListerExpansion allows custom methods to be added to -// ESIClaimLister. -type ESIClaimListerExpansion interface{} - -// ESIClaimNamespaceListerExpansion allows custom methods to be added to -// ESIClaimNamespaceLister. -type ESIClaimNamespaceListerExpansion interface{} - -// ESIEntryListerExpansion allows custom methods to be added to -// ESIEntryLister. -type ESIEntryListerExpansion interface{} - -// ESIEntryNamespaceListerExpansion allows custom methods to be added to -// ESIEntryNamespaceLister. -type ESIEntryNamespaceListerExpansion interface{} - -// ESIIndexListerExpansion allows custom methods to be added to -// ESIIndexLister. -type ESIIndexListerExpansion interface{} - -// ESIIndexNamespaceListerExpansion allows custom methods to be added to -// ESIIndexNamespaceLister. -type ESIIndexNamespaceListerExpansion interface{} diff --git a/apis/generated/listers/extcomm/v1alpha1/expansion_generated.go b/apis/generated/listers/extcomm/v1alpha1/expansion_generated.go deleted file mode 100644 index fe22f88..0000000 --- a/apis/generated/listers/extcomm/v1alpha1/expansion_generated.go +++ /dev/null @@ -1,42 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -// EXTCOMMClaimListerExpansion allows custom methods to be added to -// EXTCOMMClaimLister. -type EXTCOMMClaimListerExpansion interface{} - -// EXTCOMMClaimNamespaceListerExpansion allows custom methods to be added to -// EXTCOMMClaimNamespaceLister. -type EXTCOMMClaimNamespaceListerExpansion interface{} - -// EXTCOMMEntryListerExpansion allows custom methods to be added to -// EXTCOMMEntryLister. -type EXTCOMMEntryListerExpansion interface{} - -// EXTCOMMEntryNamespaceListerExpansion allows custom methods to be added to -// EXTCOMMEntryNamespaceLister. -type EXTCOMMEntryNamespaceListerExpansion interface{} - -// EXTCOMMIndexListerExpansion allows custom methods to be added to -// EXTCOMMIndexLister. -type EXTCOMMIndexListerExpansion interface{} - -// EXTCOMMIndexNamespaceListerExpansion allows custom methods to be added to -// EXTCOMMIndexNamespaceLister. -type EXTCOMMIndexNamespaceListerExpansion interface{} diff --git a/apis/generated/listers/extcomm/v1alpha1/extcommclaim.go b/apis/generated/listers/extcomm/v1alpha1/extcommclaim.go deleted file mode 100644 index 3838227..0000000 --- a/apis/generated/listers/extcomm/v1alpha1/extcommclaim.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// EXTCOMMClaimLister helps list EXTCOMMClaims. -// All objects returned here must be treated as read-only. -type EXTCOMMClaimLister interface { - // List lists all EXTCOMMClaims in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.EXTCOMMClaim, err error) - // EXTCOMMClaims returns an object that can list and get EXTCOMMClaims. - EXTCOMMClaims(namespace string) EXTCOMMClaimNamespaceLister - EXTCOMMClaimListerExpansion -} - -// eXTCOMMClaimLister implements the EXTCOMMClaimLister interface. -type eXTCOMMClaimLister struct { - indexer cache.Indexer -} - -// NewEXTCOMMClaimLister returns a new EXTCOMMClaimLister. -func NewEXTCOMMClaimLister(indexer cache.Indexer) EXTCOMMClaimLister { - return &eXTCOMMClaimLister{indexer: indexer} -} - -// List lists all EXTCOMMClaims in the indexer. -func (s *eXTCOMMClaimLister) List(selector labels.Selector) (ret []*v1alpha1.EXTCOMMClaim, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.EXTCOMMClaim)) - }) - return ret, err -} - -// EXTCOMMClaims returns an object that can list and get EXTCOMMClaims. -func (s *eXTCOMMClaimLister) EXTCOMMClaims(namespace string) EXTCOMMClaimNamespaceLister { - return eXTCOMMClaimNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// EXTCOMMClaimNamespaceLister helps list and get EXTCOMMClaims. -// All objects returned here must be treated as read-only. -type EXTCOMMClaimNamespaceLister interface { - // List lists all EXTCOMMClaims in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.EXTCOMMClaim, err error) - // Get retrieves the EXTCOMMClaim from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.EXTCOMMClaim, error) - EXTCOMMClaimNamespaceListerExpansion -} - -// eXTCOMMClaimNamespaceLister implements the EXTCOMMClaimNamespaceLister -// interface. -type eXTCOMMClaimNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all EXTCOMMClaims in the indexer for a given namespace. -func (s eXTCOMMClaimNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.EXTCOMMClaim, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.EXTCOMMClaim)) - }) - return ret, err -} - -// Get retrieves the EXTCOMMClaim from the indexer for a given namespace and name. -func (s eXTCOMMClaimNamespaceLister) Get(name string) (*v1alpha1.EXTCOMMClaim, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("extcommclaim"), name) - } - return obj.(*v1alpha1.EXTCOMMClaim), nil -} diff --git a/apis/generated/listers/extcomm/v1alpha1/extcommentry.go b/apis/generated/listers/extcomm/v1alpha1/extcommentry.go deleted file mode 100644 index 3764338..0000000 --- a/apis/generated/listers/extcomm/v1alpha1/extcommentry.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// EXTCOMMEntryLister helps list EXTCOMMEntries. -// All objects returned here must be treated as read-only. -type EXTCOMMEntryLister interface { - // List lists all EXTCOMMEntries in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.EXTCOMMEntry, err error) - // EXTCOMMEntries returns an object that can list and get EXTCOMMEntries. - EXTCOMMEntries(namespace string) EXTCOMMEntryNamespaceLister - EXTCOMMEntryListerExpansion -} - -// eXTCOMMEntryLister implements the EXTCOMMEntryLister interface. -type eXTCOMMEntryLister struct { - indexer cache.Indexer -} - -// NewEXTCOMMEntryLister returns a new EXTCOMMEntryLister. -func NewEXTCOMMEntryLister(indexer cache.Indexer) EXTCOMMEntryLister { - return &eXTCOMMEntryLister{indexer: indexer} -} - -// List lists all EXTCOMMEntries in the indexer. -func (s *eXTCOMMEntryLister) List(selector labels.Selector) (ret []*v1alpha1.EXTCOMMEntry, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.EXTCOMMEntry)) - }) - return ret, err -} - -// EXTCOMMEntries returns an object that can list and get EXTCOMMEntries. -func (s *eXTCOMMEntryLister) EXTCOMMEntries(namespace string) EXTCOMMEntryNamespaceLister { - return eXTCOMMEntryNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// EXTCOMMEntryNamespaceLister helps list and get EXTCOMMEntries. -// All objects returned here must be treated as read-only. -type EXTCOMMEntryNamespaceLister interface { - // List lists all EXTCOMMEntries in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.EXTCOMMEntry, err error) - // Get retrieves the EXTCOMMEntry from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.EXTCOMMEntry, error) - EXTCOMMEntryNamespaceListerExpansion -} - -// eXTCOMMEntryNamespaceLister implements the EXTCOMMEntryNamespaceLister -// interface. -type eXTCOMMEntryNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all EXTCOMMEntries in the indexer for a given namespace. -func (s eXTCOMMEntryNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.EXTCOMMEntry, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.EXTCOMMEntry)) - }) - return ret, err -} - -// Get retrieves the EXTCOMMEntry from the indexer for a given namespace and name. -func (s eXTCOMMEntryNamespaceLister) Get(name string) (*v1alpha1.EXTCOMMEntry, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("extcommentry"), name) - } - return obj.(*v1alpha1.EXTCOMMEntry), nil -} diff --git a/apis/generated/listers/extcomm/v1alpha1/extcommindex.go b/apis/generated/listers/extcomm/v1alpha1/extcommindex.go deleted file mode 100644 index 42bd003..0000000 --- a/apis/generated/listers/extcomm/v1alpha1/extcommindex.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// EXTCOMMIndexLister helps list EXTCOMMIndexes. -// All objects returned here must be treated as read-only. -type EXTCOMMIndexLister interface { - // List lists all EXTCOMMIndexes in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.EXTCOMMIndex, err error) - // EXTCOMMIndexes returns an object that can list and get EXTCOMMIndexes. - EXTCOMMIndexes(namespace string) EXTCOMMIndexNamespaceLister - EXTCOMMIndexListerExpansion -} - -// eXTCOMMIndexLister implements the EXTCOMMIndexLister interface. -type eXTCOMMIndexLister struct { - indexer cache.Indexer -} - -// NewEXTCOMMIndexLister returns a new EXTCOMMIndexLister. -func NewEXTCOMMIndexLister(indexer cache.Indexer) EXTCOMMIndexLister { - return &eXTCOMMIndexLister{indexer: indexer} -} - -// List lists all EXTCOMMIndexes in the indexer. -func (s *eXTCOMMIndexLister) List(selector labels.Selector) (ret []*v1alpha1.EXTCOMMIndex, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.EXTCOMMIndex)) - }) - return ret, err -} - -// EXTCOMMIndexes returns an object that can list and get EXTCOMMIndexes. -func (s *eXTCOMMIndexLister) EXTCOMMIndexes(namespace string) EXTCOMMIndexNamespaceLister { - return eXTCOMMIndexNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// EXTCOMMIndexNamespaceLister helps list and get EXTCOMMIndexes. -// All objects returned here must be treated as read-only. -type EXTCOMMIndexNamespaceLister interface { - // List lists all EXTCOMMIndexes in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.EXTCOMMIndex, err error) - // Get retrieves the EXTCOMMIndex from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.EXTCOMMIndex, error) - EXTCOMMIndexNamespaceListerExpansion -} - -// eXTCOMMIndexNamespaceLister implements the EXTCOMMIndexNamespaceLister -// interface. -type eXTCOMMIndexNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all EXTCOMMIndexes in the indexer for a given namespace. -func (s eXTCOMMIndexNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.EXTCOMMIndex, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.EXTCOMMIndex)) - }) - return ret, err -} - -// Get retrieves the EXTCOMMIndex from the indexer for a given namespace and name. -func (s eXTCOMMIndexNamespaceLister) Get(name string) (*v1alpha1.EXTCOMMIndex, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("extcommindex"), name) - } - return obj.(*v1alpha1.EXTCOMMIndex), nil -} diff --git a/apis/generated/listers/genid/v1alpha1/expansion_generated.go b/apis/generated/listers/genid/v1alpha1/expansion_generated.go deleted file mode 100644 index 5f2a92f..0000000 --- a/apis/generated/listers/genid/v1alpha1/expansion_generated.go +++ /dev/null @@ -1,42 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -// GENIDClaimListerExpansion allows custom methods to be added to -// GENIDClaimLister. -type GENIDClaimListerExpansion interface{} - -// GENIDClaimNamespaceListerExpansion allows custom methods to be added to -// GENIDClaimNamespaceLister. -type GENIDClaimNamespaceListerExpansion interface{} - -// GENIDEntryListerExpansion allows custom methods to be added to -// GENIDEntryLister. -type GENIDEntryListerExpansion interface{} - -// GENIDEntryNamespaceListerExpansion allows custom methods to be added to -// GENIDEntryNamespaceLister. -type GENIDEntryNamespaceListerExpansion interface{} - -// GENIDIndexListerExpansion allows custom methods to be added to -// GENIDIndexLister. -type GENIDIndexListerExpansion interface{} - -// GENIDIndexNamespaceListerExpansion allows custom methods to be added to -// GENIDIndexNamespaceLister. -type GENIDIndexNamespaceListerExpansion interface{} diff --git a/apis/generated/listers/genid/v1alpha1/genidclaim.go b/apis/generated/listers/genid/v1alpha1/genidclaim.go deleted file mode 100644 index 0c35d42..0000000 --- a/apis/generated/listers/genid/v1alpha1/genidclaim.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/backend/genid/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// GENIDClaimLister helps list GENIDClaims. -// All objects returned here must be treated as read-only. -type GENIDClaimLister interface { - // List lists all GENIDClaims in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.GENIDClaim, err error) - // GENIDClaims returns an object that can list and get GENIDClaims. - GENIDClaims(namespace string) GENIDClaimNamespaceLister - GENIDClaimListerExpansion -} - -// gENIDClaimLister implements the GENIDClaimLister interface. -type gENIDClaimLister struct { - indexer cache.Indexer -} - -// NewGENIDClaimLister returns a new GENIDClaimLister. -func NewGENIDClaimLister(indexer cache.Indexer) GENIDClaimLister { - return &gENIDClaimLister{indexer: indexer} -} - -// List lists all GENIDClaims in the indexer. -func (s *gENIDClaimLister) List(selector labels.Selector) (ret []*v1alpha1.GENIDClaim, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.GENIDClaim)) - }) - return ret, err -} - -// GENIDClaims returns an object that can list and get GENIDClaims. -func (s *gENIDClaimLister) GENIDClaims(namespace string) GENIDClaimNamespaceLister { - return gENIDClaimNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// GENIDClaimNamespaceLister helps list and get GENIDClaims. -// All objects returned here must be treated as read-only. -type GENIDClaimNamespaceLister interface { - // List lists all GENIDClaims in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.GENIDClaim, err error) - // Get retrieves the GENIDClaim from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.GENIDClaim, error) - GENIDClaimNamespaceListerExpansion -} - -// gENIDClaimNamespaceLister implements the GENIDClaimNamespaceLister -// interface. -type gENIDClaimNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all GENIDClaims in the indexer for a given namespace. -func (s gENIDClaimNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.GENIDClaim, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.GENIDClaim)) - }) - return ret, err -} - -// Get retrieves the GENIDClaim from the indexer for a given namespace and name. -func (s gENIDClaimNamespaceLister) Get(name string) (*v1alpha1.GENIDClaim, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("genidclaim"), name) - } - return obj.(*v1alpha1.GENIDClaim), nil -} diff --git a/apis/generated/listers/genid/v1alpha1/genidentry.go b/apis/generated/listers/genid/v1alpha1/genidentry.go deleted file mode 100644 index bc871b3..0000000 --- a/apis/generated/listers/genid/v1alpha1/genidentry.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/backend/genid/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// GENIDEntryLister helps list GENIDEntries. -// All objects returned here must be treated as read-only. -type GENIDEntryLister interface { - // List lists all GENIDEntries in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.GENIDEntry, err error) - // GENIDEntries returns an object that can list and get GENIDEntries. - GENIDEntries(namespace string) GENIDEntryNamespaceLister - GENIDEntryListerExpansion -} - -// gENIDEntryLister implements the GENIDEntryLister interface. -type gENIDEntryLister struct { - indexer cache.Indexer -} - -// NewGENIDEntryLister returns a new GENIDEntryLister. -func NewGENIDEntryLister(indexer cache.Indexer) GENIDEntryLister { - return &gENIDEntryLister{indexer: indexer} -} - -// List lists all GENIDEntries in the indexer. -func (s *gENIDEntryLister) List(selector labels.Selector) (ret []*v1alpha1.GENIDEntry, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.GENIDEntry)) - }) - return ret, err -} - -// GENIDEntries returns an object that can list and get GENIDEntries. -func (s *gENIDEntryLister) GENIDEntries(namespace string) GENIDEntryNamespaceLister { - return gENIDEntryNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// GENIDEntryNamespaceLister helps list and get GENIDEntries. -// All objects returned here must be treated as read-only. -type GENIDEntryNamespaceLister interface { - // List lists all GENIDEntries in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.GENIDEntry, err error) - // Get retrieves the GENIDEntry from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.GENIDEntry, error) - GENIDEntryNamespaceListerExpansion -} - -// gENIDEntryNamespaceLister implements the GENIDEntryNamespaceLister -// interface. -type gENIDEntryNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all GENIDEntries in the indexer for a given namespace. -func (s gENIDEntryNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.GENIDEntry, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.GENIDEntry)) - }) - return ret, err -} - -// Get retrieves the GENIDEntry from the indexer for a given namespace and name. -func (s gENIDEntryNamespaceLister) Get(name string) (*v1alpha1.GENIDEntry, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("genidentry"), name) - } - return obj.(*v1alpha1.GENIDEntry), nil -} diff --git a/apis/generated/listers/genid/v1alpha1/genidindex.go b/apis/generated/listers/genid/v1alpha1/genidindex.go deleted file mode 100644 index f0564fe..0000000 --- a/apis/generated/listers/genid/v1alpha1/genidindex.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/backend/genid/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// GENIDIndexLister helps list GENIDIndexes. -// All objects returned here must be treated as read-only. -type GENIDIndexLister interface { - // List lists all GENIDIndexes in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.GENIDIndex, err error) - // GENIDIndexes returns an object that can list and get GENIDIndexes. - GENIDIndexes(namespace string) GENIDIndexNamespaceLister - GENIDIndexListerExpansion -} - -// gENIDIndexLister implements the GENIDIndexLister interface. -type gENIDIndexLister struct { - indexer cache.Indexer -} - -// NewGENIDIndexLister returns a new GENIDIndexLister. -func NewGENIDIndexLister(indexer cache.Indexer) GENIDIndexLister { - return &gENIDIndexLister{indexer: indexer} -} - -// List lists all GENIDIndexes in the indexer. -func (s *gENIDIndexLister) List(selector labels.Selector) (ret []*v1alpha1.GENIDIndex, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.GENIDIndex)) - }) - return ret, err -} - -// GENIDIndexes returns an object that can list and get GENIDIndexes. -func (s *gENIDIndexLister) GENIDIndexes(namespace string) GENIDIndexNamespaceLister { - return gENIDIndexNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// GENIDIndexNamespaceLister helps list and get GENIDIndexes. -// All objects returned here must be treated as read-only. -type GENIDIndexNamespaceLister interface { - // List lists all GENIDIndexes in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.GENIDIndex, err error) - // Get retrieves the GENIDIndex from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.GENIDIndex, error) - GENIDIndexNamespaceListerExpansion -} - -// gENIDIndexNamespaceLister implements the GENIDIndexNamespaceLister -// interface. -type gENIDIndexNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all GENIDIndexes in the indexer for a given namespace. -func (s gENIDIndexNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.GENIDIndex, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.GENIDIndex)) - }) - return ret, err -} - -// Get retrieves the GENIDIndex from the indexer for a given namespace and name. -func (s gENIDIndexNamespaceLister) Get(name string) (*v1alpha1.GENIDIndex, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("genidindex"), name) - } - return obj.(*v1alpha1.GENIDIndex), nil -} diff --git a/apis/generated/listers/infra/v1alpha1/cluster.go b/apis/generated/listers/infra/v1alpha1/cluster.go deleted file mode 100644 index 81b2c9e..0000000 --- a/apis/generated/listers/infra/v1alpha1/cluster.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// ClusterLister helps list Clusters. -// All objects returned here must be treated as read-only. -type ClusterLister interface { - // List lists all Clusters in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.Cluster, err error) - // Clusters returns an object that can list and get Clusters. - Clusters(namespace string) ClusterNamespaceLister - ClusterListerExpansion -} - -// clusterLister implements the ClusterLister interface. -type clusterLister struct { - indexer cache.Indexer -} - -// NewClusterLister returns a new ClusterLister. -func NewClusterLister(indexer cache.Indexer) ClusterLister { - return &clusterLister{indexer: indexer} -} - -// List lists all Clusters in the indexer. -func (s *clusterLister) List(selector labels.Selector) (ret []*v1alpha1.Cluster, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Cluster)) - }) - return ret, err -} - -// Clusters returns an object that can list and get Clusters. -func (s *clusterLister) Clusters(namespace string) ClusterNamespaceLister { - return clusterNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// ClusterNamespaceLister helps list and get Clusters. -// All objects returned here must be treated as read-only. -type ClusterNamespaceLister interface { - // List lists all Clusters in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.Cluster, err error) - // Get retrieves the Cluster from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.Cluster, error) - ClusterNamespaceListerExpansion -} - -// clusterNamespaceLister implements the ClusterNamespaceLister -// interface. -type clusterNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Clusters in the indexer for a given namespace. -func (s clusterNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Cluster, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Cluster)) - }) - return ret, err -} - -// Get retrieves the Cluster from the indexer for a given namespace and name. -func (s clusterNamespaceLister) Get(name string) (*v1alpha1.Cluster, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("cluster"), name) - } - return obj.(*v1alpha1.Cluster), nil -} diff --git a/apis/generated/listers/infra/v1alpha1/endpoint.go b/apis/generated/listers/infra/v1alpha1/endpoint.go deleted file mode 100644 index e990f53..0000000 --- a/apis/generated/listers/infra/v1alpha1/endpoint.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// EndpointLister helps list Endpoints. -// All objects returned here must be treated as read-only. -type EndpointLister interface { - // List lists all Endpoints in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.Endpoint, err error) - // Endpoints returns an object that can list and get Endpoints. - Endpoints(namespace string) EndpointNamespaceLister - EndpointListerExpansion -} - -// endpointLister implements the EndpointLister interface. -type endpointLister struct { - indexer cache.Indexer -} - -// NewEndpointLister returns a new EndpointLister. -func NewEndpointLister(indexer cache.Indexer) EndpointLister { - return &endpointLister{indexer: indexer} -} - -// List lists all Endpoints in the indexer. -func (s *endpointLister) List(selector labels.Selector) (ret []*v1alpha1.Endpoint, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Endpoint)) - }) - return ret, err -} - -// Endpoints returns an object that can list and get Endpoints. -func (s *endpointLister) Endpoints(namespace string) EndpointNamespaceLister { - return endpointNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// EndpointNamespaceLister helps list and get Endpoints. -// All objects returned here must be treated as read-only. -type EndpointNamespaceLister interface { - // List lists all Endpoints in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.Endpoint, err error) - // Get retrieves the Endpoint from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.Endpoint, error) - EndpointNamespaceListerExpansion -} - -// endpointNamespaceLister implements the EndpointNamespaceLister -// interface. -type endpointNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Endpoints in the indexer for a given namespace. -func (s endpointNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Endpoint, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Endpoint)) - }) - return ret, err -} - -// Get retrieves the Endpoint from the indexer for a given namespace and name. -func (s endpointNamespaceLister) Get(name string) (*v1alpha1.Endpoint, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("endpoint"), name) - } - return obj.(*v1alpha1.Endpoint), nil -} diff --git a/apis/generated/listers/infra/v1alpha1/endpointset.go b/apis/generated/listers/infra/v1alpha1/endpointset.go deleted file mode 100644 index 92a3228..0000000 --- a/apis/generated/listers/infra/v1alpha1/endpointset.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// EndpointSetLister helps list EndpointSets. -// All objects returned here must be treated as read-only. -type EndpointSetLister interface { - // List lists all EndpointSets in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.EndpointSet, err error) - // EndpointSets returns an object that can list and get EndpointSets. - EndpointSets(namespace string) EndpointSetNamespaceLister - EndpointSetListerExpansion -} - -// endpointSetLister implements the EndpointSetLister interface. -type endpointSetLister struct { - indexer cache.Indexer -} - -// NewEndpointSetLister returns a new EndpointSetLister. -func NewEndpointSetLister(indexer cache.Indexer) EndpointSetLister { - return &endpointSetLister{indexer: indexer} -} - -// List lists all EndpointSets in the indexer. -func (s *endpointSetLister) List(selector labels.Selector) (ret []*v1alpha1.EndpointSet, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.EndpointSet)) - }) - return ret, err -} - -// EndpointSets returns an object that can list and get EndpointSets. -func (s *endpointSetLister) EndpointSets(namespace string) EndpointSetNamespaceLister { - return endpointSetNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// EndpointSetNamespaceLister helps list and get EndpointSets. -// All objects returned here must be treated as read-only. -type EndpointSetNamespaceLister interface { - // List lists all EndpointSets in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.EndpointSet, err error) - // Get retrieves the EndpointSet from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.EndpointSet, error) - EndpointSetNamespaceListerExpansion -} - -// endpointSetNamespaceLister implements the EndpointSetNamespaceLister -// interface. -type endpointSetNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all EndpointSets in the indexer for a given namespace. -func (s endpointSetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.EndpointSet, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.EndpointSet)) - }) - return ret, err -} - -// Get retrieves the EndpointSet from the indexer for a given namespace and name. -func (s endpointSetNamespaceLister) Get(name string) (*v1alpha1.EndpointSet, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("endpointset"), name) - } - return obj.(*v1alpha1.EndpointSet), nil -} diff --git a/apis/generated/listers/infra/v1alpha1/expansion_generated.go b/apis/generated/listers/infra/v1alpha1/expansion_generated.go deleted file mode 100644 index f2dd714..0000000 --- a/apis/generated/listers/infra/v1alpha1/expansion_generated.go +++ /dev/null @@ -1,130 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -// ClusterListerExpansion allows custom methods to be added to -// ClusterLister. -type ClusterListerExpansion interface{} - -// ClusterNamespaceListerExpansion allows custom methods to be added to -// ClusterNamespaceLister. -type ClusterNamespaceListerExpansion interface{} - -// EndpointListerExpansion allows custom methods to be added to -// EndpointLister. -type EndpointListerExpansion interface{} - -// EndpointNamespaceListerExpansion allows custom methods to be added to -// EndpointNamespaceLister. -type EndpointNamespaceListerExpansion interface{} - -// EndpointSetListerExpansion allows custom methods to be added to -// EndpointSetLister. -type EndpointSetListerExpansion interface{} - -// EndpointSetNamespaceListerExpansion allows custom methods to be added to -// EndpointSetNamespaceLister. -type EndpointSetNamespaceListerExpansion interface{} - -// LinkListerExpansion allows custom methods to be added to -// LinkLister. -type LinkListerExpansion interface{} - -// LinkNamespaceListerExpansion allows custom methods to be added to -// LinkNamespaceLister. -type LinkNamespaceListerExpansion interface{} - -// LinkSetListerExpansion allows custom methods to be added to -// LinkSetLister. -type LinkSetListerExpansion interface{} - -// LinkSetNamespaceListerExpansion allows custom methods to be added to -// LinkSetNamespaceLister. -type LinkSetNamespaceListerExpansion interface{} - -// ModuleListerExpansion allows custom methods to be added to -// ModuleLister. -type ModuleListerExpansion interface{} - -// ModuleNamespaceListerExpansion allows custom methods to be added to -// ModuleNamespaceLister. -type ModuleNamespaceListerExpansion interface{} - -// ModuleBayListerExpansion allows custom methods to be added to -// ModuleBayLister. -type ModuleBayListerExpansion interface{} - -// ModuleBayNamespaceListerExpansion allows custom methods to be added to -// ModuleBayNamespaceLister. -type ModuleBayNamespaceListerExpansion interface{} - -// NodeListerExpansion allows custom methods to be added to -// NodeLister. -type NodeListerExpansion interface{} - -// NodeNamespaceListerExpansion allows custom methods to be added to -// NodeNamespaceLister. -type NodeNamespaceListerExpansion interface{} - -// NodeGroupListerExpansion allows custom methods to be added to -// NodeGroupLister. -type NodeGroupListerExpansion interface{} - -// NodeGroupNamespaceListerExpansion allows custom methods to be added to -// NodeGroupNamespaceLister. -type NodeGroupNamespaceListerExpansion interface{} - -// NodeItemListerExpansion allows custom methods to be added to -// NodeItemLister. -type NodeItemListerExpansion interface{} - -// NodeItemNamespaceListerExpansion allows custom methods to be added to -// NodeItemNamespaceLister. -type NodeItemNamespaceListerExpansion interface{} - -// NodeSetListerExpansion allows custom methods to be added to -// NodeSetLister. -type NodeSetListerExpansion interface{} - -// NodeSetNamespaceListerExpansion allows custom methods to be added to -// NodeSetNamespaceLister. -type NodeSetNamespaceListerExpansion interface{} - -// RackListerExpansion allows custom methods to be added to -// RackLister. -type RackListerExpansion interface{} - -// RackNamespaceListerExpansion allows custom methods to be added to -// RackNamespaceLister. -type RackNamespaceListerExpansion interface{} - -// RegionListerExpansion allows custom methods to be added to -// RegionLister. -type RegionListerExpansion interface{} - -// RegionNamespaceListerExpansion allows custom methods to be added to -// RegionNamespaceLister. -type RegionNamespaceListerExpansion interface{} - -// SiteListerExpansion allows custom methods to be added to -// SiteLister. -type SiteListerExpansion interface{} - -// SiteNamespaceListerExpansion allows custom methods to be added to -// SiteNamespaceLister. -type SiteNamespaceListerExpansion interface{} diff --git a/apis/generated/listers/infra/v1alpha1/link.go b/apis/generated/listers/infra/v1alpha1/link.go deleted file mode 100644 index f629e9c..0000000 --- a/apis/generated/listers/infra/v1alpha1/link.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// LinkLister helps list Links. -// All objects returned here must be treated as read-only. -type LinkLister interface { - // List lists all Links in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.Link, err error) - // Links returns an object that can list and get Links. - Links(namespace string) LinkNamespaceLister - LinkListerExpansion -} - -// linkLister implements the LinkLister interface. -type linkLister struct { - indexer cache.Indexer -} - -// NewLinkLister returns a new LinkLister. -func NewLinkLister(indexer cache.Indexer) LinkLister { - return &linkLister{indexer: indexer} -} - -// List lists all Links in the indexer. -func (s *linkLister) List(selector labels.Selector) (ret []*v1alpha1.Link, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Link)) - }) - return ret, err -} - -// Links returns an object that can list and get Links. -func (s *linkLister) Links(namespace string) LinkNamespaceLister { - return linkNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// LinkNamespaceLister helps list and get Links. -// All objects returned here must be treated as read-only. -type LinkNamespaceLister interface { - // List lists all Links in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.Link, err error) - // Get retrieves the Link from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.Link, error) - LinkNamespaceListerExpansion -} - -// linkNamespaceLister implements the LinkNamespaceLister -// interface. -type linkNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Links in the indexer for a given namespace. -func (s linkNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Link, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Link)) - }) - return ret, err -} - -// Get retrieves the Link from the indexer for a given namespace and name. -func (s linkNamespaceLister) Get(name string) (*v1alpha1.Link, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("link"), name) - } - return obj.(*v1alpha1.Link), nil -} diff --git a/apis/generated/listers/infra/v1alpha1/linkset.go b/apis/generated/listers/infra/v1alpha1/linkset.go deleted file mode 100644 index 49a19ae..0000000 --- a/apis/generated/listers/infra/v1alpha1/linkset.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// LinkSetLister helps list LinkSets. -// All objects returned here must be treated as read-only. -type LinkSetLister interface { - // List lists all LinkSets in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.LinkSet, err error) - // LinkSets returns an object that can list and get LinkSets. - LinkSets(namespace string) LinkSetNamespaceLister - LinkSetListerExpansion -} - -// linkSetLister implements the LinkSetLister interface. -type linkSetLister struct { - indexer cache.Indexer -} - -// NewLinkSetLister returns a new LinkSetLister. -func NewLinkSetLister(indexer cache.Indexer) LinkSetLister { - return &linkSetLister{indexer: indexer} -} - -// List lists all LinkSets in the indexer. -func (s *linkSetLister) List(selector labels.Selector) (ret []*v1alpha1.LinkSet, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.LinkSet)) - }) - return ret, err -} - -// LinkSets returns an object that can list and get LinkSets. -func (s *linkSetLister) LinkSets(namespace string) LinkSetNamespaceLister { - return linkSetNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// LinkSetNamespaceLister helps list and get LinkSets. -// All objects returned here must be treated as read-only. -type LinkSetNamespaceLister interface { - // List lists all LinkSets in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.LinkSet, err error) - // Get retrieves the LinkSet from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.LinkSet, error) - LinkSetNamespaceListerExpansion -} - -// linkSetNamespaceLister implements the LinkSetNamespaceLister -// interface. -type linkSetNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all LinkSets in the indexer for a given namespace. -func (s linkSetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.LinkSet, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.LinkSet)) - }) - return ret, err -} - -// Get retrieves the LinkSet from the indexer for a given namespace and name. -func (s linkSetNamespaceLister) Get(name string) (*v1alpha1.LinkSet, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("linkset"), name) - } - return obj.(*v1alpha1.LinkSet), nil -} diff --git a/apis/generated/listers/infra/v1alpha1/module.go b/apis/generated/listers/infra/v1alpha1/module.go deleted file mode 100644 index 5a3cab7..0000000 --- a/apis/generated/listers/infra/v1alpha1/module.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// ModuleLister helps list Modules. -// All objects returned here must be treated as read-only. -type ModuleLister interface { - // List lists all Modules in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.Module, err error) - // Modules returns an object that can list and get Modules. - Modules(namespace string) ModuleNamespaceLister - ModuleListerExpansion -} - -// moduleLister implements the ModuleLister interface. -type moduleLister struct { - indexer cache.Indexer -} - -// NewModuleLister returns a new ModuleLister. -func NewModuleLister(indexer cache.Indexer) ModuleLister { - return &moduleLister{indexer: indexer} -} - -// List lists all Modules in the indexer. -func (s *moduleLister) List(selector labels.Selector) (ret []*v1alpha1.Module, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Module)) - }) - return ret, err -} - -// Modules returns an object that can list and get Modules. -func (s *moduleLister) Modules(namespace string) ModuleNamespaceLister { - return moduleNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// ModuleNamespaceLister helps list and get Modules. -// All objects returned here must be treated as read-only. -type ModuleNamespaceLister interface { - // List lists all Modules in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.Module, err error) - // Get retrieves the Module from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.Module, error) - ModuleNamespaceListerExpansion -} - -// moduleNamespaceLister implements the ModuleNamespaceLister -// interface. -type moduleNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Modules in the indexer for a given namespace. -func (s moduleNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Module, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Module)) - }) - return ret, err -} - -// Get retrieves the Module from the indexer for a given namespace and name. -func (s moduleNamespaceLister) Get(name string) (*v1alpha1.Module, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("module"), name) - } - return obj.(*v1alpha1.Module), nil -} diff --git a/apis/generated/listers/infra/v1alpha1/modulebay.go b/apis/generated/listers/infra/v1alpha1/modulebay.go deleted file mode 100644 index 20b3d5d..0000000 --- a/apis/generated/listers/infra/v1alpha1/modulebay.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// ModuleBayLister helps list ModuleBays. -// All objects returned here must be treated as read-only. -type ModuleBayLister interface { - // List lists all ModuleBays in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.ModuleBay, err error) - // ModuleBays returns an object that can list and get ModuleBays. - ModuleBays(namespace string) ModuleBayNamespaceLister - ModuleBayListerExpansion -} - -// moduleBayLister implements the ModuleBayLister interface. -type moduleBayLister struct { - indexer cache.Indexer -} - -// NewModuleBayLister returns a new ModuleBayLister. -func NewModuleBayLister(indexer cache.Indexer) ModuleBayLister { - return &moduleBayLister{indexer: indexer} -} - -// List lists all ModuleBays in the indexer. -func (s *moduleBayLister) List(selector labels.Selector) (ret []*v1alpha1.ModuleBay, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ModuleBay)) - }) - return ret, err -} - -// ModuleBays returns an object that can list and get ModuleBays. -func (s *moduleBayLister) ModuleBays(namespace string) ModuleBayNamespaceLister { - return moduleBayNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// ModuleBayNamespaceLister helps list and get ModuleBays. -// All objects returned here must be treated as read-only. -type ModuleBayNamespaceLister interface { - // List lists all ModuleBays in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.ModuleBay, err error) - // Get retrieves the ModuleBay from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.ModuleBay, error) - ModuleBayNamespaceListerExpansion -} - -// moduleBayNamespaceLister implements the ModuleBayNamespaceLister -// interface. -type moduleBayNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all ModuleBays in the indexer for a given namespace. -func (s moduleBayNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ModuleBay, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ModuleBay)) - }) - return ret, err -} - -// Get retrieves the ModuleBay from the indexer for a given namespace and name. -func (s moduleBayNamespaceLister) Get(name string) (*v1alpha1.ModuleBay, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("modulebay"), name) - } - return obj.(*v1alpha1.ModuleBay), nil -} diff --git a/apis/generated/listers/infra/v1alpha1/node.go b/apis/generated/listers/infra/v1alpha1/node.go deleted file mode 100644 index 3d7ca75..0000000 --- a/apis/generated/listers/infra/v1alpha1/node.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// NodeLister helps list Nodes. -// All objects returned here must be treated as read-only. -type NodeLister interface { - // List lists all Nodes in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.Node, err error) - // Nodes returns an object that can list and get Nodes. - Nodes(namespace string) NodeNamespaceLister - NodeListerExpansion -} - -// nodeLister implements the NodeLister interface. -type nodeLister struct { - indexer cache.Indexer -} - -// NewNodeLister returns a new NodeLister. -func NewNodeLister(indexer cache.Indexer) NodeLister { - return &nodeLister{indexer: indexer} -} - -// List lists all Nodes in the indexer. -func (s *nodeLister) List(selector labels.Selector) (ret []*v1alpha1.Node, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Node)) - }) - return ret, err -} - -// Nodes returns an object that can list and get Nodes. -func (s *nodeLister) Nodes(namespace string) NodeNamespaceLister { - return nodeNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// NodeNamespaceLister helps list and get Nodes. -// All objects returned here must be treated as read-only. -type NodeNamespaceLister interface { - // List lists all Nodes in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.Node, err error) - // Get retrieves the Node from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.Node, error) - NodeNamespaceListerExpansion -} - -// nodeNamespaceLister implements the NodeNamespaceLister -// interface. -type nodeNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Nodes in the indexer for a given namespace. -func (s nodeNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Node, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Node)) - }) - return ret, err -} - -// Get retrieves the Node from the indexer for a given namespace and name. -func (s nodeNamespaceLister) Get(name string) (*v1alpha1.Node, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("node"), name) - } - return obj.(*v1alpha1.Node), nil -} diff --git a/apis/generated/listers/infra/v1alpha1/nodegroup.go b/apis/generated/listers/infra/v1alpha1/nodegroup.go deleted file mode 100644 index 6d5e229..0000000 --- a/apis/generated/listers/infra/v1alpha1/nodegroup.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// NodeGroupLister helps list NodeGroups. -// All objects returned here must be treated as read-only. -type NodeGroupLister interface { - // List lists all NodeGroups in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.NodeGroup, err error) - // NodeGroups returns an object that can list and get NodeGroups. - NodeGroups(namespace string) NodeGroupNamespaceLister - NodeGroupListerExpansion -} - -// nodeGroupLister implements the NodeGroupLister interface. -type nodeGroupLister struct { - indexer cache.Indexer -} - -// NewNodeGroupLister returns a new NodeGroupLister. -func NewNodeGroupLister(indexer cache.Indexer) NodeGroupLister { - return &nodeGroupLister{indexer: indexer} -} - -// List lists all NodeGroups in the indexer. -func (s *nodeGroupLister) List(selector labels.Selector) (ret []*v1alpha1.NodeGroup, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.NodeGroup)) - }) - return ret, err -} - -// NodeGroups returns an object that can list and get NodeGroups. -func (s *nodeGroupLister) NodeGroups(namespace string) NodeGroupNamespaceLister { - return nodeGroupNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// NodeGroupNamespaceLister helps list and get NodeGroups. -// All objects returned here must be treated as read-only. -type NodeGroupNamespaceLister interface { - // List lists all NodeGroups in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.NodeGroup, err error) - // Get retrieves the NodeGroup from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.NodeGroup, error) - NodeGroupNamespaceListerExpansion -} - -// nodeGroupNamespaceLister implements the NodeGroupNamespaceLister -// interface. -type nodeGroupNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all NodeGroups in the indexer for a given namespace. -func (s nodeGroupNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.NodeGroup, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.NodeGroup)) - }) - return ret, err -} - -// Get retrieves the NodeGroup from the indexer for a given namespace and name. -func (s nodeGroupNamespaceLister) Get(name string) (*v1alpha1.NodeGroup, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("nodegroup"), name) - } - return obj.(*v1alpha1.NodeGroup), nil -} diff --git a/apis/generated/listers/infra/v1alpha1/nodeitem.go b/apis/generated/listers/infra/v1alpha1/nodeitem.go deleted file mode 100644 index 17392f3..0000000 --- a/apis/generated/listers/infra/v1alpha1/nodeitem.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// NodeItemLister helps list NodeItems. -// All objects returned here must be treated as read-only. -type NodeItemLister interface { - // List lists all NodeItems in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.NodeItem, err error) - // NodeItems returns an object that can list and get NodeItems. - NodeItems(namespace string) NodeItemNamespaceLister - NodeItemListerExpansion -} - -// nodeItemLister implements the NodeItemLister interface. -type nodeItemLister struct { - indexer cache.Indexer -} - -// NewNodeItemLister returns a new NodeItemLister. -func NewNodeItemLister(indexer cache.Indexer) NodeItemLister { - return &nodeItemLister{indexer: indexer} -} - -// List lists all NodeItems in the indexer. -func (s *nodeItemLister) List(selector labels.Selector) (ret []*v1alpha1.NodeItem, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.NodeItem)) - }) - return ret, err -} - -// NodeItems returns an object that can list and get NodeItems. -func (s *nodeItemLister) NodeItems(namespace string) NodeItemNamespaceLister { - return nodeItemNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// NodeItemNamespaceLister helps list and get NodeItems. -// All objects returned here must be treated as read-only. -type NodeItemNamespaceLister interface { - // List lists all NodeItems in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.NodeItem, err error) - // Get retrieves the NodeItem from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.NodeItem, error) - NodeItemNamespaceListerExpansion -} - -// nodeItemNamespaceLister implements the NodeItemNamespaceLister -// interface. -type nodeItemNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all NodeItems in the indexer for a given namespace. -func (s nodeItemNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.NodeItem, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.NodeItem)) - }) - return ret, err -} - -// Get retrieves the NodeItem from the indexer for a given namespace and name. -func (s nodeItemNamespaceLister) Get(name string) (*v1alpha1.NodeItem, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("nodeitem"), name) - } - return obj.(*v1alpha1.NodeItem), nil -} diff --git a/apis/generated/listers/infra/v1alpha1/nodeset.go b/apis/generated/listers/infra/v1alpha1/nodeset.go deleted file mode 100644 index 1eb4f33..0000000 --- a/apis/generated/listers/infra/v1alpha1/nodeset.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// NodeSetLister helps list NodeSets. -// All objects returned here must be treated as read-only. -type NodeSetLister interface { - // List lists all NodeSets in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.NodeSet, err error) - // NodeSets returns an object that can list and get NodeSets. - NodeSets(namespace string) NodeSetNamespaceLister - NodeSetListerExpansion -} - -// nodeSetLister implements the NodeSetLister interface. -type nodeSetLister struct { - indexer cache.Indexer -} - -// NewNodeSetLister returns a new NodeSetLister. -func NewNodeSetLister(indexer cache.Indexer) NodeSetLister { - return &nodeSetLister{indexer: indexer} -} - -// List lists all NodeSets in the indexer. -func (s *nodeSetLister) List(selector labels.Selector) (ret []*v1alpha1.NodeSet, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.NodeSet)) - }) - return ret, err -} - -// NodeSets returns an object that can list and get NodeSets. -func (s *nodeSetLister) NodeSets(namespace string) NodeSetNamespaceLister { - return nodeSetNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// NodeSetNamespaceLister helps list and get NodeSets. -// All objects returned here must be treated as read-only. -type NodeSetNamespaceLister interface { - // List lists all NodeSets in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.NodeSet, err error) - // Get retrieves the NodeSet from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.NodeSet, error) - NodeSetNamespaceListerExpansion -} - -// nodeSetNamespaceLister implements the NodeSetNamespaceLister -// interface. -type nodeSetNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all NodeSets in the indexer for a given namespace. -func (s nodeSetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.NodeSet, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.NodeSet)) - }) - return ret, err -} - -// Get retrieves the NodeSet from the indexer for a given namespace and name. -func (s nodeSetNamespaceLister) Get(name string) (*v1alpha1.NodeSet, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("nodeset"), name) - } - return obj.(*v1alpha1.NodeSet), nil -} diff --git a/apis/generated/listers/infra/v1alpha1/rack.go b/apis/generated/listers/infra/v1alpha1/rack.go deleted file mode 100644 index 746f47c..0000000 --- a/apis/generated/listers/infra/v1alpha1/rack.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// RackLister helps list Racks. -// All objects returned here must be treated as read-only. -type RackLister interface { - // List lists all Racks in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.Rack, err error) - // Racks returns an object that can list and get Racks. - Racks(namespace string) RackNamespaceLister - RackListerExpansion -} - -// rackLister implements the RackLister interface. -type rackLister struct { - indexer cache.Indexer -} - -// NewRackLister returns a new RackLister. -func NewRackLister(indexer cache.Indexer) RackLister { - return &rackLister{indexer: indexer} -} - -// List lists all Racks in the indexer. -func (s *rackLister) List(selector labels.Selector) (ret []*v1alpha1.Rack, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Rack)) - }) - return ret, err -} - -// Racks returns an object that can list and get Racks. -func (s *rackLister) Racks(namespace string) RackNamespaceLister { - return rackNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// RackNamespaceLister helps list and get Racks. -// All objects returned here must be treated as read-only. -type RackNamespaceLister interface { - // List lists all Racks in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.Rack, err error) - // Get retrieves the Rack from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.Rack, error) - RackNamespaceListerExpansion -} - -// rackNamespaceLister implements the RackNamespaceLister -// interface. -type rackNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Racks in the indexer for a given namespace. -func (s rackNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Rack, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Rack)) - }) - return ret, err -} - -// Get retrieves the Rack from the indexer for a given namespace and name. -func (s rackNamespaceLister) Get(name string) (*v1alpha1.Rack, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("rack"), name) - } - return obj.(*v1alpha1.Rack), nil -} diff --git a/apis/generated/listers/infra/v1alpha1/region.go b/apis/generated/listers/infra/v1alpha1/region.go deleted file mode 100644 index 160ebc0..0000000 --- a/apis/generated/listers/infra/v1alpha1/region.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// RegionLister helps list Regions. -// All objects returned here must be treated as read-only. -type RegionLister interface { - // List lists all Regions in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.Region, err error) - // Regions returns an object that can list and get Regions. - Regions(namespace string) RegionNamespaceLister - RegionListerExpansion -} - -// regionLister implements the RegionLister interface. -type regionLister struct { - indexer cache.Indexer -} - -// NewRegionLister returns a new RegionLister. -func NewRegionLister(indexer cache.Indexer) RegionLister { - return ®ionLister{indexer: indexer} -} - -// List lists all Regions in the indexer. -func (s *regionLister) List(selector labels.Selector) (ret []*v1alpha1.Region, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Region)) - }) - return ret, err -} - -// Regions returns an object that can list and get Regions. -func (s *regionLister) Regions(namespace string) RegionNamespaceLister { - return regionNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// RegionNamespaceLister helps list and get Regions. -// All objects returned here must be treated as read-only. -type RegionNamespaceLister interface { - // List lists all Regions in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.Region, err error) - // Get retrieves the Region from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.Region, error) - RegionNamespaceListerExpansion -} - -// regionNamespaceLister implements the RegionNamespaceLister -// interface. -type regionNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Regions in the indexer for a given namespace. -func (s regionNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Region, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Region)) - }) - return ret, err -} - -// Get retrieves the Region from the indexer for a given namespace and name. -func (s regionNamespaceLister) Get(name string) (*v1alpha1.Region, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("region"), name) - } - return obj.(*v1alpha1.Region), nil -} diff --git a/apis/generated/listers/infra/v1alpha1/site.go b/apis/generated/listers/infra/v1alpha1/site.go deleted file mode 100644 index 281fcfd..0000000 --- a/apis/generated/listers/infra/v1alpha1/site.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// SiteLister helps list Sites. -// All objects returned here must be treated as read-only. -type SiteLister interface { - // List lists all Sites in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.Site, err error) - // Sites returns an object that can list and get Sites. - Sites(namespace string) SiteNamespaceLister - SiteListerExpansion -} - -// siteLister implements the SiteLister interface. -type siteLister struct { - indexer cache.Indexer -} - -// NewSiteLister returns a new SiteLister. -func NewSiteLister(indexer cache.Indexer) SiteLister { - return &siteLister{indexer: indexer} -} - -// List lists all Sites in the indexer. -func (s *siteLister) List(selector labels.Selector) (ret []*v1alpha1.Site, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Site)) - }) - return ret, err -} - -// Sites returns an object that can list and get Sites. -func (s *siteLister) Sites(namespace string) SiteNamespaceLister { - return siteNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// SiteNamespaceLister helps list and get Sites. -// All objects returned here must be treated as read-only. -type SiteNamespaceLister interface { - // List lists all Sites in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.Site, err error) - // Get retrieves the Site from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.Site, error) - SiteNamespaceListerExpansion -} - -// siteNamespaceLister implements the SiteNamespaceLister -// interface. -type siteNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Sites in the indexer for a given namespace. -func (s siteNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Site, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Site)) - }) - return ret, err -} - -// Get retrieves the Site from the indexer for a given namespace and name. -func (s siteNamespaceLister) Get(name string) (*v1alpha1.Site, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("site"), name) - } - return obj.(*v1alpha1.Site), nil -} diff --git a/apis/generated/listers/ipam/v1alpha1/expansion_generated.go b/apis/generated/listers/ipam/v1alpha1/expansion_generated.go deleted file mode 100644 index 0ba39ed..0000000 --- a/apis/generated/listers/ipam/v1alpha1/expansion_generated.go +++ /dev/null @@ -1,42 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -// IPClaimListerExpansion allows custom methods to be added to -// IPClaimLister. -type IPClaimListerExpansion interface{} - -// IPClaimNamespaceListerExpansion allows custom methods to be added to -// IPClaimNamespaceLister. -type IPClaimNamespaceListerExpansion interface{} - -// IPEntryListerExpansion allows custom methods to be added to -// IPEntryLister. -type IPEntryListerExpansion interface{} - -// IPEntryNamespaceListerExpansion allows custom methods to be added to -// IPEntryNamespaceLister. -type IPEntryNamespaceListerExpansion interface{} - -// IPIndexListerExpansion allows custom methods to be added to -// IPIndexLister. -type IPIndexListerExpansion interface{} - -// IPIndexNamespaceListerExpansion allows custom methods to be added to -// IPIndexNamespaceLister. -type IPIndexNamespaceListerExpansion interface{} diff --git a/apis/generated/listers/ipam/v1alpha1/ipclaim.go b/apis/generated/listers/ipam/v1alpha1/ipclaim.go deleted file mode 100644 index 579c85b..0000000 --- a/apis/generated/listers/ipam/v1alpha1/ipclaim.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// IPClaimLister helps list IPClaims. -// All objects returned here must be treated as read-only. -type IPClaimLister interface { - // List lists all IPClaims in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.IPClaim, err error) - // IPClaims returns an object that can list and get IPClaims. - IPClaims(namespace string) IPClaimNamespaceLister - IPClaimListerExpansion -} - -// iPClaimLister implements the IPClaimLister interface. -type iPClaimLister struct { - indexer cache.Indexer -} - -// NewIPClaimLister returns a new IPClaimLister. -func NewIPClaimLister(indexer cache.Indexer) IPClaimLister { - return &iPClaimLister{indexer: indexer} -} - -// List lists all IPClaims in the indexer. -func (s *iPClaimLister) List(selector labels.Selector) (ret []*v1alpha1.IPClaim, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.IPClaim)) - }) - return ret, err -} - -// IPClaims returns an object that can list and get IPClaims. -func (s *iPClaimLister) IPClaims(namespace string) IPClaimNamespaceLister { - return iPClaimNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// IPClaimNamespaceLister helps list and get IPClaims. -// All objects returned here must be treated as read-only. -type IPClaimNamespaceLister interface { - // List lists all IPClaims in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.IPClaim, err error) - // Get retrieves the IPClaim from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.IPClaim, error) - IPClaimNamespaceListerExpansion -} - -// iPClaimNamespaceLister implements the IPClaimNamespaceLister -// interface. -type iPClaimNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all IPClaims in the indexer for a given namespace. -func (s iPClaimNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.IPClaim, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.IPClaim)) - }) - return ret, err -} - -// Get retrieves the IPClaim from the indexer for a given namespace and name. -func (s iPClaimNamespaceLister) Get(name string) (*v1alpha1.IPClaim, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("ipclaim"), name) - } - return obj.(*v1alpha1.IPClaim), nil -} diff --git a/apis/generated/listers/ipam/v1alpha1/ipentry.go b/apis/generated/listers/ipam/v1alpha1/ipentry.go deleted file mode 100644 index 4210cc1..0000000 --- a/apis/generated/listers/ipam/v1alpha1/ipentry.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// IPEntryLister helps list IPEntries. -// All objects returned here must be treated as read-only. -type IPEntryLister interface { - // List lists all IPEntries in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.IPEntry, err error) - // IPEntries returns an object that can list and get IPEntries. - IPEntries(namespace string) IPEntryNamespaceLister - IPEntryListerExpansion -} - -// iPEntryLister implements the IPEntryLister interface. -type iPEntryLister struct { - indexer cache.Indexer -} - -// NewIPEntryLister returns a new IPEntryLister. -func NewIPEntryLister(indexer cache.Indexer) IPEntryLister { - return &iPEntryLister{indexer: indexer} -} - -// List lists all IPEntries in the indexer. -func (s *iPEntryLister) List(selector labels.Selector) (ret []*v1alpha1.IPEntry, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.IPEntry)) - }) - return ret, err -} - -// IPEntries returns an object that can list and get IPEntries. -func (s *iPEntryLister) IPEntries(namespace string) IPEntryNamespaceLister { - return iPEntryNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// IPEntryNamespaceLister helps list and get IPEntries. -// All objects returned here must be treated as read-only. -type IPEntryNamespaceLister interface { - // List lists all IPEntries in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.IPEntry, err error) - // Get retrieves the IPEntry from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.IPEntry, error) - IPEntryNamespaceListerExpansion -} - -// iPEntryNamespaceLister implements the IPEntryNamespaceLister -// interface. -type iPEntryNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all IPEntries in the indexer for a given namespace. -func (s iPEntryNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.IPEntry, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.IPEntry)) - }) - return ret, err -} - -// Get retrieves the IPEntry from the indexer for a given namespace and name. -func (s iPEntryNamespaceLister) Get(name string) (*v1alpha1.IPEntry, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("ipentry"), name) - } - return obj.(*v1alpha1.IPEntry), nil -} diff --git a/apis/generated/listers/ipam/v1alpha1/ipindex.go b/apis/generated/listers/ipam/v1alpha1/ipindex.go deleted file mode 100644 index d6f79bc..0000000 --- a/apis/generated/listers/ipam/v1alpha1/ipindex.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// IPIndexLister helps list IPIndexes. -// All objects returned here must be treated as read-only. -type IPIndexLister interface { - // List lists all IPIndexes in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.IPIndex, err error) - // IPIndexes returns an object that can list and get IPIndexes. - IPIndexes(namespace string) IPIndexNamespaceLister - IPIndexListerExpansion -} - -// iPIndexLister implements the IPIndexLister interface. -type iPIndexLister struct { - indexer cache.Indexer -} - -// NewIPIndexLister returns a new IPIndexLister. -func NewIPIndexLister(indexer cache.Indexer) IPIndexLister { - return &iPIndexLister{indexer: indexer} -} - -// List lists all IPIndexes in the indexer. -func (s *iPIndexLister) List(selector labels.Selector) (ret []*v1alpha1.IPIndex, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.IPIndex)) - }) - return ret, err -} - -// IPIndexes returns an object that can list and get IPIndexes. -func (s *iPIndexLister) IPIndexes(namespace string) IPIndexNamespaceLister { - return iPIndexNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// IPIndexNamespaceLister helps list and get IPIndexes. -// All objects returned here must be treated as read-only. -type IPIndexNamespaceLister interface { - // List lists all IPIndexes in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.IPIndex, err error) - // Get retrieves the IPIndex from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.IPIndex, error) - IPIndexNamespaceListerExpansion -} - -// iPIndexNamespaceLister implements the IPIndexNamespaceLister -// interface. -type iPIndexNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all IPIndexes in the indexer for a given namespace. -func (s iPIndexNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.IPIndex, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.IPIndex)) - }) - return ret, err -} - -// Get retrieves the IPIndex from the indexer for a given namespace and name. -func (s iPIndexNamespaceLister) Get(name string) (*v1alpha1.IPIndex, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("ipindex"), name) - } - return obj.(*v1alpha1.IPIndex), nil -} diff --git a/apis/generated/listers/vlan/v1alpha1/expansion_generated.go b/apis/generated/listers/vlan/v1alpha1/expansion_generated.go deleted file mode 100644 index 46726a2..0000000 --- a/apis/generated/listers/vlan/v1alpha1/expansion_generated.go +++ /dev/null @@ -1,42 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -// VLANClaimListerExpansion allows custom methods to be added to -// VLANClaimLister. -type VLANClaimListerExpansion interface{} - -// VLANClaimNamespaceListerExpansion allows custom methods to be added to -// VLANClaimNamespaceLister. -type VLANClaimNamespaceListerExpansion interface{} - -// VLANEntryListerExpansion allows custom methods to be added to -// VLANEntryLister. -type VLANEntryListerExpansion interface{} - -// VLANEntryNamespaceListerExpansion allows custom methods to be added to -// VLANEntryNamespaceLister. -type VLANEntryNamespaceListerExpansion interface{} - -// VLANIndexListerExpansion allows custom methods to be added to -// VLANIndexLister. -type VLANIndexListerExpansion interface{} - -// VLANIndexNamespaceListerExpansion allows custom methods to be added to -// VLANIndexNamespaceLister. -type VLANIndexNamespaceListerExpansion interface{} diff --git a/apis/generated/listers/vlan/v1alpha1/vlanclaim.go b/apis/generated/listers/vlan/v1alpha1/vlanclaim.go deleted file mode 100644 index 983785b..0000000 --- a/apis/generated/listers/vlan/v1alpha1/vlanclaim.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// VLANClaimLister helps list VLANClaims. -// All objects returned here must be treated as read-only. -type VLANClaimLister interface { - // List lists all VLANClaims in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.VLANClaim, err error) - // VLANClaims returns an object that can list and get VLANClaims. - VLANClaims(namespace string) VLANClaimNamespaceLister - VLANClaimListerExpansion -} - -// vLANClaimLister implements the VLANClaimLister interface. -type vLANClaimLister struct { - indexer cache.Indexer -} - -// NewVLANClaimLister returns a new VLANClaimLister. -func NewVLANClaimLister(indexer cache.Indexer) VLANClaimLister { - return &vLANClaimLister{indexer: indexer} -} - -// List lists all VLANClaims in the indexer. -func (s *vLANClaimLister) List(selector labels.Selector) (ret []*v1alpha1.VLANClaim, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.VLANClaim)) - }) - return ret, err -} - -// VLANClaims returns an object that can list and get VLANClaims. -func (s *vLANClaimLister) VLANClaims(namespace string) VLANClaimNamespaceLister { - return vLANClaimNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// VLANClaimNamespaceLister helps list and get VLANClaims. -// All objects returned here must be treated as read-only. -type VLANClaimNamespaceLister interface { - // List lists all VLANClaims in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.VLANClaim, err error) - // Get retrieves the VLANClaim from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.VLANClaim, error) - VLANClaimNamespaceListerExpansion -} - -// vLANClaimNamespaceLister implements the VLANClaimNamespaceLister -// interface. -type vLANClaimNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all VLANClaims in the indexer for a given namespace. -func (s vLANClaimNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.VLANClaim, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.VLANClaim)) - }) - return ret, err -} - -// Get retrieves the VLANClaim from the indexer for a given namespace and name. -func (s vLANClaimNamespaceLister) Get(name string) (*v1alpha1.VLANClaim, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("vlanclaim"), name) - } - return obj.(*v1alpha1.VLANClaim), nil -} diff --git a/apis/generated/listers/vlan/v1alpha1/vlanentry.go b/apis/generated/listers/vlan/v1alpha1/vlanentry.go deleted file mode 100644 index b9bc139..0000000 --- a/apis/generated/listers/vlan/v1alpha1/vlanentry.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// VLANEntryLister helps list VLANEntries. -// All objects returned here must be treated as read-only. -type VLANEntryLister interface { - // List lists all VLANEntries in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.VLANEntry, err error) - // VLANEntries returns an object that can list and get VLANEntries. - VLANEntries(namespace string) VLANEntryNamespaceLister - VLANEntryListerExpansion -} - -// vLANEntryLister implements the VLANEntryLister interface. -type vLANEntryLister struct { - indexer cache.Indexer -} - -// NewVLANEntryLister returns a new VLANEntryLister. -func NewVLANEntryLister(indexer cache.Indexer) VLANEntryLister { - return &vLANEntryLister{indexer: indexer} -} - -// List lists all VLANEntries in the indexer. -func (s *vLANEntryLister) List(selector labels.Selector) (ret []*v1alpha1.VLANEntry, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.VLANEntry)) - }) - return ret, err -} - -// VLANEntries returns an object that can list and get VLANEntries. -func (s *vLANEntryLister) VLANEntries(namespace string) VLANEntryNamespaceLister { - return vLANEntryNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// VLANEntryNamespaceLister helps list and get VLANEntries. -// All objects returned here must be treated as read-only. -type VLANEntryNamespaceLister interface { - // List lists all VLANEntries in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.VLANEntry, err error) - // Get retrieves the VLANEntry from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.VLANEntry, error) - VLANEntryNamespaceListerExpansion -} - -// vLANEntryNamespaceLister implements the VLANEntryNamespaceLister -// interface. -type vLANEntryNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all VLANEntries in the indexer for a given namespace. -func (s vLANEntryNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.VLANEntry, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.VLANEntry)) - }) - return ret, err -} - -// Get retrieves the VLANEntry from the indexer for a given namespace and name. -func (s vLANEntryNamespaceLister) Get(name string) (*v1alpha1.VLANEntry, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("vlanentry"), name) - } - return obj.(*v1alpha1.VLANEntry), nil -} diff --git a/apis/generated/listers/vlan/v1alpha1/vlanindex.go b/apis/generated/listers/vlan/v1alpha1/vlanindex.go deleted file mode 100644 index 4f5ee0c..0000000 --- a/apis/generated/listers/vlan/v1alpha1/vlanindex.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// VLANIndexLister helps list VLANIndexes. -// All objects returned here must be treated as read-only. -type VLANIndexLister interface { - // List lists all VLANIndexes in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.VLANIndex, err error) - // VLANIndexes returns an object that can list and get VLANIndexes. - VLANIndexes(namespace string) VLANIndexNamespaceLister - VLANIndexListerExpansion -} - -// vLANIndexLister implements the VLANIndexLister interface. -type vLANIndexLister struct { - indexer cache.Indexer -} - -// NewVLANIndexLister returns a new VLANIndexLister. -func NewVLANIndexLister(indexer cache.Indexer) VLANIndexLister { - return &vLANIndexLister{indexer: indexer} -} - -// List lists all VLANIndexes in the indexer. -func (s *vLANIndexLister) List(selector labels.Selector) (ret []*v1alpha1.VLANIndex, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.VLANIndex)) - }) - return ret, err -} - -// VLANIndexes returns an object that can list and get VLANIndexes. -func (s *vLANIndexLister) VLANIndexes(namespace string) VLANIndexNamespaceLister { - return vLANIndexNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// VLANIndexNamespaceLister helps list and get VLANIndexes. -// All objects returned here must be treated as read-only. -type VLANIndexNamespaceLister interface { - // List lists all VLANIndexes in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.VLANIndex, err error) - // Get retrieves the VLANIndex from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.VLANIndex, error) - VLANIndexNamespaceListerExpansion -} - -// vLANIndexNamespaceLister implements the VLANIndexNamespaceLister -// interface. -type vLANIndexNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all VLANIndexes in the indexer for a given namespace. -func (s vLANIndexNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.VLANIndex, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.VLANIndex)) - }) - return ret, err -} - -// Get retrieves the VLANIndex from the indexer for a given namespace and name. -func (s vLANIndexNamespaceLister) Get(name string) (*v1alpha1.VLANIndex, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("vlanindex"), name) - } - return obj.(*v1alpha1.VLANIndex), nil -} diff --git a/apis/generated/listers/vxlan/v1alpha1/expansion_generated.go b/apis/generated/listers/vxlan/v1alpha1/expansion_generated.go deleted file mode 100644 index 2e1cf98..0000000 --- a/apis/generated/listers/vxlan/v1alpha1/expansion_generated.go +++ /dev/null @@ -1,42 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -// VXLANClaimListerExpansion allows custom methods to be added to -// VXLANClaimLister. -type VXLANClaimListerExpansion interface{} - -// VXLANClaimNamespaceListerExpansion allows custom methods to be added to -// VXLANClaimNamespaceLister. -type VXLANClaimNamespaceListerExpansion interface{} - -// VXLANEntryListerExpansion allows custom methods to be added to -// VXLANEntryLister. -type VXLANEntryListerExpansion interface{} - -// VXLANEntryNamespaceListerExpansion allows custom methods to be added to -// VXLANEntryNamespaceLister. -type VXLANEntryNamespaceListerExpansion interface{} - -// VXLANIndexListerExpansion allows custom methods to be added to -// VXLANIndexLister. -type VXLANIndexListerExpansion interface{} - -// VXLANIndexNamespaceListerExpansion allows custom methods to be added to -// VXLANIndexNamespaceLister. -type VXLANIndexNamespaceListerExpansion interface{} diff --git a/apis/generated/listers/vxlan/v1alpha1/vxlanclaim.go b/apis/generated/listers/vxlan/v1alpha1/vxlanclaim.go deleted file mode 100644 index 547d3f6..0000000 --- a/apis/generated/listers/vxlan/v1alpha1/vxlanclaim.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// VXLANClaimLister helps list VXLANClaims. -// All objects returned here must be treated as read-only. -type VXLANClaimLister interface { - // List lists all VXLANClaims in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.VXLANClaim, err error) - // VXLANClaims returns an object that can list and get VXLANClaims. - VXLANClaims(namespace string) VXLANClaimNamespaceLister - VXLANClaimListerExpansion -} - -// vXLANClaimLister implements the VXLANClaimLister interface. -type vXLANClaimLister struct { - indexer cache.Indexer -} - -// NewVXLANClaimLister returns a new VXLANClaimLister. -func NewVXLANClaimLister(indexer cache.Indexer) VXLANClaimLister { - return &vXLANClaimLister{indexer: indexer} -} - -// List lists all VXLANClaims in the indexer. -func (s *vXLANClaimLister) List(selector labels.Selector) (ret []*v1alpha1.VXLANClaim, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.VXLANClaim)) - }) - return ret, err -} - -// VXLANClaims returns an object that can list and get VXLANClaims. -func (s *vXLANClaimLister) VXLANClaims(namespace string) VXLANClaimNamespaceLister { - return vXLANClaimNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// VXLANClaimNamespaceLister helps list and get VXLANClaims. -// All objects returned here must be treated as read-only. -type VXLANClaimNamespaceLister interface { - // List lists all VXLANClaims in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.VXLANClaim, err error) - // Get retrieves the VXLANClaim from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.VXLANClaim, error) - VXLANClaimNamespaceListerExpansion -} - -// vXLANClaimNamespaceLister implements the VXLANClaimNamespaceLister -// interface. -type vXLANClaimNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all VXLANClaims in the indexer for a given namespace. -func (s vXLANClaimNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.VXLANClaim, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.VXLANClaim)) - }) - return ret, err -} - -// Get retrieves the VXLANClaim from the indexer for a given namespace and name. -func (s vXLANClaimNamespaceLister) Get(name string) (*v1alpha1.VXLANClaim, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("vxlanclaim"), name) - } - return obj.(*v1alpha1.VXLANClaim), nil -} diff --git a/apis/generated/listers/vxlan/v1alpha1/vxlanentry.go b/apis/generated/listers/vxlan/v1alpha1/vxlanentry.go deleted file mode 100644 index 5765dae..0000000 --- a/apis/generated/listers/vxlan/v1alpha1/vxlanentry.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// VXLANEntryLister helps list VXLANEntries. -// All objects returned here must be treated as read-only. -type VXLANEntryLister interface { - // List lists all VXLANEntries in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.VXLANEntry, err error) - // VXLANEntries returns an object that can list and get VXLANEntries. - VXLANEntries(namespace string) VXLANEntryNamespaceLister - VXLANEntryListerExpansion -} - -// vXLANEntryLister implements the VXLANEntryLister interface. -type vXLANEntryLister struct { - indexer cache.Indexer -} - -// NewVXLANEntryLister returns a new VXLANEntryLister. -func NewVXLANEntryLister(indexer cache.Indexer) VXLANEntryLister { - return &vXLANEntryLister{indexer: indexer} -} - -// List lists all VXLANEntries in the indexer. -func (s *vXLANEntryLister) List(selector labels.Selector) (ret []*v1alpha1.VXLANEntry, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.VXLANEntry)) - }) - return ret, err -} - -// VXLANEntries returns an object that can list and get VXLANEntries. -func (s *vXLANEntryLister) VXLANEntries(namespace string) VXLANEntryNamespaceLister { - return vXLANEntryNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// VXLANEntryNamespaceLister helps list and get VXLANEntries. -// All objects returned here must be treated as read-only. -type VXLANEntryNamespaceLister interface { - // List lists all VXLANEntries in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.VXLANEntry, err error) - // Get retrieves the VXLANEntry from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.VXLANEntry, error) - VXLANEntryNamespaceListerExpansion -} - -// vXLANEntryNamespaceLister implements the VXLANEntryNamespaceLister -// interface. -type vXLANEntryNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all VXLANEntries in the indexer for a given namespace. -func (s vXLANEntryNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.VXLANEntry, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.VXLANEntry)) - }) - return ret, err -} - -// Get retrieves the VXLANEntry from the indexer for a given namespace and name. -func (s vXLANEntryNamespaceLister) Get(name string) (*v1alpha1.VXLANEntry, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("vxlanentry"), name) - } - return obj.(*v1alpha1.VXLANEntry), nil -} diff --git a/apis/generated/listers/vxlan/v1alpha1/vxlanindex.go b/apis/generated/listers/vxlan/v1alpha1/vxlanindex.go deleted file mode 100644 index f52560e..0000000 --- a/apis/generated/listers/vxlan/v1alpha1/vxlanindex.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 v1alpha1 - -import ( - v1alpha1 "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// VXLANIndexLister helps list VXLANIndexes. -// All objects returned here must be treated as read-only. -type VXLANIndexLister interface { - // List lists all VXLANIndexes in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.VXLANIndex, err error) - // VXLANIndexes returns an object that can list and get VXLANIndexes. - VXLANIndexes(namespace string) VXLANIndexNamespaceLister - VXLANIndexListerExpansion -} - -// vXLANIndexLister implements the VXLANIndexLister interface. -type vXLANIndexLister struct { - indexer cache.Indexer -} - -// NewVXLANIndexLister returns a new VXLANIndexLister. -func NewVXLANIndexLister(indexer cache.Indexer) VXLANIndexLister { - return &vXLANIndexLister{indexer: indexer} -} - -// List lists all VXLANIndexes in the indexer. -func (s *vXLANIndexLister) List(selector labels.Selector) (ret []*v1alpha1.VXLANIndex, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.VXLANIndex)) - }) - return ret, err -} - -// VXLANIndexes returns an object that can list and get VXLANIndexes. -func (s *vXLANIndexLister) VXLANIndexes(namespace string) VXLANIndexNamespaceLister { - return vXLANIndexNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// VXLANIndexNamespaceLister helps list and get VXLANIndexes. -// All objects returned here must be treated as read-only. -type VXLANIndexNamespaceLister interface { - // List lists all VXLANIndexes in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.VXLANIndex, err error) - // Get retrieves the VXLANIndex from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.VXLANIndex, error) - VXLANIndexNamespaceListerExpansion -} - -// vXLANIndexNamespaceLister implements the VXLANIndexNamespaceLister -// interface. -type vXLANIndexNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all VXLANIndexes in the indexer for a given namespace. -func (s vXLANIndexNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.VXLANIndex, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.VXLANIndex)) - }) - return ret, err -} - -// Get retrieves the VXLANIndex from the indexer for a given namespace and name. -func (s vXLANIndexNamespaceLister) Get(name string) (*v1alpha1.VXLANIndex, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("vxlanindex"), name) - } - return obj.(*v1alpha1.VXLANIndex), nil -} diff --git a/apis/generated/openapi/zz_generated.openapi.go b/apis/generated/openapi/zz_generated.openapi.go deleted file mode 100644 index c999a68..0000000 --- a/apis/generated/openapi/zz_generated.openapi.go +++ /dev/null @@ -1,11151 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright 2024 Nokia. - -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 openapi-gen. DO NOT EDIT. - -// This file was autogenerated by openapi-gen. Do not edit it manually! - -package openapi - -import ( - resource "k8s.io/apimachinery/pkg/api/resource" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - common "k8s.io/kube-openapi/pkg/common" - spec "k8s.io/kube-openapi/pkg/validation/spec" -) - -func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { - return map[string]common.OpenAPIDefinition{ - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaim": schema_apis_backend_as_v1alpha1_ASClaim(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaimList": schema_apis_backend_as_v1alpha1_ASClaimList(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaimSpec": schema_apis_backend_as_v1alpha1_ASClaimSpec(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaimStatus": schema_apis_backend_as_v1alpha1_ASClaimStatus(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASDynamicIDSyntaxValidator": schema_apis_backend_as_v1alpha1_ASDynamicIDSyntaxValidator(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntry": schema_apis_backend_as_v1alpha1_ASEntry(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntryList": schema_apis_backend_as_v1alpha1_ASEntryList(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntrySpec": schema_apis_backend_as_v1alpha1_ASEntrySpec(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntryStatus": schema_apis_backend_as_v1alpha1_ASEntryStatus(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndex": schema_apis_backend_as_v1alpha1_ASIndex(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndexList": schema_apis_backend_as_v1alpha1_ASIndexList(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndexSpec": schema_apis_backend_as_v1alpha1_ASIndexSpec(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndexStatus": schema_apis_backend_as_v1alpha1_ASIndexStatus(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASRangeSyntaxValidator": schema_apis_backend_as_v1alpha1_ASRangeSyntaxValidator(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASStaticIDSyntaxValidator": schema_apis_backend_as_v1alpha1_ASStaticIDSyntaxValidator(ref), - "github.com/kuidio/kuid/apis/backend/esi/v1alpha1.ESIClaim": schema_apis_backend_esi_v1alpha1_ESIClaim(ref), - "github.com/kuidio/kuid/apis/backend/esi/v1alpha1.ESIClaimList": schema_apis_backend_esi_v1alpha1_ESIClaimList(ref), - "github.com/kuidio/kuid/apis/backend/esi/v1alpha1.ESIClaimSpec": schema_apis_backend_esi_v1alpha1_ESIClaimSpec(ref), - "github.com/kuidio/kuid/apis/backend/esi/v1alpha1.ESIClaimStatus": schema_apis_backend_esi_v1alpha1_ESIClaimStatus(ref), - "github.com/kuidio/kuid/apis/backend/esi/v1alpha1.ESIDynamicIDSyntaxValidator": schema_apis_backend_esi_v1alpha1_ESIDynamicIDSyntaxValidator(ref), - "github.com/kuidio/kuid/apis/backend/esi/v1alpha1.ESIEntry": schema_apis_backend_esi_v1alpha1_ESIEntry(ref), - "github.com/kuidio/kuid/apis/backend/esi/v1alpha1.ESIEntryList": schema_apis_backend_esi_v1alpha1_ESIEntryList(ref), - "github.com/kuidio/kuid/apis/backend/esi/v1alpha1.ESIEntrySpec": schema_apis_backend_esi_v1alpha1_ESIEntrySpec(ref), - "github.com/kuidio/kuid/apis/backend/esi/v1alpha1.ESIEntryStatus": schema_apis_backend_esi_v1alpha1_ESIEntryStatus(ref), - "github.com/kuidio/kuid/apis/backend/esi/v1alpha1.ESIIndex": schema_apis_backend_esi_v1alpha1_ESIIndex(ref), - "github.com/kuidio/kuid/apis/backend/esi/v1alpha1.ESIIndexList": schema_apis_backend_esi_v1alpha1_ESIIndexList(ref), - "github.com/kuidio/kuid/apis/backend/esi/v1alpha1.ESIIndexSpec": schema_apis_backend_esi_v1alpha1_ESIIndexSpec(ref), - "github.com/kuidio/kuid/apis/backend/esi/v1alpha1.ESIIndexStatus": schema_apis_backend_esi_v1alpha1_ESIIndexStatus(ref), - "github.com/kuidio/kuid/apis/backend/esi/v1alpha1.ESIRangeSyntaxValidator": schema_apis_backend_esi_v1alpha1_ESIRangeSyntaxValidator(ref), - "github.com/kuidio/kuid/apis/backend/esi/v1alpha1.ESIStaticIDSyntaxValidator": schema_apis_backend_esi_v1alpha1_ESIStaticIDSyntaxValidator(ref), - "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMClaim": schema_apis_backend_extcomm_v1alpha1_EXTCOMMClaim(ref), - "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMClaimList": schema_apis_backend_extcomm_v1alpha1_EXTCOMMClaimList(ref), - "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMClaimSpec": schema_apis_backend_extcomm_v1alpha1_EXTCOMMClaimSpec(ref), - "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMClaimStatus": schema_apis_backend_extcomm_v1alpha1_EXTCOMMClaimStatus(ref), - "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMDynamicIDSyntaxValidator": schema_apis_backend_extcomm_v1alpha1_EXTCOMMDynamicIDSyntaxValidator(ref), - "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMEntry": schema_apis_backend_extcomm_v1alpha1_EXTCOMMEntry(ref), - "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMEntryList": schema_apis_backend_extcomm_v1alpha1_EXTCOMMEntryList(ref), - "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMEntrySpec": schema_apis_backend_extcomm_v1alpha1_EXTCOMMEntrySpec(ref), - "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMEntryStatus": schema_apis_backend_extcomm_v1alpha1_EXTCOMMEntryStatus(ref), - "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMIndex": schema_apis_backend_extcomm_v1alpha1_EXTCOMMIndex(ref), - "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMIndexList": schema_apis_backend_extcomm_v1alpha1_EXTCOMMIndexList(ref), - "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMIndexSpec": schema_apis_backend_extcomm_v1alpha1_EXTCOMMIndexSpec(ref), - "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMIndexStatus": schema_apis_backend_extcomm_v1alpha1_EXTCOMMIndexStatus(ref), - "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMRangeSyntaxValidator": schema_apis_backend_extcomm_v1alpha1_EXTCOMMRangeSyntaxValidator(ref), - "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMStaticIDSyntaxValidator": schema_apis_backend_extcomm_v1alpha1_EXTCOMMStaticIDSyntaxValidator(ref), - "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDClaim": schema_apis_backend_genid_v1alpha1_GENIDClaim(ref), - "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDClaimList": schema_apis_backend_genid_v1alpha1_GENIDClaimList(ref), - "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDClaimSpec": schema_apis_backend_genid_v1alpha1_GENIDClaimSpec(ref), - "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDClaimStatus": schema_apis_backend_genid_v1alpha1_GENIDClaimStatus(ref), - "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDDynamicIDSyntaxValidator": schema_apis_backend_genid_v1alpha1_GENIDDynamicIDSyntaxValidator(ref), - "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDEntry": schema_apis_backend_genid_v1alpha1_GENIDEntry(ref), - "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDEntryList": schema_apis_backend_genid_v1alpha1_GENIDEntryList(ref), - "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDEntrySpec": schema_apis_backend_genid_v1alpha1_GENIDEntrySpec(ref), - "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDEntryStatus": schema_apis_backend_genid_v1alpha1_GENIDEntryStatus(ref), - "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDIndex": schema_apis_backend_genid_v1alpha1_GENIDIndex(ref), - "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDIndexList": schema_apis_backend_genid_v1alpha1_GENIDIndexList(ref), - "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDIndexSpec": schema_apis_backend_genid_v1alpha1_GENIDIndexSpec(ref), - "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDIndexStatus": schema_apis_backend_genid_v1alpha1_GENIDIndexStatus(ref), - "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDRangeSyntaxValidator": schema_apis_backend_genid_v1alpha1_GENIDRangeSyntaxValidator(ref), - "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDStaticIDSyntaxValidator": schema_apis_backend_genid_v1alpha1_GENIDStaticIDSyntaxValidator(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.BFDLinkParameters": schema_apis_backend_infra_v1alpha1_BFDLinkParameters(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.BGPLinkParameters": schema_apis_backend_infra_v1alpha1_BGPLinkParameters(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.Cluster": schema_apis_backend_infra_v1alpha1_Cluster(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.ClusterFilter": schema_apis_backend_infra_v1alpha1_ClusterFilter(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.ClusterList": schema_apis_backend_infra_v1alpha1_ClusterList(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.ClusterSpec": schema_apis_backend_infra_v1alpha1_ClusterSpec(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.ClusterStatus": schema_apis_backend_infra_v1alpha1_ClusterStatus(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.Endpoint": schema_apis_backend_infra_v1alpha1_Endpoint(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.EndpointFilter": schema_apis_backend_infra_v1alpha1_EndpointFilter(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.EndpointID": schema_apis_backend_infra_v1alpha1_EndpointID(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.EndpointList": schema_apis_backend_infra_v1alpha1_EndpointList(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.EndpointSet": schema_apis_backend_infra_v1alpha1_EndpointSet(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.EndpointSetFilter": schema_apis_backend_infra_v1alpha1_EndpointSetFilter(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.EndpointSetList": schema_apis_backend_infra_v1alpha1_EndpointSetList(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.EndpointSetSpec": schema_apis_backend_infra_v1alpha1_EndpointSetSpec(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.EndpointSetStatus": schema_apis_backend_infra_v1alpha1_EndpointSetStatus(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.EndpointSpec": schema_apis_backend_infra_v1alpha1_EndpointSpec(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.EndpointStatus": schema_apis_backend_infra_v1alpha1_EndpointStatus(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.IGPLinkParameters": schema_apis_backend_infra_v1alpha1_IGPLinkParameters(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.ISISLinkParameters": schema_apis_backend_infra_v1alpha1_ISISLinkParameters(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.Link": schema_apis_backend_infra_v1alpha1_Link(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.LinkFilter": schema_apis_backend_infra_v1alpha1_LinkFilter(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.LinkList": schema_apis_backend_infra_v1alpha1_LinkList(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.LinkSet": schema_apis_backend_infra_v1alpha1_LinkSet(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.LinkSetFilter": schema_apis_backend_infra_v1alpha1_LinkSetFilter(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.LinkSetList": schema_apis_backend_infra_v1alpha1_LinkSetList(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.LinkSetSpec": schema_apis_backend_infra_v1alpha1_LinkSetSpec(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.LinkSetStatus": schema_apis_backend_infra_v1alpha1_LinkSetStatus(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.LinkSpec": schema_apis_backend_infra_v1alpha1_LinkSpec(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.LinkStatus": schema_apis_backend_infra_v1alpha1_LinkStatus(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.Location": schema_apis_backend_infra_v1alpha1_Location(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.Module": schema_apis_backend_infra_v1alpha1_Module(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.ModuleBay": schema_apis_backend_infra_v1alpha1_ModuleBay(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.ModuleBayFilter": schema_apis_backend_infra_v1alpha1_ModuleBayFilter(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.ModuleBayList": schema_apis_backend_infra_v1alpha1_ModuleBayList(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.ModuleBaySpec": schema_apis_backend_infra_v1alpha1_ModuleBaySpec(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.ModuleBayStatus": schema_apis_backend_infra_v1alpha1_ModuleBayStatus(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.ModuleFilter": schema_apis_backend_infra_v1alpha1_ModuleFilter(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.ModuleList": schema_apis_backend_infra_v1alpha1_ModuleList(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.ModuleSpec": schema_apis_backend_infra_v1alpha1_ModuleSpec(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.ModuleStatus": schema_apis_backend_infra_v1alpha1_ModuleStatus(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.Node": schema_apis_backend_infra_v1alpha1_Node(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeFilter": schema_apis_backend_infra_v1alpha1_NodeFilter(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeGroup": schema_apis_backend_infra_v1alpha1_NodeGroup(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeGroupEndpointID": schema_apis_backend_infra_v1alpha1_NodeGroupEndpointID(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeGroupFilter": schema_apis_backend_infra_v1alpha1_NodeGroupFilter(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeGroupList": schema_apis_backend_infra_v1alpha1_NodeGroupList(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeGroupNodeID": schema_apis_backend_infra_v1alpha1_NodeGroupNodeID(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeGroupSpec": schema_apis_backend_infra_v1alpha1_NodeGroupSpec(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeGroupStatus": schema_apis_backend_infra_v1alpha1_NodeGroupStatus(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeID": schema_apis_backend_infra_v1alpha1_NodeID(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeItem": schema_apis_backend_infra_v1alpha1_NodeItem(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeItemFilter": schema_apis_backend_infra_v1alpha1_NodeItemFilter(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeItemList": schema_apis_backend_infra_v1alpha1_NodeItemList(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeItemSpec": schema_apis_backend_infra_v1alpha1_NodeItemSpec(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeItemStatus": schema_apis_backend_infra_v1alpha1_NodeItemStatus(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeList": schema_apis_backend_infra_v1alpha1_NodeList(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeSet": schema_apis_backend_infra_v1alpha1_NodeSet(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeSetFilter": schema_apis_backend_infra_v1alpha1_NodeSetFilter(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeSetList": schema_apis_backend_infra_v1alpha1_NodeSetList(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeSetSpec": schema_apis_backend_infra_v1alpha1_NodeSetSpec(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeSetStatus": schema_apis_backend_infra_v1alpha1_NodeSetStatus(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeSpec": schema_apis_backend_infra_v1alpha1_NodeSpec(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeStatus": schema_apis_backend_infra_v1alpha1_NodeStatus(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.OSPFLinkParameters": schema_apis_backend_infra_v1alpha1_OSPFLinkParameters(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.Rack": schema_apis_backend_infra_v1alpha1_Rack(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.RackFilter": schema_apis_backend_infra_v1alpha1_RackFilter(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.RackList": schema_apis_backend_infra_v1alpha1_RackList(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.RackSpec": schema_apis_backend_infra_v1alpha1_RackSpec(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.RackStatus": schema_apis_backend_infra_v1alpha1_RackStatus(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.Region": schema_apis_backend_infra_v1alpha1_Region(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.RegionFilter": schema_apis_backend_infra_v1alpha1_RegionFilter(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.RegionList": schema_apis_backend_infra_v1alpha1_RegionList(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.RegionSpec": schema_apis_backend_infra_v1alpha1_RegionSpec(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.RegionStatus": schema_apis_backend_infra_v1alpha1_RegionStatus(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.Site": schema_apis_backend_infra_v1alpha1_Site(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.SiteFilter": schema_apis_backend_infra_v1alpha1_SiteFilter(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.SiteID": schema_apis_backend_infra_v1alpha1_SiteID(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.SiteList": schema_apis_backend_infra_v1alpha1_SiteList(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.SiteSpec": schema_apis_backend_infra_v1alpha1_SiteSpec(ref), - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.SiteStatus": schema_apis_backend_infra_v1alpha1_SiteStatus(ref), - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPClaim": schema_apis_backend_ipam_v1alpha1_IPClaim(ref), - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPClaimList": schema_apis_backend_ipam_v1alpha1_IPClaimList(ref), - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPClaimSpec": schema_apis_backend_ipam_v1alpha1_IPClaimSpec(ref), - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPClaimStatus": schema_apis_backend_ipam_v1alpha1_IPClaimStatus(ref), - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPEntry": schema_apis_backend_ipam_v1alpha1_IPEntry(ref), - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPEntryList": schema_apis_backend_ipam_v1alpha1_IPEntryList(ref), - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPEntrySpec": schema_apis_backend_ipam_v1alpha1_IPEntrySpec(ref), - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPEntryStatus": schema_apis_backend_ipam_v1alpha1_IPEntryStatus(ref), - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPIndex": schema_apis_backend_ipam_v1alpha1_IPIndex(ref), - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPIndexList": schema_apis_backend_ipam_v1alpha1_IPIndexList(ref), - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPIndexSpec": schema_apis_backend_ipam_v1alpha1_IPIndexSpec(ref), - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPIndexStatus": schema_apis_backend_ipam_v1alpha1_IPIndexStatus(ref), - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.Prefix": schema_apis_backend_ipam_v1alpha1_Prefix(ref), - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.dynamicAddressSyntaxValidator": schema_apis_backend_ipam_v1alpha1_dynamicAddressSyntaxValidator(ref), - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.dynamicPrefixSyntaxValidator": schema_apis_backend_ipam_v1alpha1_dynamicPrefixSyntaxValidator(ref), - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.staticAddressSyntaxValidator": schema_apis_backend_ipam_v1alpha1_staticAddressSyntaxValidator(ref), - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.staticPrefixSyntaxValidator": schema_apis_backend_ipam_v1alpha1_staticPrefixSyntaxValidator(ref), - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.staticRangeSyntaxValidator": schema_apis_backend_ipam_v1alpha1_staticRangeSyntaxValidator(ref), - "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANClaim": schema_apis_backend_vlan_v1alpha1_VLANClaim(ref), - "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANClaimList": schema_apis_backend_vlan_v1alpha1_VLANClaimList(ref), - "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANClaimSpec": schema_apis_backend_vlan_v1alpha1_VLANClaimSpec(ref), - "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANClaimStatus": schema_apis_backend_vlan_v1alpha1_VLANClaimStatus(ref), - "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANEntry": schema_apis_backend_vlan_v1alpha1_VLANEntry(ref), - "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANEntryList": schema_apis_backend_vlan_v1alpha1_VLANEntryList(ref), - "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANEntrySpec": schema_apis_backend_vlan_v1alpha1_VLANEntrySpec(ref), - "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANEntryStatus": schema_apis_backend_vlan_v1alpha1_VLANEntryStatus(ref), - "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANIndex": schema_apis_backend_vlan_v1alpha1_VLANIndex(ref), - "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANIndexList": schema_apis_backend_vlan_v1alpha1_VLANIndexList(ref), - "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANIndexSpec": schema_apis_backend_vlan_v1alpha1_VLANIndexSpec(ref), - "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANIndexStatus": schema_apis_backend_vlan_v1alpha1_VLANIndexStatus(ref), - "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.vlanDynamicIDSyntaxValidator": schema_apis_backend_vlan_v1alpha1_vlanDynamicIDSyntaxValidator(ref), - "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.vlanRangeSyntaxValidator": schema_apis_backend_vlan_v1alpha1_vlanRangeSyntaxValidator(ref), - "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.vlanStaticIDSyntaxValidator": schema_apis_backend_vlan_v1alpha1_vlanStaticIDSyntaxValidator(ref), - "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1.VXLANClaim": schema_apis_backend_vxlan_v1alpha1_VXLANClaim(ref), - "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1.VXLANClaimList": schema_apis_backend_vxlan_v1alpha1_VXLANClaimList(ref), - "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1.VXLANClaimSpec": schema_apis_backend_vxlan_v1alpha1_VXLANClaimSpec(ref), - "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1.VXLANClaimStatus": schema_apis_backend_vxlan_v1alpha1_VXLANClaimStatus(ref), - "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1.VXLANDynamicIDSyntaxValidator": schema_apis_backend_vxlan_v1alpha1_VXLANDynamicIDSyntaxValidator(ref), - "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1.VXLANEntry": schema_apis_backend_vxlan_v1alpha1_VXLANEntry(ref), - "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1.VXLANEntryList": schema_apis_backend_vxlan_v1alpha1_VXLANEntryList(ref), - "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1.VXLANEntrySpec": schema_apis_backend_vxlan_v1alpha1_VXLANEntrySpec(ref), - "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1.VXLANEntryStatus": schema_apis_backend_vxlan_v1alpha1_VXLANEntryStatus(ref), - "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1.VXLANIndex": schema_apis_backend_vxlan_v1alpha1_VXLANIndex(ref), - "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1.VXLANIndexList": schema_apis_backend_vxlan_v1alpha1_VXLANIndexList(ref), - "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1.VXLANIndexSpec": schema_apis_backend_vxlan_v1alpha1_VXLANIndexSpec(ref), - "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1.VXLANIndexStatus": schema_apis_backend_vxlan_v1alpha1_VXLANIndexStatus(ref), - "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1.VXLANRangeSyntaxValidator": schema_apis_backend_vxlan_v1alpha1_VXLANRangeSyntaxValidator(ref), - "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1.VXLANStaticIDSyntaxValidator": schema_apis_backend_vxlan_v1alpha1_VXLANStaticIDSyntaxValidator(ref), - "github.com/kuidio/kuid/apis/common/v1alpha1.ClaimLabels": schema_kuid_apis_common_v1alpha1_ClaimLabels(ref), - "github.com/kuidio/kuid/apis/common/v1alpha1.OwnerReference": schema_kuid_apis_common_v1alpha1_OwnerReference(ref), - "github.com/kuidio/kuid/apis/common/v1alpha1.UserDefinedLabels": schema_kuid_apis_common_v1alpha1_UserDefinedLabels(ref), - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition": schema_kuid_apis_condition_v1alpha1_Condition(ref), - "github.com/kuidio/kuid/apis/condition/v1alpha1.ConditionedStatus": schema_kuid_apis_condition_v1alpha1_ConditionedStatus(ref), - "k8s.io/apimachinery/pkg/api/resource.Quantity": schema_apimachinery_pkg_api_resource_Quantity(ref), - "k8s.io/apimachinery/pkg/api/resource.int64Amount": schema_apimachinery_pkg_api_resource_int64Amount(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.APIGroup": schema_pkg_apis_meta_v1_APIGroup(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.APIGroupList": schema_pkg_apis_meta_v1_APIGroupList(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.APIResource": schema_pkg_apis_meta_v1_APIResource(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.APIResourceList": schema_pkg_apis_meta_v1_APIResourceList(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.APIVersions": schema_pkg_apis_meta_v1_APIVersions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.ApplyOptions": schema_pkg_apis_meta_v1_ApplyOptions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.Condition": schema_pkg_apis_meta_v1_Condition(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.CreateOptions": schema_pkg_apis_meta_v1_CreateOptions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.DeleteOptions": schema_pkg_apis_meta_v1_DeleteOptions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.Duration": schema_pkg_apis_meta_v1_Duration(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.FieldsV1": schema_pkg_apis_meta_v1_FieldsV1(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.GetOptions": schema_pkg_apis_meta_v1_GetOptions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.GroupKind": schema_pkg_apis_meta_v1_GroupKind(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.GroupResource": schema_pkg_apis_meta_v1_GroupResource(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersion": schema_pkg_apis_meta_v1_GroupVersion(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionForDiscovery": schema_pkg_apis_meta_v1_GroupVersionForDiscovery(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionKind": schema_pkg_apis_meta_v1_GroupVersionKind(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionResource": schema_pkg_apis_meta_v1_GroupVersionResource(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.InternalEvent": schema_pkg_apis_meta_v1_InternalEvent(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector": schema_pkg_apis_meta_v1_LabelSelector(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelectorRequirement": schema_pkg_apis_meta_v1_LabelSelectorRequirement(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.List": schema_pkg_apis_meta_v1_List(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta": schema_pkg_apis_meta_v1_ListMeta(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.ListOptions": schema_pkg_apis_meta_v1_ListOptions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.ManagedFieldsEntry": schema_pkg_apis_meta_v1_ManagedFieldsEntry(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.MicroTime": schema_pkg_apis_meta_v1_MicroTime(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta": schema_pkg_apis_meta_v1_ObjectMeta(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.OwnerReference": schema_pkg_apis_meta_v1_OwnerReference(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.PartialObjectMetadata": schema_pkg_apis_meta_v1_PartialObjectMetadata(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.PartialObjectMetadataList": schema_pkg_apis_meta_v1_PartialObjectMetadataList(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.Patch": schema_pkg_apis_meta_v1_Patch(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.PatchOptions": schema_pkg_apis_meta_v1_PatchOptions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.Preconditions": schema_pkg_apis_meta_v1_Preconditions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.RootPaths": schema_pkg_apis_meta_v1_RootPaths(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR": schema_pkg_apis_meta_v1_ServerAddressByClientCIDR(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.Status": schema_pkg_apis_meta_v1_Status(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.StatusCause": schema_pkg_apis_meta_v1_StatusCause(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.StatusDetails": schema_pkg_apis_meta_v1_StatusDetails(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.Table": schema_pkg_apis_meta_v1_Table(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.TableColumnDefinition": schema_pkg_apis_meta_v1_TableColumnDefinition(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.TableOptions": schema_pkg_apis_meta_v1_TableOptions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.TableRow": schema_pkg_apis_meta_v1_TableRow(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.TableRowCondition": schema_pkg_apis_meta_v1_TableRowCondition(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.Time": schema_pkg_apis_meta_v1_Time(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.Timestamp": schema_pkg_apis_meta_v1_Timestamp(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta": schema_pkg_apis_meta_v1_TypeMeta(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.UpdateOptions": schema_pkg_apis_meta_v1_UpdateOptions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.WatchEvent": schema_pkg_apis_meta_v1_WatchEvent(ref), - "k8s.io/apimachinery/pkg/runtime.RawExtension": schema_k8sio_apimachinery_pkg_runtime_RawExtension(ref), - "k8s.io/apimachinery/pkg/runtime.TypeMeta": schema_k8sio_apimachinery_pkg_runtime_TypeMeta(ref), - "k8s.io/apimachinery/pkg/runtime.Unknown": schema_k8sio_apimachinery_pkg_runtime_Unknown(ref), - "k8s.io/apimachinery/pkg/version.Info": schema_k8sio_apimachinery_pkg_version_Info(ref), - } -} - -func schema_apis_backend_as_v1alpha1_ASClaim(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ASClaim is the Schema for the ASClaim API", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaimSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaimStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaimSpec", "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaimStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_as_v1alpha1_ASClaimList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ASClaimList contains a list of ASClaims", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaim"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaim", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_as_v1alpha1_ASClaimSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ASClaimSpec defines the desired state of ASClaim", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "index": { - SchemaProps: spec.SchemaProps{ - Description: "Index defines the index for the AS Claim", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "id": { - SchemaProps: spec.SchemaProps{ - Description: "ASID defines the AS for the AS claim", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "range": { - SchemaProps: spec.SchemaProps{ - Description: "Range defines the AS range for the AS claim The following notation is used: start-end - the ASs in the range must be consecutive", - Type: []string{"string"}, - Format: "", - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "selector": { - SchemaProps: spec.SchemaProps{ - Description: "Selector defines the selector criterias", - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), - }, - }, - "owner": { - SchemaProps: spec.SchemaProps{ - Description: "Owner defines the ownerReference of the ASClaim Allow for different namesapces, hence it is part of the spec", - Ref: ref("github.com/kuidio/kuid/apis/common/v1alpha1.OwnerReference"), - }, - }, - }, - Required: []string{"index"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/common/v1alpha1.OwnerReference", "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, - } -} - -func schema_apis_backend_as_v1alpha1_ASClaimStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ASClaimStatus defines the observed state of ASClaim", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - "id": { - SchemaProps: spec.SchemaProps{ - Description: "ASID defines the AS for the AS claim", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "range": { - SchemaProps: spec.SchemaProps{ - Description: "ASRange defines the AS range for the AS claim", - Type: []string{"string"}, - Format: "", - }, - }, - "expiryTime": { - SchemaProps: spec.SchemaProps{ - Description: "ExpiryTime defines when the claim expires", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_as_v1alpha1_ASDynamicIDSyntaxValidator(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"name"}, - }, - }, - } -} - -func schema_apis_backend_as_v1alpha1_ASEntry(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ASEntry is the Schema for the ASentry API", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntrySpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntryStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntrySpec", "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntryStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_as_v1alpha1_ASEntryList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ASEntryList contains a list of ASEntries", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntry"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntry", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_as_v1alpha1_ASEntrySpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ASEntrySpec defines the desired state of ASEntry", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "index": { - SchemaProps: spec.SchemaProps{ - Description: "ASIndex defines the AS index for the AS Claim", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "claimType": { - SchemaProps: spec.SchemaProps{ - Description: "ClaimType defines the claimType of the AS Entry", - Type: []string{"string"}, - Format: "", - }, - }, - "id": { - SchemaProps: spec.SchemaProps{ - Description: "ID defines the id of the AS entry in the tree", - Type: []string{"string"}, - Format: "", - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "selector": { - SchemaProps: spec.SchemaProps{ - Description: "Selector defines the selector criterias", - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), - }, - }, - "claim": { - SchemaProps: spec.SchemaProps{ - Description: "Claim defines the name of the claim that is the origin of this entry", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "owner": { - SchemaProps: spec.SchemaProps{ - Description: "Owner defines the ownerReference of the ASClaim Allow for different namesapces, hence it is part of the spec", - Ref: ref("github.com/kuidio/kuid/apis/common/v1alpha1.OwnerReference"), - }, - }, - }, - Required: []string{"index", "claim"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/common/v1alpha1.OwnerReference", "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, - } -} - -func schema_apis_backend_as_v1alpha1_ASEntryStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ASEntryStatus defines the observed state of ASEntry", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_as_v1alpha1_ASIndex(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ASIndex is the Schema for the ASIndex API", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndexSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndexStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndexSpec", "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndexStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_as_v1alpha1_ASIndexList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ASIndexList contains a list of ASIndexs", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndex"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndex", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_as_v1alpha1_ASIndexSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ASIndexSpec defines the desired state of ASIndex", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "minID": { - SchemaProps: spec.SchemaProps{ - Description: "MinID defines the min VLAN ID the index supports", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "maxID": { - SchemaProps: spec.SchemaProps{ - Description: "MaxID defines the max VLAN ID the index supports", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - }, - }, - }, - } -} - -func schema_apis_backend_as_v1alpha1_ASIndexStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ASIndexStatus defines the observed state of ASIndex", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "minID": { - SchemaProps: spec.SchemaProps{ - Description: "MinID defines the min VLAN ID the index supports", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "maxID": { - SchemaProps: spec.SchemaProps{ - Description: "MaxID defines the max VLAN ID the index supports", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_as_v1alpha1_ASRangeSyntaxValidator(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"name"}, - }, - }, - } -} - -func schema_apis_backend_as_v1alpha1_ASStaticIDSyntaxValidator(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"name"}, - }, - }, - } -} - -func schema_apis_backend_esi_v1alpha1_ESIClaim(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ESIClaim is the Schema for the ESIClaim API", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/esi/v1alpha1.ESIClaimSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/esi/v1alpha1.ESIClaimStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/esi/v1alpha1.ESIClaimSpec", "github.com/kuidio/kuid/apis/backend/esi/v1alpha1.ESIClaimStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_esi_v1alpha1_ESIClaimList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ESIClaimList contains a list of ESIClaims", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/esi/v1alpha1.ESIClaim"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/esi/v1alpha1.ESIClaim", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_esi_v1alpha1_ESIClaimSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ESIClaimSpec defines the desired state of ESIClaim", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "index": { - SchemaProps: spec.SchemaProps{ - Description: "ESIIndex defines the ESI index for the ESI Claim", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "id": { - SchemaProps: spec.SchemaProps{ - Description: "ESIID defines the ESI for the ESI claim", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "range": { - SchemaProps: spec.SchemaProps{ - Description: "Range defines the ESI range for the ESI claim The following notation is used: start-end - the ESIs in the range must be consecutive", - Type: []string{"string"}, - Format: "", - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "selector": { - SchemaProps: spec.SchemaProps{ - Description: "Selector defines the selector criterias", - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), - }, - }, - "owner": { - SchemaProps: spec.SchemaProps{ - Description: "Owner defines the ownerReference of the ESIClaim Allow for different namesapces, hence it is part of the spec", - Ref: ref("github.com/kuidio/kuid/apis/common/v1alpha1.OwnerReference"), - }, - }, - }, - Required: []string{"index"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/common/v1alpha1.OwnerReference", "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, - } -} - -func schema_apis_backend_esi_v1alpha1_ESIClaimStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ESIClaimStatus defines the observed state of ESIClaim", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - "id": { - SchemaProps: spec.SchemaProps{ - Description: "ESIID defines the ESI for the ESI claim", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "range": { - SchemaProps: spec.SchemaProps{ - Description: "ESIRange defines the ESI range for the ESI claim", - Type: []string{"string"}, - Format: "", - }, - }, - "expiryTime": { - SchemaProps: spec.SchemaProps{ - Description: "ExpiryTime defines when the claim expires", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_esi_v1alpha1_ESIDynamicIDSyntaxValidator(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"name"}, - }, - }, - } -} - -func schema_apis_backend_esi_v1alpha1_ESIEntry(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ESIEntry is the Schema for the ESIentry API", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/esi/v1alpha1.ESIEntrySpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/esi/v1alpha1.ESIEntryStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/esi/v1alpha1.ESIEntrySpec", "github.com/kuidio/kuid/apis/backend/esi/v1alpha1.ESIEntryStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_esi_v1alpha1_ESIEntryList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ESIEntryList contains a list of ESIEntries", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/esi/v1alpha1.ESIEntry"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/esi/v1alpha1.ESIEntry", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_esi_v1alpha1_ESIEntrySpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ESIEntrySpec defines the desired state of ESIEntry", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "index": { - SchemaProps: spec.SchemaProps{ - Description: "ESIIndex defines the ESI index for the ESI Claim", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "claimType": { - SchemaProps: spec.SchemaProps{ - Description: "ClaimType defines the claimType of the ESI Entry", - Type: []string{"string"}, - Format: "", - }, - }, - "id": { - SchemaProps: spec.SchemaProps{ - Description: "ID defines the id of the ESI entry in the tree", - Type: []string{"string"}, - Format: "", - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "selector": { - SchemaProps: spec.SchemaProps{ - Description: "Selector defines the selector criterias", - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), - }, - }, - "claim": { - SchemaProps: spec.SchemaProps{ - Description: "Claim defines the name of the claim that is the origin of this entry", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "owner": { - SchemaProps: spec.SchemaProps{ - Description: "Owner defines the ownerReference of the ESIClaim Allow for different namesapces, hence it is part of the spec", - Ref: ref("github.com/kuidio/kuid/apis/common/v1alpha1.OwnerReference"), - }, - }, - }, - Required: []string{"index", "claim"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/common/v1alpha1.OwnerReference", "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, - } -} - -func schema_apis_backend_esi_v1alpha1_ESIEntryStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ESIEntryStatus defines the observed state of ESIEntry", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_esi_v1alpha1_ESIIndex(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ESIIndex is the Schema for the ESIIndex API", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/esi/v1alpha1.ESIIndexSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/esi/v1alpha1.ESIIndexStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/esi/v1alpha1.ESIIndexSpec", "github.com/kuidio/kuid/apis/backend/esi/v1alpha1.ESIIndexStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_esi_v1alpha1_ESIIndexList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ESIIndexList contains a list of ESIIndexs", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/esi/v1alpha1.ESIIndex"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/esi/v1alpha1.ESIIndex", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_esi_v1alpha1_ESIIndexSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ESIIndexSpec defines the desired state of ESIIndex", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "minID": { - SchemaProps: spec.SchemaProps{ - Description: "MinID defines the min ESI ID the index supports", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "maxID": { - SchemaProps: spec.SchemaProps{ - Description: "MaxID defines the max ESI ID the index supports", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - }, - }, - }, - } -} - -func schema_apis_backend_esi_v1alpha1_ESIIndexStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ESIIndexStatus defines the observed state of ESIIndex", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "minID": { - SchemaProps: spec.SchemaProps{ - Description: "MinID defines the min ESI ID the index supports", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "maxID": { - SchemaProps: spec.SchemaProps{ - Description: "MaxID defines the max ESI ID the index supports", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_esi_v1alpha1_ESIRangeSyntaxValidator(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"name"}, - }, - }, - } -} - -func schema_apis_backend_esi_v1alpha1_ESIStaticIDSyntaxValidator(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"name"}, - }, - }, - } -} - -func schema_apis_backend_extcomm_v1alpha1_EXTCOMMClaim(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "EXTCOMMClaim is the Schema for the EXTCOMMClaim API", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMClaimSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMClaimStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMClaimSpec", "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMClaimStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_extcomm_v1alpha1_EXTCOMMClaimList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "EXTCOMMClaimList contains a list of EXTCOMMClaims", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMClaim"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMClaim", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_extcomm_v1alpha1_EXTCOMMClaimSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "EXTCOMMClaimSpec defines the dEXTCOMMred state of EXTCOMMClaim", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "index": { - SchemaProps: spec.SchemaProps{ - Description: "EXTCOMMIndex defines the EXTCOMM index for the EXTCOMM Claim", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "id": { - SchemaProps: spec.SchemaProps{ - Description: "EXTCOMMID defines the EXTCOMM for the EXTCOMM claim", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "range": { - SchemaProps: spec.SchemaProps{ - Description: "Range defines the EXTCOMM range for the EXTCOMM claim The following notation is used: start-end - the EXTCOMMs in the range must be consecutive", - Type: []string{"string"}, - Format: "", - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "selector": { - SchemaProps: spec.SchemaProps{ - Description: "Selector defines the selector criterias", - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), - }, - }, - "owner": { - SchemaProps: spec.SchemaProps{ - Description: "Owner defines the ownerReference of the EXTCOMMClaim Allow for different namesapces, hence it is part of the spec", - Ref: ref("github.com/kuidio/kuid/apis/common/v1alpha1.OwnerReference"), - }, - }, - }, - Required: []string{"index"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/common/v1alpha1.OwnerReference", "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, - } -} - -func schema_apis_backend_extcomm_v1alpha1_EXTCOMMClaimStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "EXTCOMMClaimStatus defines the observed state of EXTCOMMClaim", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - "id": { - SchemaProps: spec.SchemaProps{ - Description: "EXTCOMMID defines the EXTCOMM for the EXTCOMM claim", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "range": { - SchemaProps: spec.SchemaProps{ - Description: "EXTCOMMRange defines the EXTCOMM range for the EXTCOMM claim", - Type: []string{"string"}, - Format: "", - }, - }, - "expiryTime": { - SchemaProps: spec.SchemaProps{ - Description: "ExpiryTime defines when the claim expires", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_extcomm_v1alpha1_EXTCOMMDynamicIDSyntaxValidator(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"name"}, - }, - }, - } -} - -func schema_apis_backend_extcomm_v1alpha1_EXTCOMMEntry(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "EXTCOMMEntry is the Schema for the EXTCOMMentry API", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMEntrySpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMEntryStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMEntrySpec", "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMEntryStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_extcomm_v1alpha1_EXTCOMMEntryList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "EXTCOMMEntryList contains a list of EXTCOMMEntries", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMEntry"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMEntry", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_extcomm_v1alpha1_EXTCOMMEntrySpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "EXTCOMMEntrySpec defines the dEXTCOMMred state of EXTCOMMEntry", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "index": { - SchemaProps: spec.SchemaProps{ - Description: "EXTCOMMIndex defines the EXTCOMM index for the EXTCOMM Claim", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "claimType": { - SchemaProps: spec.SchemaProps{ - Description: "ClaimType defines the claimType of the EXTCOMM Entry", - Type: []string{"string"}, - Format: "", - }, - }, - "id": { - SchemaProps: spec.SchemaProps{ - Description: "ID defines the id of the EXTCOMM entry in the tree", - Type: []string{"string"}, - Format: "", - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "selector": { - SchemaProps: spec.SchemaProps{ - Description: "Selector defines the selector criterias", - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), - }, - }, - "claim": { - SchemaProps: spec.SchemaProps{ - Description: "Claim defines the name of the claim that is the origin of this entry", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "owner": { - SchemaProps: spec.SchemaProps{ - Description: "Owner defines the ownerReference of the EXTCOMMClaim Allow for different namesapces, hence it is part of the spec", - Ref: ref("github.com/kuidio/kuid/apis/common/v1alpha1.OwnerReference"), - }, - }, - }, - Required: []string{"index", "claim"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/common/v1alpha1.OwnerReference", "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, - } -} - -func schema_apis_backend_extcomm_v1alpha1_EXTCOMMEntryStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "EXTCOMMEntryStatus defines the observed state of EXTCOMMEntry", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_extcomm_v1alpha1_EXTCOMMIndex(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "EXTCOMMIndex is the Schema for the EXTCOMMIndex API", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMIndexSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMIndexStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMIndexSpec", "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMIndexStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_extcomm_v1alpha1_EXTCOMMIndexList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "EXTCOMMIndexList contains a list of EXTCOMMIndexs", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMIndex"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMIndex", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_extcomm_v1alpha1_EXTCOMMIndexSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "EXTCOMMIndexSpec defines the dEXTCOMMred state of EXTCOMMIndex", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "minID": { - SchemaProps: spec.SchemaProps{ - Description: "MinID defines the min EXTCOMM ID the index supports", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "maxID": { - SchemaProps: spec.SchemaProps{ - Description: "MaxID defines the max EXTCOMM ID the index supports", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "transitive": { - SchemaProps: spec.SchemaProps{ - Description: "Transitive defines the transative nature of the extended community", - Type: []string{"boolean"}, - Format: "", - }, - }, - "type": { - SchemaProps: spec.SchemaProps{ - Description: "Type defines the type of the extended community 2byteAS, 4byteAS, ipv4Address, opaque", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "subType": { - SchemaProps: spec.SchemaProps{ - Description: "SubType defines the subTyoe of the extended community routeTarget, routeOrigin;", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "globalID": { - SchemaProps: spec.SchemaProps{ - Description: "GlobalID is interpreted dependeing on the type AS in case of 2byteAS, 4byteAS IPV4 addrress irrelevant for the opaque type", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"type", "subType"}, - }, - }, - } -} - -func schema_apis_backend_extcomm_v1alpha1_EXTCOMMIndexStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "EXTCOMMIndexStatus defines the observed state of EXTCOMMIndex", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "minID": { - SchemaProps: spec.SchemaProps{ - Description: "MinID defines the min EXTCOMM ID the index supports", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "maxID": { - SchemaProps: spec.SchemaProps{ - Description: "MaxID defines the max EXTCOMM ID the index supports", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_extcomm_v1alpha1_EXTCOMMRangeSyntaxValidator(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"name"}, - }, - }, - } -} - -func schema_apis_backend_extcomm_v1alpha1_EXTCOMMStaticIDSyntaxValidator(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"name"}, - }, - }, - } -} - -func schema_apis_backend_genid_v1alpha1_GENIDClaim(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "GENIDClaim is the Schema for the GENIDClaim API", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDClaimSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDClaimStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDClaimSpec", "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDClaimStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_genid_v1alpha1_GENIDClaimList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "GENIDClaimList contains a list of GENIDClaims", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDClaim"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDClaim", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_genid_v1alpha1_GENIDClaimSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "GENIDClaimSpec defines the dGENIDred state of GENIDClaim", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "index": { - SchemaProps: spec.SchemaProps{ - Description: "GENIDIndex defines the GENID index for the GENID Claim", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "id": { - SchemaProps: spec.SchemaProps{ - Description: "GENIDID defines the GENID for the GENID claim", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "range": { - SchemaProps: spec.SchemaProps{ - Description: "Range defines the GENID range for the GENID claim The following notation is used: start-end - the GENIDs in the range must be consecutive", - Type: []string{"string"}, - Format: "", - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "selector": { - SchemaProps: spec.SchemaProps{ - Description: "Selector defines the selector criterias", - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), - }, - }, - "owner": { - SchemaProps: spec.SchemaProps{ - Description: "Owner defines the ownerReference of the GENIDClaim Allow for different namesapces, hence it is part of the spec", - Ref: ref("github.com/kuidio/kuid/apis/common/v1alpha1.OwnerReference"), - }, - }, - }, - Required: []string{"index"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/common/v1alpha1.OwnerReference", "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, - } -} - -func schema_apis_backend_genid_v1alpha1_GENIDClaimStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "GENIDClaimStatus defines the observed state of GENIDClaim", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - "id": { - SchemaProps: spec.SchemaProps{ - Description: "GENIDID defines the GENID for the GENID claim", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "range": { - SchemaProps: spec.SchemaProps{ - Description: "GENIDRange defines the GENID range for the GENID claim", - Type: []string{"string"}, - Format: "", - }, - }, - "expiryTime": { - SchemaProps: spec.SchemaProps{ - Description: "ExpiryTime defines when the claim expires", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_genid_v1alpha1_GENIDDynamicIDSyntaxValidator(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"name"}, - }, - }, - } -} - -func schema_apis_backend_genid_v1alpha1_GENIDEntry(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "GENIDEntry is the Schema for the GENIDentry API", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDEntrySpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDEntryStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDEntrySpec", "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDEntryStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_genid_v1alpha1_GENIDEntryList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "GENIDEntryList contains a list of GENIDEntries", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDEntry"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDEntry", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_genid_v1alpha1_GENIDEntrySpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "GENIDEntrySpec defines the dGENIDred state of GENIDEntry", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "index": { - SchemaProps: spec.SchemaProps{ - Description: "GENIDIndex defines the GENID index for the GENID Claim", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "claimType": { - SchemaProps: spec.SchemaProps{ - Description: "ClaimType defines the claimType of the GENID Entry", - Type: []string{"string"}, - Format: "", - }, - }, - "id": { - SchemaProps: spec.SchemaProps{ - Description: "ID defines the id of the GENID entry in the tree", - Type: []string{"string"}, - Format: "", - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "selector": { - SchemaProps: spec.SchemaProps{ - Description: "Selector defines the selector criterias", - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), - }, - }, - "claim": { - SchemaProps: spec.SchemaProps{ - Description: "Claim defines the name of the claim that is the origin of this entry", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "owner": { - SchemaProps: spec.SchemaProps{ - Description: "Owner defines the ownerReference of the GENIDClaim Allow for different namesapces, hence it is part of the spec", - Ref: ref("github.com/kuidio/kuid/apis/common/v1alpha1.OwnerReference"), - }, - }, - }, - Required: []string{"index", "claim"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/common/v1alpha1.OwnerReference", "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, - } -} - -func schema_apis_backend_genid_v1alpha1_GENIDEntryStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "GENIDEntryStatus defines the observed state of GENIDEntry", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_genid_v1alpha1_GENIDIndex(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "GENIDIndex is the Schema for the GENIDIndex API", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDIndexSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDIndexStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDIndexSpec", "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDIndexStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_genid_v1alpha1_GENIDIndexList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "GENIDIndexList contains a list of GENIDIndexs", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDIndex"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDIndex", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_genid_v1alpha1_GENIDIndexSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "GENIDIndexSpec defines the dGENIDred state of GENIDIndex", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "minID": { - SchemaProps: spec.SchemaProps{ - Description: "MinID defines the min GENID ID the index supports", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "maxID": { - SchemaProps: spec.SchemaProps{ - Description: "MaxID defines the max GENID ID the index supports", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "type": { - SchemaProps: spec.SchemaProps{ - Description: "Type defines the type of the GENID 16bit, 32bit, 48bit, 64bit", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - } -} - -func schema_apis_backend_genid_v1alpha1_GENIDIndexStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "GENIDIndexStatus defines the observed state of GENIDIndex", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "minID": { - SchemaProps: spec.SchemaProps{ - Description: "MinID defines the min GENID ID the index supports", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "maxID": { - SchemaProps: spec.SchemaProps{ - Description: "MaxID defines the max GENID ID the index supports", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_genid_v1alpha1_GENIDRangeSyntaxValidator(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"name"}, - }, - }, - } -} - -func schema_apis_backend_genid_v1alpha1_GENIDStaticIDSyntaxValidator(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"name"}, - }, - }, - } -} - -func schema_apis_backend_infra_v1alpha1_BFDLinkParameters(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "enabled": { - SchemaProps: spec.SchemaProps{ - Description: "Disabled defines if bfd is disabled or not", - Type: []string{"boolean"}, - Format: "", - }, - }, - "minTx": { - SchemaProps: spec.SchemaProps{ - Description: "MinTx defines the desired minimal interval for sending BFD packets, in msec.", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "minRx": { - SchemaProps: spec.SchemaProps{ - Description: "MinTx defines the required minimal interval for receiving BFD packets, in msec.", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "minEchoRx": { - SchemaProps: spec.SchemaProps{ - Description: "MinEchoRx defines the echo function timer, in msec.", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "multiplier": { - SchemaProps: spec.SchemaProps{ - Description: "Multiplier defines the number of missed packets before the session is considered down", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "ttl": { - SchemaProps: spec.SchemaProps{ - Description: "TTL defines the time to live on the outgoing BFD packet", - Type: []string{"integer"}, - Format: "int64", - }, - }, - }, - }, - }, - } -} - -func schema_apis_backend_infra_v1alpha1_BGPLinkParameters(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "bfd": { - SchemaProps: spec.SchemaProps{ - Description: "BFD defines if BFD is enabled for the EGP on this interface", - Type: []string{"boolean"}, - Format: "", - }, - }, - }, - }, - }, - } -} - -func schema_apis_backend_infra_v1alpha1_Cluster(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "A Cluster represents a kubernetes cluster and is typically used as a nodeGroup identifier.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.ClusterSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.ClusterStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.ClusterSpec", "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.ClusterStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_infra_v1alpha1_ClusterFilter(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "Name": { - SchemaProps: spec.SchemaProps{ - Description: "Name filters by the name of the objects", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "Namespace": { - SchemaProps: spec.SchemaProps{ - Description: "Namespace filters by the namespace of the objects", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"Name", "Namespace"}, - }, - }, - } -} - -func schema_apis_backend_infra_v1alpha1_ClusterList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ClusterList contains a list of Clusters", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.Cluster"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.Cluster", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_infra_v1alpha1_ClusterSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ClusterSpec defines the desired state of Cluster", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "nodeGroup": { - SchemaProps: spec.SchemaProps{ - Description: "NodeGroup defines the node group the resource belongs to.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "provider": { - SchemaProps: spec.SchemaProps{ - Description: "Provider defines the provider implementing this resource.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "location": { - SchemaProps: spec.SchemaProps{ - Description: "Location defines the location information where this resource is located in lon/lat coordinates", - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.Location"), - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - }, - Required: []string{"nodeGroup", "provider"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.Location"}, - } -} - -func schema_apis_backend_infra_v1alpha1_ClusterStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ClusterStatus defines the observed state of Cluster", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_infra_v1alpha1_Endpoint(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "An Endpoint represents a communication interface or connection point within a Node, facilitating network communication and data transfer between different components or systems within the environment. `Endpoints` serve as gateways for transmitting and receiving data, enabling seamless communication between Nodes.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.EndpointSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.EndpointStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.EndpointSpec", "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.EndpointStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_infra_v1alpha1_EndpointFilter(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "Name": { - SchemaProps: spec.SchemaProps{ - Description: "Name filters by the name of the objects", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "Namespace": { - SchemaProps: spec.SchemaProps{ - Description: "Namespace filters by the namespace of the objects", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"Name", "Namespace"}, - }, - }, - } -} - -func schema_apis_backend_infra_v1alpha1_EndpointID(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "region": { - SchemaProps: spec.SchemaProps{ - Description: "Region defines the region this sites belongs to", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "site": { - SchemaProps: spec.SchemaProps{ - Description: "Site defines the site in which the node is deployed", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "node": { - SchemaProps: spec.SchemaProps{ - Description: "Node defines the node the resource belongs to.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "endpoint": { - SchemaProps: spec.SchemaProps{ - Description: "Endpoint defines the name of the endpoint", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"region", "site", "node", "endpoint"}, - }, - }, - } -} - -func schema_apis_backend_infra_v1alpha1_EndpointList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "EndpointList contains a list of Endpoints", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.Endpoint"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.Endpoint", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_infra_v1alpha1_EndpointSet(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "A EndpointSet represents a set of endpoints that belong together within a nodeGroup. E.g. it can be used to model a logical Link Aggregation group within a node or it can be used to represent a logical multi-homing construction between a set of nodes belonging to a single nodeGroup.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.EndpointSetSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.EndpointSetStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.EndpointSetSpec", "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.EndpointSetStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_infra_v1alpha1_EndpointSetFilter(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "Name": { - SchemaProps: spec.SchemaProps{ - Description: "Name filters by the name of the objects", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "Namespace": { - SchemaProps: spec.SchemaProps{ - Description: "Namespace filters by the namespace of the objects", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"Name", "Namespace"}, - }, - }, - } -} - -func schema_apis_backend_infra_v1alpha1_EndpointSetList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "EndpointSetList contains a list of EndpointSets", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.EndpointSet"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.EndpointSet", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_infra_v1alpha1_EndpointSetSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "EndpointSetSpec defines the desired state of EndpointSet An EndpointSet can be a LAG (single Homed) or ESI (multiHomed). The EndpointSet can only belong to a single NodeGroup", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "endpoints": { - SchemaProps: spec.SchemaProps{ - Description: "Endpoints defines the Endpoints that are part of the EndpointSet Min 1, Max 16", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.EndpointID"), - }, - }, - }, - }, - }, - "lacp": { - SchemaProps: spec.SchemaProps{ - Description: "Lacp defines if the lag enabled LACP", - Type: []string{"boolean"}, - Format: "", - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - }, - Required: []string{"endpoints"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.EndpointID"}, - } -} - -func schema_apis_backend_infra_v1alpha1_EndpointSetStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "EndpointSetStatus defines the observed state of EndpointSet", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - "esi": { - SchemaProps: spec.SchemaProps{ - Description: "ESI defines the ethernet segment identifier of the logical link if set this is a multi-homed logical endpoint the ESI is a global unique identifier within the administrative domain", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "lagID": { - SchemaProps: spec.SchemaProps{ - Description: "LagId defines the lag id for the logical single-homed or multi-homed endpoint", - Type: []string{"integer"}, - Format: "int64", - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_infra_v1alpha1_EndpointSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "EndpointSpec defines the desired state of Endpoint", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "nodeGroup": { - SchemaProps: spec.SchemaProps{ - Description: "NodeGroup defines the node group the resource belongs to.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "region": { - SchemaProps: spec.SchemaProps{ - Description: "Region defines the region this sites belongs to", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "site": { - SchemaProps: spec.SchemaProps{ - Description: "Site defines the site in which the node is deployed", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "node": { - SchemaProps: spec.SchemaProps{ - Description: "Node defines the node the resource belongs to.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "endpoint": { - SchemaProps: spec.SchemaProps{ - Description: "Endpoint defines the name of the endpoint", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "module": { - SchemaProps: spec.SchemaProps{ - Description: "Module define the module to which the Endpoint belongs", - Type: []string{"string"}, - Format: "", - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "speed": { - SchemaProps: spec.SchemaProps{ - Description: "(Gbps)", - Type: []string{"string"}, - Format: "", - }, - }, - "vlanTagging": { - SchemaProps: spec.SchemaProps{ - Description: "VLANTagging defines if VLAN tagging is enabled or disabled on the interface", - Type: []string{"boolean"}, - Format: "", - }, - }, - "provider": { - SchemaProps: spec.SchemaProps{ - Description: "Provider defines the provider implementing this resource.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"nodeGroup", "region", "site", "node", "endpoint", "provider"}, - }, - }, - } -} - -func schema_apis_backend_infra_v1alpha1_EndpointStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "EndpointStatus defines the observed state of Endpoint", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_infra_v1alpha1_IGPLinkParameters(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "networkType": { - SchemaProps: spec.SchemaProps{ - Description: "Type defines the type of network", - Type: []string{"string"}, - Format: "", - }, - }, - "minTx": { - SchemaProps: spec.SchemaProps{ - Description: "Passive defines if this interface is passive", - Type: []string{"boolean"}, - Format: "", - }, - }, - "bfd": { - SchemaProps: spec.SchemaProps{ - Description: "BFD defines if BFD is enabled for the IGP on this interface", - Type: []string{"boolean"}, - Format: "", - }, - }, - "metric": { - SchemaProps: spec.SchemaProps{ - Description: "Metric defines the interface metric associated with the native routing topology", - Type: []string{"integer"}, - Format: "int64", - }, - }, - }, - }, - }, - } -} - -func schema_apis_backend_infra_v1alpha1_ISISLinkParameters(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "networkType": { - SchemaProps: spec.SchemaProps{ - Description: "Type defines the type of network", - Type: []string{"string"}, - Format: "", - }, - }, - "minTx": { - SchemaProps: spec.SchemaProps{ - Description: "Passive defines if this interface is passive", - Type: []string{"boolean"}, - Format: "", - }, - }, - "bfd": { - SchemaProps: spec.SchemaProps{ - Description: "BFD defines if BFD is enabled for the IGP on this interface", - Type: []string{"boolean"}, - Format: "", - }, - }, - "metric": { - SchemaProps: spec.SchemaProps{ - Description: "Metric defines the interface metric associated with the native routing topology", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "area": { - SchemaProps: spec.SchemaProps{ - Description: "Defines the ISIS level the link is assocaited with", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - } -} - -func schema_apis_backend_infra_v1alpha1_Link(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "A link represents a physical/logical connection that enables communication and data transfer between 2 endpoints of a node.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.LinkSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.LinkStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.LinkSpec", "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.LinkStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_infra_v1alpha1_LinkFilter(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "Name": { - SchemaProps: spec.SchemaProps{ - Description: "Name filters by the name of the objects", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "Namespace": { - SchemaProps: spec.SchemaProps{ - Description: "Namespace filters by the namespace of the objects", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"Name", "Namespace"}, - }, - }, - } -} - -func schema_apis_backend_infra_v1alpha1_LinkList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "LinkList contains a list of Links", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.Link"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.Link", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_infra_v1alpha1_LinkSet(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "A linkSet represents a set of links that belong together within a node group or accross nodeGroups. E.g. it can be used to model a logical Link Aggregation group between 2 nodes or it can be used to represent a logical multi-homing construction between a set of nodes belonging to 1 or multiple nodeGroups/Topologies.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.LinkSetSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.LinkSetStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.LinkSetSpec", "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.LinkSetStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_infra_v1alpha1_LinkSetFilter(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "Name": { - SchemaProps: spec.SchemaProps{ - Description: "Name filters by the name of the objects", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "Namespace": { - SchemaProps: spec.SchemaProps{ - Description: "Namespace filters by the namespace of the objects", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"Name", "Namespace"}, - }, - }, - } -} - -func schema_apis_backend_infra_v1alpha1_LinkSetList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "LinkSetList contains a list of LinkSets", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.LinkSet"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.LinkSet", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_infra_v1alpha1_LinkSetSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "LinkSetSpec defines the desired state of LinkSet", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "endpoints": { - SchemaProps: spec.SchemaProps{ - Description: "Endpoints define the endpoint identifiers of the LinkSet", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.EndpointID"), - }, - }, - }, - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - }, - Required: []string{"endpoints"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.EndpointID"}, - } -} - -func schema_apis_backend_infra_v1alpha1_LinkSetStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "LinkSetStatus defines the observed state of LinkSet", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - "esi": { - SchemaProps: spec.SchemaProps{ - Description: "ESI defines the ethernet segment identifier of the logical link if set this is a multi-homed linkset the ESI is a global unique identifier within the administrative domain/topology", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "lagId": { - SchemaProps: spec.SchemaProps{ - Description: "LagId defines the lag id for the logical single-homed or multi-homed endpoint", - Type: []string{"integer"}, - Format: "int64", - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_infra_v1alpha1_LinkSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "LinkSpec defines the desired state of Link", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "endpoints": { - SchemaProps: spec.SchemaProps{ - Description: "Endpoints define the 2 endpoint identifiers of the link Can only have 2 endpoints", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeGroupEndpointID"), - }, - }, - }, - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "bfd": { - SchemaProps: spec.SchemaProps{ - Description: "BFD defines the BFD specific parameters on the link", - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.BFDLinkParameters"), - }, - }, - "ospf": { - SchemaProps: spec.SchemaProps{ - Description: "OSPF defines the OSPF specific parameters on the link", - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.OSPFLinkParameters"), - }, - }, - "isis": { - SchemaProps: spec.SchemaProps{ - Description: "ISIS defines the ISIS specific parameters on the link", - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.ISISLinkParameters"), - }, - }, - "bgp": { - SchemaProps: spec.SchemaProps{ - Description: "BGP defines the BGP specific parameters on the link", - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.BGPLinkParameters"), - }, - }, - }, - Required: []string{"endpoints"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.BFDLinkParameters", "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.BGPLinkParameters", "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.ISISLinkParameters", "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeGroupEndpointID", "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.OSPFLinkParameters"}, - } -} - -func schema_apis_backend_infra_v1alpha1_LinkStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "LinkStatus defines the observed state of Link", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_infra_v1alpha1_Location(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "latitude": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "longitude": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"latitude", "longitude"}, - }, - }, - } -} - -func schema_apis_backend_infra_v1alpha1_Module(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "A module refers to a hardware component or expansion module that can be installed within a ModuleBay of a Node. Modules provide additional functionality and capabilities to the infrastructure environment, allowing users to enhance and customize their deployments according to specific requirements.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.ModuleSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.ModuleStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.ModuleSpec", "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.ModuleStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_infra_v1alpha1_ModuleBay(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "A ModuleBay serves as a modular slot or enclosure within a Node, designed to accommodate additional modules. ModuleBays provide a flexible and scalable approach to extending the capabilities of Nodes, allowing users to customize and enhance their infrastructure deployments according to specific requirements.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.ModuleBaySpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.ModuleBayStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.ModuleBaySpec", "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.ModuleBayStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_infra_v1alpha1_ModuleBayFilter(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "Name": { - SchemaProps: spec.SchemaProps{ - Description: "Name filters by the name of the objects", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "Namespace": { - SchemaProps: spec.SchemaProps{ - Description: "Namespace filters by the namespace of the objects", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"Name", "Namespace"}, - }, - }, - } -} - -func schema_apis_backend_infra_v1alpha1_ModuleBayList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ModuleBayList contains a list of ModuleBays", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.ModuleBay"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.ModuleBay", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_infra_v1alpha1_ModuleBaySpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ModuleBaySpec defines the desired state of ModuleBay", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "region": { - SchemaProps: spec.SchemaProps{ - Description: "Region defines the region this sites belongs to", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "site": { - SchemaProps: spec.SchemaProps{ - Description: "Site defines the site in which the node is deployed", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "node": { - SchemaProps: spec.SchemaProps{ - Description: "Node defines the node the resource belongs to.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "psoition": { - SchemaProps: spec.SchemaProps{ - Description: "Position defines the position in the node the moduleBay is deployed", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - }, - Required: []string{"region", "site", "node", "psoition"}, - }, - }, - } -} - -func schema_apis_backend_infra_v1alpha1_ModuleBayStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ModuleBayStatus defines the observed state of ModuleBay", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_infra_v1alpha1_ModuleFilter(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "Name": { - SchemaProps: spec.SchemaProps{ - Description: "Name filters by the name of the objects", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "Namespace": { - SchemaProps: spec.SchemaProps{ - Description: "Namespace filters by the namespace of the objects", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"Name", "Namespace"}, - }, - }, - } -} - -func schema_apis_backend_infra_v1alpha1_ModuleList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ModuleList contains a list of Modules", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.Module"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.Module", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_infra_v1alpha1_ModuleSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ModuleSpec defines the desired state of Module", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "region": { - SchemaProps: spec.SchemaProps{ - Description: "Region defines the region this sites belongs to", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "site": { - SchemaProps: spec.SchemaProps{ - Description: "Site defines the site in which the node is deployed", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "node": { - SchemaProps: spec.SchemaProps{ - Description: "Node defines the node the resource belongs to.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "moduleBay": { - SchemaProps: spec.SchemaProps{ - Description: "ModuelBay defines the bay in which the module is deployed", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - }, - Required: []string{"region", "site", "node", "moduleBay"}, - }, - }, - } -} - -func schema_apis_backend_infra_v1alpha1_ModuleStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ModuleStatus defines the observed state of Module", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_infra_v1alpha1_Node(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "A Node represents a fundamental unit that implements compute, storage, and/or networking within your environment. Nodes can embody physical, virtual, or containerized entities, offering versatility in deployment options to suit diverse infrastructure requirements. Nodes are logically organized within racks and sites/regions, establishing a hierarchical structure for efficient resource management and organization. Additionally, Nodes are associated with nodeGroups, facilitating centralized management and control within defined administrative boundaries. Each Node is assigned a provider, representing the entity responsible for implementing the specifics of the Node.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeSpec", "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_infra_v1alpha1_NodeFilter(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "Name": { - SchemaProps: spec.SchemaProps{ - Description: "Name filters by the name of the objects", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "Namespace": { - SchemaProps: spec.SchemaProps{ - Description: "Namespace filters by the namespace of the objects", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"Name", "Namespace"}, - }, - }, - } -} - -func schema_apis_backend_infra_v1alpha1_NodeGroup(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "A NodeGrouo represents a logical grouping of infrastructure resources managed by a single administrative entity or organization. NodeGroups serve as administrative boundaries within the environment, providing a structured framework for organizing and managing resources based on administrative ownership or responsibility. E.g. A NodeGroup on one hand, can be used to represent a topology that spans multiple sites and regions, but a NodeGroup can also be used to group all nodes of a NodeGroup together.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeGroupSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeGroupStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeGroupSpec", "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeGroupStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_infra_v1alpha1_NodeGroupEndpointID(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "nodeGroup": { - SchemaProps: spec.SchemaProps{ - Description: "NodeGroup defines the node group the resource belongs to.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "region": { - SchemaProps: spec.SchemaProps{ - Description: "Region defines the region this sites belongs to", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "site": { - SchemaProps: spec.SchemaProps{ - Description: "Site defines the site in which the node is deployed", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "node": { - SchemaProps: spec.SchemaProps{ - Description: "Node defines the node the resource belongs to.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "endpoint": { - SchemaProps: spec.SchemaProps{ - Description: "Endpoint defines the name of the endpoint", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"nodeGroup", "region", "site", "node", "endpoint"}, - }, - }, - } -} - -func schema_apis_backend_infra_v1alpha1_NodeGroupFilter(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "Name": { - SchemaProps: spec.SchemaProps{ - Description: "Name filters by the name of the objects", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "Namespace": { - SchemaProps: spec.SchemaProps{ - Description: "Namespace filters by the namespace of the objects", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"Name", "Namespace"}, - }, - }, - } -} - -func schema_apis_backend_infra_v1alpha1_NodeGroupList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "NodeGroupList contains a list of NodeGroups", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeGroup"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeGroup", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_infra_v1alpha1_NodeGroupNodeID(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "nodeGroup": { - SchemaProps: spec.SchemaProps{ - Description: "NodeGroup defines the node group the resource belongs to.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "region": { - SchemaProps: spec.SchemaProps{ - Description: "Region defines the region this sites belongs to", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "site": { - SchemaProps: spec.SchemaProps{ - Description: "Site defines the site in which the node is deployed", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "node": { - SchemaProps: spec.SchemaProps{ - Description: "Node defines the node the resource belongs to.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"nodeGroup", "region", "site", "node"}, - }, - }, - } -} - -func schema_apis_backend_infra_v1alpha1_NodeGroupSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "NodeGroupSpec defines the desired state of NodeGroup E.g. A nodeGroup can be a NodeGroup E.g. A nodeGroup can be a topology like a DC fabric (frontend and backend could be a different nodeGroup) A Node Group is a global unique identifier within the system e.g. representing a topology, a NodeGroup or another set of elements that are managed together by a single entity", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - }, - }, - }, - } -} - -func schema_apis_backend_infra_v1alpha1_NodeGroupStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "NodeGroupStatus defines the observed state of NodeGroup", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_infra_v1alpha1_NodeID(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "region": { - SchemaProps: spec.SchemaProps{ - Description: "Region defines the region this sites belongs to", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "site": { - SchemaProps: spec.SchemaProps{ - Description: "Site defines the site in which the node is deployed", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "node": { - SchemaProps: spec.SchemaProps{ - Description: "Node defines the node the resource belongs to.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"region", "site", "node"}, - }, - }, - } -} - -func schema_apis_backend_infra_v1alpha1_NodeItem(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "A NodeItem represents a specific hardware component or accessory associated with a Node. NodeItems represent a wide range of hardware elements, e.g Fan(s), PowerUnit(s), CPU(s), and other peripheral devices essential for the operation of the Node. NodeItem is used to represent the modular components of a node.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeItemSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeItemStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeItemSpec", "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeItemStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_infra_v1alpha1_NodeItemFilter(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "Name": { - SchemaProps: spec.SchemaProps{ - Description: "Name filters by the name of the objects", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "Namespace": { - SchemaProps: spec.SchemaProps{ - Description: "Namespace filters by the namespace of the objects", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"Name", "Namespace"}, - }, - }, - } -} - -func schema_apis_backend_infra_v1alpha1_NodeItemList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "NodeItemList contains a list of NodeItems", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeItem"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeItem", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_infra_v1alpha1_NodeItemSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "NodeItemSpec defines the desired state of NodeItem", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "region": { - SchemaProps: spec.SchemaProps{ - Description: "Region defines the region this sites belongs to", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "site": { - SchemaProps: spec.SchemaProps{ - Description: "Site defines the site in which the node is deployed", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "node": { - SchemaProps: spec.SchemaProps{ - Description: "Node defines the node the resource belongs to.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - }, - Required: []string{"region", "site", "node"}, - }, - }, - } -} - -func schema_apis_backend_infra_v1alpha1_NodeItemStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "NodeItemStatus defines the observed state of NodeItem", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_infra_v1alpha1_NodeList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "NodeList contains a list of Nodes", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.Node"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.Node", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_infra_v1alpha1_NodeSet(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "A NodeSet represents a set of nodes. E.g. it can be used to model a set of nodes in a NodeSet that share the same charecteristics wrt, Numa, interfaces, etc. Another usage of NodeSet is the representation of a virtual Node that consists of multiple nodes.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeSetSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeSetStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeSetSpec", "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeSetStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_infra_v1alpha1_NodeSetFilter(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "Name": { - SchemaProps: spec.SchemaProps{ - Description: "Name filters by the name of the objects", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "Namespace": { - SchemaProps: spec.SchemaProps{ - Description: "Namespace filters by the namespace of the objects", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"Name", "Namespace"}, - }, - }, - } -} - -func schema_apis_backend_infra_v1alpha1_NodeSetList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "NodeSetList contains a list of NodeSets", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeSet"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.NodeSet", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_infra_v1alpha1_NodeSetSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "NodeSetSetSpec defines the desired state of NodeSet", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "nodeGroup": { - SchemaProps: spec.SchemaProps{ - Description: "NodeGroupName identifies the nodeGroup this resource belongs to E.g. a NodeSet in a NodeSet belongs to a nodeGroup where the name of the nodeGroup is the NodeSet E.g. a Virtual Node, belongs to a nodeGroup where the name of the nodeGroup represents the topology this node is deployed in", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "selector": { - SchemaProps: spec.SchemaProps{ - Description: "Selector defines the selector criterias", - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), - }, - }, - }, - Required: []string{"nodeGroup"}, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, - } -} - -func schema_apis_backend_infra_v1alpha1_NodeSetStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "NodeSetStatus defines the observed state of NodeSet", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_infra_v1alpha1_NodeSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "NodeSpec defines the desired state of Node", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "nodeGroup": { - SchemaProps: spec.SchemaProps{ - Description: "NodeGroup defines the node group the resource belongs to.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "region": { - SchemaProps: spec.SchemaProps{ - Description: "Region defines the region this sites belongs to", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "site": { - SchemaProps: spec.SchemaProps{ - Description: "Site defines the site in which the node is deployed", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "node": { - SchemaProps: spec.SchemaProps{ - Description: "Node defines the node the resource belongs to.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "rack": { - SchemaProps: spec.SchemaProps{ - Description: "Rack defines the rack in which the node is deployed", - Type: []string{"string"}, - Format: "", - }, - }, - "position": { - SchemaProps: spec.SchemaProps{ - Description: "relative position in the rack", - Type: []string{"string"}, - Format: "", - }, - }, - "location": { - SchemaProps: spec.SchemaProps{ - Description: "Location defines the location information where this resource is located in lon/lat coordinates", - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.Location"), - }, - }, - "provider": { - SchemaProps: spec.SchemaProps{ - Description: "Provider defines the provider implementing this resource.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - }, - Required: []string{"nodeGroup", "region", "site", "node", "provider"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.Location"}, - } -} - -func schema_apis_backend_infra_v1alpha1_NodeStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "NodeStatus defines the observed state of Node", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - "systemID": { - SchemaProps: spec.SchemaProps{ - Description: "System ID define the unique system id of the node", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_infra_v1alpha1_OSPFLinkParameters(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "networkType": { - SchemaProps: spec.SchemaProps{ - Description: "Type defines the type of network", - Type: []string{"string"}, - Format: "", - }, - }, - "minTx": { - SchemaProps: spec.SchemaProps{ - Description: "Passive defines if this interface is passive", - Type: []string{"boolean"}, - Format: "", - }, - }, - "bfd": { - SchemaProps: spec.SchemaProps{ - Description: "BFD defines if BFD is enabled for the IGP on this interface", - Type: []string{"boolean"}, - Format: "", - }, - }, - "metric": { - SchemaProps: spec.SchemaProps{ - Description: "Metric defines the interface metric associated with the native routing topology", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "area": { - SchemaProps: spec.SchemaProps{ - Description: "Defines the OSPF area the link is assocaited with", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - } -} - -func schema_apis_backend_infra_v1alpha1_Rack(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "A rack represents a physical equipment rack within your environment. Each rack is designed to accommodate the installation of devices and equipment.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.RackSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.RackStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.RackSpec", "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.RackStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_infra_v1alpha1_RackFilter(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "Name": { - SchemaProps: spec.SchemaProps{ - Description: "Name filters by the name of the objects", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "Namespace": { - SchemaProps: spec.SchemaProps{ - Description: "Namespace filters by the namespace of the objects", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"Name", "Namespace"}, - }, - }, - } -} - -func schema_apis_backend_infra_v1alpha1_RackList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "RackList contains a list of Racks", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.Rack"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.Rack", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_infra_v1alpha1_RackSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "RackSpec defines the desired state of Rack", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "region": { - SchemaProps: spec.SchemaProps{ - Description: "Region defines the region this sites belongs to", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "site": { - SchemaProps: spec.SchemaProps{ - Description: "Site defines the site in which the node is deployed", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "location": { - SchemaProps: spec.SchemaProps{ - Description: "Location defines the location information where this resource is located in lon/lat coordinates", - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.Location"), - }, - }, - "height": { - SchemaProps: spec.SchemaProps{ - Description: "The height of the rack, measured in units.", - Type: []string{"string"}, - Format: "", - }, - }, - "width": { - SchemaProps: spec.SchemaProps{ - Description: "The canonical distance between the two vertical rails on a face. In inch", - Type: []string{"string"}, - Format: "", - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - }, - Required: []string{"region", "site"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.Location"}, - } -} - -func schema_apis_backend_infra_v1alpha1_RackStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "RackStatus defines the observed state of Rack", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_infra_v1alpha1_Region(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "A region represent a geography in which multiple infrastructure resources are grouped A region might represent a continent, country, city, campus, or other area depending on your environment.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.RegionSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.RegionStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.RegionSpec", "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.RegionStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_infra_v1alpha1_RegionFilter(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "Name": { - SchemaProps: spec.SchemaProps{ - Description: "Name filters by the name of the objects", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "Namespace": { - SchemaProps: spec.SchemaProps{ - Description: "Namespace filters by the namespace of the objects", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"Name", "Namespace"}, - }, - }, - } -} - -func schema_apis_backend_infra_v1alpha1_RegionList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "RegionList contains a list of Regions", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.Region"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.Region", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_infra_v1alpha1_RegionSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "RegionSpec defines the desired state of Region", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - }, - }, - }, - } -} - -func schema_apis_backend_infra_v1alpha1_RegionStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "RegionStatus defines the observed state of Region", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_infra_v1alpha1_Site(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "A site serves as a fundamental organizational unit for managing infrastructure resources within your environment. The utilization of sites may vary based on the organizational structure and requirements, but in essence, each site typically corresponds to a distinct building or campus.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.SiteSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.SiteStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.SiteSpec", "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.SiteStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_infra_v1alpha1_SiteFilter(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "Name": { - SchemaProps: spec.SchemaProps{ - Description: "Name filters by the name of the objects", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "Namespace": { - SchemaProps: spec.SchemaProps{ - Description: "Namespace filters by the namespace of the objects", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"Name", "Namespace"}, - }, - }, - } -} - -func schema_apis_backend_infra_v1alpha1_SiteID(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "region": { - SchemaProps: spec.SchemaProps{ - Description: "Region defines the region this sites belongs to", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "site": { - SchemaProps: spec.SchemaProps{ - Description: "Site defines the site in which the node is deployed", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"region", "site"}, - }, - }, - } -} - -func schema_apis_backend_infra_v1alpha1_SiteList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "SiteList contains a list of Sites", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.Site"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.Site", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_infra_v1alpha1_SiteSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "SiteSpec defines the desired state of Site", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "region": { - SchemaProps: spec.SchemaProps{ - Description: "Region defines the region this sites belongs to", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "location": { - SchemaProps: spec.SchemaProps{ - Description: "Location defines the location information where this resource is located in lon/lat coordinates", - Ref: ref("github.com/kuidio/kuid/apis/backend/infra/v1alpha1.Location"), - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - }, - Required: []string{"region"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/infra/v1alpha1.Location"}, - } -} - -func schema_apis_backend_infra_v1alpha1_SiteStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "SiteStatus defines the observed state of Site", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_ipam_v1alpha1_IPClaim(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "IPClaim is the Schema for the ipclaim API", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPClaimSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPClaimStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPClaimSpec", "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPClaimStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_ipam_v1alpha1_IPClaimList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "IPClaimList contains a list of IPClaims", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPClaim"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPClaim", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_ipam_v1alpha1_IPClaimSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "IPClaimSpec defines the desired state of IPClaim", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "index": { - SchemaProps: spec.SchemaProps{ - Description: "Index defines the index for the IP Entry", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "prefixType": { - SchemaProps: spec.SchemaProps{ - Description: "PrefixType defines the prefixtype of IPEntry; for address and range claims this is not relevant - network kind is used for physical, virtual nics on a device - pool kind is used for allocating dedicated IP addresses - aggregate kind is used for claiming an aggregate prefix; only used for networkInstance prefixes", - Type: []string{"string"}, - Format: "", - }, - }, - "prefix": { - SchemaProps: spec.SchemaProps{ - Description: "Prefix defines the prefix for the IP claim", - Type: []string{"string"}, - Format: "", - }, - }, - "address": { - SchemaProps: spec.SchemaProps{ - Description: "Address defines the address for the IP claim", - Type: []string{"string"}, - Format: "", - }, - }, - "range": { - SchemaProps: spec.SchemaProps{ - Description: "Range defines the range for the IP claim", - Type: []string{"string"}, - Format: "", - }, - }, - "defaultGateway": { - SchemaProps: spec.SchemaProps{ - Description: "DefaultGateway defines if the address acts as a default gateway", - Type: []string{"boolean"}, - Format: "", - }, - }, - "createPrefix": { - SchemaProps: spec.SchemaProps{ - Description: "CreatePrefix defines if this prefix must be created. Only used for dynamic prefixes e.g. non /32 ipv4 and non /128 ipv6 prefixes", - Type: []string{"boolean"}, - Format: "", - }, - }, - "prefixLength": { - SchemaProps: spec.SchemaProps{ - Description: "PrefixLength defines the prefix length for the IP Claim, Must be set when CreatePrefic is set If not present we use assume /32 for ipv4 and /128 for ipv6", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "addressFamily": { - SchemaProps: spec.SchemaProps{ - Description: "AddressFamily defines the address family for the IP claim", - Type: []string{"string"}, - Format: "", - }, - }, - "idx": { - SchemaProps: spec.SchemaProps{ - Description: "Index defines the index of the IP Claim, used to get a deterministic IP from a prefix If not present we claim a random prefix from a prefix", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "selector": { - SchemaProps: spec.SchemaProps{ - Description: "Selector defines the selector criterias", - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), - }, - }, - "owner": { - SchemaProps: spec.SchemaProps{ - Description: "Owner defines the ownerReference of the IPClaim Allow for different namesapces, hence it is part of the spec", - Ref: ref("github.com/kuidio/kuid/apis/common/v1alpha1.OwnerReference"), - }, - }, - }, - Required: []string{"index"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/common/v1alpha1.OwnerReference", "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, - } -} - -func schema_apis_backend_ipam_v1alpha1_IPClaimStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "IPClaimStatus defines the observed state of IPClaim", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - "range": { - SchemaProps: spec.SchemaProps{ - Description: "Range defines the range, claimed through the IPAM backend", - Type: []string{"string"}, - Format: "", - }, - }, - "address": { - SchemaProps: spec.SchemaProps{ - Description: "Address defines the address, claimed through the IPAM backend", - Type: []string{"string"}, - Format: "", - }, - }, - "prefix": { - SchemaProps: spec.SchemaProps{ - Description: "Prefix defines the prefix, claimed through the IPAM backend", - Type: []string{"string"}, - Format: "", - }, - }, - "defaultGateway": { - SchemaProps: spec.SchemaProps{ - Description: "DefaultGateway defines the default gateway IP for the claimed prefix DefaultGateway is only relevant for prefix kind = network", - Type: []string{"string"}, - Format: "", - }, - }, - "expiryTime": { - SchemaProps: spec.SchemaProps{ - Description: "ExpiryTime defines when the claim expires", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_ipam_v1alpha1_IPEntry(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "IPEntry is the Schema for the ipentry API", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPEntrySpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPEntryStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPEntrySpec", "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPEntryStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_ipam_v1alpha1_IPEntryList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "IPEntryList contains a list of IPEntries", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPEntry"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPEntry", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_ipam_v1alpha1_IPEntrySpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "IPEntrySpec defines the desired state of IPEntry", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "index": { - SchemaProps: spec.SchemaProps{ - Description: "Index defines the index for the IP Entry", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "prefixType": { - SchemaProps: spec.SchemaProps{ - Description: "PrefixType defines the prefixtype of IPEntry; for address and range claims this is not relevant - network kind is used for physical, virtual nics on a device - pool kind is used for allocating dedicated IP addresses - aggregate kind is used for claiming an aggregate prefix; only used for networkInstance prefixes", - Type: []string{"string"}, - Format: "", - }, - }, - "claimType": { - SchemaProps: spec.SchemaProps{ - Description: "ClaimType defines the claimType of the IP Entry", - Type: []string{"string"}, - Format: "", - }, - }, - "prefix": { - SchemaProps: spec.SchemaProps{ - Description: "Prefix defines the prefix for the IP entry; which can be an expanded prefix from the prefix, range or address", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "defaultGateway": { - SchemaProps: spec.SchemaProps{ - Description: "DefaultGateway defines if the address acts as a default gateway", - Type: []string{"boolean"}, - Format: "", - }, - }, - "addressFamily": { - SchemaProps: spec.SchemaProps{ - Description: "AddressFamily defines the address family for the IP claim", - Type: []string{"string"}, - Format: "", - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "claim": { - SchemaProps: spec.SchemaProps{ - Description: "Claim defines the name of the ip claim that is the origin of this ip entry", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "owner": { - SchemaProps: spec.SchemaProps{ - Description: "Owner defines the ownerReference of the IPENtry Allow for different namesapces, hence it is part of the spec", - Ref: ref("github.com/kuidio/kuid/apis/common/v1alpha1.OwnerReference"), - }, - }, - }, - Required: []string{"index", "prefix", "claim"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/common/v1alpha1.OwnerReference"}, - } -} - -func schema_apis_backend_ipam_v1alpha1_IPEntryStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "IPEntryStatus defines the observed state of IPEntry", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_ipam_v1alpha1_IPIndex(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "IPIndex is the Schema for the IPIndex API", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPIndexSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPIndexStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPIndexSpec", "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPIndexStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_ipam_v1alpha1_IPIndexList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "IPIndexList contains a list of IPIndexs", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPIndex"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPIndex", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_ipam_v1alpha1_IPIndexSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "IPIndexSpec defines the desired state of IPIndex", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "prefixes": { - SchemaProps: spec.SchemaProps{ - Description: "Prefixes define the aggregate prefixes for the network instance A Network instance needs at least 1 prefix to be defined to become operational", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.Prefix"), - }, - }, - }, - }, - }, - }, - Required: []string{"prefixes"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.Prefix"}, - } -} - -func schema_apis_backend_ipam_v1alpha1_IPIndexStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "IPIndexStatus defines the observed state of IPIndex", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - "prefixes": { - SchemaProps: spec.SchemaProps{ - Description: "Prefixes defines the prefixes, claimed through the IPAM backend", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.Prefix"), - }, - }, - }, - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.Prefix", "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_ipam_v1alpha1_Prefix(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "prefix": { - SchemaProps: spec.SchemaProps{ - Description: "Prefix defines the ip cidr in prefix notation.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - }, - Required: []string{"prefix"}, - }, - }, - } -} - -func schema_apis_backend_ipam_v1alpha1_dynamicAddressSyntaxValidator(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"name"}, - }, - }, - } -} - -func schema_apis_backend_ipam_v1alpha1_dynamicPrefixSyntaxValidator(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"name"}, - }, - }, - } -} - -func schema_apis_backend_ipam_v1alpha1_staticAddressSyntaxValidator(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"name"}, - }, - }, - } -} - -func schema_apis_backend_ipam_v1alpha1_staticPrefixSyntaxValidator(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"name"}, - }, - }, - } -} - -func schema_apis_backend_ipam_v1alpha1_staticRangeSyntaxValidator(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"name"}, - }, - }, - } -} - -func schema_apis_backend_vlan_v1alpha1_VLANClaim(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "VLANClaim is the Schema for the VLANClaim API", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANClaimSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANClaimStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANClaimSpec", "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANClaimStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_vlan_v1alpha1_VLANClaimList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "VLANClaimList contains a list of VLANClaims", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANClaim"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANClaim", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_vlan_v1alpha1_VLANClaimSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "VLANClaimSpec defines the desired state of VLANClaim", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "index": { - SchemaProps: spec.SchemaProps{ - Description: "VLANIndex defines the vlan index for the VLAN Claim", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "id": { - SchemaProps: spec.SchemaProps{ - Description: "VLANID defines the vlan for the VLAN claim", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "range": { - SchemaProps: spec.SchemaProps{ - Description: "Range defines the vlan range for the VLAN claim The following notation is used: start-end - the vlans in the range must be consecutive", - Type: []string{"string"}, - Format: "", - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "selector": { - SchemaProps: spec.SchemaProps{ - Description: "Selector defines the selector criterias", - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), - }, - }, - "owner": { - SchemaProps: spec.SchemaProps{ - Description: "Owner defines the ownerReference of the VLANClaim Allow for different namesapces, hence it is part of the spec", - Ref: ref("github.com/kuidio/kuid/apis/common/v1alpha1.OwnerReference"), - }, - }, - }, - Required: []string{"index"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/common/v1alpha1.OwnerReference", "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, - } -} - -func schema_apis_backend_vlan_v1alpha1_VLANClaimStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "VLANClaimStatus defines the observed state of VLANClaim", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - "id": { - SchemaProps: spec.SchemaProps{ - Description: "VLANID defines the vlan for the VLAN claim", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "range": { - SchemaProps: spec.SchemaProps{ - Description: "VLANRange defines the vlan range for the VLAN claim", - Type: []string{"string"}, - Format: "", - }, - }, - "expiryTime": { - SchemaProps: spec.SchemaProps{ - Description: "ExpiryTime defines when the claim expires", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_vlan_v1alpha1_VLANEntry(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "VLANEntry is the Schema for the vlanentry API", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANEntrySpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANEntryStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANEntrySpec", "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANEntryStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_vlan_v1alpha1_VLANEntryList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "VLANEntryList contains a list of VLANEntries", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANEntry"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANEntry", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_vlan_v1alpha1_VLANEntrySpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "VLANEntrySpec defines the desired state of VLANEntry", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "index": { - SchemaProps: spec.SchemaProps{ - Description: "VLANIndex defines the vlan index for the VLAN Claim", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "claimType": { - SchemaProps: spec.SchemaProps{ - Description: "ClaimType defines the claimType of the VLAN Entry", - Type: []string{"string"}, - Format: "", - }, - }, - "id": { - SchemaProps: spec.SchemaProps{ - Description: "ID defines the id of the VLAN entry in the tree", - Type: []string{"string"}, - Format: "", - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "selector": { - SchemaProps: spec.SchemaProps{ - Description: "Selector defines the selector criterias", - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), - }, - }, - "claim": { - SchemaProps: spec.SchemaProps{ - Description: "Claim defines the name of the claim that is the origin of this entry", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "owner": { - SchemaProps: spec.SchemaProps{ - Description: "Owner defines the ownerReference of the VLANClaim Allow for different namesapces, hence it is part of the spec", - Ref: ref("github.com/kuidio/kuid/apis/common/v1alpha1.OwnerReference"), - }, - }, - }, - Required: []string{"index", "claim"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/common/v1alpha1.OwnerReference", "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, - } -} - -func schema_apis_backend_vlan_v1alpha1_VLANEntryStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "VLANEntryStatus defines the observed state of VLANEntry", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_vlan_v1alpha1_VLANIndex(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "VLANIndex is the Schema for the VLANIndex API", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANIndexSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANIndexStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANIndexSpec", "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANIndexStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_vlan_v1alpha1_VLANIndexList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "VLANIndexList contains a list of VLANIndexs", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANIndex"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANIndex", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_vlan_v1alpha1_VLANIndexSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "VLANIndexSpec defines the desired state of VLANIndex", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "minID": { - SchemaProps: spec.SchemaProps{ - Description: "MinID defines the min VLAN ID the index supports", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "maxID": { - SchemaProps: spec.SchemaProps{ - Description: "MaxID defines the max VLAN ID the index supports", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - }, - }, - }, - } -} - -func schema_apis_backend_vlan_v1alpha1_VLANIndexStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "VLANIndexStatus defines the observed state of VLANIndex", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "minID": { - SchemaProps: spec.SchemaProps{ - Description: "MinID defines the min VLAN ID the index supports", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "maxID": { - SchemaProps: spec.SchemaProps{ - Description: "MaxID defines the max VLAN ID the index supports", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_vlan_v1alpha1_vlanDynamicIDSyntaxValidator(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"name"}, - }, - }, - } -} - -func schema_apis_backend_vlan_v1alpha1_vlanRangeSyntaxValidator(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"name"}, - }, - }, - } -} - -func schema_apis_backend_vlan_v1alpha1_vlanStaticIDSyntaxValidator(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"name"}, - }, - }, - } -} - -func schema_apis_backend_vxlan_v1alpha1_VXLANClaim(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "VXLANClaim is the Schema for the VXLANClaim API", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1.VXLANClaimSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1.VXLANClaimStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1.VXLANClaimSpec", "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1.VXLANClaimStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_vxlan_v1alpha1_VXLANClaimList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "VXLANClaimList contains a list of VXLANClaims", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1.VXLANClaim"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1.VXLANClaim", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_vxlan_v1alpha1_VXLANClaimSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "VXLANClaimSpec defines the desired state of VXLANClaim", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "index": { - SchemaProps: spec.SchemaProps{ - Description: "VXLANIndex defines the VXLAN index for the VXLAN Claim", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "id": { - SchemaProps: spec.SchemaProps{ - Description: "VXLANID defines the VXLAN for the VXLAN claim", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "range": { - SchemaProps: spec.SchemaProps{ - Description: "Range defines the VXLAN range for the VXLAN claim The following notation is used: start-end - the VXLANs in the range must be consecutive", - Type: []string{"string"}, - Format: "", - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "selector": { - SchemaProps: spec.SchemaProps{ - Description: "Selector defines the selector criterias", - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), - }, - }, - "owner": { - SchemaProps: spec.SchemaProps{ - Description: "Owner defines the ownerReference of the VXLANClaim Allow for different namesapces, hence it is part of the spec", - Ref: ref("github.com/kuidio/kuid/apis/common/v1alpha1.OwnerReference"), - }, - }, - }, - Required: []string{"index"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/common/v1alpha1.OwnerReference", "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, - } -} - -func schema_apis_backend_vxlan_v1alpha1_VXLANClaimStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "VXLANClaimStatus defines the observed state of VXLANClaim", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - "id": { - SchemaProps: spec.SchemaProps{ - Description: "VXLANID defines the VXLAN for the VXLAN claim", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "range": { - SchemaProps: spec.SchemaProps{ - Description: "VXLANRange defines the VXLAN range for the VXLAN claim", - Type: []string{"string"}, - Format: "", - }, - }, - "expiryTime": { - SchemaProps: spec.SchemaProps{ - Description: "ExpiryTime defines when the claim expires", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_vxlan_v1alpha1_VXLANDynamicIDSyntaxValidator(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"name"}, - }, - }, - } -} - -func schema_apis_backend_vxlan_v1alpha1_VXLANEntry(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "VXLANEntry is the Schema for the VXLANentry API", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1.VXLANEntrySpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1.VXLANEntryStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1.VXLANEntrySpec", "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1.VXLANEntryStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_vxlan_v1alpha1_VXLANEntryList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "VXLANEntryList contains a list of VXLANEntries", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1.VXLANEntry"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1.VXLANEntry", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_vxlan_v1alpha1_VXLANEntrySpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "VXLANEntrySpec defines the desired state of VXLANEntry", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "index": { - SchemaProps: spec.SchemaProps{ - Description: "VXLANIndex defines the VXLAN index for the VXLAN Claim", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "claimType": { - SchemaProps: spec.SchemaProps{ - Description: "ClaimType defines the claimType of the VXLAN Entry", - Type: []string{"string"}, - Format: "", - }, - }, - "id": { - SchemaProps: spec.SchemaProps{ - Description: "ID defines the id of the VXLAN entry in the tree", - Type: []string{"string"}, - Format: "", - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "selector": { - SchemaProps: spec.SchemaProps{ - Description: "Selector defines the selector criterias", - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), - }, - }, - "claim": { - SchemaProps: spec.SchemaProps{ - Description: "Claim defines the name of the claim that is the origin of this entry", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "owner": { - SchemaProps: spec.SchemaProps{ - Description: "Owner defines the ownerReference of the VXLANClaim Allow for different namesapces, hence it is part of the spec", - Ref: ref("github.com/kuidio/kuid/apis/common/v1alpha1.OwnerReference"), - }, - }, - }, - Required: []string{"index", "claim"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/common/v1alpha1.OwnerReference", "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, - } -} - -func schema_apis_backend_vxlan_v1alpha1_VXLANEntryStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "VXLANEntryStatus defines the observed state of VXLANEntry", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_vxlan_v1alpha1_VXLANIndex(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "VXLANIndex is the Schema for the VXLANIndex API", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1.VXLANIndexSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1.VXLANIndexStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1.VXLANIndexSpec", "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1.VXLANIndexStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_apis_backend_vxlan_v1alpha1_VXLANIndexList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "VXLANIndexList contains a list of VXLANIndexs", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1.VXLANIndex"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1.VXLANIndex", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_apis_backend_vxlan_v1alpha1_VXLANIndexSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "VXLANIndexSpec defines the desired state of VXLANIndex", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "minID": { - SchemaProps: spec.SchemaProps{ - Description: "MinID defines the min ID the index supports", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "maxID": { - SchemaProps: spec.SchemaProps{ - Description: "MaxID defines the max ID the index supports", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - }, - }, - }, - } -} - -func schema_apis_backend_vxlan_v1alpha1_VXLANIndexStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "VXLANIndexStatus defines the observed state of VXLANIndex", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "minID": { - SchemaProps: spec.SchemaProps{ - Description: "MinID defines the min ID the index is configured with", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "maxID": { - SchemaProps: spec.SchemaProps{ - Description: "MaxID defines the max ID the index is configured with", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apis_backend_vxlan_v1alpha1_VXLANRangeSyntaxValidator(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"name"}, - }, - }, - } -} - -func schema_apis_backend_vxlan_v1alpha1_VXLANStaticIDSyntaxValidator(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"name"}, - }, - }, - } -} - -func schema_kuid_apis_common_v1alpha1_ClaimLabels(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "selector": { - SchemaProps: spec.SchemaProps{ - Description: "Selector defines the selector criterias", - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, - } -} - -func schema_kuid_apis_common_v1alpha1_OwnerReference(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "group": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "version": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "kind": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "namespace": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "name": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"group", "version", "kind", "namespace", "name"}, - }, - }, - } -} - -func schema_kuid_apis_common_v1alpha1_UserDefinedLabels(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "UserDefinedLabels define metadata to the resource.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Labels as user defined labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - }, - }, - }, - } -} - -func schema_kuid_apis_condition_v1alpha1_Condition(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "type": { - SchemaProps: spec.SchemaProps{ - Description: "type of condition in CamelCase or in foo.example.com/CamelCase.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Description: "status of the condition, one of True, False, Unknown.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "observedGeneration": { - SchemaProps: spec.SchemaProps{ - Description: "observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance.", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "lastTransitionTime": { - SchemaProps: spec.SchemaProps{ - Description: "lastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.", - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), - }, - }, - "reason": { - SchemaProps: spec.SchemaProps{ - Description: "reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "message": { - SchemaProps: spec.SchemaProps{ - Description: "message is a human readable message indicating details about the transition. This may be an empty string.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"type", "status", "lastTransitionTime", "reason", "message"}, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, - } -} - -func schema_kuid_apis_condition_v1alpha1_ConditionedStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "A ConditionedStatus reflects the observed status of a resource. Only one condition of each type may exist.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"), - }, - }, - }, - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kuidio/kuid/apis/condition/v1alpha1.Condition"}, - } -} - -func schema_apimachinery_pkg_api_resource_Quantity(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.EmbedOpenAPIDefinitionIntoV2Extension(common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and AsInt64() accessors.\n\nThe serialization format is:\n\n``` ::= \n\n\t(Note that may be empty, from the \"\" case in .)\n\n ::= 0 | 1 | ... | 9 ::= | ::= | . | . | . ::= \"+\" | \"-\" ::= | ::= | | ::= Ki | Mi | Gi | Ti | Pi | Ei\n\n\t(International System of units; See: http://physics.nist.gov/cuu/Units/binary.html)\n\n ::= m | \"\" | k | M | G | T | P | E\n\n\t(Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.)\n\n ::= \"e\" | \"E\" ```\n\nNo matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities.\n\nWhen a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized.\n\nBefore serializing, Quantity will be put in \"canonical form\". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that:\n\n- No precision is lost - No fractional digits will be emitted - The exponent (or suffix) is as large as possible.\n\nThe sign will be omitted unless the number is negative.\n\nExamples:\n\n- 1.5 will be serialized as \"1500m\" - 1.5Gi will be serialized as \"1536Mi\"\n\nNote that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise.\n\nNon-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.)\n\nThis format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation.", - OneOf: common.GenerateOpenAPIV3OneOfSchema(resource.Quantity{}.OpenAPIV3OneOfTypes()), - Format: resource.Quantity{}.OpenAPISchemaFormat(), - }, - }, - }, common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and AsInt64() accessors.\n\nThe serialization format is:\n\n``` ::= \n\n\t(Note that may be empty, from the \"\" case in .)\n\n ::= 0 | 1 | ... | 9 ::= | ::= | . | . | . ::= \"+\" | \"-\" ::= | ::= | | ::= Ki | Mi | Gi | Ti | Pi | Ei\n\n\t(International System of units; See: http://physics.nist.gov/cuu/Units/binary.html)\n\n ::= m | \"\" | k | M | G | T | P | E\n\n\t(Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.)\n\n ::= \"e\" | \"E\" ```\n\nNo matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities.\n\nWhen a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized.\n\nBefore serializing, Quantity will be put in \"canonical form\". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that:\n\n- No precision is lost - No fractional digits will be emitted - The exponent (or suffix) is as large as possible.\n\nThe sign will be omitted unless the number is negative.\n\nExamples:\n\n- 1.5 will be serialized as \"1500m\" - 1.5Gi will be serialized as \"1536Mi\"\n\nNote that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise.\n\nNon-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.)\n\nThis format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation.", - Type: resource.Quantity{}.OpenAPISchemaType(), - Format: resource.Quantity{}.OpenAPISchemaFormat(), - }, - }, - }) -} - -func schema_apimachinery_pkg_api_resource_int64Amount(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "int64Amount represents a fixed precision numerator and arbitrary scale exponent. It is faster than operations on inf.Dec for values that can be represented as int64.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "value": { - SchemaProps: spec.SchemaProps{ - Default: 0, - Type: []string{"integer"}, - Format: "int64", - }, - }, - "scale": { - SchemaProps: spec.SchemaProps{ - Default: 0, - Type: []string{"integer"}, - Format: "int32", - }, - }, - }, - Required: []string{"value", "scale"}, - }, - }, - } -} - -func schema_pkg_apis_meta_v1_APIGroup(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "APIGroup contains the name, the supported versions, and the preferred version of a group.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "name": { - SchemaProps: spec.SchemaProps{ - Description: "name is the name of the group.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "versions": { - SchemaProps: spec.SchemaProps{ - Description: "versions are the versions supported in this group.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionForDiscovery"), - }, - }, - }, - }, - }, - "preferredVersion": { - SchemaProps: spec.SchemaProps{ - Description: "preferredVersion is the version preferred by the API server, which probably is the storage version.", - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionForDiscovery"), - }, - }, - "serverAddressByClientCIDRs": { - SchemaProps: spec.SchemaProps{ - Description: "a map of client CIDR to server address that is serving this group. This is to help clients reach servers in the most network-efficient way possible. Clients can use the appropriate server address as per the CIDR that they match. In case of multiple matches, clients should use the longest matching CIDR. The server returns only those CIDRs that it thinks that the client can match. For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP. Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR"), - }, - }, - }, - }, - }, - }, - Required: []string{"name", "versions"}, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionForDiscovery", "k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR"}, - } -} - -func schema_pkg_apis_meta_v1_APIGroupList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "APIGroupList is a list of APIGroup, to allow clients to discover the API at /apis.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "groups": { - SchemaProps: spec.SchemaProps{ - Description: "groups is a list of APIGroup.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.APIGroup"), - }, - }, - }, - }, - }, - }, - Required: []string{"groups"}, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.APIGroup"}, - } -} - -func schema_pkg_apis_meta_v1_APIResource(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "APIResource specifies the name of a resource and whether it is namespaced.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Description: "name is the plural name of the resource.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "singularName": { - SchemaProps: spec.SchemaProps{ - Description: "singularName is the singular name of the resource. This allows clients to handle plural and singular opaquely. The singularName is more correct for reporting status on a single item and both singular and plural are allowed from the kubectl CLI interface.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "namespaced": { - SchemaProps: spec.SchemaProps{ - Description: "namespaced indicates if a resource is namespaced or not.", - Default: false, - Type: []string{"boolean"}, - Format: "", - }, - }, - "group": { - SchemaProps: spec.SchemaProps{ - Description: "group is the preferred group of the resource. Empty implies the group of the containing resource list. For subresources, this may have a different value, for example: Scale\".", - Type: []string{"string"}, - Format: "", - }, - }, - "version": { - SchemaProps: spec.SchemaProps{ - Description: "version is the preferred version of the resource. Empty implies the version of the containing resource list For subresources, this may have a different value, for example: v1 (while inside a v1beta1 version of the core resource's group)\".", - Type: []string{"string"}, - Format: "", - }, - }, - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "kind is the kind for the resource (e.g. 'Foo' is the kind for a resource 'foo')", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "verbs": { - SchemaProps: spec.SchemaProps{ - Description: "verbs is a list of supported kube verbs (this includes get, list, watch, create, update, patch, delete, deletecollection, and proxy)", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "shortNames": { - SchemaProps: spec.SchemaProps{ - Description: "shortNames is a list of suggested short names of the resource.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "categories": { - SchemaProps: spec.SchemaProps{ - Description: "categories is a list of the grouped resources this resource belongs to (e.g. 'all')", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "storageVersionHash": { - SchemaProps: spec.SchemaProps{ - Description: "The hash value of the storage version, the version this resource is converted to when written to the data store. Value must be treated as opaque by clients. Only equality comparison on the value is valid. This is an alpha feature and may change or be removed in the future. The field is populated by the apiserver only if the StorageVersionHash feature gate is enabled. This field will remain optional even if it graduates.", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"name", "singularName", "namespaced", "kind", "verbs"}, - }, - }, - } -} - -func schema_pkg_apis_meta_v1_APIResourceList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "APIResourceList is a list of APIResource, it is used to expose the name of the resources supported in a specific group and version, and if the resource is namespaced.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "groupVersion": { - SchemaProps: spec.SchemaProps{ - Description: "groupVersion is the group and version this APIResourceList is for.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "resources": { - SchemaProps: spec.SchemaProps{ - Description: "resources contains the name of the resources and if they are namespaced.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.APIResource"), - }, - }, - }, - }, - }, - }, - Required: []string{"groupVersion", "resources"}, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.APIResource"}, - } -} - -func schema_pkg_apis_meta_v1_APIVersions(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "APIVersions lists the versions that are available, to allow clients to discover the API at /api, which is the root path of the legacy v1 API.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "versions": { - SchemaProps: spec.SchemaProps{ - Description: "versions are the api versions that are available.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "serverAddressByClientCIDRs": { - SchemaProps: spec.SchemaProps{ - Description: "a map of client CIDR to server address that is serving this group. This is to help clients reach servers in the most network-efficient way possible. Clients can use the appropriate server address as per the CIDR that they match. In case of multiple matches, clients should use the longest matching CIDR. The server returns only those CIDRs that it thinks that the client can match. For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP. Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR"), - }, - }, - }, - }, - }, - }, - Required: []string{"versions", "serverAddressByClientCIDRs"}, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR"}, - } -} - -func schema_pkg_apis_meta_v1_ApplyOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ApplyOptions may be provided when applying an API object. FieldManager is required for apply requests. ApplyOptions is equivalent to PatchOptions. It is provided as a convenience with documentation that speaks specifically to how the options fields relate to apply.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "dryRun": { - SchemaProps: spec.SchemaProps{ - Description: "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "force": { - SchemaProps: spec.SchemaProps{ - Description: "Force is going to \"force\" Apply requests. It means user will re-acquire conflicting fields owned by other people.", - Default: false, - Type: []string{"boolean"}, - Format: "", - }, - }, - "fieldManager": { - SchemaProps: spec.SchemaProps{ - Description: "fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"force", "fieldManager"}, - }, - }, - } -} - -func schema_pkg_apis_meta_v1_Condition(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "Condition contains details for one aspect of the current state of this API Resource.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "type": { - SchemaProps: spec.SchemaProps{ - Description: "type of condition in CamelCase or in foo.example.com/CamelCase.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Description: "status of the condition, one of True, False, Unknown.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "observedGeneration": { - SchemaProps: spec.SchemaProps{ - Description: "observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance.", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "lastTransitionTime": { - SchemaProps: spec.SchemaProps{ - Description: "lastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.", - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), - }, - }, - "reason": { - SchemaProps: spec.SchemaProps{ - Description: "reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "message": { - SchemaProps: spec.SchemaProps{ - Description: "message is a human readable message indicating details about the transition. This may be an empty string.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"type", "status", "lastTransitionTime", "reason", "message"}, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, - } -} - -func schema_pkg_apis_meta_v1_CreateOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "CreateOptions may be provided when creating an API object.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "dryRun": { - SchemaProps: spec.SchemaProps{ - Description: "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "fieldManager": { - SchemaProps: spec.SchemaProps{ - Description: "fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.", - Type: []string{"string"}, - Format: "", - }, - }, - "fieldValidation": { - SchemaProps: spec.SchemaProps{ - Description: "fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - } -} - -func schema_pkg_apis_meta_v1_DeleteOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "DeleteOptions may be provided when deleting an API object.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "gracePeriodSeconds": { - SchemaProps: spec.SchemaProps{ - Description: "The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "preconditions": { - SchemaProps: spec.SchemaProps{ - Description: "Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned.", - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Preconditions"), - }, - }, - "orphanDependents": { - SchemaProps: spec.SchemaProps{ - Description: "Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.", - Type: []string{"boolean"}, - Format: "", - }, - }, - "propagationPolicy": { - SchemaProps: spec.SchemaProps{ - Description: "Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground.", - Type: []string{"string"}, - Format: "", - }, - }, - "dryRun": { - SchemaProps: spec.SchemaProps{ - Description: "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - }, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.Preconditions"}, - } -} - -func schema_pkg_apis_meta_v1_Duration(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "Duration is a wrapper around time.Duration which supports correct marshaling to YAML and JSON. In particular, it marshals into strings, which can be used as map keys in json.", - Type: v1.Duration{}.OpenAPISchemaType(), - Format: v1.Duration{}.OpenAPISchemaFormat(), - }, - }, - } -} - -func schema_pkg_apis_meta_v1_FieldsV1(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "FieldsV1 stores a set of fields in a data structure like a Trie, in JSON format.\n\nEach key is either a '.' representing the field itself, and will always map to an empty set, or a string representing a sub-field or item. The string will follow one of these four formats: 'f:', where is the name of a field in a struct, or key in a map 'v:', where is the exact json formatted value of a list item 'i:', where is position of a item in a list 'k:', where is a map of a list item's key fields to their unique values If a key maps to an empty Fields value, the field that key represents is part of the set.\n\nThe exact format is defined in sigs.k8s.io/structured-merge-diff", - Type: []string{"object"}, - }, - }, - } -} - -func schema_pkg_apis_meta_v1_GetOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "GetOptions is the standard query options to the standard REST get call.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "resourceVersion": { - SchemaProps: spec.SchemaProps{ - Description: "resourceVersion sets a constraint on what resource versions a request may be served from. See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details.\n\nDefaults to unset", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - } -} - -func schema_pkg_apis_meta_v1_GroupKind(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "GroupKind specifies a Group and a Kind, but does not force a version. This is useful for identifying concepts during lookup stages without having partially valid types", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "group": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "kind": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"group", "kind"}, - }, - }, - } -} - -func schema_pkg_apis_meta_v1_GroupResource(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "GroupResource specifies a Group and a Resource, but does not force a version. This is useful for identifying concepts during lookup stages without having partially valid types", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "group": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "resource": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"group", "resource"}, - }, - }, - } -} - -func schema_pkg_apis_meta_v1_GroupVersion(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "GroupVersion contains the \"group\" and the \"version\", which uniquely identifies the API.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "group": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "version": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"group", "version"}, - }, - }, - } -} - -func schema_pkg_apis_meta_v1_GroupVersionForDiscovery(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "GroupVersion contains the \"group/version\" and \"version\" string of a version. It is made a struct to keep extensibility.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "groupVersion": { - SchemaProps: spec.SchemaProps{ - Description: "groupVersion specifies the API group and version in the form \"group/version\"", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "version": { - SchemaProps: spec.SchemaProps{ - Description: "version specifies the version in the form of \"version\". This is to save the clients the trouble of splitting the GroupVersion.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"groupVersion", "version"}, - }, - }, - } -} - -func schema_pkg_apis_meta_v1_GroupVersionKind(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "GroupVersionKind unambiguously identifies a kind. It doesn't anonymously include GroupVersion to avoid automatic coercion. It doesn't use a GroupVersion to avoid custom marshalling", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "group": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "version": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "kind": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"group", "version", "kind"}, - }, - }, - } -} - -func schema_pkg_apis_meta_v1_GroupVersionResource(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "GroupVersionResource unambiguously identifies a resource. It doesn't anonymously include GroupVersion to avoid automatic coercion. It doesn't use a GroupVersion to avoid custom marshalling", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "group": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "version": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "resource": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"group", "version", "resource"}, - }, - }, - } -} - -func schema_pkg_apis_meta_v1_InternalEvent(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "InternalEvent makes watch.Event versioned", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "Type": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "Object": { - SchemaProps: spec.SchemaProps{ - Description: "Object is:\n * If Type is Added or Modified: the new state of the object.\n * If Type is Deleted: the state of the object immediately before deletion.\n * If Type is Bookmark: the object (instance of a type being watched) where\n only ResourceVersion field is set. On successful restart of watch from a\n bookmark resourceVersion, client is guaranteed to not get repeat event\n nor miss any events.\n * If Type is Error: *api.Status is recommended; other types may make sense\n depending on context.", - Ref: ref("k8s.io/apimachinery/pkg/runtime.Object"), - }, - }, - }, - Required: []string{"Type", "Object"}, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/runtime.Object"}, - } -} - -func schema_pkg_apis_meta_v1_LabelSelector(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "matchLabels": { - SchemaProps: spec.SchemaProps{ - Description: "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "matchExpressions": { - SchemaProps: spec.SchemaProps{ - Description: "matchExpressions is a list of label selector requirements. The requirements are ANDed.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelectorRequirement"), - }, - }, - }, - }, - }, - }, - }, - VendorExtensible: spec.VendorExtensible{ - Extensions: spec.Extensions{ - "x-kubernetes-map-type": "atomic", - }, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelectorRequirement"}, - } -} - -func schema_pkg_apis_meta_v1_LabelSelectorRequirement(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "key": { - SchemaProps: spec.SchemaProps{ - Description: "key is the label key that the selector applies to.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "operator": { - SchemaProps: spec.SchemaProps{ - Description: "operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "values": { - SchemaProps: spec.SchemaProps{ - Description: "values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - }, - Required: []string{"key", "operator"}, - }, - }, - } -} - -func schema_pkg_apis_meta_v1_List(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "List holds a list of objects, which may not be known by the server.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Description: "List of objects", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "k8s.io/apimachinery/pkg/runtime.RawExtension"}, - } -} - -func schema_pkg_apis_meta_v1_ListMeta(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "selfLink": { - SchemaProps: spec.SchemaProps{ - Description: "Deprecated: selfLink is a legacy read-only field that is no longer populated by the system.", - Type: []string{"string"}, - Format: "", - }, - }, - "resourceVersion": { - SchemaProps: spec.SchemaProps{ - Description: "String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency", - Type: []string{"string"}, - Format: "", - }, - }, - "continue": { - SchemaProps: spec.SchemaProps{ - Description: "continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a consistent list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response, unless you have received this token from an error message.", - Type: []string{"string"}, - Format: "", - }, - }, - "remainingItemCount": { - SchemaProps: spec.SchemaProps{ - Description: "remainingItemCount is the number of subsequent items in the list which are not included in this list response. If the list request contained label or field selectors, then the number of remaining items is unknown and the field will be left unset and omitted during serialization. If the list is complete (either because it is not chunking or because this is the last chunk), then there are no more remaining items and this field will be left unset and omitted during serialization. Servers older than v1.15 do not set this field. The intended use of the remainingItemCount is *estimating* the size of a collection. Clients should not rely on the remainingItemCount to be set or to be exact.", - Type: []string{"integer"}, - Format: "int64", - }, - }, - }, - }, - }, - } -} - -func schema_pkg_apis_meta_v1_ListOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ListOptions is the query options to a standard REST list call.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "labelSelector": { - SchemaProps: spec.SchemaProps{ - Description: "A selector to restrict the list of returned objects by their labels. Defaults to everything.", - Type: []string{"string"}, - Format: "", - }, - }, - "fieldSelector": { - SchemaProps: spec.SchemaProps{ - Description: "A selector to restrict the list of returned objects by their fields. Defaults to everything.", - Type: []string{"string"}, - Format: "", - }, - }, - "watch": { - SchemaProps: spec.SchemaProps{ - Description: "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.", - Type: []string{"boolean"}, - Format: "", - }, - }, - "allowWatchBookmarks": { - SchemaProps: spec.SchemaProps{ - Description: "allowWatchBookmarks requests watch events with type \"BOOKMARK\". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored.", - Type: []string{"boolean"}, - Format: "", - }, - }, - "resourceVersion": { - SchemaProps: spec.SchemaProps{ - Description: "resourceVersion sets a constraint on what resource versions a request may be served from. See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details.\n\nDefaults to unset", - Type: []string{"string"}, - Format: "", - }, - }, - "resourceVersionMatch": { - SchemaProps: spec.SchemaProps{ - Description: "resourceVersionMatch determines how resourceVersion is applied to list calls. It is highly recommended that resourceVersionMatch be set for list calls where resourceVersion is set See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details.\n\nDefaults to unset", - Type: []string{"string"}, - Format: "", - }, - }, - "timeoutSeconds": { - SchemaProps: spec.SchemaProps{ - Description: "Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "limit": { - SchemaProps: spec.SchemaProps{ - Description: "limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.\n\nThe server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "continue": { - SchemaProps: spec.SchemaProps{ - Description: "The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\".\n\nThis field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.", - Type: []string{"string"}, - Format: "", - }, - }, - "sendInitialEvents": { - SchemaProps: spec.SchemaProps{ - Description: "`sendInitialEvents=true` may be set together with `watch=true`. In that case, the watch stream will begin with synthetic events to produce the current state of objects in the collection. Once all such events have been sent, a synthetic \"Bookmark\" event will be sent. The bookmark will report the ResourceVersion (RV) corresponding to the set of objects, and be marked with `\"k8s.io/initial-events-end\": \"true\"` annotation. Afterwards, the watch stream will proceed as usual, sending watch events corresponding to changes (subsequent to the RV) to objects watched.\n\nWhen `sendInitialEvents` option is set, we require `resourceVersionMatch` option to also be set. The semantic of the watch request is as following: - `resourceVersionMatch` = NotOlderThan\n is interpreted as \"data at least as new as the provided `resourceVersion`\"\n and the bookmark event is send when the state is synced\n to a `resourceVersion` at least as fresh as the one provided by the ListOptions.\n If `resourceVersion` is unset, this is interpreted as \"consistent read\" and the\n bookmark event is send when the state is synced at least to the moment\n when request started being processed.\n- `resourceVersionMatch` set to any other value or unset\n Invalid error is returned.\n\nDefaults to true if `resourceVersion=\"\"` or `resourceVersion=\"0\"` (for backward compatibility reasons) and to false otherwise.", - Type: []string{"boolean"}, - Format: "", - }, - }, - }, - }, - }, - } -} - -func schema_pkg_apis_meta_v1_ManagedFieldsEntry(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ManagedFieldsEntry is a workflow-id, a FieldSet and the group version of the resource that the fieldset applies to.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "manager": { - SchemaProps: spec.SchemaProps{ - Description: "Manager is an identifier of the workflow managing these fields.", - Type: []string{"string"}, - Format: "", - }, - }, - "operation": { - SchemaProps: spec.SchemaProps{ - Description: "Operation is the type of operation which lead to this ManagedFieldsEntry being created. The only valid values for this field are 'Apply' and 'Update'.", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the version of this resource that this field set applies to. The format is \"group/version\" just like the top-level APIVersion field. It is necessary to track the version of a field set because it cannot be automatically converted.", - Type: []string{"string"}, - Format: "", - }, - }, - "time": { - SchemaProps: spec.SchemaProps{ - Description: "Time is the timestamp of when the ManagedFields entry was added. The timestamp will also be updated if a field is added, the manager changes any of the owned fields value or removes a field. The timestamp does not update when a field is removed from the entry because another manager took it over.", - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), - }, - }, - "fieldsType": { - SchemaProps: spec.SchemaProps{ - Description: "FieldsType is the discriminator for the different fields format and version. There is currently only one possible value: \"FieldsV1\"", - Type: []string{"string"}, - Format: "", - }, - }, - "fieldsV1": { - SchemaProps: spec.SchemaProps{ - Description: "FieldsV1 holds the first JSON version format as described in the \"FieldsV1\" type.", - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.FieldsV1"), - }, - }, - "subresource": { - SchemaProps: spec.SchemaProps{ - Description: "Subresource is the name of the subresource used to update that object, or empty string if the object was updated through the main resource. The value of this field is used to distinguish between managers, even if they share the same name. For example, a status update will be distinct from a regular update using the same manager name. Note that the APIVersion field is not related to the Subresource field and it always corresponds to the version of the main resource.", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.FieldsV1", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, - } -} - -func schema_pkg_apis_meta_v1_MicroTime(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "MicroTime is version of Time with microsecond level precision.", - Type: v1.MicroTime{}.OpenAPISchemaType(), - Format: v1.MicroTime{}.OpenAPISchemaFormat(), - }, - }, - } -} - -func schema_pkg_apis_meta_v1_ObjectMeta(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Description: "Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names", - Type: []string{"string"}, - Format: "", - }, - }, - "generateName": { - SchemaProps: spec.SchemaProps{ - Description: "GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.\n\nIf this field is specified and the generated name exists, the server will return a 409.\n\nApplied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency", - Type: []string{"string"}, - Format: "", - }, - }, - "namespace": { - SchemaProps: spec.SchemaProps{ - Description: "Namespace defines the space within which each name must be unique. An empty namespace is equivalent to the \"default\" namespace, but \"default\" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty.\n\nMust be a DNS_LABEL. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces", - Type: []string{"string"}, - Format: "", - }, - }, - "selfLink": { - SchemaProps: spec.SchemaProps{ - Description: "Deprecated: selfLink is a legacy read-only field that is no longer populated by the system.", - Type: []string{"string"}, - Format: "", - }, - }, - "uid": { - SchemaProps: spec.SchemaProps{ - Description: "UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations.\n\nPopulated by the system. Read-only. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids", - Type: []string{"string"}, - Format: "", - }, - }, - "resourceVersion": { - SchemaProps: spec.SchemaProps{ - Description: "An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.\n\nPopulated by the system. Read-only. Value must be treated as opaque by clients and . More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency", - Type: []string{"string"}, - Format: "", - }, - }, - "generation": { - SchemaProps: spec.SchemaProps{ - Description: "A sequence number representing a specific generation of the desired state. Populated by the system. Read-only.", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "creationTimestamp": { - SchemaProps: spec.SchemaProps{ - Description: "CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.\n\nPopulated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), - }, - }, - "deletionTimestamp": { - SchemaProps: spec.SchemaProps{ - Description: "DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This field is set by the server when a graceful deletion is requested by the user, and is not directly settable by a client. The resource is expected to be deleted (no longer visible from resource lists, and not reachable by name) after the time in this field, once the finalizers list is empty. As long as the finalizers list contains items, deletion is blocked. Once the deletionTimestamp is set, this value may not be unset or be set further into the future, although it may be shortened or the resource may be deleted prior to this time. For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react by sending a graceful termination signal to the containers in the pod. After that 30 seconds, the Kubelet will send a hard termination signal (SIGKILL) to the container and after cleanup, remove the pod from the API. In the presence of network partitions, this object may still exist after this timestamp, until an administrator or automated process can determine the resource is fully terminated. If not set, graceful deletion of the object has not been requested.\n\nPopulated by the system when a graceful deletion is requested. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), - }, - }, - "deletionGracePeriodSeconds": { - SchemaProps: spec.SchemaProps{ - Description: "Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only.", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "labels": { - SchemaProps: spec.SchemaProps{ - Description: "Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "annotations": { - SchemaProps: spec.SchemaProps{ - Description: "Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations", - Type: []string{"object"}, - AdditionalProperties: &spec.SchemaOrBool{ - Allows: true, - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "ownerReferences": { - VendorExtensible: spec.VendorExtensible{ - Extensions: spec.Extensions{ - "x-kubernetes-patch-merge-key": "uid", - "x-kubernetes-patch-strategy": "merge", - }, - }, - SchemaProps: spec.SchemaProps{ - Description: "List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.OwnerReference"), - }, - }, - }, - }, - }, - "finalizers": { - VendorExtensible: spec.VendorExtensible{ - Extensions: spec.Extensions{ - "x-kubernetes-patch-strategy": "merge", - }, - }, - SchemaProps: spec.SchemaProps{ - Description: "Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed. Finalizers may be processed and removed in any order. Order is NOT enforced because it introduces significant risk of stuck finalizers. finalizers is a shared field, any actor with permission can reorder it. If the finalizer list is processed in order, then this can lead to a situation in which the component responsible for the first finalizer in the list is waiting for a signal (field value, external system, or other) produced by a component responsible for a finalizer later in the list, resulting in a deadlock. Without enforced ordering finalizers are free to order amongst themselves and are not vulnerable to ordering changes in the list.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "managedFields": { - SchemaProps: spec.SchemaProps{ - Description: "ManagedFields maps workflow-id and version to the set of fields that are managed by that workflow. This is mostly for internal housekeeping, and users typically shouldn't need to set or understand this field. A workflow can be the user's name, a controller's name, or the name of a specific apply path like \"ci-cd\". The set of fields is always in the version that the workflow used when modifying the object.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ManagedFieldsEntry"), - }, - }, - }, - }, - }, - }, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.ManagedFieldsEntry", "k8s.io/apimachinery/pkg/apis/meta/v1.OwnerReference", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, - } -} - -func schema_pkg_apis_meta_v1_OwnerReference(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "OwnerReference contains enough information to let you identify an owning object. An owning object must be in the same namespace as the dependent, or be cluster-scoped, so there is no namespace field.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "API version of the referent.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "name": { - SchemaProps: spec.SchemaProps{ - Description: "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "uid": { - SchemaProps: spec.SchemaProps{ - Description: "UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "controller": { - SchemaProps: spec.SchemaProps{ - Description: "If true, this reference points to the managing controller.", - Type: []string{"boolean"}, - Format: "", - }, - }, - "blockOwnerDeletion": { - SchemaProps: spec.SchemaProps{ - Description: "If true, AND if the owner has the \"foregroundDeletion\" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. See https://kubernetes.io/docs/concepts/architecture/garbage-collection/#foreground-deletion for how the garbage collector interacts with this field and enforces the foreground deletion. Defaults to false. To set this field, a user needs \"delete\" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned.", - Type: []string{"boolean"}, - Format: "", - }, - }, - }, - Required: []string{"apiVersion", "kind", "name", "uid"}, - }, - VendorExtensible: spec.VendorExtensible{ - Extensions: spec.Extensions{ - "x-kubernetes-map-type": "atomic", - }, - }, - }, - } -} - -func schema_pkg_apis_meta_v1_PartialObjectMetadata(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "PartialObjectMetadata is a generic representation of any object with ObjectMeta. It allows clients to get access to a particular ObjectMeta schema without knowing the details of the version.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Description: "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_pkg_apis_meta_v1_PartialObjectMetadataList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "PartialObjectMetadataList contains a list of objects containing only their metadata", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Description: "items contains each of the included items.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.PartialObjectMetadata"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "k8s.io/apimachinery/pkg/apis/meta/v1.PartialObjectMetadata"}, - } -} - -func schema_pkg_apis_meta_v1_Patch(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "Patch is provided to give a concrete name and type to the Kubernetes PATCH request body.", - Type: []string{"object"}, - }, - }, - } -} - -func schema_pkg_apis_meta_v1_PatchOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "PatchOptions may be provided when patching an API object. PatchOptions is meant to be a superset of UpdateOptions.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "dryRun": { - SchemaProps: spec.SchemaProps{ - Description: "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "force": { - SchemaProps: spec.SchemaProps{ - Description: "Force is going to \"force\" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests.", - Type: []string{"boolean"}, - Format: "", - }, - }, - "fieldManager": { - SchemaProps: spec.SchemaProps{ - Description: "fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch).", - Type: []string{"string"}, - Format: "", - }, - }, - "fieldValidation": { - SchemaProps: spec.SchemaProps{ - Description: "fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - } -} - -func schema_pkg_apis_meta_v1_Preconditions(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "Preconditions must be fulfilled before an operation (update, delete, etc.) is carried out.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "uid": { - SchemaProps: spec.SchemaProps{ - Description: "Specifies the target UID.", - Type: []string{"string"}, - Format: "", - }, - }, - "resourceVersion": { - SchemaProps: spec.SchemaProps{ - Description: "Specifies the target ResourceVersion", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - } -} - -func schema_pkg_apis_meta_v1_RootPaths(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "RootPaths lists the paths available at root. For example: \"/healthz\", \"/apis\".", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "paths": { - SchemaProps: spec.SchemaProps{ - Description: "paths are the paths available at root.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - }, - Required: []string{"paths"}, - }, - }, - } -} - -func schema_pkg_apis_meta_v1_ServerAddressByClientCIDR(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ServerAddressByClientCIDR helps the client to determine the server address that they should use, depending on the clientCIDR that they match.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "clientCIDR": { - SchemaProps: spec.SchemaProps{ - Description: "The CIDR with which clients can match their IP to figure out the server address that they should use.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "serverAddress": { - SchemaProps: spec.SchemaProps{ - Description: "Address of this server, suitable for a client that matches the above CIDR. This can be a hostname, hostname:port, IP or IP:port.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"clientCIDR", "serverAddress"}, - }, - }, - } -} - -func schema_pkg_apis_meta_v1_Status(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "Status is a return value for calls that don't return other objects.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Description: "Status of the operation. One of: \"Success\" or \"Failure\". More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status", - Type: []string{"string"}, - Format: "", - }, - }, - "message": { - SchemaProps: spec.SchemaProps{ - Description: "A human-readable description of the status of this operation.", - Type: []string{"string"}, - Format: "", - }, - }, - "reason": { - SchemaProps: spec.SchemaProps{ - Description: "A machine-readable description of why this operation is in the \"Failure\" status. If this value is empty there is no information available. A Reason clarifies an HTTP status code but does not override it.", - Type: []string{"string"}, - Format: "", - }, - }, - "details": { - SchemaProps: spec.SchemaProps{ - Description: "Extended data associated with the reason. Each reason may define its own extended details. This field is optional and the data returned is not guaranteed to conform to any schema except that defined by the reason type.", - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.StatusDetails"), - }, - }, - "code": { - SchemaProps: spec.SchemaProps{ - Description: "Suggested HTTP return code for this status, 0 if not set.", - Type: []string{"integer"}, - Format: "int32", - }, - }, - }, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "k8s.io/apimachinery/pkg/apis/meta/v1.StatusDetails"}, - } -} - -func schema_pkg_apis_meta_v1_StatusCause(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "StatusCause provides more information about an api.Status failure, including cases when multiple errors are encountered.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "reason": { - SchemaProps: spec.SchemaProps{ - Description: "A machine-readable description of the cause of the error. If this value is empty there is no information available.", - Type: []string{"string"}, - Format: "", - }, - }, - "message": { - SchemaProps: spec.SchemaProps{ - Description: "A human-readable description of the cause of the error. This field may be presented as-is to a reader.", - Type: []string{"string"}, - Format: "", - }, - }, - "field": { - SchemaProps: spec.SchemaProps{ - Description: "The field of the resource that has caused this error, as named by its JSON serialization. May include dot and postfix notation for nested attributes. Arrays are zero-indexed. Fields may appear more than once in an array of causes due to fields having multiple errors. Optional.\n\nExamples:\n \"name\" - the field \"name\" on the current resource\n \"items[0].name\" - the field \"name\" on the first array entry in \"items\"", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - } -} - -func schema_pkg_apis_meta_v1_StatusDetails(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "StatusDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Description: "The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).", - Type: []string{"string"}, - Format: "", - }, - }, - "group": { - SchemaProps: spec.SchemaProps{ - Description: "The group attribute of the resource associated with the status StatusReason.", - Type: []string{"string"}, - Format: "", - }, - }, - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "uid": { - SchemaProps: spec.SchemaProps{ - Description: "UID of the resource. (when there is a single resource which can be described). More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids", - Type: []string{"string"}, - Format: "", - }, - }, - "causes": { - SchemaProps: spec.SchemaProps{ - Description: "The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.StatusCause"), - }, - }, - }, - }, - }, - "retryAfterSeconds": { - SchemaProps: spec.SchemaProps{ - Description: "If specified, the time in seconds before the operation should be retried. Some errors may indicate the client must take an alternate action - for those errors this field may indicate how long to wait before taking the alternate action.", - Type: []string{"integer"}, - Format: "int32", - }, - }, - }, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.StatusCause"}, - } -} - -func schema_pkg_apis_meta_v1_Table(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "Table is a tabular representation of a set of API resources. The server transforms the object into a set of preferred columns for quickly reviewing the objects.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "columnDefinitions": { - SchemaProps: spec.SchemaProps{ - Description: "columnDefinitions describes each column in the returned items array. The number of cells per row will always match the number of column definitions.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.TableColumnDefinition"), - }, - }, - }, - }, - }, - "rows": { - SchemaProps: spec.SchemaProps{ - Description: "rows is the list of items in the table.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.TableRow"), - }, - }, - }, - }, - }, - }, - Required: []string{"columnDefinitions", "rows"}, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "k8s.io/apimachinery/pkg/apis/meta/v1.TableColumnDefinition", "k8s.io/apimachinery/pkg/apis/meta/v1.TableRow"}, - } -} - -func schema_pkg_apis_meta_v1_TableColumnDefinition(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "TableColumnDefinition contains information about a column returned in the Table.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Description: "name is a human readable name for the column.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "type": { - SchemaProps: spec.SchemaProps{ - Description: "type is an OpenAPI type definition for this column, such as number, integer, string, or array. See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "format": { - SchemaProps: spec.SchemaProps{ - Description: "format is an optional OpenAPI type modifier for this column. A format modifies the type and imposes additional rules, like date or time formatting for a string. The 'name' format is applied to the primary identifier column which has type 'string' to assist in clients identifying column is the resource name. See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "description": { - SchemaProps: spec.SchemaProps{ - Description: "description is a human readable description of this column.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "priority": { - SchemaProps: spec.SchemaProps{ - Description: "priority is an integer defining the relative importance of this column compared to others. Lower numbers are considered higher priority. Columns that may be omitted in limited space scenarios should be given a higher priority.", - Default: 0, - Type: []string{"integer"}, - Format: "int32", - }, - }, - }, - Required: []string{"name", "type", "format", "description", "priority"}, - }, - }, - } -} - -func schema_pkg_apis_meta_v1_TableOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "TableOptions are used when a Table is requested by the caller.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "includeObject": { - SchemaProps: spec.SchemaProps{ - Description: "includeObject decides whether to include each object along with its columnar information. Specifying \"None\" will return no object, specifying \"Object\" will return the full object contents, and specifying \"Metadata\" (the default) will return the object's metadata in the PartialObjectMetadata kind in version v1beta1 of the meta.k8s.io API group.", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - } -} - -func schema_pkg_apis_meta_v1_TableRow(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "TableRow is an individual row in a table.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "cells": { - SchemaProps: spec.SchemaProps{ - Description: "cells will be as wide as the column definitions array and may contain strings, numbers (float64 or int64), booleans, simple maps, lists, or null. See the type field of the column definition for a more detailed description.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Format: "", - }, - }, - }, - }, - }, - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "conditions describe additional status of a row that are relevant for a human user. These conditions apply to the row, not to the object, and will be specific to table output. The only defined condition type is 'Completed', for a row that indicates a resource that has run to completion and can be given less visual priority.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.TableRowCondition"), - }, - }, - }, - }, - }, - "object": { - SchemaProps: spec.SchemaProps{ - Description: "This field contains the requested additional information about each object based on the includeObject policy when requesting the Table. If \"None\", this field is empty, if \"Object\" this will be the default serialization of the object for the current API version, and if \"Metadata\" (the default) will contain the object metadata. Check the returned kind and apiVersion of the object before parsing. The media type of the object will always match the enclosing list - if this as a JSON table, these will be JSON encoded objects.", - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), - }, - }, - }, - Required: []string{"cells"}, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.TableRowCondition", "k8s.io/apimachinery/pkg/runtime.RawExtension"}, - } -} - -func schema_pkg_apis_meta_v1_TableRowCondition(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "TableRowCondition allows a row to be marked with additional information.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "type": { - SchemaProps: spec.SchemaProps{ - Description: "Type of row condition. The only defined value is 'Completed' indicating that the object this row represents has reached a completed state and may be given less visual priority than other rows. Clients are not required to honor any conditions but should be consistent where possible about handling the conditions.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Description: "Status of the condition, one of True, False, Unknown.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "reason": { - SchemaProps: spec.SchemaProps{ - Description: "(brief) machine readable reason for the condition's last transition.", - Type: []string{"string"}, - Format: "", - }, - }, - "message": { - SchemaProps: spec.SchemaProps{ - Description: "Human readable message indicating details about last transition.", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"type", "status"}, - }, - }, - } -} - -func schema_pkg_apis_meta_v1_Time(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.", - Type: v1.Time{}.OpenAPISchemaType(), - Format: v1.Time{}.OpenAPISchemaFormat(), - }, - }, - } -} - -func schema_pkg_apis_meta_v1_Timestamp(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "Timestamp is a struct that is equivalent to Time, but intended for protobuf marshalling/unmarshalling. It is generated into a serialization that matches Time. Do not use in Go structs.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "seconds": { - SchemaProps: spec.SchemaProps{ - Description: "Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.", - Default: 0, - Type: []string{"integer"}, - Format: "int64", - }, - }, - "nanos": { - SchemaProps: spec.SchemaProps{ - Description: "Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive. This field may be limited in precision depending on context.", - Default: 0, - Type: []string{"integer"}, - Format: "int32", - }, - }, - }, - Required: []string{"seconds", "nanos"}, - }, - }, - } -} - -func schema_pkg_apis_meta_v1_TypeMeta(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "TypeMeta describes an individual object in an API response or request with strings representing the type of the object and its API schema version. Structures that are versioned or persisted should inline TypeMeta.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - } -} - -func schema_pkg_apis_meta_v1_UpdateOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "UpdateOptions may be provided when updating an API object. All fields in UpdateOptions should also be present in PatchOptions.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "dryRun": { - SchemaProps: spec.SchemaProps{ - Description: "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - "fieldManager": { - SchemaProps: spec.SchemaProps{ - Description: "fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.", - Type: []string{"string"}, - Format: "", - }, - }, - "fieldValidation": { - SchemaProps: spec.SchemaProps{ - Description: "fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - } -} - -func schema_pkg_apis_meta_v1_WatchEvent(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "Event represents a single event to a watched resource.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "type": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "object": { - SchemaProps: spec.SchemaProps{ - Description: "Object is:\n * If Type is Added or Modified: the new state of the object.\n * If Type is Deleted: the state of the object immediately before deletion.\n * If Type is Error: *Status is recommended; other types may make sense\n depending on context.", - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), - }, - }, - }, - Required: []string{"type", "object"}, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/runtime.RawExtension"}, - } -} - -func schema_k8sio_apimachinery_pkg_runtime_RawExtension(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "RawExtension is used to hold extensions in external versions.\n\nTo use this, make a field which has RawExtension as its type in your external, versioned struct, and Object in your internal struct. You also need to register your various plugin types.\n\n// Internal package:\n\n\ttype MyAPIObject struct {\n\t\truntime.TypeMeta `json:\",inline\"`\n\t\tMyPlugin runtime.Object `json:\"myPlugin\"`\n\t}\n\n\ttype PluginA struct {\n\t\tAOption string `json:\"aOption\"`\n\t}\n\n// External package:\n\n\ttype MyAPIObject struct {\n\t\truntime.TypeMeta `json:\",inline\"`\n\t\tMyPlugin runtime.RawExtension `json:\"myPlugin\"`\n\t}\n\n\ttype PluginA struct {\n\t\tAOption string `json:\"aOption\"`\n\t}\n\n// On the wire, the JSON will look something like this:\n\n\t{\n\t\t\"kind\":\"MyAPIObject\",\n\t\t\"apiVersion\":\"v1\",\n\t\t\"myPlugin\": {\n\t\t\t\"kind\":\"PluginA\",\n\t\t\t\"aOption\":\"foo\",\n\t\t},\n\t}\n\nSo what happens? Decode first uses json or yaml to unmarshal the serialized data into your external MyAPIObject. That causes the raw JSON to be stored, but not unpacked. The next step is to copy (using pkg/conversion) into the internal struct. The runtime package's DefaultScheme has conversion functions installed which will unpack the JSON stored in RawExtension, turning it into the correct object type, and storing it in the Object. (TODO: In the case where the object is of an unknown type, a runtime.Unknown object will be created and stored.)", - Type: []string{"object"}, - }, - }, - } -} - -func schema_k8sio_apimachinery_pkg_runtime_TypeMeta(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "TypeMeta is shared by all top level objects. The proper way to use it is to inline it in your type, like this:\n\n\ttype MyAwesomeAPIObject struct {\n\t runtime.TypeMeta `json:\",inline\"`\n\t ... // other fields\n\t}\n\nfunc (obj *MyAwesomeAPIObject) SetGroupVersionKind(gvk *metav1.GroupVersionKind) { metav1.UpdateTypeMeta(obj,gvk) }; GroupVersionKind() *GroupVersionKind\n\nTypeMeta is provided here for convenience. You may use it directly from this package or define your own with the same fields.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", - }, - }, - "kind": { - SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - } -} - -func schema_k8sio_apimachinery_pkg_runtime_Unknown(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "Unknown allows api objects with unknown types to be passed-through. This can be used to deal with the API objects from a plug-in. Unknown objects still have functioning TypeMeta features-- kind, version, etc. metadata and field mutatation.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", - }, - }, - "kind": { - SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", - }, - }, - "ContentEncoding": { - SchemaProps: spec.SchemaProps{ - Description: "ContentEncoding is encoding used to encode 'Raw' data. Unspecified means no encoding.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "ContentType": { - SchemaProps: spec.SchemaProps{ - Description: "ContentType is serialization method used to serialize 'Raw'. Unspecified means ContentTypeJSON.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"ContentEncoding", "ContentType"}, - }, - }, - } -} - -func schema_k8sio_apimachinery_pkg_version_Info(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "Info contains versioning information. how we'll want to distribute that information.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "major": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "minor": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "gitVersion": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "gitCommit": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "gitTreeState": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "buildDate": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "goVersion": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "compiler": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "platform": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"major", "minor", "gitVersion", "gitCommit", "gitTreeState", "buildDate", "goVersion", "compiler", "platform"}, - }, - }, - } -} diff --git a/apis/condition/doc.go b/apis/id/doc.go similarity index 91% rename from apis/condition/doc.go rename to apis/id/doc.go index 88e1f97..e8d632e 100644 --- a/apis/condition/doc.go +++ b/apis/id/doc.go @@ -16,5 +16,5 @@ limitations under the License. // +k8s:deepcopy-gen=package,register -// condition defines the condition api -package condition +// id defines the id api +package id diff --git a/apis/id/id.go b/apis/id/id.go new file mode 100644 index 0000000..3be3bbf --- /dev/null +++ b/apis/id/id.go @@ -0,0 +1,143 @@ +/* +Copyright 2024 Nokia. + +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 id + +// +k8s:openapi-gen=true +type SiteID struct { + // Region defines the region of the resource + Region string `json:"region" yaml:"region" protobuf:"bytes,1,opt,name=region"` + // Site defines the site of the resource + Site string `json:"site" yaml:"site" protobuf:"bytes,2,opt,name=site"` +} + +// +k8s:openapi-gen=true +type NodeID struct { + SiteID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=siteID"` + // Node defines the name of the node + Node string `json:"node" yaml:"node" protobuf:"bytes,2,opt,name=node"` +} + +// +k8s:openapi-gen=true +type PartitionNodeID struct { + // Partition defines the partition this resource belongs to + Partition string `json:"partition" yaml:"partition" protobuf:"bytes,1,opt,name=partition"` + // SiteID define the siteid of the node + SiteID `json:",inline" yaml:",inline" protobuf:"bytes,2,opt,name=siteID"` + // Node defines the name of the node + Node string `json:"node" yaml:"node" protobuf:"bytes,3,opt,name=node"` +} + +// +k8s:openapi-gen=true +type PortID struct { + NodeID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"` + // ModuleBay defines the moduleBay reference id + ModuleBay *int `json:"moduleBay,omitempty" yaml:"moduleBay,omitempty" protobuf:"bytes,2,opt,name=moduleBay"` + // Module defines the module reference id + Module *int `json:"module,omitempty" yaml:"module,omitempty" protobuf:"bytes,3,opt,name=module"` + // Port defines the id of the port + Port int `json:"port" yaml:"port" protobuf:"bytes,4,opt,name=port"` +} + +// +k8s:openapi-gen=true +type AdaptorID struct { + NodeID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"` + // ModuleBay defines the moduleBay reference id + ModuleBay *int `json:"moduleBay,omitempty" yaml:"moduleBay,omitempty" protobuf:"bytes,2,opt,name=moduleBay"` + // Module defines the module reference id + Module *int `json:"module,omitempty" yaml:"module,omitempty" protobuf:"bytes,3,opt,name=module"` + // Port defines the id of the port + Port int `json:"port" yaml:"port" protobuf:"bytes,4,opt,name=port"` + // Adaptor defines the name of the adaptor + Adaptor string `json:"adaptor" yaml:"adaptor" protobuf:"bytes,5,opt,name=adaptor"` +} + +// +k8s:openapi-gen=true +type EndpointID struct { + NodeID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"` + // ModuleBay defines the moduleBay reference id + ModuleBay *int `json:"moduleBay,omitempty" yaml:"moduleBay,omitempty" protobuf:"bytes,2,opt,name=moduleBay"` + // Module defines the module reference id + Module *int `json:"module,omitempty" yaml:"module,omitempty" protobuf:"bytes,3,opt,name=module"` + // Port defines the id of the port + Port int `json:"port" yaml:"port" protobuf:"bytes,4,opt,name=port"` + // Adaptor defines the name of the adaptor + Adaptor string `json:"adaptor" yaml:"adaptor" protobuf:"bytes,5,opt,name=adaptor"` + // Endpoint defines the name of the endpoint + Endpoint int `json:"endpoint" yaml:"endpoint" protobuf:"bytes,6,opt,name=endpoint"` +} + +// +k8s:openapi-gen=true +type PartitionEndpointID struct { + // Partition defines the partition this resource belongs to + Partition string `json:"partition" yaml:"partition" protobuf:"bytes,1,opt,name=partition"` + + NodeID `json:",inline" yaml:",inline" protobuf:"bytes,2,opt,name=nodeID"` + // ModuleBay defines the moduleBay reference id + ModuleBay *int `json:"moduleBay,omitempty" yaml:"moduleBay,omitempty" protobuf:"bytes,3,opt,name=moduleBay"` + // Module defines the module reference id + Module *int `json:"module,omitempty" yaml:"module,omitempty" protobuf:"bytes,4,opt,name=module"` + // Port defines the id of the port + Port int `json:"port" yaml:"port" protobuf:"bytes,5,opt,name=port"` + // Adaptor defines the name of the adaptor + Adaptor *string `json:"adaptor,omitempty" yaml:"adaptor,omitempty" protobuf:"bytes,6,opt,name=adaptor"` + // Endpoint defines the name of the endpoint + Endpoint int `json:"endpoint" yaml:"endpoint" protobuf:"bytes,7,opt,name=endpoint"` + // Name is used to refer to internal names of the node + Name *string `json:"name,omitempty" yaml:"name,omitempty" protobuf:"bytes,8,opt,name=name"` +} + +// +k8s:openapi-gen=true +type ClusterID struct { + SiteID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=siteID"` + // Cluster defines the name of the cluster + Cluster string `json:"cluster" yaml:"cluster" protobuf:"bytes,2,opt,name=cluster"` +} + +// +k8s:openapi-gen=true +type PartitionClusterID struct { + // Partition defines the partition this resource belongs to + Partition string `json:"partition" yaml:"partition" protobuf:"bytes,1,opt,name=partition"` + // SiteID define the siteid of the node + SiteID `json:",inline" yaml:",inline" protobuf:"bytes,2,opt,name=siteID"` + // Cluster defines the name of the cluster + Cluster string `json:"cluster" yaml:"cluster" protobuf:"bytes,3,opt,name=cluster"` +} + +// +k8s:openapi-gen=true +type PartitionAttachmentID struct { + // Partition defines the partition this resource belongs to + Partition string `json:"partition" yaml:"partition" protobuf:"bytes,1,opt,name=partition"` + // SiteID define the siteid of the node + SiteID `json:",inline" yaml:",inline" protobuf:"bytes,2,opt,name=siteID"` + // Cluster defines the name of the cluster + Cluster *string `json:"cluster,omitempty" yaml:"cluster,omitempty" protobuf:"bytes,3,opt,name=cluster"` + // Node defines the name of the node + Node *string `json:"node,omitempty" yaml:"node,omitempty" protobuf:"bytes,4,opt,name=node"` + // Node defines the name of the nodeset + NodeSet *string `json:"nodeset,omitempty" yaml:"nodeset,omitempty" protobuf:"bytes,5,opt,name=nodeset"` + // Interface defines the name of the interface + Interface string `json:"interface" yaml:"interface" protobuf:"bytes,1,opt,name=interface"` +} + +/* +Endpoint.Connector +ModuleBay.Module.Endpoint.Connector + +// Satelite +Endpoint.ModuleAdaptor.ModuleEndpoint.Connector +ModuleBay.Module.Endpoint.ModuleAdaptor.ModuleEndpoint.Connector +*/ diff --git a/apis/condition/v1alpha1/doc.go b/apis/id/v1alpha1/doc.go similarity index 100% rename from apis/condition/v1alpha1/doc.go rename to apis/id/v1alpha1/doc.go diff --git a/apis/id/v1alpha1/id.go b/apis/id/v1alpha1/id.go new file mode 100644 index 0000000..4534320 --- /dev/null +++ b/apis/id/v1alpha1/id.go @@ -0,0 +1,133 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +type SiteID struct { + // Region defines the region of the resource + Region string `json:"region" yaml:"region" protobuf:"bytes,1,opt,name=region"` + // Site defines the site of the resource + Site string `json:"site" yaml:"site" protobuf:"bytes,2,opt,name=site"` +} + +type NodeID struct { + SiteID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=siteID"` + // Node defines the name of the node + Node string `json:"node" yaml:"node" protobuf:"bytes,2,opt,name=node"` +} + +type PartitionNodeID struct { + // Partition defines the partition this resource belongs to + Partition string `json:"partition" yaml:"partition" protobuf:"bytes,1,opt,name=partition"` + // SiteID define the siteid of the node + SiteID `json:",inline" yaml:",inline" protobuf:"bytes,2,opt,name=siteID"` + // Node defines the name of the node + Node string `json:"node" yaml:"node" protobuf:"bytes,3,opt,name=node"` +} + +type PortID struct { + NodeID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"` + // ModuleBay defines the moduleBay reference id + ModuleBay *int `json:"moduleBay,omitempty" yaml:"moduleBay,omitempty" protobuf:"bytes,2,opt,name=moduleBay"` + // Module defines the module reference id + Module *int `json:"module,omitempty" yaml:"module,omitempty" protobuf:"bytes,3,opt,name=module"` + // Port defines the id of the port + Port int `json:"port" yaml:"port" protobuf:"bytes,4,opt,name=port"` +} + +type AdaptorID struct { + NodeID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"` + // ModuleBay defines the moduleBay reference id + ModuleBay *int `json:"moduleBay,omitempty" yaml:"moduleBay,omitempty" protobuf:"bytes,2,opt,name=moduleBay"` + // Module defines the module reference id + Module *int `json:"module,omitempty" yaml:"module,omitempty" protobuf:"bytes,3,opt,name=module"` + // Port defines the id of the port + Port int `json:"port" yaml:"port" protobuf:"bytes,4,opt,name=port"` + // Adaptor defines the name of the adaptor + Adaptor string `json:"adaptor" yaml:"adaptor" protobuf:"bytes,5,opt,name=adaptor"` +} + +type EndpointID struct { + NodeID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"` + // ModuleBay defines the moduleBay reference id + ModuleBay *int `json:"moduleBay,omitempty" yaml:"moduleBay,omitempty" protobuf:"bytes,2,opt,name=moduleBay"` + // Module defines the module reference id + Module *int `json:"module,omitempty" yaml:"module,omitempty" protobuf:"bytes,3,opt,name=module"` + // Port defines the id of the port + Port int `json:"port" yaml:"port" protobuf:"bytes,4,opt,name=port"` + // Adaptor defines the name of the adaptor + Adaptor string `json:"adaptor" yaml:"adaptor" protobuf:"bytes,5,opt,name=adaptor"` + // Endpoint defines the name of the endpoint + Endpoint int `json:"endpoint" yaml:"endpoint" protobuf:"bytes,6,opt,name=endpoint"` +} + +type PartitionEndpointID struct { + // Partition defines the partition this resource belongs to + Partition string `json:"partition" yaml:"partition" protobuf:"bytes,1,opt,name=partition"` + + NodeID `json:",inline" yaml:",inline" protobuf:"bytes,2,opt,name=nodeID"` + // ModuleBay defines the moduleBay reference id + ModuleBay *int `json:"moduleBay,omitempty" yaml:"moduleBay,omitempty" protobuf:"bytes,3,opt,name=moduleBay"` + // Module defines the module reference id + Module *int `json:"module,omitempty" yaml:"module,omitempty" protobuf:"bytes,4,opt,name=module"` + // Port defines the id of the port + Port int `json:"port" yaml:"port" protobuf:"bytes,5,opt,name=port"` + // Adaptor defines the name of the adaptor + Adaptor *string `json:"adaptor,omitempty" yaml:"adaptor,omitempty" protobuf:"bytes,6,opt,name=adaptor"` + // Endpoint defines the name of the endpoint + Endpoint int `json:"endpoint" yaml:"endpoint" protobuf:"bytes,7,opt,name=endpoint"` + // Name is used to refer to internal names of the node + Name *string `json:"name,omitempty" yaml:"name,omitempty" protobuf:"bytes,8,opt,name=name"` +} + +type ClusterID struct { + SiteID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=siteID"` + // Cluster defines the name of the cluster + Cluster string `json:"cluster" yaml:"cluster" protobuf:"bytes,2,opt,name=cluster"` +} + +type PartitionClusterID struct { + // Partition defines the partition this resource belongs to + Partition string `json:"partition" yaml:"partition" protobuf:"bytes,1,opt,name=partition"` + // SiteID define the siteid of the node + SiteID `json:",inline" yaml:",inline" protobuf:"bytes,2,opt,name=siteID"` + // Cluster defines the name of the cluster + Cluster string `json:"cluster" yaml:"cluster" protobuf:"bytes,3,opt,name=cluster"` +} + +type PartitionAttachmentID struct { + // Partition defines the partition this resource belongs to + Partition string `json:"partition" yaml:"partition" protobuf:"bytes,1,opt,name=partition"` + // SiteID define the siteid of the node + SiteID `json:",inline" yaml:",inline" protobuf:"bytes,2,opt,name=siteID"` + // Cluster defines the name of the cluster + Cluster *string `json:"cluster,omitempty" yaml:"cluster,omitempty" protobuf:"bytes,3,opt,name=cluster"` + // Node defines the name of the node + Node *string `json:"node,omitempty" yaml:"node,omitempty" protobuf:"bytes,4,opt,name=node"` + // Node defines the name of the nodeset + NodeSet *string `json:"nodeset,omitempty" yaml:"nodeset,omitempty" protobuf:"bytes,5,opt,name=nodeset"` + // Interface defines the name of the interface + Interface string `json:"interface" yaml:"interface" protobuf:"bytes,1,opt,name=interface"` +} + +/* +Endpoint.Connector +ModuleBay.Module.Endpoint.Connector + +// Satelite +Endpoint.ModuleAdaptor.ModuleEndpoint.Connector +ModuleBay.Module.Endpoint.ModuleAdaptor.ModuleEndpoint.Connector +*/ diff --git a/apis/id/v1alpha1/zz_generated.deepcopy.go b/apis/id/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 0000000..42a5b4a --- /dev/null +++ b/apis/id/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,255 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AdaptorID) DeepCopyInto(out *AdaptorID) { + *out = *in + out.NodeID = in.NodeID + if in.ModuleBay != nil { + in, out := &in.ModuleBay, &out.ModuleBay + *out = new(int) + **out = **in + } + if in.Module != nil { + in, out := &in.Module, &out.Module + *out = new(int) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AdaptorID. +func (in *AdaptorID) DeepCopy() *AdaptorID { + if in == nil { + return nil + } + out := new(AdaptorID) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterID) DeepCopyInto(out *ClusterID) { + *out = *in + out.SiteID = in.SiteID + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterID. +func (in *ClusterID) DeepCopy() *ClusterID { + if in == nil { + return nil + } + out := new(ClusterID) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EndpointID) DeepCopyInto(out *EndpointID) { + *out = *in + out.NodeID = in.NodeID + if in.ModuleBay != nil { + in, out := &in.ModuleBay, &out.ModuleBay + *out = new(int) + **out = **in + } + if in.Module != nil { + in, out := &in.Module, &out.Module + *out = new(int) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointID. +func (in *EndpointID) DeepCopy() *EndpointID { + if in == nil { + return nil + } + out := new(EndpointID) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeID) DeepCopyInto(out *NodeID) { + *out = *in + out.SiteID = in.SiteID + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeID. +func (in *NodeID) DeepCopy() *NodeID { + if in == nil { + return nil + } + out := new(NodeID) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PartitionAttachmentID) DeepCopyInto(out *PartitionAttachmentID) { + *out = *in + out.SiteID = in.SiteID + if in.Cluster != nil { + in, out := &in.Cluster, &out.Cluster + *out = new(string) + **out = **in + } + if in.Node != nil { + in, out := &in.Node, &out.Node + *out = new(string) + **out = **in + } + if in.NodeSet != nil { + in, out := &in.NodeSet, &out.NodeSet + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PartitionAttachmentID. +func (in *PartitionAttachmentID) DeepCopy() *PartitionAttachmentID { + if in == nil { + return nil + } + out := new(PartitionAttachmentID) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PartitionClusterID) DeepCopyInto(out *PartitionClusterID) { + *out = *in + out.SiteID = in.SiteID + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PartitionClusterID. +func (in *PartitionClusterID) DeepCopy() *PartitionClusterID { + if in == nil { + return nil + } + out := new(PartitionClusterID) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PartitionEndpointID) DeepCopyInto(out *PartitionEndpointID) { + *out = *in + out.NodeID = in.NodeID + if in.ModuleBay != nil { + in, out := &in.ModuleBay, &out.ModuleBay + *out = new(int) + **out = **in + } + if in.Module != nil { + in, out := &in.Module, &out.Module + *out = new(int) + **out = **in + } + if in.Adaptor != nil { + in, out := &in.Adaptor, &out.Adaptor + *out = new(string) + **out = **in + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PartitionEndpointID. +func (in *PartitionEndpointID) DeepCopy() *PartitionEndpointID { + if in == nil { + return nil + } + out := new(PartitionEndpointID) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PartitionNodeID) DeepCopyInto(out *PartitionNodeID) { + *out = *in + out.SiteID = in.SiteID + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PartitionNodeID. +func (in *PartitionNodeID) DeepCopy() *PartitionNodeID { + if in == nil { + return nil + } + out := new(PartitionNodeID) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PortID) DeepCopyInto(out *PortID) { + *out = *in + out.NodeID = in.NodeID + if in.ModuleBay != nil { + in, out := &in.ModuleBay, &out.ModuleBay + *out = new(int) + **out = **in + } + if in.Module != nil { + in, out := &in.Module, &out.Module + *out = new(int) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortID. +func (in *PortID) DeepCopy() *PortID { + if in == nil { + return nil + } + out := new(PortID) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SiteID) DeepCopyInto(out *SiteID) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SiteID. +func (in *SiteID) DeepCopy() *SiteID { + if in == nil { + return nil + } + out := new(SiteID) + in.DeepCopyInto(out) + return out +} diff --git a/apis/id/zz_generated.deepcopy.go b/apis/id/zz_generated.deepcopy.go new file mode 100644 index 0000000..ad07374 --- /dev/null +++ b/apis/id/zz_generated.deepcopy.go @@ -0,0 +1,255 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2024 Nokia. + +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 id + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AdaptorID) DeepCopyInto(out *AdaptorID) { + *out = *in + out.NodeID = in.NodeID + if in.ModuleBay != nil { + in, out := &in.ModuleBay, &out.ModuleBay + *out = new(int) + **out = **in + } + if in.Module != nil { + in, out := &in.Module, &out.Module + *out = new(int) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AdaptorID. +func (in *AdaptorID) DeepCopy() *AdaptorID { + if in == nil { + return nil + } + out := new(AdaptorID) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterID) DeepCopyInto(out *ClusterID) { + *out = *in + out.SiteID = in.SiteID + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterID. +func (in *ClusterID) DeepCopy() *ClusterID { + if in == nil { + return nil + } + out := new(ClusterID) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EndpointID) DeepCopyInto(out *EndpointID) { + *out = *in + out.NodeID = in.NodeID + if in.ModuleBay != nil { + in, out := &in.ModuleBay, &out.ModuleBay + *out = new(int) + **out = **in + } + if in.Module != nil { + in, out := &in.Module, &out.Module + *out = new(int) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointID. +func (in *EndpointID) DeepCopy() *EndpointID { + if in == nil { + return nil + } + out := new(EndpointID) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeID) DeepCopyInto(out *NodeID) { + *out = *in + out.SiteID = in.SiteID + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeID. +func (in *NodeID) DeepCopy() *NodeID { + if in == nil { + return nil + } + out := new(NodeID) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PartitionAttachmentID) DeepCopyInto(out *PartitionAttachmentID) { + *out = *in + out.SiteID = in.SiteID + if in.Cluster != nil { + in, out := &in.Cluster, &out.Cluster + *out = new(string) + **out = **in + } + if in.Node != nil { + in, out := &in.Node, &out.Node + *out = new(string) + **out = **in + } + if in.NodeSet != nil { + in, out := &in.NodeSet, &out.NodeSet + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PartitionAttachmentID. +func (in *PartitionAttachmentID) DeepCopy() *PartitionAttachmentID { + if in == nil { + return nil + } + out := new(PartitionAttachmentID) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PartitionClusterID) DeepCopyInto(out *PartitionClusterID) { + *out = *in + out.SiteID = in.SiteID + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PartitionClusterID. +func (in *PartitionClusterID) DeepCopy() *PartitionClusterID { + if in == nil { + return nil + } + out := new(PartitionClusterID) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PartitionEndpointID) DeepCopyInto(out *PartitionEndpointID) { + *out = *in + out.NodeID = in.NodeID + if in.ModuleBay != nil { + in, out := &in.ModuleBay, &out.ModuleBay + *out = new(int) + **out = **in + } + if in.Module != nil { + in, out := &in.Module, &out.Module + *out = new(int) + **out = **in + } + if in.Adaptor != nil { + in, out := &in.Adaptor, &out.Adaptor + *out = new(string) + **out = **in + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PartitionEndpointID. +func (in *PartitionEndpointID) DeepCopy() *PartitionEndpointID { + if in == nil { + return nil + } + out := new(PartitionEndpointID) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PartitionNodeID) DeepCopyInto(out *PartitionNodeID) { + *out = *in + out.SiteID = in.SiteID + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PartitionNodeID. +func (in *PartitionNodeID) DeepCopy() *PartitionNodeID { + if in == nil { + return nil + } + out := new(PartitionNodeID) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PortID) DeepCopyInto(out *PortID) { + *out = *in + out.NodeID = in.NodeID + if in.ModuleBay != nil { + in, out := &in.ModuleBay, &out.ModuleBay + *out = new(int) + **out = **in + } + if in.Module != nil { + in, out := &in.Module, &out.Module + *out = new(int) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortID. +func (in *PortID) DeepCopy() *PortID { + if in == nil { + return nil + } + out := new(PortID) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SiteID) DeepCopyInto(out *SiteID) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SiteID. +func (in *SiteID) DeepCopy() *SiteID { + if in == nil { + return nil + } + out := new(SiteID) + in.DeepCopyInto(out) + return out +} diff --git a/artifacts/out/artifacts.yaml b/artifacts/out/artifacts.yaml index e367dfe..711f937 100644 --- a/artifacts/out/artifacts.yaml +++ b/artifacts/out/artifacts.yaml @@ -507,7 +507,7 @@ rules: apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: - name: kuid:system:auth-delegator + name: config:system:auth-delegator roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole diff --git a/examples/genid/index.yaml b/examples/genid/index.yaml index ebfa427..d0309e6 100644 --- a/examples/genid/index.yaml +++ b/examples/genid/index.yaml @@ -6,4 +6,5 @@ spec: minID: 0 maxID: 4095 labels: - inv.kuid.dev/node: node1 \ No newline at end of file + inv.kuid.dev/node: node1 + \ No newline at end of file diff --git a/examples/ipam/prefix-network-10.0.0.0-24.yaml b/examples/ipam/prefix-network-10.0.0.0-24.yaml index b9b8279..9dea6cd 100644 --- a/examples/ipam/prefix-network-10.0.0.0-24.yaml +++ b/examples/ipam/prefix-network-10.0.0.0-24.yaml @@ -2,6 +2,7 @@ apiVersion: ipam.be.kuid.dev/v1alpha1 kind: IPClaim metadata: name: vpc1.10.0.0.1-24 + namespace: default spec: index: vpc1 prefixType: network diff --git a/go.mod b/go.mod index d77c582..697940e 100644 --- a/go.mod +++ b/go.mod @@ -1,153 +1,146 @@ module github.com/kuidio/kuid -go 1.22.0 +go 1.23.0 -toolchain go1.22.2 +toolchain go1.23.2 -replace github.com/google/cel-go => github.com/google/cel-go v0.16.1 +replace k8s.io/api => k8s.io/api v0.31.1 -replace k8s.io/client-go => k8s.io/client-go v0.28.6 +replace k8s.io/apimachinery => k8s.io/apimachinery v0.31.1 -replace k8s.io/api => k8s.io/api v0.28.6 +replace k8s.io/client-go => k8s.io/client-go v0.31.1 -replace k8s.io/apimachinery => k8s.io/apimachinery v0.28.6 +replace k8s.io/gengo/v2 => k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 -replace k8s.io/component-base => k8s.io/component-base v0.28.6 +replace github.com/henderiw/apiserver-store => /Users/henderiw/code/tmp/apiserver-store -replace k8s.io/cli-runtime => k8s.io/cli-runtime v0.28.6 - -replace k8s.io/kube-openapi => k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 - -replace k8s.io/apiserver => k8s.io/apiserver v0.28.6 - -replace sigs.k8s.io/kustomize/kyaml => sigs.k8s.io/kustomize/kyaml v0.15.0 - -replace sigs.k8s.io/kustomize/api => sigs.k8s.io/kustomize/api v0.15.0 - -replace k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.28.6 +replace github.com/henderiw/apiserver-builder => /Users/henderiw/code/tmp/apiserver-builder require ( - github.com/dgraph-io/badger/v4 v4.2.0 - github.com/gogo/protobuf v1.3.2 + github.com/dgraph-io/badger/v4 v4.3.0 github.com/google/go-cmp v0.6.0 github.com/google/uuid v1.6.0 - github.com/hansthienpondt/nipam v0.0.5 - github.com/henderiw/apiserver-builder v0.0.2-0.20240414132730-35630f41575d - github.com/henderiw/apiserver-store v0.0.0-20240419050621-a69e6046534c - github.com/henderiw/idxtable v0.0.0-20240507134400-54d7d0b2a708 - github.com/henderiw/iputil v0.0.0-20231218081610-37f78ad9c81c + github.com/henderiw/apiserver-builder v0.0.4-0.20241020093259-47da0b178335 + github.com/henderiw/apiserver-store v0.0.3-0.20241020093130-09730291ea07 + github.com/henderiw/idxtable v0.0.0-20241020093436-6b78e5fa3b3c github.com/henderiw/logger v0.0.0-20230911123436-8655829b1abe - github.com/henderiw/store v0.0.0-20240513051819-0202d08d7b42 + github.com/henderiw/store v0.0.2-0.20241020093537-5a92d3e14a02 + github.com/kform-dev/choreo v0.0.11 github.com/pkg/errors v0.9.1 - github.com/spf13/cobra v1.8.0 - github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/otel v1.20.0 + github.com/spf13/cobra v1.8.1 + go.opentelemetry.io/otel v1.28.0 go.uber.org/zap v1.27.0 - go4.org/netipx v0.0.0-20231129151722-fdeea329fbba - golang.org/x/mod v0.17.0 - golang.org/x/sync v0.7.0 - k8s.io/api v0.29.3 - k8s.io/apimachinery v0.30.1 - k8s.io/apiserver v0.29.3 - k8s.io/client-go v0.29.3 - k8s.io/code-generator v0.29.3 - k8s.io/component-base v0.29.3 - k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 - k8s.io/utils v0.0.0-20230726121419-3b25d923346b - sigs.k8s.io/controller-runtime v0.17.2 + golang.org/x/mod v0.21.0 + golang.org/x/sync v0.8.0 + k8s.io/api v0.32.0-alpha.1 + k8s.io/apimachinery v0.32.0-alpha.1 + k8s.io/apiserver v0.31.1 + k8s.io/client-go v0.32.0-alpha.1 + k8s.io/code-generator v0.31.1 + k8s.io/component-base v0.31.1 + k8s.io/kube-openapi v0.0.0-20240827152857-f7e401e7b4c2 + k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 + sigs.k8s.io/controller-runtime v0.19.0 + sigs.k8s.io/structured-merge-diff/v4 v4.4.1 sigs.k8s.io/yaml v1.4.0 ) require ( github.com/NYTimes/gziphandler v1.1.1 // indirect - github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df // indirect + github.com/ProtonMail/go-crypto v1.0.0 // indirect + github.com/antlr4-go/antlr/v4 v4.13.0 // indirect github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/blang/semver/v4 v4.0.0 // indirect - github.com/cenkalti/backoff/v4 v4.2.1 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/cenkalti/backoff/v4 v4.3.0 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/cloudflare/circl v1.3.7 // indirect github.com/coreos/go-semver v0.3.1 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect + github.com/cyphar/filepath-securejoin v0.2.4 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/dgraph-io/ristretto v0.1.1 // indirect + github.com/dgraph-io/ristretto v0.1.2-0.20240116140435-c67e07994f91 // indirect github.com/dustin/go-humanize v1.0.1 // indirect - github.com/emicklei/go-restful/v3 v3.11.0 // indirect - github.com/evanphx/json-patch v5.6.0+incompatible // indirect - github.com/evanphx/json-patch/v5 v5.8.0 // indirect + github.com/emicklei/go-restful/v3 v3.11.2 // indirect + github.com/emirpasic/gods v1.18.1 // indirect + github.com/evanphx/json-patch/v5 v5.9.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect - github.com/go-logr/logr v1.4.1 // indirect + github.com/fxamacker/cbor/v2 v2.7.0 // indirect + github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect + github.com/go-git/go-billy/v5 v5.5.0 // indirect + github.com/go-git/go-git/v5 v5.12.0 // indirect + github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-logr/zapr v1.3.0 // indirect - github.com/go-openapi/jsonpointer v0.19.6 // indirect - github.com/go-openapi/jsonreference v0.20.2 // indirect - github.com/go-openapi/swag v0.22.4 // indirect - github.com/golang/glog v1.1.2 // indirect + github.com/go-openapi/jsonpointer v0.21.0 // indirect + github.com/go-openapi/jsonreference v0.20.4 // indirect + github.com/go-openapi/swag v0.23.0 // indirect + github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.4 // indirect - github.com/golang/snappy v0.0.3 // indirect - github.com/google/cel-go v0.18.2 // indirect + github.com/google/cel-go v0.21.0 // indirect github.com/google/flatbuffers v1.12.1 // indirect github.com/google/gnostic-models v0.6.8 // indirect github.com/google/gofuzz v1.2.0 // indirect github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect - github.com/imdario/mergo v0.3.16 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect + github.com/imdario/mergo v0.3.6 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/kentik/patricia v1.2.0 // indirect - github.com/klauspost/compress v1.12.3 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/mailru/easyjson v0.7.7 // indirect - github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.18.0 // indirect - github.com/prometheus/client_model v0.5.0 // indirect - github.com/prometheus/common v0.45.0 // indirect - github.com/prometheus/procfs v0.12.0 // indirect + github.com/pjbgf/sha1cd v0.3.0 // indirect + github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_model v0.6.1 // indirect + github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/procfs v0.15.1 // indirect + github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/stoewer/go-strcase v1.2.0 // indirect - go.etcd.io/etcd/api/v3 v3.5.10 // indirect - go.etcd.io/etcd/client/pkg/v3 v3.5.10 // indirect - go.etcd.io/etcd/client/v3 v3.5.10 // indirect - go.opencensus.io v0.22.5 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0 // indirect - go.opentelemetry.io/otel/metric v1.20.0 // indirect - go.opentelemetry.io/otel/sdk v1.20.0 // indirect - go.opentelemetry.io/otel/trace v1.20.0 // indirect - go.opentelemetry.io/proto/otlp v1.0.0 // indirect + github.com/stoewer/go-strcase v1.3.0 // indirect + github.com/x448/float16 v0.8.4 // indirect + go.etcd.io/etcd/api/v3 v3.5.16 // indirect + go.etcd.io/etcd/client/pkg/v3 v3.5.16 // indirect + go.etcd.io/etcd/client/v3 v3.5.16 // indirect + go.opencensus.io v0.24.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0 // indirect + go.opentelemetry.io/otel/metric v1.28.0 // indirect + go.opentelemetry.io/otel/sdk v1.28.0 // indirect + go.opentelemetry.io/otel/trace v1.28.0 // indirect + go.opentelemetry.io/proto/otlp v1.3.1 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/crypto v0.21.0 // indirect - golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect - golang.org/x/net v0.23.0 // indirect - golang.org/x/oauth2 v0.17.0 // indirect - golang.org/x/sys v0.18.0 // indirect - golang.org/x/term v0.18.0 // indirect - golang.org/x/text v0.14.0 // indirect - golang.org/x/time v0.5.0 // indirect - golang.org/x/tools v0.18.0 // indirect + golang.org/x/crypto v0.28.0 // indirect + golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect + golang.org/x/net v0.30.0 // indirect + golang.org/x/oauth2 v0.23.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/term v0.25.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/time v0.7.0 // indirect + golang.org/x/tools v0.26.0 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect - google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect - google.golang.org/grpc v1.61.1 // indirect - google.golang.org/protobuf v1.33.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/grpc v1.67.1 // indirect + google.golang.org/protobuf v1.34.2 // indirect + gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect + gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/apiextensions-apiserver v0.29.0 // indirect - k8s.io/gengo v0.0.0-20230829151522-9cce18d56c01 // indirect - k8s.io/klog/v2 v2.120.1 // indirect - k8s.io/kms v0.29.3 // indirect - sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.28.0 // indirect - sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect - sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect + k8s.io/apiextensions-apiserver v0.31.1 // indirect + k8s.io/gengo/v2 v2.0.0-20240911193312-2b36238f13e9 // indirect + k8s.io/klog/v2 v2.130.1 // indirect + k8s.io/kms v0.32.0-alpha.2 // indirect + sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3 // indirect + sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect ) diff --git a/go.sum b/go.sum index 81b5153..e71a528 100644 --- a/go.sum +++ b/go.sum @@ -1,160 +1,175 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.110.10 h1:LXy9GEO+timppncPIAZoOj3l58LIU9k+kn48AN7IO3Y= -cloud.google.com/go/compute v1.23.3 h1:6sVlXXBmbd7jNX0Ipq0trII3e4n1/MsADLK6a+aiVlk= -cloud.google.com/go/compute v1.23.3/go.mod h1:VCgBUoMnIVIR0CscqQiPJLAG25E3ZRZMzcFZeQ+h8CI= -cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= -cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= +dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= +dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= +github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I= github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c= -github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df h1:7RFfzj4SSt6nnvCPbCqijJi1nWCd+TqAT3bYCStRC18= -github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df/go.mod h1:pSwJ0fSY5KhvocuWSx4fz3BA8OrA1bQn+K1Eli3BRwM= +github.com/ProtonMail/go-crypto v1.0.0 h1:LRuvITjQWX+WIfr930YHG2HNfjR1uOfyf5vE0kC2U78= +github.com/ProtonMail/go-crypto v1.0.0/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= +github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8TVTI= +github.com/antlr4-go/antlr/v4 v4.13.0/go.mod h1:pfChB/xh/Unjila75QW7+VU4TSnWnnk9UTnmpPaOR2g= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= -github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= -github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= +github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= +github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/xds/go v0.0.0-20231109132714-523115ebc101 h1:7To3pQ+pZo0i3dsWEbinPNFs5gPSBOsJtx3wTT94VBY= -github.com/cncf/xds/go v0.0.0-20231109132714-523115ebc101/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= +github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= +github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4= github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec= github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= +github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgraph-io/badger/v4 v4.2.0 h1:kJrlajbXXL9DFTNuhhu9yCx7JJa4qpYWxtE8BzuWsEs= -github.com/dgraph-io/badger/v4 v4.2.0/go.mod h1:qfCqhPoWDFJRx1gp5QwwyGo8xk1lbHUxvK9nK0OGAak= -github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8= -github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA= -github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= -github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dgraph-io/badger/v4 v4.3.0 h1:lcsCE1/1qrRhqP+zYx6xDZb8n7U+QlwNicpc676Ub40= +github.com/dgraph-io/badger/v4 v4.3.0/go.mod h1:Sc0T595g8zqAQRDf44n+z3wG4BOqLwceaFntt8KPxUM= +github.com/dgraph-io/ristretto v0.1.2-0.20240116140435-c67e07994f91 h1:Pux6+xANi0I7RRo5E1gflI4EZ2yx3BGZ75JkAIvGEOA= +github.com/dgraph-io/ristretto v0.1.2-0.20240116140435-c67e07994f91/go.mod h1:swkazRqnUf1N62d0Nutz7KIj2UKqsm/H8tD0nBJAXqM= +github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= +github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= -github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= -github.com/envoyproxy/protoc-gen-validate v1.0.2 h1:QkIBuU5k+x7/QXPvPPnWXWlCdaBFApVqftFV6k087DA= -github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE= -github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U= -github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -github.com/evanphx/json-patch/v5 v5.8.0 h1:lRj6N9Nci7MvzrXuX6HFzU8XjmhPiXPlsKEy1u0KQro= -github.com/evanphx/json-patch/v5 v5.8.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= +github.com/emicklei/go-restful/v3 v3.11.2 h1:1onLa9DcsMYO9P+CXaL0dStDqQ2EHHXLiz+BtnqkLAU= +github.com/emicklei/go-restful/v3 v3.11.2/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= +github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/evanphx/json-patch v0.5.2 h1:xVCHIVMUu1wtM/VkR9jVZ45N3FhZfYMMYGorLCR8P3k= +github.com/evanphx/json-patch v0.5.2/go.mod h1:ZWS5hhDbVDyob71nXKNL0+PWn6ToqBHMikGIFbs31qQ= +github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg= +github.com/evanphx/json-patch/v5 v5.9.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= -github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= +github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= +github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= +github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= +github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= +github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU= +github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow= +github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMje31YglSBqCdIqdhKBW8lokaMrL3uTkpGYlE2OOT4= +github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII= +github.com/go-git/go-git/v5 v5.12.0 h1:7Md+ndsjrzZxbddRDZjF14qK+NN56sy6wkqaVrjZtys= +github.com/go-git/go-git/v5 v5.12.0/go.mod h1:FTM9VKtnI2m65hNI/TenDDDnUf2Q9FHnXYjuz9i5OEY= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= -github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ= github.com/go-logr/zapr v1.3.0/go.mod h1:YKepepNBd1u/oyhd/yQmtjVXmm9uML4IXUgMOwR8/Gg= -github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= -github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= -github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= -github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= -github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= -github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU= -github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= -github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= -github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= +github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= +github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= +github.com/go-openapi/jsonreference v0.20.4 h1:bKlDxQxQJgwpUSgOENiMPzCTBVuc7vTdXSSgNeAhojU= +github.com/go-openapi/jsonreference v0.20.4/go.mod h1:5pZJyJP2MnYCpoeoMAql78cCHauHj0V9Lhc506VOpw4= +github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= +github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= +github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= +github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= -github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA= -github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4= github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= -github.com/google/cel-go v0.16.1 h1:3hZfSNiAU3KOiNtxuFXVp5WFy4hf/Ly3Sa4/7F8SXNo= -github.com/google/cel-go v0.16.1/go.mod h1:HXZKzB0LXqer5lHHgfWAnlYwJaQBDKMjxjulNQzhwhY= +github.com/google/cel-go v0.21.0 h1:cl6uW/gxN+Hy50tNYvI691+sXxioCnstFzLp2WO4GCI= +github.com/google/cel-go v0.21.0/go.mod h1:rHUlWCcBKgyEk+eV03RPdZUekPp6YcJwV0FxuUksYxc= github.com/google/flatbuffers v1.12.1 h1:MVlul7pQNoDzWRLTw5imwYsl+usrS1TXG2H4jg6ImGw= github.com/google/flatbuffers v1.12.1/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= -github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 h1:FKHo8hFI3A+7w0aUQuYXQ+6EN5stWmeY/AZqtM8xk9k= +github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= -github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= +github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= -github.com/hansthienpondt/nipam v0.0.5 h1:83Mdwdgx3l9tvio8u8ufan97MWx49n38IJwgSBgATEc= -github.com/hansthienpondt/nipam v0.0.5/go.mod h1:dJI5FdzV6iaQyaOH4htGqJNs6wGieJeX3lhPj1Ah19U= -github.com/henderiw/apiserver-builder v0.0.2-0.20240414132730-35630f41575d h1:aigHSo3p9WC7yjp4ElcAPMXvYjEfE5Yin2tDthKS7Yk= -github.com/henderiw/apiserver-builder v0.0.2-0.20240414132730-35630f41575d/go.mod h1:2lcqB0FhlVaEe96mFo+9mBFLc4inya4y03UTGgaYwzE= -github.com/henderiw/apiserver-store v0.0.0-20240419050621-a69e6046534c h1:LKlu1qvJc1KxC1jEHgGLdHc2dwAB8mEmatic5sH1muE= -github.com/henderiw/apiserver-store v0.0.0-20240419050621-a69e6046534c/go.mod h1:ymfcsQIkGBgOG+YZkWHZQYn6JH0QfUmRwzGTGScP540= -github.com/henderiw/idxtable v0.0.0-20240507134400-54d7d0b2a708 h1:huTicXgI3yQFDgJ3VujXFt7FTWvpswNqhdAopSr9jQI= -github.com/henderiw/idxtable v0.0.0-20240507134400-54d7d0b2a708/go.mod h1:ootD0vnWeRXt3vN+kREv15mGBC/2plye9OHOxIFKpBs= -github.com/henderiw/iputil v0.0.0-20231218081610-37f78ad9c81c h1:nFnCNyRV1Ej/zqV/gn8UnFESkoPUXhwpUCZyhSYGSYA= -github.com/henderiw/iputil v0.0.0-20231218081610-37f78ad9c81c/go.mod h1:PrPJdVAwtl5tL323wykHZ5L/b7tfJJsjhegza/wq4fQ= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k= +github.com/henderiw/idxtable v0.0.0-20241020093436-6b78e5fa3b3c h1:KAQe0QLJJaGzQ+9Xil0+xgsISqqWXbUE4DUXGRdsB2I= +github.com/henderiw/idxtable v0.0.0-20241020093436-6b78e5fa3b3c/go.mod h1:EPdUFZyKA2IORzohdu67+xBbfDmkHEDUaMN0BBsk8eY= github.com/henderiw/logger v0.0.0-20230911123436-8655829b1abe h1:+R53KH7fW+pmqlfSYVTCGPn8pj6gqBGcQ0nq7L1h8+g= github.com/henderiw/logger v0.0.0-20230911123436-8655829b1abe/go.mod h1:KNMXpSG8v0BAfIh5rZL4hgow3pBWNbkmmb28x9C5s+Y= -github.com/henderiw/store v0.0.0-20240513051819-0202d08d7b42 h1:uo9dUhlOW/d9zONbqstB5Qllv1N9TBcPg+YXZDktG3U= -github.com/henderiw/store v0.0.0-20240513051819-0202d08d7b42/go.mod h1:c5bSCdQjql9EgFH643u1LNaUgrh8RD/5FE7yLe73d98= -github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= -github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= +github.com/henderiw/store v0.0.2-0.20241020093537-5a92d3e14a02 h1:AyDjgCG9+s+ci3HNU++YZ3o3p4nxngWWhAmwU64YPs8= +github.com/henderiw/store v0.0.2-0.20241020093537-5a92d3e14a02/go.mod h1:BS0axsmGORgxlBKcdl9T+oxhWEyTwSpb4ZyIqulQ2Bc= +github.com/imdario/mergo v0.3.6 h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28= +github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= +github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jonboulle/clockwork v0.2.2 h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9qUBdQ= github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/kentik/patricia v1.2.0 h1:WZcp8V8GQhsya0bMZuXktEH/Wz+aBlhiMle4tExkj6M= -github.com/kentik/patricia v1.2.0/go.mod h1:6jY40ESetsbfi04/S12iJlsiS6DYL2B2W+WAcqoDHtw= +github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= +github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= +github.com/kform-dev/choreo v0.0.11 h1:ISBWPKJpNO9m88FYzNu7Jj56mYWa8ko+m8nwiPJehvs= +github.com/kform-dev/choreo v0.0.11/go.mod h1:2eXUXWxyWGbLpZ965uFVzLF6755dsdYyIBcOMwXXMOw= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.12.3 h1:G5AfA94pHPysR56qqrkO2pxEexdDzrpFJ6yt/VqWxVU= -github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= -github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -163,8 +178,6 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg= -github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -172,42 +185,48 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/onsi/ginkgo/v2 v2.14.0 h1:vSmGj2Z5YPb9JwCWT6z6ihcUvDhuXLc3sJiqd3jMKAY= -github.com/onsi/ginkgo/v2 v2.14.0/go.mod h1:JkUdW7JkN0V6rFvsHcJ478egV3XH9NxpD27Hal/PhZw= -github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8= -github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= +github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA= +github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To= +github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk= +github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0= +github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= +github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk= -github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA= -github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= -github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= -github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lneoxM= -github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY= -github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= -github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= +github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= +github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= +github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= +github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= +github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= +github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/skeema/knownhosts v1.2.2 h1:Iug2P4fLmDw9f41PB6thxUkNUkJzB5i+1/exaj40L3A= +github.com/skeema/knownhosts v1.2.2/go.mod h1:xYbVRSPxqBZFrdmDyMmsOs+uX1UZC3nTN3ThzgDxUwo= github.com/soheilhy/cmux v0.1.5 h1:jjzc5WVemNEDTLwv9tlmemhC73tI08BNOIGwBOo10Js= github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0= -github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= -github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= +github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/stoewer/go-strcase v1.2.0 h1:Z2iHWqGXH00XYgqDmNgQbIBxf3wrNq0F3feEy0ainaU= -github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= +github.com/stoewer/go-strcase v1.3.0 h1:g0eASXYtp+yvN9fK8sH94oCIk0fau9uV1/ZdJ0AVEzs= +github.com/stoewer/go-strcase v1.3.0/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= @@ -217,72 +236,77 @@ github.com/tj/assert v0.0.3 h1:Df/BlaZ20mq6kuai7f5z2TvPFiwC3xaWJSDQNiIS3Rk= github.com/tj/assert v0.0.3/go.mod h1:Ne6X72Q+TB1AteidzQncjw9PabbMp4PBMZ1k+vd1Pvk= github.com/tmc/grpc-websocket-proxy v0.0.0-20220101234140-673ab2c3ae75 h1:6fotK7otjonDflCTK0BCfls4SPy3NcCVb5dqqmbRknE= github.com/tmc/grpc-websocket-proxy v0.0.0-20220101234140-673ab2c3ae75/go.mod h1:KO6IkyS8Y3j8OdNO85qEYBsRPuteD+YciPomcXdrMnk= +github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= +github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= +github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= +github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= -go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= -go.etcd.io/etcd/api/v3 v3.5.10 h1:szRajuUUbLyppkhs9K6BRtjY37l66XQQmw7oZRANE4k= -go.etcd.io/etcd/api/v3 v3.5.10/go.mod h1:TidfmT4Uycad3NM/o25fG3J07odo4GBB9hoxaodFCtI= -go.etcd.io/etcd/client/pkg/v3 v3.5.10 h1:kfYIdQftBnbAq8pUWFXfpuuxFSKzlmM5cSn76JByiT0= -go.etcd.io/etcd/client/pkg/v3 v3.5.10/go.mod h1:DYivfIviIuQ8+/lCq4vcxuseg2P2XbHygkKwFo9fc8U= -go.etcd.io/etcd/client/v2 v2.305.9 h1:YZ2OLi0OvR0H75AcgSUajjd5uqKDKocQUqROTG11jIo= -go.etcd.io/etcd/client/v2 v2.305.9/go.mod h1:0NBdNx9wbxtEQLwAQtrDHwx58m02vXpDcgSYI2seohQ= -go.etcd.io/etcd/client/v3 v3.5.10 h1:W9TXNZ+oB3MCd/8UjxHTWK5J9Nquw9fQBLJd5ne5/Ao= -go.etcd.io/etcd/client/v3 v3.5.10/go.mod h1:RVeBnDz2PUEZqTpgqwAtUd8nAPf5kjyFyND7P1VkOKc= -go.etcd.io/etcd/pkg/v3 v3.5.9 h1:6R2jg/aWd/zB9+9JxmijDKStGJAPFsX3e6BeJkMi6eQ= -go.etcd.io/etcd/pkg/v3 v3.5.9/go.mod h1:BZl0SAShQFk0IpLWR78T/+pyt8AruMHhTNNX73hkNVY= -go.etcd.io/etcd/raft/v3 v3.5.9 h1:ZZ1GIHoUlHsn0QVqiRysAm3/81Xx7+i2d7nSdWxlOiI= -go.etcd.io/etcd/raft/v3 v3.5.9/go.mod h1:WnFkqzFdZua4LVlVXQEGhmooLeyS7mqzS4Pf4BCVqXg= -go.etcd.io/etcd/server/v3 v3.5.9 h1:vomEmmxeztLtS5OEH7d0hBAg4cjVIu9wXuNzUZx2ZA0= -go.etcd.io/etcd/server/v3 v3.5.9/go.mod h1:GgI1fQClQCFIzuVjlvdbMxNbnISt90gdfYyqiAIt65g= -go.opencensus.io v0.22.5 h1:dntmOdLpSpHlVqbW5Eay97DelsZHe+55D+xC6i0dDS0= -go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 h1:PzIubN4/sjByhDRHLviCjJuweBXWFZWhghjg7cS28+M= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0/go.mod h1:Ct6zzQEuGK3WpJs2n4dn+wfJYzd/+hNnxMRTWjGn30M= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.0 h1:1eHu3/pUSWaOgltNK3WJFaywKsTIr/PwvHyDmi0lQA0= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.0/go.mod h1:HyABWq60Uy1kjJSa2BVOxUVao8Cdick5AWSKPutqy6U= -go.opentelemetry.io/otel v1.20.0 h1:vsb/ggIY+hUjD/zCAQHpzTmndPqv/ml2ArbsbfBYTAc= -go.opentelemetry.io/otel v1.20.0/go.mod h1:oUIGj3D77RwJdM6PPZImDpSZGDvkD9fhesHny69JFrs= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 h1:Mne5On7VWdx7omSrSSZvM4Kw7cS7NQkOOmLcgscI51U= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0/go.mod h1:IPtUMKL4O3tH5y+iXVyAXqpAwMuzC1IrxVS81rummfE= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0 h1:3d+S281UTjM+AbF31XSOYn1qXn3BgIdWl8HNEpx08Jk= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0/go.mod h1:0+KuTDyKL4gjKCF75pHOX4wuzYDUZYfAQdSu43o+Z2I= -go.opentelemetry.io/otel/metric v1.20.0 h1:ZlrO8Hu9+GAhnepmRGhSU7/VkpjrNowxRN9GyKR4wzA= -go.opentelemetry.io/otel/metric v1.20.0/go.mod h1:90DRw3nfK4D7Sm/75yQ00gTJxtkBxX+wu6YaNymbpVM= -go.opentelemetry.io/otel/sdk v1.20.0 h1:5Jf6imeFZlZtKv9Qbo6qt2ZkmWtdWx/wzcCbNUlAWGM= -go.opentelemetry.io/otel/sdk v1.20.0/go.mod h1:rmkSx1cZCm/tn16iWDn1GQbLtsW/LvsdEEFzCSRM6V0= -go.opentelemetry.io/otel/trace v1.20.0 h1:+yxVAPZPbQhbC3OfAkeIVTky6iTFpcr4SiY9om7mXSQ= -go.opentelemetry.io/otel/trace v1.20.0/go.mod h1:HJSK7F/hA5RlzpZ0zKDCHCDHm556LCDtKaAo6JmBFUU= -go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= -go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= +go.etcd.io/bbolt v1.3.10 h1:+BqfJTcCzTItrop8mq/lbzL8wSGtj94UO/3U31shqG0= +go.etcd.io/bbolt v1.3.10/go.mod h1:bK3UQLPJZly7IlNmV7uVHJDxfe5aK9Ll93e/74Y9oEQ= +go.etcd.io/etcd/api/v3 v3.5.16 h1:WvmyJVbjWqK4R1E+B12RRHz3bRGy9XVfh++MgbN+6n0= +go.etcd.io/etcd/api/v3 v3.5.16/go.mod h1:1P4SlIP/VwkDmGo3OlOD7faPeP8KDIFhqvciH5EfN28= +go.etcd.io/etcd/client/pkg/v3 v3.5.16 h1:ZgY48uH6UvB+/7R9Yf4x574uCO3jIx0TRDyetSfId3Q= +go.etcd.io/etcd/client/pkg/v3 v3.5.16/go.mod h1:V8acl8pcEK0Y2g19YlOV9m9ssUe6MgiDSobSoaBAM0E= +go.etcd.io/etcd/client/v2 v2.305.13 h1:RWfV1SX5jTU0lbCvpVQe3iPQeAHETWdOTb6pxhd77C8= +go.etcd.io/etcd/client/v2 v2.305.13/go.mod h1:iQnL7fepbiomdXMb3om1rHq96htNNGv2sJkEcZGDRRg= +go.etcd.io/etcd/client/v3 v3.5.16 h1:sSmVYOAHeC9doqi0gv7v86oY/BTld0SEFGaxsU9eRhE= +go.etcd.io/etcd/client/v3 v3.5.16/go.mod h1:X+rExSGkyqxvu276cr2OwPLBaeqFu1cIl4vmRjAD/50= +go.etcd.io/etcd/pkg/v3 v3.5.13 h1:st9bDWNsKkBNpP4PR1MvM/9NqUPfvYZx/YXegsYEH8M= +go.etcd.io/etcd/pkg/v3 v3.5.13/go.mod h1:N+4PLrp7agI/Viy+dUYpX7iRtSPvKq+w8Y14d1vX+m0= +go.etcd.io/etcd/raft/v3 v3.5.13 h1:7r/NKAOups1YnKcfro2RvGGo2PTuizF/xh26Z2CTAzA= +go.etcd.io/etcd/raft/v3 v3.5.13/go.mod h1:uUFibGLn2Ksm2URMxN1fICGhk8Wu96EfDQyuLhAcAmw= +go.etcd.io/etcd/server/v3 v3.5.13 h1:V6KG+yMfMSqWt+lGnhFpP5z5dRUj1BDRJ5k1fQ9DFok= +go.etcd.io/etcd/server/v3 v3.5.13/go.mod h1:K/8nbsGupHqmr5MkgaZpLlH1QdX1pcNQLAkODy44XcQ= +go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= +go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 h1:9G6E0TXzGFVfTnawRzrPl83iHOAV7L8NJiR8RSGYV1g= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0/go.mod h1:azvtTADFQJA8mX80jIH/akaE7h+dbm/sVuaHqN13w74= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 h1:4K4tsIXefpVJtvA/8srF4V4y0akAoPHkIslgAkjixJA= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0/go.mod h1:jjdQuTGVsXV4vSs+CJ2qYDeDPf9yIJV23qlIzBm73Vg= +go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= +go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 h1:3Q/xZUyC1BBkualc9ROb4G8qkH90LXEIICcs5zv1OYY= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0/go.mod h1:s75jGIWA9OfCMzF0xr+ZgfrB5FEbbV7UuYo32ahUiFI= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0 h1:qFffATk0X+HD+f1Z8lswGiOQYKHRlzfmdJm0wEaVrFA= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0/go.mod h1:MOiCmryaYtc+V0Ei+Tx9o5S1ZjA7kzLucuVuyzBZloQ= +go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= +go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= +go.opentelemetry.io/otel/sdk v1.28.0 h1:b9d7hIry8yZsgtbmM0DKyPWMMUMlK9NEKuIG4aBqWyE= +go.opentelemetry.io/otel/sdk v1.28.0/go.mod h1:oYj7ClPUA7Iw3m+r7GeEjz0qckQRJK2B8zjcZEfu7Pg= +go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= +go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= +go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= +go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= -go4.org/netipx v0.0.0-20231129151722-fdeea329fbba h1:0b9z3AuHCjxk0x/opv64kcgZLBseWJUpBw5I82+2U4M= -go4.org/netipx v0.0.0-20231129151722-fdeea329fbba/go.mod h1:PLyyIXexvUFg3Owu6p/WfdlivPbZJsZdgWZlrGope/Y= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= -golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= +golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= +golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= +golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= +golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= +golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8= +golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= +golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -291,57 +315,69 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= -golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.17.0 h1:6m3ZPmLEFdVxKKWnKq4VqZ60gutO35zm+zrAHVmHyDQ= -golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5HA= +golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= +golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= -golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= -golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= +golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= +golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= +golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= -golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ= +golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200505023115-26f46d2f7ef8/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ= -golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -350,32 +386,45 @@ gomodules.xyz/jsonpatch/v2 v2.4.0 h1:Ci3iUJyx9UeRx7CeFN8ARgGbkESwJK+KB9lLcWxY/Zw gomodules.xyz/jsonpatch/v2 v2.4.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= -google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f h1:Vn+VyHU5guc9KjB5KrjI2q0wCOWEOIh0OEsleqakHJg= -google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f/go.mod h1:nWSwAFPb+qfNJXsoeO3Io7zf4tMSfN8EA8RlDA04GhY= -google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 h1:JpwMPBpFN3uKhdaekDpiNlImDdkUAyiJ6ez/uxGaUSo= -google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:0xJLfVdJqpAPl8tDg1ujOCGzx6LFLttXT5NhllGOXY4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 h1:DC7wcm+i+P1rN3Ff07vL+OndGg5OhNddHyTA+ocPqYE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4/go.mod h1:eJVxU6o+4G1PSczBr85xmyvSNYAKvAYgkub40YGomFM= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d h1:VBu5YqKPv6XiJ199exd8Br+Aetz+o08F+PLMnwJQHAY= +google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4= +google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 h1:wKguEg1hsxI2/L3hUYrpo1RVi48K+uTyzKqprwLXsb8= +google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142/go.mod h1:d6be+8HhtEtucleCbxpPW9PA9XwISACu8nvpPqF0BVo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.61.1 h1:kLAiWrZs7YeDM6MumDe7m3y4aM6wacLzM1Y/wiLP9XY= -google.golang.org/grpc v1.61.1/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= +google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSPG+6V4= +gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= +gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= +gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= @@ -384,39 +433,38 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -k8s.io/api v0.28.6 h1:yy6u9CuIhmg55YvF/BavPBBXB+5QicB64njJXxVnzLo= -k8s.io/api v0.28.6/go.mod h1:AM6Ys6g9MY3dl/XNaNfg/GePI0FT7WBGu8efU/lirAo= -k8s.io/apiextensions-apiserver v0.28.6 h1:myB3iG/3v3jqCg28JDbOefu4sH2/erNEXgytRzJKBOo= -k8s.io/apiextensions-apiserver v0.28.6/go.mod h1:qlp6xRKBgyRhe5AYc81TQpLx4kLNK8/sGQUOwMkVjRk= -k8s.io/apimachinery v0.28.6 h1:RsTeR4z6S07srPg6XYrwXpTJVMXsjPXn0ODakMytSW0= -k8s.io/apimachinery v0.28.6/go.mod h1:QFNX/kCl/EMT2WTSz8k4WLCv2XnkOLMaL8GAVRMdpsA= -k8s.io/apiserver v0.28.6 h1:SfS5v4I5UGvh0q/1rzvNwLFsK+r7YzcsixnUc0NwoEk= -k8s.io/apiserver v0.28.6/go.mod h1:8n0aerS3kPm9usyB8B+an6/BZ5+Fa9fNqlASFdDDVwk= -k8s.io/client-go v0.28.6 h1:Gge6ziyIdafRchfoBKcpaARuz7jfrK1R1azuwORIsQI= -k8s.io/client-go v0.28.6/go.mod h1:+nu0Yp21Oeo/cBCsprNVXB2BfJTV51lFfe5tXl2rUL8= -k8s.io/code-generator v0.29.3 h1:m7E25/t9R9NvejspO2zBdyu+/Gl0Z5m7dCRc680KS14= -k8s.io/code-generator v0.29.3/go.mod h1:x47ofBhN4gxYFcxeKA1PYXeaPreAGaDN85Y/lNUsPoM= -k8s.io/component-base v0.28.6 h1:G4T8VrcQ7xZou3by/fY5NU5mfxOBlWaivS2lPrEltAo= -k8s.io/component-base v0.28.6/go.mod h1:Dg62OOG3ALu2P4nAG00UdsuHoNLQJ5VsUZKQlLDcS+E= -k8s.io/gengo v0.0.0-20230829151522-9cce18d56c01 h1:pWEwq4Asjm4vjW7vcsmijwBhOr1/shsbSYiWXmNGlks= -k8s.io/gengo v0.0.0-20230829151522-9cce18d56c01/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= -k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= -k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw= -k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= -k8s.io/kms v0.29.3 h1:ReljsAUhYlm2spdT4yXmY+9a8x8dc/OT4mXvwQPPteQ= -k8s.io/kms v0.29.3/go.mod h1:TBGbJKpRUMk59neTMDMddjIDL+D4HuFUbpuiuzmOPg0= -k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 h1:LyMgNKD2P8Wn1iAwQU5OhxCKlKJy0sHc+PcDwFB24dQ= -k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9/go.mod h1:wZK2AVp1uHCp4VamDVgBP2COHZjqD1T68Rf0CM3YjSM= -k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI= -k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.28.0 h1:TgtAeesdhpm2SGwkQasmbeqDo8th5wOBA5h/AjTKA4I= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.28.0/go.mod h1:VHVDI/KrK4fjnV61bE2g3sA7tiETLn8sooImelsCx3Y= -sigs.k8s.io/controller-runtime v0.17.2 h1:FwHwD1CTUemg0pW2otk7/U5/i5m2ymzvOXdbeGOUvw0= -sigs.k8s.io/controller-runtime v0.17.2/go.mod h1:+MngTvIQQQhfXtwfdGw/UOQ/aIaqsYywfCINOtwMO/s= -sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= -sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +k8s.io/api v0.31.1 h1:Xe1hX/fPW3PXYYv8BlozYqw63ytA92snr96zMW9gWTU= +k8s.io/api v0.31.1/go.mod h1:sbN1g6eY6XVLeqNsZGLnI5FwVseTrZX7Fv3O26rhAaI= +k8s.io/apiextensions-apiserver v0.31.1 h1:L+hwULvXx+nvTYX/MKM3kKMZyei+UiSXQWciX/N6E40= +k8s.io/apiextensions-apiserver v0.31.1/go.mod h1:tWMPR3sgW+jsl2xm9v7lAyRF1rYEK71i9G5dRtkknoQ= +k8s.io/apimachinery v0.31.1 h1:mhcUBbj7KUjaVhyXILglcVjuS4nYXiwC+KKFBgIVy7U= +k8s.io/apimachinery v0.31.1/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= +k8s.io/apiserver v0.31.1 h1:Sars5ejQDCRBY5f7R3QFHdqN3s61nhkpaX8/k1iEw1c= +k8s.io/apiserver v0.31.1/go.mod h1:lzDhpeToamVZJmmFlaLwdYZwd7zB+WYRYIboqA1kGxM= +k8s.io/client-go v0.31.1 h1:f0ugtWSbWpxHR7sjVpQwuvw9a3ZKLXX0u0itkFXufb0= +k8s.io/client-go v0.31.1/go.mod h1:sKI8871MJN2OyeqRlmA4W4KM9KBdBUpDLu/43eGemCg= +k8s.io/code-generator v0.31.1 h1:GvkRZEP2g2UnB2QKT2Dgc/kYxIkDxCHENv2Q1itioVs= +k8s.io/code-generator v0.31.1/go.mod h1:oL2ky46L48osNqqZAeOcWWy0S5BXj50vVdwOtTefqIs= +k8s.io/component-base v0.31.1 h1:UpOepcrX3rQ3ab5NB6g5iP0tvsgJWzxTyAo20sgYSy8= +k8s.io/component-base v0.31.1/go.mod h1:WGeaw7t/kTsqpVTaCoVEtillbqAhF2/JgvO0LDOMa0w= +k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 h1:NGrVE502P0s0/1hudf8zjgwki1X/TByhmAoILTarmzo= +k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70/go.mod h1:VH3AT8AaQOqiGjMF9p0/IM1Dj+82ZwjfxUP1IxaHE+8= +k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= +k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= +k8s.io/kms v0.32.0-alpha.2 h1:NJN4JwERThH1UVDE8XSEXrBf4Zi8nPFpuiF3rWCjYU4= +k8s.io/kms v0.32.0-alpha.2/go.mod h1:9jVVb5kg1PXT6I5QMPUTqnr6P9Tg+6H5Y7hCML+P0k0= +k8s.io/kube-openapi v0.0.0-20240827152857-f7e401e7b4c2 h1:GKE9U8BH16uynoxQii0auTjmmmuZ3O0LFMN6S0lPPhI= +k8s.io/kube-openapi v0.0.0-20240827152857-f7e401e7b4c2/go.mod h1:coRQXBK9NxO98XUv3ZD6AK3xzHCxV6+b7lrquKwaKzA= +k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A= +k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3 h1:2770sDpzrjjsAtVhSeUFseziht227YAWYHLGNM8QPwY= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw= +sigs.k8s.io/controller-runtime v0.19.0 h1:nWVM7aq+Il2ABxwiCizrVDSlmDcshi9llbaFbC0ji/Q= +sigs.k8s.io/controller-runtime v0.19.0/go.mod h1:iRmWllt8IlaLjvTTDLhRBXIEtkCK6hwVBJJsYS9Ajf4= +sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 h1:/Rv+M11QRah1itp8VhT6HoVx1Ray9eB4DBr+K+/sCJ8= +sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3/go.mod h1:18nIHnGi6636UCz6m8i4DhaJ65T6EruyzmoQqI2BVDo= sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= -sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= diff --git a/main.go b/main.go index 11afd1e..72462d9 100644 --- a/main.go +++ b/main.go @@ -14,7 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. */ -//go:generate apiserver-runtime-gen package main import ( @@ -27,26 +26,13 @@ import ( "github.com/henderiw/apiserver-builder/pkg/builder" "github.com/henderiw/apiserver-store/pkg/db/badgerdb" "github.com/henderiw/logger/log" - "github.com/kuidio/kuid/apis/backend" + "github.com/kuidio/kuid/apis/backend/as" asbev1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" - extcommbev1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" - genidbev1alpha1 "github.com/kuidio/kuid/apis/backend/genid/v1alpha1" - infrabev1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - ipambev1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" - vlanbev1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" - vxlanbev1alpha1 "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1" - "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" - kuidopenapi "github.com/kuidio/kuid/apis/generated/openapi" - bebackend "github.com/kuidio/kuid/pkg/backend/backend" - "github.com/kuidio/kuid/pkg/backend/ipam" - "github.com/kuidio/kuid/pkg/kuidserver/claimserver" - "github.com/kuidio/kuid/pkg/kuidserver/entryserver" - "github.com/kuidio/kuid/pkg/kuidserver/genericserver" - "github.com/kuidio/kuid/pkg/kuidserver/indexserver" - serverstore "github.com/kuidio/kuid/pkg/kuidserver/store" + "github.com/kuidio/kuid/pkg/generated/openapi" "github.com/kuidio/kuid/pkg/reconcilers" _ "github.com/kuidio/kuid/pkg/reconcilers/all" "github.com/kuidio/kuid/pkg/reconcilers/ctrlconfig" + "github.com/kuidio/kuid/pkg/registry/options" "go.uber.org/zap/zapcore" "k8s.io/apimachinery/pkg/runtime" clientgoscheme "k8s.io/client-go/kubernetes/scheme" @@ -82,20 +68,16 @@ func main() { // setup controllers runScheme := runtime.NewScheme() - if err := scheme.AddToScheme(runScheme); err != nil { - log.Error("cannot initialize schema", "error", err) - os.Exit(1) - } // add the core object to the scheme for _, api := range (runtime.SchemeBuilder{ clientgoscheme.AddToScheme, - infrabev1alpha1.AddToScheme, - ipambev1alpha1.AddToScheme, - vlanbev1alpha1.AddToScheme, - vxlanbev1alpha1.AddToScheme, + //infrabev1alpha1.AddToScheme, + //ipambev1alpha1.AddToScheme, + //vlanbev1alpha1.AddToScheme, + //vxlanbev1alpha1.AddToScheme, asbev1alpha1.AddToScheme, - extcommbev1alpha1.AddToScheme, - genidbev1alpha1.AddToScheme, + //extcommbev1alpha1.AddToScheme, + //genidbev1alpha1.AddToScheme, }) { if err := api(runScheme); err != nil { log.Error("cannot add scheme", "err", err) @@ -103,62 +85,64 @@ func main() { } } - runScheme.AddFieldLabelConversionFunc( - ipambev1alpha1.SchemeGroupVersion.WithKind(ipambev1alpha1.IPClaimKind), - ipambev1alpha1.IPClaimConvertFieldSelector, - ) - runScheme.AddFieldLabelConversionFunc( - ipambev1alpha1.SchemeGroupVersion.WithKind(ipambev1alpha1.IPEntryKind), - ipambev1alpha1.IPEntryConvertFieldSelector, - ) - runScheme.AddFieldLabelConversionFunc( - vlanbev1alpha1.SchemeGroupVersion.WithKind(vlanbev1alpha1.VLANClaimKind), - vlanbev1alpha1.VLANClaimConvertFieldSelector, - ) - runScheme.AddFieldLabelConversionFunc( - vlanbev1alpha1.SchemeGroupVersion.WithKind(vlanbev1alpha1.VLANEntryKind), - vlanbev1alpha1.VLANEntryConvertFieldSelector, - ) - runScheme.AddFieldLabelConversionFunc( - vxlanbev1alpha1.SchemeGroupVersion.WithKind(vxlanbev1alpha1.VXLANClaimKind), - vxlanbev1alpha1.VXLANClaimConvertFieldSelector, - ) - runScheme.AddFieldLabelConversionFunc( - vxlanbev1alpha1.SchemeGroupVersion.WithKind(vxlanbev1alpha1.VXLANEntryKind), - vxlanbev1alpha1.VXLANEntryConvertFieldSelector, - ) - runScheme.AddFieldLabelConversionFunc( - asbev1alpha1.SchemeGroupVersion.WithKind(asbev1alpha1.ASClaimKind), - asbev1alpha1.ASClaimConvertFieldSelector, - ) - runScheme.AddFieldLabelConversionFunc( - asbev1alpha1.SchemeGroupVersion.WithKind(asbev1alpha1.ASEntryKind), - asbev1alpha1.ASEntryConvertFieldSelector, - ) - runScheme.AddFieldLabelConversionFunc( - extcommbev1alpha1.SchemeGroupVersion.WithKind(extcommbev1alpha1.EXTCOMMClaimKind), - extcommbev1alpha1.EXTCOMMClaimConvertFieldSelector, - ) - runScheme.AddFieldLabelConversionFunc( - extcommbev1alpha1.SchemeGroupVersion.WithKind(extcommbev1alpha1.EXTCOMMEntryKind), - extcommbev1alpha1.EXTCOMMEntryConvertFieldSelector, - ) - runScheme.AddFieldLabelConversionFunc( - genidbev1alpha1.SchemeGroupVersion.WithKind(genidbev1alpha1.GENIDClaimKind), - genidbev1alpha1.GENIDClaimConvertFieldSelector, - ) - runScheme.AddFieldLabelConversionFunc( - genidbev1alpha1.SchemeGroupVersion.WithKind(genidbev1alpha1.GENIDEntryKind), - genidbev1alpha1.GENIDEntryConvertFieldSelector, - ) - runScheme.AddFieldLabelConversionFunc( - infrabev1alpha1.SchemeGroupVersion.WithKind(infrabev1alpha1.NodeKind), - infrabev1alpha1.NodeConvertFieldSelector, - ) - runScheme.AddFieldLabelConversionFunc( - infrabev1alpha1.SchemeGroupVersion.WithKind(infrabev1alpha1.LinkKind), - infrabev1alpha1.LinkConvertFieldSelector, - ) + /* + runScheme.AddFieldLabelConversionFunc( + ipambev1alpha1.SchemeGroupVersion.WithKind(ipambev1alpha1.IPClaimKind), + ipambev1alpha1.IPClaimConvertFieldSelector, + ) + runScheme.AddFieldLabelConversionFunc( + ipambev1alpha1.SchemeGroupVersion.WithKind(ipambev1alpha1.IPEntryKind), + ipambev1alpha1.IPEntryConvertFieldSelector, + ) + runScheme.AddFieldLabelConversionFunc( + vlanbev1alpha1.SchemeGroupVersion.WithKind(vlanbev1alpha1.VLANClaimKind), + vlanbev1alpha1.VLANClaimConvertFieldSelector, + ) + runScheme.AddFieldLabelConversionFunc( + vlanbev1alpha1.SchemeGroupVersion.WithKind(vlanbev1alpha1.VLANEntryKind), + vlanbev1alpha1.VLANEntryConvertFieldSelector, + ) + runScheme.AddFieldLabelConversionFunc( + vxlanbev1alpha1.SchemeGroupVersion.WithKind(vxlanbev1alpha1.VXLANClaimKind), + vxlanbev1alpha1.VXLANClaimConvertFieldSelector, + ) + runScheme.AddFieldLabelConversionFunc( + vxlanbev1alpha1.SchemeGroupVersion.WithKind(vxlanbev1alpha1.VXLANEntryKind), + vxlanbev1alpha1.VXLANEntryConvertFieldSelector, + ) + runScheme.AddFieldLabelConversionFunc( + asbev1alpha1.SchemeGroupVersion.WithKind(asbev1alpha1.ASClaimKind), + asbev1alpha1.ASClaimConvertFieldSelector, + ) + runScheme.AddFieldLabelConversionFunc( + asbev1alpha1.SchemeGroupVersion.WithKind(asbev1alpha1.ASEntryKind), + asbev1alpha1.ASEntryConvertFieldSelector, + ) + runScheme.AddFieldLabelConversionFunc( + extcommbev1alpha1.SchemeGroupVersion.WithKind(extcommbev1alpha1.EXTCOMMClaimKind), + extcommbev1alpha1.EXTCOMMClaimConvertFieldSelector, + ) + runScheme.AddFieldLabelConversionFunc( + extcommbev1alpha1.SchemeGroupVersion.WithKind(extcommbev1alpha1.EXTCOMMEntryKind), + extcommbev1alpha1.EXTCOMMEntryConvertFieldSelector, + ) + runScheme.AddFieldLabelConversionFunc( + genidbev1alpha1.SchemeGroupVersion.WithKind(genidbev1alpha1.GENIDClaimKind), + genidbev1alpha1.GENIDClaimConvertFieldSelector, + ) + runScheme.AddFieldLabelConversionFunc( + genidbev1alpha1.SchemeGroupVersion.WithKind(genidbev1alpha1.GENIDEntryKind), + genidbev1alpha1.GENIDEntryConvertFieldSelector, + ) + runScheme.AddFieldLabelConversionFunc( + infrabev1alpha1.SchemeGroupVersion.WithKind(infrabev1alpha1.NodeKind), + infrabev1alpha1.NodeConvertFieldSelector, + ) + runScheme.AddFieldLabelConversionFunc( + infrabev1alpha1.SchemeGroupVersion.WithKind(infrabev1alpha1.LinkKind), + infrabev1alpha1.LinkConvertFieldSelector, + ) + */ mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), manager.Options{ Scheme: runScheme, @@ -168,60 +152,62 @@ func main() { os.Exit(1) } - ipbe := ipam.New(mgr.GetClient()) - vlanbe := bebackend.New( - mgr.GetClient(), - func() backend.IndexObject { return &vlanbev1alpha1.VLANIndex{} }, - func() backend.ObjectList { return &vlanbev1alpha1.VLANEntryList{} }, - func() backend.ObjectList { return &vlanbev1alpha1.VLANClaimList{} }, - vlanbev1alpha1.GetVLANEntry, - vlanbev1alpha1.SchemeGroupVersion.WithKind(vlanbev1alpha1.VLANIndexKind), - vlanbev1alpha1.SchemeGroupVersion.WithKind(vlanbev1alpha1.VLANClaimKind), - ) - vxlanbe := bebackend.New( - mgr.GetClient(), - func() backend.IndexObject { return &vxlanbev1alpha1.VXLANIndex{} }, - func() backend.ObjectList { return &vxlanbev1alpha1.VXLANEntryList{} }, - func() backend.ObjectList { return &vxlanbev1alpha1.VXLANClaimList{} }, - vxlanbev1alpha1.GetVXLANEntry, - vxlanbev1alpha1.SchemeGroupVersion.WithKind(vxlanbev1alpha1.VXLANIndexKind), - vxlanbev1alpha1.SchemeGroupVersion.WithKind(vxlanbev1alpha1.VXLANClaimKind), - ) - asbe := bebackend.New( - mgr.GetClient(), - func() backend.IndexObject { return &asbev1alpha1.ASIndex{} }, - func() backend.ObjectList { return &asbev1alpha1.ASEntryList{} }, - func() backend.ObjectList { return &asbev1alpha1.ASClaimList{} }, - asbev1alpha1.GetASEntry, - asbev1alpha1.SchemeGroupVersion.WithKind(asbev1alpha1.ASIndexKind), - asbev1alpha1.SchemeGroupVersion.WithKind(asbev1alpha1.ASClaimKind), - ) - extcommbe := bebackend.New( - mgr.GetClient(), - func() backend.IndexObject { return &extcommbev1alpha1.EXTCOMMIndex{} }, - func() backend.ObjectList { return &extcommbev1alpha1.EXTCOMMEntryList{} }, - func() backend.ObjectList { return &extcommbev1alpha1.EXTCOMMClaimList{} }, - extcommbev1alpha1.GetEXTCOMMEntry, - extcommbev1alpha1.SchemeGroupVersion.WithKind(extcommbev1alpha1.EXTCOMMIndexKind), - extcommbev1alpha1.SchemeGroupVersion.WithKind(extcommbev1alpha1.EXTCOMMClaimKind), - ) - genidbe := bebackend.New( - mgr.GetClient(), - func() backend.IndexObject { return &genidbev1alpha1.GENIDIndex{} }, - func() backend.ObjectList { return &genidbev1alpha1.GENIDEntryList{} }, - func() backend.ObjectList { return &genidbev1alpha1.GENIDClaimList{} }, - genidbev1alpha1.GetGENIDEntry, - genidbev1alpha1.SchemeGroupVersion.WithKind(genidbev1alpha1.GENIDIndexKind), - genidbev1alpha1.SchemeGroupVersion.WithKind(genidbev1alpha1.GENIDClaimKind), - ) + /* + ipbe := ipam.New(mgr.GetClient()) + vlanbe := bebackend.New( + mgr.GetClient(), + func() backend.IndexObject { return &vlanbev1alpha1.VLANIndex{} }, + func() backend.ObjectList { return &vlanbev1alpha1.VLANEntryList{} }, + func() backend.ObjectList { return &vlanbev1alpha1.VLANClaimList{} }, + vlanbev1alpha1.GetVLANEntry, + vlanbev1alpha1.SchemeGroupVersion.WithKind(vlanbev1alpha1.VLANIndexKind), + vlanbev1alpha1.SchemeGroupVersion.WithKind(vlanbev1alpha1.VLANClaimKind), + ) + vxlanbe := bebackend.New( + mgr.GetClient(), + func() backend.IndexObject { return &vxlanbev1alpha1.VXLANIndex{} }, + func() backend.ObjectList { return &vxlanbev1alpha1.VXLANEntryList{} }, + func() backend.ObjectList { return &vxlanbev1alpha1.VXLANClaimList{} }, + vxlanbev1alpha1.GetVXLANEntry, + vxlanbev1alpha1.SchemeGroupVersion.WithKind(vxlanbev1alpha1.VXLANIndexKind), + vxlanbev1alpha1.SchemeGroupVersion.WithKind(vxlanbev1alpha1.VXLANClaimKind), + ) + asbe := bebackend.New( + mgr.GetClient(), + func() backend.IndexObject { return &asbev1alpha1.ASIndex{} }, + func() backend.ObjectList { return &asbev1alpha1.ASEntryList{} }, + func() backend.ObjectList { return &asbev1alpha1.ASClaimList{} }, + asbev1alpha1.GetASEntry, + asbev1alpha1.SchemeGroupVersion.WithKind(asbev1alpha1.ASIndexKind), + asbev1alpha1.SchemeGroupVersion.WithKind(asbev1alpha1.ASClaimKind), + ) + extcommbe := bebackend.New( + mgr.GetClient(), + func() backend.IndexObject { return &extcommbev1alpha1.EXTCOMMIndex{} }, + func() backend.ObjectList { return &extcommbev1alpha1.EXTCOMMEntryList{} }, + func() backend.ObjectList { return &extcommbev1alpha1.EXTCOMMClaimList{} }, + extcommbev1alpha1.GetEXTCOMMEntry, + extcommbev1alpha1.SchemeGroupVersion.WithKind(extcommbev1alpha1.EXTCOMMIndexKind), + extcommbev1alpha1.SchemeGroupVersion.WithKind(extcommbev1alpha1.EXTCOMMClaimKind), + ) + genidbe := bebackend.New( + mgr.GetClient(), + func() backend.IndexObject { return &genidbev1alpha1.GENIDIndex{} }, + func() backend.ObjectList { return &genidbev1alpha1.GENIDEntryList{} }, + func() backend.ObjectList { return &genidbev1alpha1.GENIDClaimList{} }, + genidbev1alpha1.GetGENIDEntry, + genidbev1alpha1.SchemeGroupVersion.WithKind(genidbev1alpha1.GENIDIndexKind), + genidbev1alpha1.SchemeGroupVersion.WithKind(genidbev1alpha1.GENIDClaimKind), + ) + */ ctrlCfg := &ctrlconfig.ControllerConfig{ - IPAMBackend: ipbe, - VLANBackend: vlanbe, - VXLANBackend: vxlanbe, - ASBackend: asbe, - EXTCOMMBackend: extcommbe, - GENIDBackend: genidbe, + //IPAMBackend: ipbe, + //VLANBackend: vlanbe, + //VXLANBackend: vxlanbe, + //ASBackend: asbe, + //EXTCOMMBackend: extcommbe, + //GENIDBackend: genidbe, } for name, reconciler := range reconcilers.Reconcilers { log.Info("reconciler", "name", name, "enabled", IsReconcilerEnabled(name)) @@ -240,487 +226,32 @@ func main() { os.Exit(1) } + registryOptions := &options.Options{ + Prefix: configDir, + Type: options.StorageType_KV, + DB: db, + } + + asStorageProviders := as.NewStorageProviders(ctx, true, registryOptions) + go func() { - if err := builder.APIServer. - WithServerName("kuid-server"). - WithEtcdPath(defaultEtcdPathPrefix). - WithOpenAPIDefinitions("Kuid", "v1alpha1", kuidopenapi.GetOpenAPIDefinitions). - WithResourceAndHandler(ctx, &ipambev1alpha1.IPClaim{}, claimserver.NewProvider( - ctx, - mgr.GetClient(), - &claimserver.ServerObjContext{ - TracerString: "ipclaim-server", - Obj: &ipambev1alpha1.IPClaim{}, - ConversionFunc: ipambev1alpha1.IPClaimConvertFieldSelector, - TableConverter: ipambev1alpha1.IPClaimTableConvertor, - }, - &serverstore.Config{ - Prefix: configDir, - Type: serverstore.StorageType_KV, - DB: db, - }, - ipbe)). - WithResourceAndHandler(ctx, &ipambev1alpha1.IPEntry{}, entryserver.NewProvider( - ctx, - mgr.GetClient(), - &entryserver.ServerObjContext{ - TracerString: "ipentry-server", - Obj: &ipambev1alpha1.IPEntry{}, - ConversionFunc: ipambev1alpha1.IPEntryConvertFieldSelector, - TableConverter: ipambev1alpha1.IPEntryTableConvertor, - }, - &serverstore.Config{ - Prefix: configDir, - Type: serverstore.StorageType_KV, - DB: db, - }, - ipbe)). - WithResourceAndHandler(ctx, &ipambev1alpha1.IPIndex{}, indexserver.NewProvider( - ctx, - mgr.GetClient(), - &indexserver.ServerObjContext{ - TracerString: "ipindex-server", - Obj: &ipambev1alpha1.IPIndex{}, - ConversionFunc: ipambev1alpha1.IPIndexConvertFieldSelector, - TableConverter: ipambev1alpha1.IPIndexTableConvertor, - }, - &serverstore.Config{ - Prefix: configDir, - Type: serverstore.StorageType_KV, - DB: db, - }, - ipbe)). - WithResourceAndHandler(ctx, &vlanbev1alpha1.VLANClaim{}, claimserver.NewProvider( - ctx, - mgr.GetClient(), - &claimserver.ServerObjContext{ - TracerString: "vlanclaim-server", - Obj: &vlanbev1alpha1.VLANClaim{}, - ConversionFunc: vlanbev1alpha1.VLANClaimConvertFieldSelector, - }, - &serverstore.Config{ - Prefix: configDir, - Type: serverstore.StorageType_KV, - DB: db, - }, - vlanbe)). - WithResourceAndHandler(ctx, &vlanbev1alpha1.VLANEntry{}, entryserver.NewProvider( - ctx, - mgr.GetClient(), - &entryserver.ServerObjContext{ - TracerString: "vlanentry-server", - Obj: &vlanbev1alpha1.VLANEntry{}, - ConversionFunc: vlanbev1alpha1.VLANEntryConvertFieldSelector, - }, - &serverstore.Config{ - Prefix: configDir, - Type: serverstore.StorageType_KV, - DB: db, - }, - vlanbe)). - WithResourceAndHandler(ctx, &vlanbev1alpha1.VLANIndex{}, indexserver.NewProvider( - ctx, - mgr.GetClient(), - &indexserver.ServerObjContext{ - TracerString: "vlanindex-server", - Obj: &vlanbev1alpha1.VLANIndex{}, - //NewIndexFn: func() backend.IndexObject { return &vlanbev1alpha1.VLANIndex{} }, - ConversionFunc: vlanbev1alpha1.VLANIndexConvertFieldSelector, - }, - &serverstore.Config{ - Prefix: configDir, - Type: serverstore.StorageType_KV, - DB: db, - }, - vlanbe)). - WithResourceAndHandler(ctx, &vxlanbev1alpha1.VXLANClaim{}, claimserver.NewProvider( - ctx, - mgr.GetClient(), - &claimserver.ServerObjContext{ - TracerString: "vxlanclaim-server", - Obj: &vxlanbev1alpha1.VXLANClaim{}, - //NewIndexFn: func() backend.IndexObject { return &vlanbev1alpha1.VLANIndex{} }, - ConversionFunc: vxlanbev1alpha1.VXLANClaimConvertFieldSelector, - }, - &serverstore.Config{ - Prefix: configDir, - Type: serverstore.StorageType_KV, - DB: db, - }, - vxlanbe)). - WithResourceAndHandler(ctx, &vxlanbev1alpha1.VXLANEntry{}, entryserver.NewProvider( - ctx, - mgr.GetClient(), - &entryserver.ServerObjContext{ - TracerString: "vxlanentry-server", - Obj: &vxlanbev1alpha1.VXLANEntry{}, - ConversionFunc: vxlanbev1alpha1.VXLANEntryConvertFieldSelector, - }, - &serverstore.Config{ - Prefix: configDir, - Type: serverstore.StorageType_KV, - DB: db, - }, - vxlanbe)). - WithResourceAndHandler(ctx, &vxlanbev1alpha1.VXLANIndex{}, indexserver.NewProvider( - ctx, - mgr.GetClient(), - &indexserver.ServerObjContext{ - TracerString: "vxlanindex-server", - Obj: &vxlanbev1alpha1.VXLANIndex{}, - ConversionFunc: vxlanbev1alpha1.VXLANIndexConvertFieldSelector, - }, - &serverstore.Config{ - Prefix: configDir, - Type: serverstore.StorageType_KV, - DB: db, - }, - vxlanbe)). - WithResourceAndHandler(ctx, &asbev1alpha1.ASClaim{}, claimserver.NewProvider( - ctx, - mgr.GetClient(), - &claimserver.ServerObjContext{ - TracerString: "asclaim-server", - Obj: &asbev1alpha1.ASClaim{}, - //NewIndexFn: func() backend.IndexObject { return &vlanbev1alpha1.VLANIndex{} }, - ConversionFunc: asbev1alpha1.ASClaimConvertFieldSelector, - }, - &serverstore.Config{ - Prefix: configDir, - Type: serverstore.StorageType_KV, - DB: db, - }, - asbe)). - WithResourceAndHandler(ctx, &asbev1alpha1.ASEntry{}, entryserver.NewProvider( - ctx, - mgr.GetClient(), - &entryserver.ServerObjContext{ - TracerString: "asentry-server", - Obj: &asbev1alpha1.ASEntry{}, - //NewIndexFn: func() backend.IndexObject { return &vlanbev1alpha1.VLANIndex{} }, - ConversionFunc: asbev1alpha1.ASEntryConvertFieldSelector, - }, - &serverstore.Config{ - Prefix: configDir, - Type: serverstore.StorageType_KV, - DB: db, - }, - asbe)). - WithResourceAndHandler(ctx, &asbev1alpha1.ASIndex{}, indexserver.NewProvider( - ctx, - mgr.GetClient(), - &indexserver.ServerObjContext{ - TracerString: "asindex-server", - Obj: &asbev1alpha1.ASIndex{}, - ConversionFunc: asbev1alpha1.ASIndexConvertFieldSelector, - }, - &serverstore.Config{ - Prefix: configDir, - Type: serverstore.StorageType_KV, - DB: db, - }, - asbe)). - WithResourceAndHandler(ctx, &extcommbev1alpha1.EXTCOMMClaim{}, claimserver.NewProvider( - ctx, - mgr.GetClient(), - &claimserver.ServerObjContext{ - TracerString: "extcommclaim-server", - Obj: &extcommbev1alpha1.EXTCOMMClaim{}, - NewIndexFn: func() backend.IndexObject { return &extcommbev1alpha1.EXTCOMMIndex{} }, - ConversionFunc: extcommbev1alpha1.EXTCOMMClaimConvertFieldSelector, - }, - &serverstore.Config{ - Prefix: configDir, - Type: serverstore.StorageType_KV, - DB: db, - }, - extcommbe)). - WithResourceAndHandler(ctx, &extcommbev1alpha1.EXTCOMMEntry{}, entryserver.NewProvider( - ctx, - mgr.GetClient(), - &entryserver.ServerObjContext{ - TracerString: "extcommentry-server", - Obj: &extcommbev1alpha1.EXTCOMMEntry{}, - ConversionFunc: extcommbev1alpha1.EXTCOMMEntryConvertFieldSelector, - }, - &serverstore.Config{ - Prefix: configDir, - Type: serverstore.StorageType_KV, - DB: db, - }, - extcommbe)). - WithResourceAndHandler(ctx, &extcommbev1alpha1.EXTCOMMIndex{}, indexserver.NewProvider( - ctx, - mgr.GetClient(), - &indexserver.ServerObjContext{ - TracerString: "extcommindex-server", - Obj: &extcommbev1alpha1.EXTCOMMIndex{}, - ConversionFunc: extcommbev1alpha1.EXTCOMMIndexConvertFieldSelector, - TableConverter: extcommbev1alpha1.EXTCOMMIndexTableConvertor, - }, - &serverstore.Config{ - Prefix: configDir, - Type: serverstore.StorageType_KV, - DB: db, - }, - extcommbe)). - WithResourceAndHandler(ctx, &genidbev1alpha1.GENIDClaim{}, claimserver.NewProvider( - ctx, - mgr.GetClient(), - &claimserver.ServerObjContext{ - TracerString: "genidclaim-server", - Obj: &genidbev1alpha1.GENIDClaim{}, - NewIndexFn: func() backend.IndexObject { return &genidbev1alpha1.GENIDIndex{} }, - ConversionFunc: genidbev1alpha1.GENIDClaimConvertFieldSelector, - }, - &serverstore.Config{ - Prefix: configDir, - Type: serverstore.StorageType_KV, - DB: db, - }, - genidbe)). - WithResourceAndHandler(ctx, &genidbev1alpha1.GENIDEntry{}, entryserver.NewProvider( - ctx, - mgr.GetClient(), - &entryserver.ServerObjContext{ - TracerString: "genidentry-server", - Obj: &genidbev1alpha1.GENIDEntry{}, - ConversionFunc: genidbev1alpha1.GENIDEntryConvertFieldSelector, - }, - &serverstore.Config{ - Prefix: configDir, - Type: serverstore.StorageType_KV, - DB: db, - }, - genidbe)). - WithResourceAndHandler(ctx, &genidbev1alpha1.GENIDIndex{}, indexserver.NewProvider( - ctx, - mgr.GetClient(), - &indexserver.ServerObjContext{ - TracerString: "genidindex-server", - Obj: &genidbev1alpha1.GENIDIndex{}, - ConversionFunc: genidbev1alpha1.GENIDIndexConvertFieldSelector, - TableConverter: genidbev1alpha1.GENIDIndexTableConvertor, - }, - &serverstore.Config{ - Prefix: configDir, - Type: serverstore.StorageType_KV, - DB: db, - }, - genidbe)). - WithResourceAndHandler(ctx, &infrabev1alpha1.Cluster{}, genericserver.NewProvider( - ctx, - mgr.GetClient(), - &genericserver.ServerObjContext{ - TracerString: "cluster-server", - Obj: &infrabev1alpha1.Cluster{}, - ConversionFunc: infrabev1alpha1.ClusterConvertFieldSelector, - TableConverter: infrabev1alpha1.ClusterTableConvertor, - FieldSelector: infrabev1alpha1.ClusterParseFieldSelector, - }, - &serverstore.Config{ - Prefix: configDir, - Type: serverstore.StorageType_KV, - DB: db, - })). - WithResourceAndHandler(ctx, &infrabev1alpha1.Endpoint{}, genericserver.NewProvider( - ctx, - mgr.GetClient(), - &genericserver.ServerObjContext{ - TracerString: "endpoint-server", - Obj: &infrabev1alpha1.Endpoint{}, - ConversionFunc: infrabev1alpha1.EndpointConvertFieldSelector, - TableConverter: infrabev1alpha1.EndpointTableConvertor, - FieldSelector: infrabev1alpha1.EndpointParseFieldSelector, - }, - &serverstore.Config{ - Prefix: configDir, - Type: serverstore.StorageType_KV, - DB: db, - })). - WithResourceAndHandler(ctx, &infrabev1alpha1.EndpointSet{}, genericserver.NewProvider( - ctx, - mgr.GetClient(), - &genericserver.ServerObjContext{ - TracerString: "endpointset-server", - Obj: &infrabev1alpha1.EndpointSet{}, - ConversionFunc: infrabev1alpha1.EndpointSetConvertFieldSelector, - TableConverter: infrabev1alpha1.EndpointSetTableConvertor, - FieldSelector: infrabev1alpha1.EndpointSetParseFieldSelector, - }, - &serverstore.Config{ - Prefix: configDir, - Type: serverstore.StorageType_KV, - DB: db, - })). - WithResourceAndHandler(ctx, &infrabev1alpha1.Link{}, genericserver.NewProvider( - ctx, - mgr.GetClient(), - &genericserver.ServerObjContext{ - TracerString: "link-server", - Obj: &infrabev1alpha1.Link{}, - ConversionFunc: infrabev1alpha1.LinkConvertFieldSelector, - TableConverter: infrabev1alpha1.LinkTableConvertor, - FieldSelector: infrabev1alpha1.LinkParseFieldSelector, - }, - &serverstore.Config{ - Prefix: configDir, - Type: serverstore.StorageType_KV, - DB: db, - })). - WithResourceAndHandler(ctx, &infrabev1alpha1.LinkSet{}, genericserver.NewProvider( - ctx, - mgr.GetClient(), - &genericserver.ServerObjContext{ - TracerString: "linkset-server", - Obj: &infrabev1alpha1.LinkSet{}, - ConversionFunc: infrabev1alpha1.LinkSetConvertFieldSelector, - TableConverter: infrabev1alpha1.LinkSetTableConvertor, - FieldSelector: infrabev1alpha1.LinkSetParseFieldSelector, - }, - &serverstore.Config{ - Prefix: configDir, - Type: serverstore.StorageType_KV, - DB: db, - })). - WithResourceAndHandler(ctx, &infrabev1alpha1.Module{}, genericserver.NewProvider( - ctx, - mgr.GetClient(), - &genericserver.ServerObjContext{ - TracerString: "module-server", - Obj: &infrabev1alpha1.Module{}, - ConversionFunc: infrabev1alpha1.ModuleConvertFieldSelector, - TableConverter: infrabev1alpha1.ModuleTableConvertor, - FieldSelector: infrabev1alpha1.ModuleParseFieldSelector, - }, - &serverstore.Config{ - Prefix: configDir, - Type: serverstore.StorageType_KV, - DB: db, - })). - WithResourceAndHandler(ctx, &infrabev1alpha1.ModuleBay{}, genericserver.NewProvider( - ctx, - mgr.GetClient(), - &genericserver.ServerObjContext{ - TracerString: "modulebay-server", - Obj: &infrabev1alpha1.ModuleBay{}, - ConversionFunc: infrabev1alpha1.ModuleBayConvertFieldSelector, - TableConverter: infrabev1alpha1.ModuleBayTableConvertor, - FieldSelector: infrabev1alpha1.ModuleBayParseFieldSelector, - }, - &serverstore.Config{ - Prefix: configDir, - Type: serverstore.StorageType_KV, - DB: db, - })). - WithResourceAndHandler(ctx, &infrabev1alpha1.Node{}, genericserver.NewProvider( - ctx, - mgr.GetClient(), - &genericserver.ServerObjContext{ - TracerString: "node-server", - Obj: &infrabev1alpha1.Node{}, - ConversionFunc: infrabev1alpha1.NodeConvertFieldSelector, - TableConverter: infrabev1alpha1.NodeTableConvertor, - FieldSelector: infrabev1alpha1.NodeParseFieldSelector, - }, - &serverstore.Config{ - Prefix: configDir, - Type: serverstore.StorageType_KV, - DB: db, - })). - WithResourceAndHandler(ctx, &infrabev1alpha1.NodeGroup{}, genericserver.NewProvider( - ctx, - mgr.GetClient(), - &genericserver.ServerObjContext{ - TracerString: "nodegroup-server", - Obj: &infrabev1alpha1.NodeGroup{}, - ConversionFunc: infrabev1alpha1.NodeGroupConvertFieldSelector, - TableConverter: infrabev1alpha1.NodeGroupTableConvertor, - FieldSelector: infrabev1alpha1.NodeGroupParseFieldSelector, - }, - &serverstore.Config{ - Prefix: configDir, - Type: serverstore.StorageType_KV, - DB: db, - })). - WithResourceAndHandler(ctx, &infrabev1alpha1.NodeItem{}, genericserver.NewProvider( - ctx, - mgr.GetClient(), - &genericserver.ServerObjContext{ - TracerString: "nodeitem-server", - Obj: &infrabev1alpha1.NodeItem{}, - ConversionFunc: infrabev1alpha1.NodeItemConvertFieldSelector, - TableConverter: infrabev1alpha1.NodeItemTableConvertor, - FieldSelector: infrabev1alpha1.NodeItemParseFieldSelector, - }, - &serverstore.Config{ - Prefix: configDir, - Type: serverstore.StorageType_KV, - DB: db, - })). - WithResourceAndHandler(ctx, &infrabev1alpha1.NodeSet{}, genericserver.NewProvider( - ctx, - mgr.GetClient(), - &genericserver.ServerObjContext{ - TracerString: "nodeset-server", - Obj: &infrabev1alpha1.NodeSet{}, - ConversionFunc: infrabev1alpha1.NodeSetConvertFieldSelector, - TableConverter: infrabev1alpha1.NodeSetTableConvertor, - FieldSelector: infrabev1alpha1.NodeSetParseFieldSelector, - }, - &serverstore.Config{ - Prefix: configDir, - Type: serverstore.StorageType_KV, - DB: db, - })). - WithResourceAndHandler(ctx, &infrabev1alpha1.Rack{}, genericserver.NewProvider( - ctx, - mgr.GetClient(), - &genericserver.ServerObjContext{ - TracerString: "rack-server", - Obj: &infrabev1alpha1.Rack{}, - ConversionFunc: infrabev1alpha1.RackConvertFieldSelector, - TableConverter: infrabev1alpha1.RackTableConvertor, - FieldSelector: infrabev1alpha1.RackParseFieldSelector, - }, - &serverstore.Config{ - Prefix: configDir, - Type: serverstore.StorageType_KV, - DB: db, - })). - WithResourceAndHandler(ctx, &infrabev1alpha1.Region{}, genericserver.NewProvider( - ctx, - mgr.GetClient(), - &genericserver.ServerObjContext{ - TracerString: "region-server", - Obj: &infrabev1alpha1.Region{}, - ConversionFunc: infrabev1alpha1.RegionConvertFieldSelector, - TableConverter: infrabev1alpha1.RegionTableConvertor, - FieldSelector: infrabev1alpha1.RegionParseFieldSelector, - }, - &serverstore.Config{ - Prefix: configDir, - Type: serverstore.StorageType_KV, - DB: db, - })). - WithResourceAndHandler(ctx, &infrabev1alpha1.Site{}, genericserver.NewProvider( - ctx, - mgr.GetClient(), - &genericserver.ServerObjContext{ - TracerString: "site-server", - Obj: &infrabev1alpha1.Site{}, - ConversionFunc: infrabev1alpha1.SiteConvertFieldSelector, - TableConverter: infrabev1alpha1.SiteTableConvertor, - FieldSelector: infrabev1alpha1.SiteParseFieldSelector, - }, - &serverstore.Config{ - Prefix: configDir, - Type: serverstore.StorageType_KV, - DB: db, - })). - WithoutEtcd(). - Execute(ctx); err != nil { - log.Info("cannot start config-server") + apiserver := builder.APIServer. + WithServerName("kuid-api-server"). + WithOpenAPIDefinitions("Config", "v1alpha1", openapi.GetOpenAPIDefinitions). + WithResourceAndHandler(&as.ASIndex{}, asStorageProviders.GetIndexStorageProvider()). + WithResourceAndHandler(&as.ASClaim{}, asStorageProviders.GetClaimStorageProvider()). + WithResourceAndHandler(&as.ASEntry{}, asStorageProviders.GetEntryStorageProvider()). + WithoutEtcd() + + cmd, err := apiserver.Build(ctx) + if err != nil { + panic(err) + } + if err := asStorageProviders.ApplyStorageToBackend(ctx, apiserver); err != nil { + panic(err) + } + if err := cmd.Execute(); err != nil { + panic(err) } }() diff --git a/pkg/backend/as/as_helpers_test.go b/pkg/backend-orig/as/as_helpers_test.go similarity index 99% rename from pkg/backend/as/as_helpers_test.go rename to pkg/backend-orig/as/as_helpers_test.go index 8bc4cfd..f4401d3 100644 --- a/pkg/backend/as/as_helpers_test.go +++ b/pkg/backend-orig/as/as_helpers_test.go @@ -1,5 +1,7 @@ package as +/* + import ( "fmt" @@ -100,3 +102,4 @@ func (r testCtx) getRangeClaim(index, testType string) (*asbev1alpha1.ASClaim, e } return claim, nil } +*/ diff --git a/pkg/backend/as/as_index_test.go b/pkg/backend-orig/as/as_index_test.go similarity index 99% rename from pkg/backend/as/as_index_test.go rename to pkg/backend-orig/as/as_index_test.go index 14aefc8..0076896 100644 --- a/pkg/backend/as/as_index_test.go +++ b/pkg/backend-orig/as/as_index_test.go @@ -1,5 +1,7 @@ package as +/* + import ( "context" "testing" @@ -38,3 +40,4 @@ func TestIndex(t *testing.T) { }) } } +*/ diff --git a/pkg/backend/as/as_test.go b/pkg/backend-orig/as/as_test.go similarity index 99% rename from pkg/backend/as/as_test.go rename to pkg/backend-orig/as/as_test.go index e8a4c2b..a85b7b2 100644 --- a/pkg/backend/as/as_test.go +++ b/pkg/backend-orig/as/as_test.go @@ -1,5 +1,7 @@ package as +/* + import ( "context" "fmt" @@ -126,3 +128,4 @@ func Test(t *testing.T) { } } } +*/ diff --git a/pkg/backend/backend/applicator.go b/pkg/backend-orig/backend/applicator.go similarity index 99% rename from pkg/backend/backend/applicator.go rename to pkg/backend-orig/backend/applicator.go index f18b855..8349786 100644 --- a/pkg/backend/backend/applicator.go +++ b/pkg/backend-orig/backend/applicator.go @@ -16,6 +16,8 @@ limitations under the License. package backend +/* + import ( "context" "errors" @@ -150,3 +152,4 @@ func isReserved(parentName, index string) bool { return parentName == fmt.Sprintf("%s.%s", index, backend.IndexReservedMaxName) || parentName == fmt.Sprintf("%s.%s", index, backend.IndexReservedMinName) } +*/ diff --git a/pkg/backend/backend/applicator_dynamic_id.go b/pkg/backend-orig/backend/applicator_dynamic_id.go similarity index 98% rename from pkg/backend/backend/applicator_dynamic_id.go rename to pkg/backend-orig/backend/applicator_dynamic_id.go index 9ad070b..db9ca89 100644 --- a/pkg/backend/backend/applicator_dynamic_id.go +++ b/pkg/backend-orig/backend/applicator_dynamic_id.go @@ -16,6 +16,8 @@ limitations under the License. package backend +/* + import ( "context" "fmt" @@ -61,7 +63,7 @@ func (r *dynamicApplicator) reclaimID(ctx context.Context, claim backend.ClaimOb } else { claimID, claimTreeName = claimIDFromExisitingEntries(existingEntries) } - // remove the existing entries that done match the claimed ID + // remove the existing entries that don't match the claimed ID // should be none, but just in case if err := r.deleteNonClaimedEntries(ctx, existingEntries, claimID, claimTreeName); err != nil { return err @@ -157,3 +159,4 @@ func (r *dynamicApplicator) Delete(ctx context.Context, claim backend.ClaimObjec // this is a generic delete by owner return r.delete(ctx, claim) } +*/ diff --git a/pkg/backend/backend/applicator_static_id.go b/pkg/backend-orig/backend/applicator_static_id.go similarity index 99% rename from pkg/backend/backend/applicator_static_id.go rename to pkg/backend-orig/backend/applicator_static_id.go index 0cbed4f..ddd1df4 100644 --- a/pkg/backend/backend/applicator_static_id.go +++ b/pkg/backend-orig/backend/applicator_static_id.go @@ -16,6 +16,8 @@ limitations under the License. package backend +/* + import ( "context" "fmt" @@ -166,3 +168,4 @@ func (r *staticApplicator) Apply(ctx context.Context, claim backend.ClaimObject) func (r *staticApplicator) Delete(ctx context.Context, claim backend.ClaimObject) error { return r.delete(ctx, claim) } +*/ diff --git a/pkg/backend/backend/applicator_static_range.go b/pkg/backend-orig/backend/applicator_static_range.go similarity index 99% rename from pkg/backend/backend/applicator_static_range.go rename to pkg/backend-orig/backend/applicator_static_range.go index ac40e1f..799634b 100644 --- a/pkg/backend/backend/applicator_static_range.go +++ b/pkg/backend-orig/backend/applicator_static_range.go @@ -16,6 +16,8 @@ limitations under the License. package backend +/* + import ( "context" "fmt" @@ -169,3 +171,4 @@ func (r *rangeApplicator) Apply(ctx context.Context, claim backend.ClaimObject) func (r *rangeApplicator) Delete(ctx context.Context, claim backend.ClaimObject) error { return r.delete(ctx, claim) } +*/ diff --git a/pkg/backend/backend/be.go b/pkg/backend-orig/backend/be.go similarity index 99% rename from pkg/backend/backend/be.go rename to pkg/backend-orig/backend/be.go index 8606612..5f5ca98 100644 --- a/pkg/backend/backend/be.go +++ b/pkg/backend-orig/backend/be.go @@ -16,6 +16,8 @@ limitations under the License. package backend +/* + import ( "context" "fmt" @@ -37,7 +39,7 @@ type Backend interface { Claim(ctx context.Context, obj backend.ClaimObject) error // Release a claim in the backend Release(ctx context.Context, obj backend.ClaimObject) error - // GetCache returns the cache + // PrintEntries prints the entries of the cache PrintEntries(ctx context.Context, k store.Key) error } @@ -202,3 +204,4 @@ func (r *be) PrintEntries(ctx context.Context, k store.Key) error { }) return nil } +*/ \ No newline at end of file diff --git a/pkg/backend/backend/cache_context.go b/pkg/backend-orig/backend/cache_context.go similarity index 99% rename from pkg/backend/backend/cache_context.go rename to pkg/backend-orig/backend/cache_context.go index 28d46c8..355e24c 100644 --- a/pkg/backend/backend/cache_context.go +++ b/pkg/backend-orig/backend/cache_context.go @@ -16,6 +16,8 @@ limitations under the License. package backend +/* + import ( "context" @@ -75,3 +77,4 @@ func (r *CacheContext) Size() int { func (r *CacheContext) Type() string { return r.idxType } +*/ diff --git a/pkg/backend/backend/cache_interface.go b/pkg/backend-orig/backend/cache_interface.go similarity index 99% rename from pkg/backend/backend/cache_interface.go rename to pkg/backend-orig/backend/cache_interface.go index d4e6bd9..bb9fc1a 100644 --- a/pkg/backend/backend/cache_interface.go +++ b/pkg/backend-orig/backend/cache_interface.go @@ -16,6 +16,8 @@ limitations under the License. package backend +/* + import ( "context" "fmt" @@ -88,3 +90,4 @@ func (r *cache[T1]) SetInitialized(ctx context.Context, k store.Key) error { cacheCtx.Initialized() return nil } +*/ diff --git a/pkg/backend-orig/backend/context.go b/pkg/backend-orig/backend/context.go new file mode 100644 index 0000000..e8e6f79 --- /dev/null +++ b/pkg/backend-orig/backend/context.go @@ -0,0 +1,70 @@ +/* +Copyright 2024 Nokia. + +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 backend + +/* +import ( + "context" + "fmt" + "log/slog" + + "github.com/henderiw/logger/log" + "github.com/kuidio/kuid/apis/backend" +) + +func InitIndexContext(ctx context.Context, op string, idx backend.IndexObject) context.Context { + l := log.FromContext(ctx). + With( + "op", fmt.Sprintf("%s index", op), + "gvk", idx.GetObjectKind().GroupVersionKind().String(), + "nsn", idx.GetNamespacedName().String(), + ) + return log.IntoContext(ctx, l) +} + +func InitClaimContext(ctx context.Context, op string, claim backend.ClaimObject) context.Context { + var l *slog.Logger + + claimType := claim.GetClaimType() + switch claimType { + case backend.ClaimType_DynamicID: + l = log.FromContext(ctx). + With( + "op", fmt.Sprintf("%s %s claim", op, string(claimType)), + "nsn", claim.GetNamespacedName().String(), + "index", claim.GetIndex(), + ) + case backend.ClaimType_StaticID: + l = log.FromContext(ctx). + With( + "op", fmt.Sprintf("%s %s claim", op, string(claimType)), + "nsn", claim.GetNamespacedName().String(), + "index", claim.GetIndex(), + "id", *claim.GetStaticID(), // safe + ) + case backend.ClaimType_Range: + l = log.FromContext(ctx). + With( + "op", fmt.Sprintf("%s %s claim", op, string(claimType)), + "nsn", claim.GetNamespacedName().String(), + "index", claim.GetIndex(), + "range", *claim.GetRange(), // safe + ) + } + return log.IntoContext(ctx, l) +} +*/ diff --git a/pkg/backend/backend/store.go b/pkg/backend-orig/backend/store.go similarity index 99% rename from pkg/backend/backend/store.go rename to pkg/backend-orig/backend/store.go index 8ecb805..8770c4b 100644 --- a/pkg/backend/backend/store.go +++ b/pkg/backend-orig/backend/store.go @@ -16,6 +16,8 @@ limitations under the License. package backend +/* + import ( "context" "errors" @@ -238,11 +240,10 @@ func (r *bestore) listEntries(ctx context.Context, k store.Key) ([]backend.Entry func (r *bestore) listClaims(ctx context.Context, k store.Key) (map[string]backend.ClaimObject, error) { opt := []client.ListOption{ - /* - client.MatchingFields{ - "spec.networkInstance": k.Name, - }, - */ + + // client.MatchingFields{ + // "spec.networkInstance": k.Name, + // }, } claims := r.newClaimList() @@ -329,3 +330,4 @@ func (r *bestore) restoreClaim(ctx context.Context, cacheCtx *CacheContext, clai } return nil } +*/ diff --git a/pkg/backend/backend/store_interface.go b/pkg/backend-orig/backend/store_interface.go similarity index 99% rename from pkg/backend/backend/store_interface.go rename to pkg/backend-orig/backend/store_interface.go index a2f4aa7..72bba99 100644 --- a/pkg/backend/backend/store_interface.go +++ b/pkg/backend-orig/backend/store_interface.go @@ -16,6 +16,8 @@ limitations under the License. package backend +/* + import ( "context" @@ -42,3 +44,4 @@ func (r *nopStore) Restore(ctx context.Context, k store.Key) error { return nil func (r *nopStore) SaveAll(ctx context.Context, k store.Key) error { return nil } func (r *nopStore) Destroy(ctx context.Context, k store.Key) error { return nil } +*/ diff --git a/apis/backend/esi/doc.go b/pkg/backend/backend_config.go similarity index 79% rename from apis/backend/esi/doc.go rename to pkg/backend/backend_config.go index 1485a43..74cbfd2 100644 --- a/apis/backend/esi/doc.go +++ b/pkg/backend/backend_config.go @@ -14,8 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -// +k8s:deepcopy-gen=package,register -// +groupName=esi.be.kuid.dev +package backend -// esi defines the esi api -package esi + +type BackendConfig struct { + Backend Backend + IndexKind string + EntryKind string + ClaimKind string +} diff --git a/pkg/backend/backend_interface.go b/pkg/backend/backend_interface.go new file mode 100644 index 0000000..226887e --- /dev/null +++ b/pkg/backend/backend_interface.go @@ -0,0 +1,38 @@ +/* +Copyright 2024 Nokia. + +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 backend + +import ( + "context" + + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apiserver/pkg/registry/rest" +) + +type Backend interface { + AddStorage(entryStorage, claimStorage rest.Storage) error + // CreateIndex creates a backend index + CreateIndex(ctx context.Context, obj runtime.Object) error + // DeleteIndex deletes a backend index + DeleteIndex(ctx context.Context, obj runtime.Object) error + // Claim claims an entry in the backend index + Claim(ctx context.Context, obj runtime.Object) error + // Release a claim in the backend + Release(ctx context.Context, obj runtime.Object) error + // PrintEntries prints the entries of the cache + //PrintEntries(ctx context.Context, k store.Key) error +} diff --git a/pkg/backend/cache_instance.go b/pkg/backend/cache_instance.go new file mode 100644 index 0000000..8002f62 --- /dev/null +++ b/pkg/backend/cache_instance.go @@ -0,0 +1,48 @@ +/* +Copyright 2024 Nokia. + +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 backend + +import "sync" + +// newCacheContext holds the cache instance context +// with a status to indicate if it is initialized or not +// initialized false: means it is NOT initialized, +// initialized true means it is initialized +func newCacheInstance[T1 any](i T1) *cacheInstance[T1] { + return &cacheInstance[T1]{ + initialized: false, + instance: i, + } +} + +type cacheInstance[T1 any] struct { + m sync.RWMutex + initialized bool + instance T1 +} + +func (r *cacheInstance[T1]) SetInitialized() { + r.m.Lock() + defer r.m.Unlock() + r.initialized = true +} + +func (r *cacheInstance[T1]) IsInitialized() bool { + r.m.RLock() + defer r.m.RUnlock() + return r.initialized +} diff --git a/pkg/backend/cache_interface.go b/pkg/backend/cache_interface.go new file mode 100644 index 0000000..29de668 --- /dev/null +++ b/pkg/backend/cache_interface.go @@ -0,0 +1,80 @@ +/* +Copyright 2024 Nokia. + +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 backend + +import ( + "context" + "fmt" + + "github.com/henderiw/store" + "github.com/henderiw/store/memory" +) + +type Cache[T1 any] interface { + IsInitialized(ctx context.Context, k store.Key) bool + SetInitialized(ctx context.Context, k store.Key) error + Get(ctx context.Context, k store.Key) (T1, error) + Create(ctx context.Context, k store.Key, i T1) + Delete(ctx context.Context, k store.Key) +} + +func NewCache[T1 any]() Cache[T1] { + return &cache[T1]{ + store: memory.NewStore[*cacheInstance[T1]](nil), + } +} + +type cache[T1 any] struct { + store store.Storer[*cacheInstance[T1]] +} + +func (r *cache[T1]) Create(ctx context.Context, k store.Key, i T1) { + _ = r.store.Create(k, newCacheInstance(i)) +} + +func (r *cache[T1]) Delete(ctx context.Context, k store.Key) { + _ = r.store.Delete(k) +} + +// Get returns the cache; the initialized flag can be used to return a cache even if not initialized +func (r *cache[T1]) Get(ctx context.Context, k store.Key) (T1, error) { + cacheInstance, err := r.store.Get(k) + if err != nil { + return *new(T1), fmt.Errorf("index %s not initialized", k.String()) + } + return cacheInstance.instance, nil +} + +// IsInitialized returns true if the cache is initialized and false if the cache is +// not initialized +func (r *cache[T1]) IsInitialized(ctx context.Context, k store.Key) bool { + cacheInstance, err := r.store.Get(k) + if err != nil { + return false + } + return cacheInstance.IsInitialized() +} + +// SetInitialized sets the status in the cacheContext to initialized +func (r *cache[T1]) SetInitialized(ctx context.Context, k store.Key) error { + cacheInstance, err := r.store.Get(k) + if err != nil { + return fmt.Errorf("index %s not initialized", k.String()) + } + cacheInstance.SetInitialized() + return nil +} diff --git a/pkg/backend/backend/context.go b/pkg/backend/context.go similarity index 100% rename from pkg/backend/backend/context.go rename to pkg/backend/context.go diff --git a/pkg/backend/extcomm/extcomm_helpers_test.go b/pkg/backend/extcomm/extcomm_helpers_test.go deleted file mode 100644 index 5a06779..0000000 --- a/pkg/backend/extcomm/extcomm_helpers_test.go +++ /dev/null @@ -1,105 +0,0 @@ -package extcomm - -import ( - "fmt" - - "github.com/kuidio/kuid/apis/backend" - extcommbev1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/utils/ptr" -) - -type testCtx struct { - name string - claimType backend.ClaimType - id uint64 - tRange string - labels map[string]string - selector *metav1.LabelSelector - expectedError bool - expectedID *uint64 - expectedRange *string -} - -// aliEXTCOMM -const ( - namespace = "dummy" - staticClaim = backend.ClaimType_StaticID - dynamicClaim = backend.ClaimType_DynamicID - rangeClaim = backend.ClaimType_Range -) - -func getIndex(index, testType string) (*extcommbev1alpha1.EXTCOMMIndex, error) { - idx := extcommbev1alpha1.BuildEXTCOMMIndex( - metav1.ObjectMeta{Namespace: namespace, Name: index}, - &extcommbev1alpha1.EXTCOMMIndexSpec{ - Type: testType, - SubType: string(extcommbev1alpha1.ExtendedCommunitySubType_RouteTarget), - }, - nil, - ) - - fieldErrs := idx.ValidateSyntax("") - if len(fieldErrs) != 0 { - return nil, fmt.Errorf("syntax errors %v", fieldErrs) - } - return idx, nil -} - -func (r testCtx) getDynamicClaim(index, testType string) (*extcommbev1alpha1.EXTCOMMClaim, error) { - claim := extcommbev1alpha1.BuildEXTCOMMClaim( - metav1.ObjectMeta{Namespace: namespace, Name: r.name}, - &extcommbev1alpha1.EXTCOMMClaimSpec{ - Index: index, - ClaimLabels: commonv1alpha1.ClaimLabels{ - UserDefinedLabels: commonv1alpha1.UserDefinedLabels{Labels: r.labels}, - Selector: r.selector, - }, - }, - nil, - ) - fielErrList := claim.ValidateSyntax(testType) // this expands the ownerRef in the spec - if len(fielErrList) != 0 { - return nil, fmt.Errorf("invalid syntax %v", fielErrList) - } - return claim, nil -} - -func (r testCtx) getStaticClaim(index, testType string) (*extcommbev1alpha1.EXTCOMMClaim, error) { - claim := extcommbev1alpha1.BuildEXTCOMMClaim( - metav1.ObjectMeta{Namespace: namespace, Name: r.name}, - &extcommbev1alpha1.EXTCOMMClaimSpec{ - Index: index, - ID: ptr.To[int64](int64(r.id)), - ClaimLabels: commonv1alpha1.ClaimLabels{ - UserDefinedLabels: commonv1alpha1.UserDefinedLabels{Labels: r.labels}, - }, - }, - nil, - ) - fielErrList := claim.ValidateSyntax(testType) // this expands the ownerRef in the spec - if len(fielErrList) != 0 { - return nil, fmt.Errorf("invalid syntax %v", fielErrList) - } - return claim, nil -} - -func (r testCtx) getRangeClaim(index, testType string) (*extcommbev1alpha1.EXTCOMMClaim, error) { - claim := extcommbev1alpha1.BuildEXTCOMMClaim( - metav1.ObjectMeta{Namespace: namespace, Name: r.name}, - &extcommbev1alpha1.EXTCOMMClaimSpec{ - Index: index, - Range: ptr.To[string](r.tRange), - ClaimLabels: commonv1alpha1.ClaimLabels{ - UserDefinedLabels: commonv1alpha1.UserDefinedLabels{Labels: r.labels}, - }, - }, - nil, - ) - fielErrList := claim.ValidateSyntax(testType) // this expands the ownerRef in the spec - if len(fielErrList) != 0 { - return nil, fmt.Errorf("invalid syntax %v", fielErrList) - } - return claim, nil -} diff --git a/pkg/backend/extcomm/extcomm_index_test.go b/pkg/backend/extcomm/extcomm_index_test.go deleted file mode 100644 index 13198af..0000000 --- a/pkg/backend/extcomm/extcomm_index_test.go +++ /dev/null @@ -1,53 +0,0 @@ -package extcomm - -import ( - "context" - "testing" - - "github.com/kuidio/kuid/pkg/backend/backend" - "github.com/stretchr/testify/assert" - "k8s.io/apimachinery/pkg/runtime/schema" - extcommbev1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" -) - -func TestIndex(t *testing.T) { - tests := map[string]struct { - index string - testType string - }{ - "CreateDelete-2ByteAS": { - index: "a", - testType: string(extcommbev1alpha1.ExtendedCommunityType_2byteAS), - }, - "CreateDelete-4ByteAS": { - index: "a", - testType: string(extcommbev1alpha1.ExtendedCommunityType_4byteAS), - }, - "CreateDelete-IPv4Address": { - index: "a", - testType: string(extcommbev1alpha1.ExtendedCommunityType_IPv4Address), - }, - "CreateDelete-Opaque": { - index: "a", - testType: string(extcommbev1alpha1.ExtendedCommunityType_Opaque), - }, - } - - for name, tc := range tests { - t.Run(name, func(t *testing.T) { - be := backend.New(nil, nil, nil, nil, nil, schema.GroupVersionKind{}, schema.GroupVersionKind{}) - ctx := context.Background() - index, err := getIndex(tc.index, tc.testType) - assert.NoError(t, err) - if err := be.CreateIndex(ctx, index); err != nil { - assert.Error(t, err) - } - if err := be.DeleteIndex(ctx, index); err != nil { - assert.Error(t, err) - } - if err := be.DeleteIndex(ctx, index); err != nil { - assert.Error(t, err) - } - }) - } -} diff --git a/pkg/backend/extcomm/extcomm_test.go b/pkg/backend/extcomm/extcomm_test.go deleted file mode 100644 index b08a1ce..0000000 --- a/pkg/backend/extcomm/extcomm_test.go +++ /dev/null @@ -1,133 +0,0 @@ -package extcomm - -import ( - "context" - "fmt" - "testing" - - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - extcommbev1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" - backendbe "github.com/kuidio/kuid/pkg/backend/backend" - "github.com/stretchr/testify/assert" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/types" - "k8s.io/utils/ptr" -) - -func Test(t *testing.T) { - tests := map[string]struct { - index string - ctxs []testCtx - }{ - "Mix": { - index: "a", - ctxs: []testCtx{ - {claimType: dynamicClaim, name: "claim1", expectedError: false, expectedID: ptr.To[uint64](0)}, - {claimType: staticClaim, name: "claim2", id: 100, expectedError: false}, - {claimType: staticClaim, name: "claim3", id: 4000, expectedError: false}, - {claimType: rangeClaim, name: "claim4", tRange: "10-19", expectedError: false}, - {claimType: rangeClaim, name: "claim4", tRange: "11-19", expectedError: false}, // reclaim - {claimType: rangeClaim, name: "claim5", tRange: "5-10", expectedError: false}, // claim a new entry - {claimType: rangeClaim, name: "claim6", tRange: "19-100", expectedError: true}, // overlap - {claimType: staticClaim, name: "claim7", id: 12, expectedError: false}, - {claimType: staticClaim, name: "claim7", id: 13, expectedError: false}, // reclaim an existing id - {claimType: dynamicClaim, name: "claim8", selector: &metav1.LabelSelector{ - MatchLabels: map[string]string{backend.KuidClaimNameKey: "claim4"}, - }, expectedError: false, expectedID: ptr.To[uint64](11)}, // a dynamic claim from a range - {claimType: dynamicClaim, name: "claim9", selector: &metav1.LabelSelector{ - MatchLabels: map[string]string{backend.KuidClaimNameKey: "claim4"}, - }, expectedError: false, expectedID: ptr.To[uint64](12)}, // a dynamic claim from a range that was claimed before - {claimType: dynamicClaim, name: "claim10", selector: &metav1.LabelSelector{ - MatchLabels: map[string]string{backend.KuidClaimNameKey: "claim4"}, - }, expectedError: false, expectedID: ptr.To[uint64](14)}, - {claimType: dynamicClaim, name: "claim10", selector: &metav1.LabelSelector{ - MatchLabels: map[string]string{backend.KuidClaimNameKey: "claim4"}, // update - }, expectedError: false, expectedID: ptr.To[uint64](14)}, - {claimType: rangeClaim, name: "claim4", tRange: "11-19", expectedError: false}, // update - }, - }, - } - - for name, tc := range tests { - tc := tc - - testTypes := []string{ - string(extcommbev1alpha1.ExtendedCommunityType_2byteAS), - string(extcommbev1alpha1.ExtendedCommunityType_4byteAS), - string(extcommbev1alpha1.ExtendedCommunityType_IPv4Address), - //string(extcommbev1alpha1.ExtendedCommunityType_Opaque), - } - - for _, testType := range testTypes { - t.Run(name, func(t *testing.T) { - be := backendbe.New(nil, nil, nil, nil, nil, schema.GroupVersionKind{}, schema.GroupVersionKind{}) - ctx := context.Background() - if tc.index != "" { - index, err := getIndex(tc.index, testType) - assert.NoError(t, err) - err = be.CreateIndex(ctx, index) - assert.NoError(t, err) - } - - for _, v := range tc.ctxs { - v := v - var claim *extcommbev1alpha1.EXTCOMMClaim - var err error - - switch v.claimType { - case staticClaim: - claim, err = v.getStaticClaim(tc.index, testType) - case dynamicClaim: - claim, err = v.getDynamicClaim(tc.index, testType) - case rangeClaim: - claim, err = v.getRangeClaim(tc.index, testType) - } - assert.NoError(t, err) - if err != nil { - return - } - - err = be.Claim(ctx, claim) - if v.expectedError { - assert.Error(t, err) - continue - } else { - assert.NoError(t, err) - } - switch v.claimType { - case staticClaim, dynamicClaim: - if claim.Status.ID == nil { - t.Errorf("expecting status id got nil") - } else { - expectedID := v.id - if v.expectedID != nil { - expectedID = *v.expectedID - } - if uint64(*claim.Status.ID) != expectedID { - t.Errorf("expecting id got %d, want %d\n", *claim.Status.ID, expectedID) - } - } - case rangeClaim: - if claim.Status.Range == nil { - t.Errorf("expecting status id got nil") - } else { - expectedRange := v.tRange - if v.expectedRange != nil { - expectedRange = *v.expectedRange - } - if *claim.Status.Range != expectedRange { - t.Errorf("expecting range got %s, want %s\n", *claim.Status.Range, expectedRange) - } - } - } - fmt.Println("entries after claim", v.name) - key := store.KeyFromNSN(types.NamespacedName{Namespace: namespace, Name: tc.index}) - err = be.PrintEntries(ctx, key) - assert.NoError(t, err) - } - }) - } - } -} diff --git a/pkg/backend/generic/applicator.go b/pkg/backend/generic/applicator.go new file mode 100644 index 0000000..ba26736 --- /dev/null +++ b/pkg/backend/generic/applicator.go @@ -0,0 +1,140 @@ +package generic + +import ( + "context" + "errors" + "fmt" + + "github.com/henderiw/idxtable/pkg/table" + "github.com/henderiw/idxtable/pkg/tree" + "github.com/henderiw/logger/log" + "github.com/henderiw/store" + "github.com/kuidio/kuid/apis/backend" + "k8s.io/utils/ptr" +) + +type Applicator interface { + Validate(ctx context.Context, claim backend.ClaimObject) error + Apply(ctx context.Context, claim backend.ClaimObject) error + Delete(ctx context.Context, claim backend.ClaimObject) error +} + +type applicator struct { + cacheInstanceCtx *CacheInstanceContext +} + +func (r *applicator) getEntriesByOwner(_ context.Context, claim backend.ClaimObject) (map[string]tree.Entries, error) { + treeEntries := map[string]tree.Entries{} + ownerSelector, err := claim.GetOwnerSelector() + if err != nil { + return nil, err + } + claimType := claim.GetClaimType() + // treeEntries with empty string is the root tree + treeEntries[""] = r.cacheInstanceCtx.tree.GetByLabel(ownerSelector) + if claimType == backend.ClaimType_Range { + // for range claims we return + return treeEntries, nil + } + // this is a NOT a range claim -> static or dynamic claim + if len(treeEntries) != 0 && len(treeEntries[""]) > 1 { + return treeEntries, fmt.Errorf("multiple entries match the owner, %v", treeEntries[""]) + } + var errs error + r.cacheInstanceCtx.ranges.List(func(k store.Key, t table.Table) { + treeEntries[k.Name] = t.GetByLabel(ownerSelector) + if len(treeEntries[k.Name]) > 1 { + errs = errors.Join(errs, fmt.Errorf("multiple entries match the owner, %v", treeEntries[k.Name])) + return + } + }) + if errs != nil { + return nil, errs + } + return treeEntries, nil +} + +func (r *applicator) delete(ctx context.Context, claim backend.ClaimObject) error { + existingEntries, err := r.getEntriesByOwner(ctx, claim) + if err != nil { + return err + } + + for treeName, existingEntries := range existingEntries { + for _, existingEntry := range existingEntries { + if treeName == "" { + r.cacheInstanceCtx.tree.ReleaseID(existingEntry.ID()) + } else { + k := store.ToKey(treeName) + if table, err := r.cacheInstanceCtx.ranges.Get(k); err == nil { + if err := table.Release(existingEntry.ID().ID()); err != nil { + return err + } + } + } + } + } + return nil +} + +func (r *applicator) getEntriesByLabelSelector(ctx context.Context, claim backend.ClaimObject) tree.Entries { + log := log.FromContext(ctx) + labelSelector, err := claim.GetLabelSelector() + if err != nil { + log.Error("cannot get label selector", "error", err.Error()) + return nil + } + return r.cacheInstanceCtx.tree.GetByLabel(labelSelector) +} + +func reclaimIDFromExisitingEntries(existingEntries map[string]tree.Entries, id uint64) (*uint64, string) { + for treeName, existingEntries := range existingEntries { + for _, existingEntry := range existingEntries { + if id == existingEntry.ID().ID() { + return &id, treeName + } + } + } + return nil, "" +} + +func claimIDFromExisitingEntries(existingEntries map[string]tree.Entries) (*uint64, string) { + for treeName, existingEntries := range existingEntries { + for _, existingEntry := range existingEntries { + return ptr.To[uint64](existingEntry.ID().ID()), treeName + } + } + return nil, "" +} + +func (r *applicator) deleteNonClaimedEntries(_ context.Context, existingEntries map[string]tree.Entries, id *uint64, reclaimTreeName string) error { + for treeName, existingEntries := range existingEntries { + for _, existingEntry := range existingEntries { + if id != nil && *id == existingEntry.ID().ID() && reclaimTreeName == treeName { + continue + } + if treeName == "" { + r.cacheInstanceCtx.tree.ReleaseID(existingEntry.ID()) + } else { + k := store.ToKey(treeName) + if table, err := r.cacheInstanceCtx.ranges.Get(k); err == nil { + if err := table.Release(existingEntry.ID().ID()); err != nil { + return err + } + } + } + } + } + return nil +} + +func isReserved(parentName, index string) bool { + // given we use the ownerreference with index in the kind the parentName and index + // match when we check for reserved fields + // This means a range cannot be defined using the name of the index + return parentName == index + /* + return parentName == fmt.Sprintf("%s.%s", index, backend.IndexReservedMaxName) || + parentName == fmt.Sprintf("%s.%s", index, backend.IndexReservedMinName) + */ +} diff --git a/pkg/backend/generic/applicator_dynamic_id.go b/pkg/backend/generic/applicator_dynamic_id.go new file mode 100644 index 0000000..6bc1a23 --- /dev/null +++ b/pkg/backend/generic/applicator_dynamic_id.go @@ -0,0 +1,156 @@ +/* +Copyright 2024 Nokia. + +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 generic + +import ( + "context" + "fmt" + + "github.com/henderiw/logger/log" + "github.com/henderiw/store" + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/backend" + "k8s.io/utils/ptr" +) + +type dynamicApplicator struct { + name string + applicator +} + +func (r *dynamicApplicator) Validate(ctx context.Context, claim backend.ClaimObject) error { + return nil +} + +// validateExists will validate if the id specified in the claim exists already. +// If so it will reclaim it and update the parentTreeName (this is to ensure the claim reclaims it from the proper tree/table) +// if no entry exist it will keep r.claimID to nil +// On top the entries that were not claimed are cleaned up, such that we delete entries that are +// void. E.g. this takes care of the fact that a use changed the static ID as the reclaim failed +// so the remaining entry is cleaned up +func (r *dynamicApplicator) validateExists(ctx context.Context, claim backend.ClaimObject) (*uint64, string, error) { + existingEntries, err := r.getEntriesByOwner(ctx, claim) + if err != nil { + return nil, "", err + } + + var claimID *uint64 + var claimTreeName string + if claim.GetStatusID() != nil { + claimID, claimTreeName = reclaimIDFromExisitingEntries(existingEntries, *claim.GetStatusID()) + } else { + claimID, claimTreeName = claimIDFromExisitingEntries(existingEntries) + } + // remove the existing entries that don't match the claimed ID + // should be none, but just in case + if err := r.deleteNonClaimedEntries(ctx, existingEntries, claimID, claimTreeName); err != nil { + return nil, "", err + } + + return claimID, claimTreeName, nil +} + +// There are 2 scenario's. +// without a label selector: this claims from the main tree +// with a label selector: we expect a parent as this claims from a range +func (r *dynamicApplicator) getParentContext(ctx context.Context, claim backend.ClaimObject) (string, error) { + // get entries by labelSelector if the label selector is defined + if claim.GetSelector() == nil { + // this is a dynamic claim for the main tree + return "", nil + } + // this is a allocation for a range + parentEntries := r.getEntriesByLabelSelector(ctx, claim) + + if len(parentEntries) == 0 { + return "", fmt.Errorf("no parent found") + } + + // validate if all parents are from the same range + for _, parentEntry := range parentEntries { + labels := parentEntry.Labels() + parentClaimType := backend.GetClaimTypeFromString(labels[backend.KuidClaimTypeKey]) + if parentClaimType == backend.ClaimType_Range { + return labels[backend.KuidClaimNameKey], nil + } else { + return "", fmt.Errorf("a parent can only be a range, got: %s", string(parentClaimType)) + } + } + return "", nil +} + +func (r *dynamicApplicator) Apply(ctx context.Context, claim backend.ClaimObject) error { + log := log.FromContext(ctx).With("name", claim.GetName()) + log.Debug("dynamic claim") + + claimID, parentTreeName, err := r.validateExists(ctx, claim) + if err != nil { + return err + } + if claimID == nil { + parentTreeName, err = r.getParentContext(ctx, claim) + if err != nil { + return err + } + } + + if isReserved(parentTreeName, claim.GetIndex()) { + return fmt.Errorf("cannot claim from a reserved range") + } + + if parentTreeName == "" { + if claimID != nil { + if err := r.cacheInstanceCtx.tree.Update(claim.GetClaimID(r.cacheInstanceCtx.Type(), *claimID), claim.GetClaimLabels()); err != nil { + return err + } + } else { + e, err := r.cacheInstanceCtx.tree.ClaimFree(claim.GetClaimLabels()) + if err != nil { + return err + } + claimID = ptr.To[uint64](e.ID().ID()) + } + } else { + k := store.ToKey(parentTreeName) + table, err := r.cacheInstanceCtx.ranges.Get(k) + if err != nil { + return fmt.Errorf("selectAddress range does not have corresponding range table: err: %s", err.Error()) + } + if claimID != nil { + if err := table.Update(*claimID, claim.GetClaimLabels()); err != nil { + return err + } + } else { + e, err := table.ClaimFree(claim.GetClaimLabels()) + if err != nil { + return err + } + claimID = ptr.To[uint64](e.ID().ID()) + } + } + if claimID == nil { + return fmt.Errorf("claimed failed, no claim ID found") + } + claim.SetStatusID(claimID) + claim.SetConditions(condition.Ready()) + return nil +} + +func (r *dynamicApplicator) Delete(ctx context.Context, claim backend.ClaimObject) error { + // this is a generic delete by owner + return r.delete(ctx, claim) +} diff --git a/pkg/backend/generic/applicator_static_id.go b/pkg/backend/generic/applicator_static_id.go new file mode 100644 index 0000000..969105d --- /dev/null +++ b/pkg/backend/generic/applicator_static_id.go @@ -0,0 +1,152 @@ +/* +Copyright 2024 Nokia. + +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 generic + +import ( + "context" + "fmt" + + "github.com/henderiw/logger/log" + "github.com/henderiw/store" + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/backend" +) + +type staticApplicator struct { + name string + applicator +} + +func (r *staticApplicator) Validate(ctx context.Context, claim backend.ClaimObject) error { + //log := log.FromContext(ctx) + if claim.GetStaticID() == nil { + return fmt.Errorf("cannot claim a static id without an id") + } + + return nil +} + +func (r *staticApplicator) Apply(ctx context.Context, claim backend.ClaimObject) error { + + claimID, parentTreeName, err := r.validateExists(ctx, claim) + if err != nil { + return err + } + if claimID == nil { + parentTreeName, err = r.getParentContext(ctx, claim) + if err != nil { + return err + } + } + if isReserved(parentTreeName, claim.GetIndex()) { + return fmt.Errorf("cannot claim an id from a reserved range") + } + if parentTreeName == "" { + // a claim in the main tree + if claimID != nil { + if err := r.cacheInstanceCtx.tree.Update(claim.GetClaimID(r.cacheInstanceCtx.Type(), *claimID), claim.GetClaimLabels()); err != nil { + return err + } + } else { + if err := r.cacheInstanceCtx.tree.ClaimID(claim.GetStaticTreeID(r.cacheInstanceCtx.Type()), claim.GetClaimLabels()); err != nil { + return err + } + } + } else { + // a claim in a range + k := store.ToKey(parentTreeName) + table, err := r.cacheInstanceCtx.ranges.Get(k) + if err != nil { + return fmt.Errorf("selectAddress range does not have corresponding range table: err: %s", err.Error()) + } + if claimID != nil { + if err := table.Update(*claim.GetStaticID(), claim.GetClaimLabels()); err != nil { + return err + } + } else { + if err := table.Claim(*claim.GetStaticID(), claim.GetClaimLabels()); err != nil { + return err + } + } + } + claim.SetStatusID(claim.GetStaticID()) + claim.SetConditions(condition.Ready()) + return nil +} + +// validateExists will validate if the id specified in the claim exists already. +// If so it will reclaim it and update the parentTreeName (this is to ensure the claim reclaims it from the proper tree/table) +// if no entry exist it will keep r.claimID to nil +// On top the entries that were not claimed are cleaned up, such that we delete entries that are +// void. E.g. this takes care of the fact that a use changed the static ID as the reclaim failed +// so the remaining entry is cleaned up +func (r *staticApplicator) validateExists(ctx context.Context, claim backend.ClaimObject) (*uint64, string, error) { + existingEntries, err := r.getEntriesByOwner(ctx, claim) + if err != nil { + return nil, "", err + } + + claimID, claimTreeName := reclaimIDFromExisitingEntries(existingEntries, *claim.GetStaticID()) + // remove the existing entries that done match the claimed ID + // should be none, but just in case + if err := r.deleteNonClaimedEntries(ctx, existingEntries, claimID, claimTreeName); err != nil { + return nil, "", err + } + return claimID, claimTreeName, nil +} + +func (r *staticApplicator) getParentContext(ctx context.Context, claim backend.ClaimObject) (string, error) { + log := log.FromContext(ctx).With("name", claim.GetName()) + + entry, err := r.cacheInstanceCtx.tree.Get(claim.GetStaticTreeID(r.cacheInstanceCtx.Type())) + if err == nil { + // entry exists + labels := entry.Labels() + // a range can overlap so we return the entry as a parent if the entry match and it is a range + claimType := backend.GetClaimTypeFromString(labels[backend.KuidClaimTypeKey]) + if claimType == backend.ClaimType_Range { + return labels[backend.KuidClaimNameKey], nil + } else { + // This should always result in a different owner + // since we checked the claimed entries before + if err := claim.ValidateOwner(labels); err != nil { + return "", err + } + return "", nil + } + } + parentEntries := r.cacheInstanceCtx.tree.Parents(claim.GetStaticTreeID(r.cacheInstanceCtx.Type())) + if len(parentEntries) > 1 { + log.Error("got multiple parent entries", "entries", parentEntries) + return "", fmt.Errorf("multiple parent entries %v", parentEntries) + } + for _, parentEntry := range parentEntries { + labels := parentEntry.Labels() + parentClaimType := backend.GetClaimTypeFromString(labels[backend.KuidClaimTypeKey]) + if parentClaimType == backend.ClaimType_Range { + return labels[backend.KuidClaimNameKey], nil + } else { + log.Error("got parent which is not a range", "entry", parentEntry) + return "", fmt.Errorf("got parent which is not a range %s", labels[backend.KuidClaimTypeKey]) + } + } + return "", nil +} + +func (r *staticApplicator) Delete(ctx context.Context, claim backend.ClaimObject) error { + return r.delete(ctx, claim) +} diff --git a/pkg/backend/generic/applicator_static_range.go b/pkg/backend/generic/applicator_static_range.go new file mode 100644 index 0000000..554018c --- /dev/null +++ b/pkg/backend/generic/applicator_static_range.go @@ -0,0 +1,167 @@ +/* +Copyright 2024 Nokia. + +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 generic + +import ( + "context" + "fmt" + + "github.com/henderiw/store" + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/backend" +) + +type rangeApplicator struct { + name string + applicator + rangeExists bool +} + +// when a range changes the start and stop we delete the range +// and recreate it. All the children will be deleted as well +func (r *rangeApplicator) Validate(ctx context.Context, claim backend.ClaimObject) error { + //log := log.FromContext(ctx) + + // reclaimRange gets the existing entries based on owner + // -> 3 scenarios: none exist, they all exist, some exist + // -> none exist -> claim them + // -> they all exist -> reclaim them + // -> same exist -> delete them including the children and reclaim the new range after the entries + // have been deleted + exists, err := r.validateExists(ctx, claim) + if err != nil { + return err + } + if !exists { + // we need to validate if there are no children + if err := r.validateRangeOverlap(ctx, claim); err != nil { + return err + } + } + r.rangeExists = exists + return nil +} + +// reclaimRange gets the existing entries based on owner +// -> 3 scenarios: none exist, they all exist, some exist +// -> none exist -> claim them +// -> they all exist -> reclaim them +// -> same exist -> delete them including the children and reclaim the new range aftre the entries +// have been deleted +func (r *rangeApplicator) validateExists(ctx context.Context, claim backend.ClaimObject) (bool, error) { + arange, err := claim.GetRangeID(r.cacheInstanceCtx.Type()) + if err != nil { + return false, err + } + rangeExists := true // we are optimistic and set the claimset to true since we have entries + claimSet := map[string]struct{}{} + for _, rangeID := range arange.IDs() { + claimSet[rangeID.String()] = struct{}{} + } + + existingEntries, err := r.getEntriesByOwner(ctx, claim) + if err != nil { + return false, err + } + // delete the + for treeName, existingEntries := range existingEntries { + if treeName != "" { + return false, fmt.Errorf("cannot have a range in non root tree: %s", treeName) + } + for _, existingEntry := range existingEntries { + delete(claimSet, existingEntry.ID().String()) + } + } + + if len(claimSet) != 0 { + // cleanup + rangeExists = false + // remove all entries as the range change + if err := r.deleteNonClaimedEntries(ctx, existingEntries, nil, ""); err != nil { + return false, err + } + k := store.ToKey(claim.GetName()) + if _, err := r.cacheInstanceCtx.ranges.Get(k); err == nil { + // exists + if err := r.cacheInstanceCtx.ranges.Delete(k); err != nil { + return false, err + } + } + } + // all good -> they either all exist or none exists or we cleaned up + return rangeExists, nil +} + +func (r *rangeApplicator) validateRangeOverlap(_ context.Context, claim backend.ClaimObject) error { + arange, err := claim.GetRangeID(r.cacheInstanceCtx.Type()) + if err != nil { + return err + } + for _, id := range arange.IDs() { + entry, err := r.cacheInstanceCtx.tree.Get(id) + if err == nil { + // this shouls always fail since the range existance was already validated + labels := entry.Labels() + if err := claim.ValidateOwner(labels); err != nil { + return err + } + } + childEntries := r.cacheInstanceCtx.tree.Children(id) + if len(childEntries) != 0 { + return fmt.Errorf("range overlaps with children: %v", childEntries) + } + parentEntries := r.cacheInstanceCtx.tree.Parents(id) + if len(parentEntries) > 0 { + return fmt.Errorf("range overlaps with parent: %v", parentEntries) + } + } + return nil +} + +func (r *rangeApplicator) Apply(ctx context.Context, claim backend.ClaimObject) error { + arange, err := claim.GetRangeID(r.cacheInstanceCtx.Type()) + if err != nil { + return err + } + for _, id := range arange.IDs() { + if r.rangeExists { + if err := r.cacheInstanceCtx.tree.Update(id, claim.GetClaimLabels()); err != nil { + return err + } + } else { + if err := r.cacheInstanceCtx.tree.ClaimID(id, claim.GetClaimLabels()); err != nil { + return err + } + } + + } + k := store.ToKey(claim.GetName()) + if _, err := r.cacheInstanceCtx.ranges.Get(k); err != nil { + //table := table.New(uint32(arange.From().ID()), uint32(arange.To().ID())) + table := claim.GetTable(r.cacheInstanceCtx.Type(), arange.From().ID(), arange.To().ID()) + if err := r.cacheInstanceCtx.ranges.Create(k, table); err != nil { + return err + } + } + claim.SetStatusRange(claim.GetRange()) + claim.SetConditions(condition.Ready()) + return nil +} + +func (r *rangeApplicator) Delete(ctx context.Context, claim backend.ClaimObject) error { + return r.delete(ctx, claim) +} diff --git a/pkg/backend/generic/backend.go b/pkg/backend/generic/backend.go new file mode 100644 index 0000000..76be800 --- /dev/null +++ b/pkg/backend/generic/backend.go @@ -0,0 +1,221 @@ +package generic + +import ( + "context" + "errors" + "fmt" + "sync" + + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/henderiw/logger/log" + "github.com/henderiw/store" + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/backend" + bebackend "github.com/kuidio/kuid/pkg/backend" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apiserver/pkg/registry/rest" +) + +func New( + claimKind string, + //indexGVK schema.GroupVersionKind, + //claimGVK schema.GroupVersionKind, + //entryGVK schema.GroupVersionKind, + indexObjectFn func(runtime.Object) (backend.IndexObject, error), + claimObjectFn func(runtime.Object) (backend.ClaimObject, error), + entryObjectFn func(runtime.Object) (backend.EntryObject, error), + entryFromCacheFn func(k store.Key, vrange, id string, labels map[string]string) backend.EntryObject, +) bebackend.Backend { + + cache := bebackend.NewCache[*CacheInstanceContext]() + + return &be{ + cache: cache, + claimKind: claimKind, + //indexGVK: indexGVK, + //claimGVK: claimGVK, + //entryGVK: entryGVK, + indexObjectFn: indexObjectFn, + claimObjectFn: claimObjectFn, + entryObjectFn: entryObjectFn, + entryFromCacheFn: entryFromCacheFn, + } +} + +type be struct { + cache bebackend.Cache[*CacheInstanceContext] + m sync.RWMutex + claimKind string + //indexGVK schema.GroupVersionKind + //claimGVK schema.GroupVersionKind + //entryGVK schema.GroupVersionKind + indexObjectFn func(runtime.Object) (backend.IndexObject, error) + claimObjectFn func(runtime.Object) (backend.ClaimObject, error) + entryObjectFn func(runtime.Object) (backend.EntryObject, error) + entryFromCacheFn func(k store.Key, vrange, id string, labels map[string]string) backend.EntryObject + // added later + entryStorage *registry.Store + claimStorage *registry.Store +} + +func (r *be) AddStorage(entryStorage, claimStorage rest.Storage) error { + entrystore, ok := entryStorage.(*registry.Store) + if !ok { + return errors.New("entry store is not a *registry.Store") + } + r.entryStorage = entrystore + claimstore, ok := claimStorage.(*registry.Store) + if !ok { + return errors.New("claim store is not a *registry.Store") + } + r.claimStorage = claimstore + return nil +} + +// CreateIndex creates a backend index +func (r *be) CreateIndex(ctx context.Context, obj runtime.Object) error { + //r.m.Lock() + //defer r.m.Unlock() + index, err := r.indexObjectFn(obj) + if err != nil { + return err + } + ctx = bebackend.InitIndexContext(ctx, "create", index) + log := log.FromContext(ctx) + log.Debug("start") + key := index.GetKey() + + log.Debug("start", "isInitialized", r.cache.IsInitialized(ctx, key)) + // if the Cache is not initialized -> restore the cache + // this happens upon initialization or backend restart + if _, err := r.cache.Get(ctx, key); err != nil { + // if it does not exist create the cache + cacheInstanceCtx := NewCacheInstanceContext(index.GetTree(), index.GetType()) + r.cache.Create(ctx, key, cacheInstanceCtx) + } + + if !r.cache.IsInitialized(ctx, key) { + if err := r.restore(ctx, index); err != nil { + log.Error("cannot restore index", "error", err.Error()) + return err + } + log.Debug("restored") + index.SetConditions(condition.Ready()) + obj = index + + return r.cache.SetInitialized(ctx, key) + } + log.Debug("finished") + return nil +} + +// DeleteIndex deletes a backend index +func (r *be) DeleteIndex(ctx context.Context, obj runtime.Object) error { + r.m.Lock() + defer r.m.Unlock() + objidx, err := r.indexObjectFn(obj) + if err != nil { + return err + } + ctx = bebackend.InitIndexContext(ctx, "delete", objidx) + log := log.FromContext(ctx) + log.Debug("start") + key := objidx.GetKey() + + log.Debug("start", "isInitialized", r.cache.IsInitialized(ctx, key)) + // delete the data from the backend + if err := r.destroy(ctx, key); err != nil { + log.Error("cannot delete Index", "error", err.Error()) + return err + } + r.cache.Delete(ctx, key) + + log.Debug("finished") + return nil +} + +func (r *be) Claim(ctx context.Context, obj runtime.Object) error { + r.m.Lock() + defer r.m.Unlock() + claim, err := r.claimObjectFn(obj) + if err != nil { + return err + } + + ctx = bebackend.InitClaimContext(ctx, "create", claim) + log := log.FromContext(ctx) + log.Debug("start") + + cacheCtx, err := r.cache.Get(ctx, claim.GetKey()) + if err != nil { + return err + } + if !r.cache.IsInitialized(ctx, claim.GetKey()) { + return fmt.Errorf("cache not initialized") + } + + a, err := getApplicator(ctx, cacheCtx, claim) + if err != nil { + return err + } + if err := a.Validate(ctx, claim); err != nil { + return err + } + if err := a.Apply(ctx, claim); err != nil { + return err + } + // store the resources in the backend + if err := r.saveAll(ctx, claim.GetKey()); err != nil { + return err + } + obj = claim + return nil +} + +func (r *be) Release(ctx context.Context, obj runtime.Object) error { + r.m.Lock() + defer r.m.Unlock() + claim, err := r.claimObjectFn(obj) + if err != nil { + return err + } + + ctx = bebackend.InitClaimContext(ctx, "delete", claim) + log := log.FromContext(ctx) + log.Debug("start") + + cacheCtx, err := r.cache.Get(ctx, claim.GetKey()) + if err != nil { + return err + } + if !r.cache.IsInitialized(ctx, claim.GetKey()) { + return fmt.Errorf("cache not initialized") + } + + a, err := getApplicator(ctx, cacheCtx, claim) + if err != nil { + return err + } + if err := a.Delete(ctx, claim); err != nil { + return err + } + + return r.saveAll(ctx, claim.GetKey()) +} + +func getApplicator(_ context.Context, cacheInstanceCtx *CacheInstanceContext, claim backend.ClaimObject) (Applicator, error) { + claimType := claim.GetClaimType() + var a Applicator + switch claimType { + case backend.ClaimType_DynamicID: + a = &dynamicApplicator{name: string(claimType), applicator: applicator{cacheInstanceCtx: cacheInstanceCtx}} + case backend.ClaimType_StaticID: + a = &staticApplicator{name: string(claimType), applicator: applicator{cacheInstanceCtx: cacheInstanceCtx}} + case backend.ClaimType_Range: + a = &rangeApplicator{name: string(claimType), applicator: applicator{cacheInstanceCtx: cacheInstanceCtx}} + default: + return nil, fmt.Errorf("invalid addressing, got: %s", string(claimType)) + } + + return a, nil +} diff --git a/pkg/backend/generic/backend_store.go b/pkg/backend/generic/backend_store.go new file mode 100644 index 0000000..4de7b8e --- /dev/null +++ b/pkg/backend/generic/backend_store.go @@ -0,0 +1,364 @@ +package generic + +import ( + "context" + "errors" + "fmt" + + "github.com/henderiw/idxtable/pkg/table" + "github.com/henderiw/logger/log" + "github.com/henderiw/store" + "github.com/kform-dev/choreo/pkg/server/apiserver/rest" + "github.com/kuidio/kuid/apis/backend" + bebackend "github.com/kuidio/kuid/pkg/backend" + "k8s.io/apimachinery/pkg/apis/meta/internalversion" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/sets" +) + +func (r *be) restore(ctx context.Context, index backend.IndexObject) error { + log := log.FromContext(ctx) + + k := index.GetKey() + + cacheInstanceCtx, err := r.cache.Get(ctx, k) + if err != nil { + log.Error("cannot get index", "error", err.Error()) + return err + } + + // Fetch the current entries that were stored + curEntries, err := r.listEntries(ctx, k) + if err != nil { + return err + } + + claimmap, err := r.listClaims(ctx, k) + if err != nil { + return nil + } + + if err := r.restoreMinMaxRanges(ctx, cacheInstanceCtx, curEntries, index); err != nil { + return err + } + + if err := r.restoreClaims(ctx, cacheInstanceCtx, curEntries, backend.ClaimType_Range, claimmap); err != nil { + return err + } + if err := r.restoreClaims(ctx, cacheInstanceCtx, curEntries, backend.ClaimType_StaticID, claimmap); err != nil { + return err + } + if err := r.restoreClaims(ctx, cacheInstanceCtx, curEntries, backend.ClaimType_DynamicID, claimmap); err != nil { + return err + } + + log.Debug("restore entries left", "items", len(curEntries)) + + return nil +} + +func (r *be) saveAll(ctx context.Context, k store.Key) error { + log := log.FromContext(ctx) + log.Debug("SaveAll") + + newEntries, err := r.getEntriesFromCache(ctx, k) + if err != nil { + return err + } + + curEntries, err := r.listEntries(ctx, k) + if err != nil { + return err + } + + // debug end + for _, newEntry := range newEntries { + newEntry := newEntry + found := false + //var entry backend.EntryObject + for idx, curEntry := range curEntries { + idx := idx + curEntry := curEntry + if curEntry.GetNamespacedName() == newEntry.GetNamespacedName() { + // delete the current entry + curEntries = append(curEntries[:idx], curEntries[idx+1:]...) + //found = true + //entry = curEntry + break + } + } + + newuobj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(newEntry) + if err != nil { + return err + } + newu := &unstructured.Unstructured{ + Object: newuobj, + } + + if !found { + if _, err := r.entryStorage.Create(ctx, newu, nil, &metav1.CreateOptions{ + FieldManager: "backend", + }); err != nil { + log.Error("saveAll create failed", "name", newEntry.GetName(), "error", err.Error()) + return err + } + continue + } + olduobj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(newEntry) + if err != nil { + return err + } + oldu := &unstructured.Unstructured{ + Object: olduobj, + } + + oldu.Object["spec"] = newu.Object["spec"] + oldu.Object["status"] = newu.Object["status"] + + //log.Debug("save all ipEntry update", "ipEntry", entry.GetName()) + + if _, err := r.entryStorage.Update(ctx, newu, &rest.ApplyOptions{FieldManager: "backend"}); err != nil { + return err + } + } + for _, curEntry := range curEntries { + if _, _, err := r.entryStorage.Delete(ctx, curEntry.GetName(), nil, &metav1.DeleteOptions{}); err != nil { + return err + } + } + return nil +} + +// Destroy removes the store db +func (r *be) destroy(ctx context.Context, k store.Key) error { + // no need to delete the index as this is what this fn is supposed to do + return r.deleteEntries(ctx, k) +} + +func (r *be) getEntriesFromCache(ctx context.Context, k store.Key) ([]backend.EntryObject, error) { + //log := log.FromContext(ctx).With("key", k.String()) + + cacheInstanceCtx, err := r.cache.Get(ctx, k) + if err != nil { + return nil, fmt.Errorf("cache index not initialized") + } + + entries := make([]backend.EntryObject, 0, cacheInstanceCtx.Size()) + // add the main rib entry + for _, entry := range cacheInstanceCtx.tree.GetAll() { + entry := entry + entries = append(entries, r.entryFromCacheFn(k, "", entry.ID().String(), entry.Labels())) + } + // add all the range entries + cacheInstanceCtx.ranges.List(func(key store.Key, t table.Table) { + for _, entry := range t.GetAll() { + entry := entry + entries = append(entries, r.entryFromCacheFn(k, key.Name, entry.ID().String(), entry.Labels())) + } + }) + + return entries, nil +} + +func (r *be) deleteEntries(ctx context.Context, k store.Key) error { + log := log.FromContext(ctx).With("key", k.String()) + + entries, err := r.listEntries(ctx, k) + if err != nil { + log.Error("cannot list entries", "error", err) + return err + } + + var errm error + for _, entry := range entries { + if _, _, err := r.entryStorage.Delete(ctx, entry.GetName(), nil, &metav1.DeleteOptions{}); err != nil { + log.Error("cannot delete entry", "error", err) + errm = errors.Join(errm, err) + continue + } + } + return errm +} + +func (r *be) listEntries(ctx context.Context, k store.Key) ([]backend.EntryObject, error) { + /* + selector, err := selector.ExprSelectorAsSelector( + &selectorv1alpha1.ExpressionSelector{ + Match: map[string]string{ + "spec.index": k.Name, + }, + }, + ) + if err != nil { + return nil, err + } + */ + list, err := r.entryStorage.List(ctx, &internalversion.ListOptions{}) + if err != nil { + return nil, err + } + + ulObj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(list) + ul := &unstructured.UnstructuredList{ + Object: ulObj, + } + + entryList := make([]backend.EntryObject, 0) + if ul.IsList() { + ul.EachListItem(func(obj runtime.Object) error { + u, ok := obj.(runtime.Unstructured) + if !ok { + return fmt.Errorf("not unstructured") + } + entryObj, err := r.entryObjectFn(u) + if err != nil { + return fmt.Errorf("not entry object") + } + if entryObj.GetIndex() == k.Name { + entryList = append(entryList, entryObj) + } + return nil + }) + } + return entryList, nil +} + +func (r *be) listClaims(ctx context.Context, k store.Key) (map[string]backend.ClaimObject, error) { + /* + selector, err := selector.ExprSelectorAsSelector( + &selectorv1alpha1.ExpressionSelector{ + Match: map[string]string{ + "spec.index": k.Name, + }, + }, + ) + if err != nil { + return nil, err + } + */ + list, err := r.entryStorage.List(ctx, &internalversion.ListOptions{}) + if err != nil { + return nil, err + } + + ulObj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(list) + ul := &unstructured.UnstructuredList{ + Object: ulObj, + } + + claimMap := make(map[string]backend.ClaimObject) + if ul.IsList() { + ul.EachListItem(func(obj runtime.Object) error { + ru, ok := obj.(runtime.Unstructured) + if !ok { + return fmt.Errorf("not unstructured") + } + claimObj, err := r.claimObjectFn(ru) + if err != nil { + return fmt.Errorf("not claim object") + } + claimMap[claimObj.GetNamespacedName().String()] = claimObj + return nil + }) + } + return claimMap, nil +} + +func (r *be) restoreMinMaxRanges(ctx context.Context, cacheInstanceCtx *CacheInstanceContext, entries []backend.EntryObject, index backend.IndexObject) error { + storedEntries := sets.New[string]() + for i := len(entries) - 1; i >= 0; i-- { + entry := entries[i] + for _, ownerref := range entry.GetOwnerReferences() { + if ownerref.APIVersion == index.GetObjectKind().GroupVersionKind().GroupVersion().Identifier() && + ownerref.Kind == index.GetObjectKind().GroupVersionKind().Kind && + ownerref.Name == index.GetName() && + ownerref.UID == index.GetUID() { + entries = append(entries[:i], entries[i+1:]...) + storedEntries.Insert(entry.GetSpecID()) + } + } + } + + if index.GetMinID() != nil && *index.GetMinID() != 0 { + claim := index.GetMinClaim() + if err := r.restoreClaim(ctx, cacheInstanceCtx, claim); err != nil { + return err + } + } + if index.GetMaxID() != nil && *index.GetMaxID() != index.GetMax() { + claim := index.GetMaxClaim() + if err := r.restoreClaim(ctx, cacheInstanceCtx, claim); err != nil { + return err + } + } + // At init when there is no entries initialized this allows to store the entries in the database + if storedEntries.Len() == 0 { + entries, err := r.getEntriesFromCache(ctx, index.GetKey()) + if err != nil { + return err + } + for _, entry := range entries { + uobj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(entry) + if err != nil { + return err + } + u := &unstructured.Unstructured{ + Object: uobj, + } + if _, err := r.entryStorage.Create(ctx, u, nil, &metav1.CreateOptions{ + FieldManager: "backend", + }); err != nil { + return err + } + } + } + return nil +} + +func (r *be) restoreClaims(ctx context.Context, cacheInstanceCtx *CacheInstanceContext, entries []backend.EntryObject, claimType backend.ClaimType, claimmap map[string]backend.ClaimObject) error { + for i := len(entries) - 1; i >= 0; i-- { + entry := entries[i] + for _, ownerref := range entry.GetOwnerReferences() { + if ownerref.Kind == r.claimKind { + if claimType == entry.GetClaimType() { + nsn := types.NamespacedName{Namespace: entry.GetNamespace(), Name: ownerref.Name} + claim, ok := claimmap[nsn.String()] + if ok { + if err := r.restoreClaim(ctx, cacheInstanceCtx, claim); err != nil { + return err + } + // remove the entry since it is processed + entries = append(entries[:i], entries[i+1:]...) + delete(claimmap, nsn.String()) // delete the entry to optimize + } + } + } + } + } + return nil +} + +func (r *be) restoreClaim(ctx context.Context, cacheInstanceCtx *CacheInstanceContext, claim backend.ClaimObject) error { + ctx = bebackend.InitClaimContext(ctx, "restore", claim) + a, err := getApplicator(ctx, cacheInstanceCtx, claim) + if err != nil { + return err + } + // validate is needed, mainly for addresses since the parent route determines + // e.g. the fact the address belongs to a range or not + errList := claim.ValidateSyntax(cacheInstanceCtx.Type()) + if len(errList) != 0 { + return fmt.Errorf("invalid syntax %v", errList) + } + if err := a.Validate(ctx, claim); err != nil { + return err + } + if err := a.Apply(ctx, claim); err != nil { + return err + } + return nil +} diff --git a/pkg/backend/generic/cache_instance.go b/pkg/backend/generic/cache_instance.go new file mode 100644 index 0000000..c80a9d6 --- /dev/null +++ b/pkg/backend/generic/cache_instance.go @@ -0,0 +1,51 @@ +/* +Copyright 2024 Nokia. + +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 generic + +import ( + "github.com/henderiw/idxtable/pkg/table" + "github.com/henderiw/idxtable/pkg/tree/gtree" + "github.com/henderiw/store" + "github.com/henderiw/store/memory" +) + +type CacheInstanceContext struct { + idxType string + tree gtree.GTree + ranges store.Storer[table.Table] +} + +func NewCacheInstanceContext(tree gtree.GTree, idxType string) *CacheInstanceContext { + return &CacheInstanceContext{ + idxType: idxType, // provides extra context around the + tree: tree, + ranges: memory.NewStore[table.Table](nil), + } +} + +func (r *CacheInstanceContext) Size() int { + var size int + size += r.tree.Size() + r.ranges.List(func(k store.Key, t table.Table) { + size += t.Size() + }) + return size +} + +func (r *CacheInstanceContext) Type() string { + return r.idxType +} diff --git a/pkg/backend/genid/genid_helpers_test.go b/pkg/backend/genid/genid_helpers_test.go deleted file mode 100644 index ce8983c..0000000 --- a/pkg/backend/genid/genid_helpers_test.go +++ /dev/null @@ -1,104 +0,0 @@ -package genid - -import ( - "fmt" - - "github.com/kuidio/kuid/apis/backend" - genidbev1alpha1 "github.com/kuidio/kuid/apis/backend/genid/v1alpha1" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/utils/ptr" -) - -type testCtx struct { - name string - claimType backend.ClaimType - id uint64 - tRange string - labels map[string]string - selector *metav1.LabelSelector - expectedError bool - expectedID *uint64 - expectedRange *string -} - -// aliGENID -const ( - namespace = "dummy" - staticClaim = backend.ClaimType_StaticID - dynamicClaim = backend.ClaimType_DynamicID - rangeClaim = backend.ClaimType_Range -) - -func getIndex(index, testType string) (*genidbev1alpha1.GENIDIndex, error) { - idx := genidbev1alpha1.BuildGENIDIndex( - metav1.ObjectMeta{Namespace: namespace, Name: index}, - &genidbev1alpha1.GENIDIndexSpec{ - Type: testType, - }, - nil, - ) - - fieldErrs := idx.ValidateSyntax("") - if len(fieldErrs) != 0 { - return nil, fmt.Errorf("syntax errors %v", fieldErrs) - } - return idx, nil -} - -func (r testCtx) getDynamicClaim(index, testType string) (*genidbev1alpha1.GENIDClaim, error) { - claim := genidbev1alpha1.BuildGENIDClaim( - metav1.ObjectMeta{Namespace: namespace, Name: r.name}, - &genidbev1alpha1.GENIDClaimSpec{ - Index: index, - ClaimLabels: commonv1alpha1.ClaimLabels{ - UserDefinedLabels: commonv1alpha1.UserDefinedLabels{Labels: r.labels}, - Selector: r.selector, - }, - }, - nil, - ) - fielErrList := claim.ValidateSyntax(testType) // this expands the ownerRef in the spec - if len(fielErrList) != 0 { - return nil, fmt.Errorf("invalid syntax %v", fielErrList) - } - return claim, nil -} - -func (r testCtx) getStaticClaim(index, testType string) (*genidbev1alpha1.GENIDClaim, error) { - claim := genidbev1alpha1.BuildGENIDClaim( - metav1.ObjectMeta{Namespace: namespace, Name: r.name}, - &genidbev1alpha1.GENIDClaimSpec{ - Index: index, - ID: ptr.To[int64](int64(r.id)), - ClaimLabels: commonv1alpha1.ClaimLabels{ - UserDefinedLabels: commonv1alpha1.UserDefinedLabels{Labels: r.labels}, - }, - }, - nil, - ) - fielErrList := claim.ValidateSyntax(testType) // this expands the ownerRef in the spec - if len(fielErrList) != 0 { - return nil, fmt.Errorf("invalid syntax %v", fielErrList) - } - return claim, nil -} - -func (r testCtx) getRangeClaim(index, testType string) (*genidbev1alpha1.GENIDClaim, error) { - claim := genidbev1alpha1.BuildGENIDClaim( - metav1.ObjectMeta{Namespace: namespace, Name: r.name}, - &genidbev1alpha1.GENIDClaimSpec{ - Index: index, - Range: ptr.To[string](r.tRange), - ClaimLabels: commonv1alpha1.ClaimLabels{ - UserDefinedLabels: commonv1alpha1.UserDefinedLabels{Labels: r.labels}, - }, - }, - nil, - ) - fielErrList := claim.ValidateSyntax(testType) // this expands the ownerRef in the spec - if len(fielErrList) != 0 { - return nil, fmt.Errorf("invalid syntax %v", fielErrList) - } - return claim, nil -} diff --git a/pkg/backend/genid/genid_index_test.go b/pkg/backend/genid/genid_index_test.go deleted file mode 100644 index f3914c4..0000000 --- a/pkg/backend/genid/genid_index_test.go +++ /dev/null @@ -1,53 +0,0 @@ -package genid - -import ( - "context" - "testing" - - "github.com/kuidio/kuid/pkg/backend/backend" - "github.com/stretchr/testify/assert" - "k8s.io/apimachinery/pkg/runtime/schema" - genidbev1alpha1 "github.com/kuidio/kuid/apis/backend/genid/v1alpha1" -) - -func TestIndex(t *testing.T) { - tests := map[string]struct { - index string - testType string - }{ - "CreateDelete-16bit": { - index: "a", - testType: string(genidbev1alpha1.GENIDType_16bit), - }, - "CreateDelete-32bit": { - index: "a", - testType: string(genidbev1alpha1.GENIDType_32bit), - }, - "CreateDelete-48bit": { - index: "a", - testType: string(genidbev1alpha1.GENIDType_48bit), - }, - "CreateDelete-64bit": { - index: "a", - testType: string(genidbev1alpha1.GENIDType_64bit), - }, - } - - for name, tc := range tests { - t.Run(name, func(t *testing.T) { - be := backend.New(nil, nil, nil, nil, nil, schema.GroupVersionKind{},schema.GroupVersionKind{}) - ctx := context.Background() - index, err := getIndex(tc.index, tc.testType) - assert.NoError(t, err) - if err := be.CreateIndex(ctx, index); err != nil { - assert.Error(t, err) - } - if err := be.DeleteIndex(ctx, index); err != nil { - assert.Error(t, err) - } - if err := be.DeleteIndex(ctx, index); err != nil { - assert.Error(t, err) - } - }) - } -} diff --git a/pkg/backend/genid/genid_test.go b/pkg/backend/genid/genid_test.go deleted file mode 100644 index 21271d2..0000000 --- a/pkg/backend/genid/genid_test.go +++ /dev/null @@ -1,133 +0,0 @@ -package genid - -import ( - "context" - "fmt" - "testing" - - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - genidbev1alpha1 "github.com/kuidio/kuid/apis/backend/genid/v1alpha1" - backendbe "github.com/kuidio/kuid/pkg/backend/backend" - "github.com/stretchr/testify/assert" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/types" - "k8s.io/utils/ptr" -) - -func Test(t *testing.T) { - tests := map[string]struct { - index string - ctxs []testCtx - }{ - "Mix": { - index: "a", - ctxs: []testCtx{ - {claimType: dynamicClaim, name: "claim1", expectedError: false, expectedID: ptr.To[uint64](0)}, - {claimType: staticClaim, name: "claim2", id: 100, expectedError: false}, - {claimType: staticClaim, name: "claim3", id: 4000, expectedError: false}, - {claimType: rangeClaim, name: "claim4", tRange: "10-19", expectedError: false}, - {claimType: rangeClaim, name: "claim4", tRange: "11-19", expectedError: false}, // reclaim - {claimType: rangeClaim, name: "claim5", tRange: "5-10", expectedError: false}, // claim a new entry - {claimType: rangeClaim, name: "claim6", tRange: "19-100", expectedError: true}, // overlap - {claimType: staticClaim, name: "claim7", id: 12, expectedError: false}, - {claimType: staticClaim, name: "claim7", id: 13, expectedError: false}, // reclaim an existing id - {claimType: dynamicClaim, name: "claim8", selector: &metav1.LabelSelector{ - MatchLabels: map[string]string{backend.KuidClaimNameKey: "claim4"}, - }, expectedError: false, expectedID: ptr.To[uint64](11)}, // a dynamic claim from a range - {claimType: dynamicClaim, name: "claim9", selector: &metav1.LabelSelector{ - MatchLabels: map[string]string{backend.KuidClaimNameKey: "claim4"}, - }, expectedError: false, expectedID: ptr.To[uint64](12)}, // a dynamic claim from a range that was claimed before - {claimType: dynamicClaim, name: "claim10", selector: &metav1.LabelSelector{ - MatchLabels: map[string]string{backend.KuidClaimNameKey: "claim4"}, - }, expectedError: false, expectedID: ptr.To[uint64](14)}, - {claimType: dynamicClaim, name: "claim10", selector: &metav1.LabelSelector{ - MatchLabels: map[string]string{backend.KuidClaimNameKey: "claim4"}, // update - }, expectedError: false, expectedID: ptr.To[uint64](14)}, - {claimType: rangeClaim, name: "claim4", tRange: "11-19", expectedError: false}, // update - }, - }, - } - - for name, tc := range tests { - tc := tc - - testTypes := []string{ - string(genidbev1alpha1.GENIDType_16bit), - string(genidbev1alpha1.GENIDType_32bit), - //string(genidbev1alpha1.GENIDType_48bit), - //string(genidbev1alpha1.GENIDType_64bit), - } - - for _, testType := range testTypes { - t.Run(name, func(t *testing.T) { - be := backendbe.New(nil, nil, nil, nil, nil, schema.GroupVersionKind{}, schema.GroupVersionKind{}) - ctx := context.Background() - if tc.index != "" { - index, err := getIndex(tc.index, testType) - assert.NoError(t, err) - err = be.CreateIndex(ctx, index) - assert.NoError(t, err) - } - - for _, v := range tc.ctxs { - v := v - var claim *genidbev1alpha1.GENIDClaim - var err error - - switch v.claimType { - case staticClaim: - claim, err = v.getStaticClaim(tc.index, testType) - case dynamicClaim: - claim, err = v.getDynamicClaim(tc.index, testType) - case rangeClaim: - claim, err = v.getRangeClaim(tc.index, testType) - } - assert.NoError(t, err) - if err != nil { - return - } - - err = be.Claim(ctx, claim) - if v.expectedError { - assert.Error(t, err) - continue - } else { - assert.NoError(t, err) - } - switch v.claimType { - case staticClaim, dynamicClaim: - if claim.Status.ID == nil { - t.Errorf("expecting status id got nil") - } else { - expectedID := v.id - if v.expectedID != nil { - expectedID = *v.expectedID - } - if uint64(*claim.Status.ID) != expectedID { - t.Errorf("expecting id got %d, want %d\n", *claim.Status.ID, expectedID) - } - } - case rangeClaim: - if claim.Status.Range == nil { - t.Errorf("expecting status id got nil") - } else { - expectedRange := v.tRange - if v.expectedRange != nil { - expectedRange = *v.expectedRange - } - if *claim.Status.Range != expectedRange { - t.Errorf("expecting range got %s, want %s\n", *claim.Status.Range, expectedRange) - } - } - } - fmt.Println("entries after claim", v.name) - key := store.KeyFromNSN(types.NamespacedName{Namespace: namespace, Name: tc.index}) - err = be.PrintEntries(ctx, key) - assert.NoError(t, err) - } - }) - } - } -} diff --git a/pkg/backend/invoker.go b/pkg/backend/invoker.go new file mode 100644 index 0000000..20df0a3 --- /dev/null +++ b/pkg/backend/invoker.go @@ -0,0 +1,68 @@ +/* +Copyright 2024 Nokia. + +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 backend + +import ( + "context" + + "github.com/kuidio/kuid/pkg/registry/options" + "k8s.io/apimachinery/pkg/runtime" +) + +func NewClaimInvoker(be Backend) options.BackendInvoker { + return &claimInvoker{ + be: be, + } +} + +type claimInvoker struct { + be Backend +} + +func (r *claimInvoker) InvokeCreate(ctx context.Context, obj runtime.Object) error { + return r.be.Claim(ctx, obj) +} + +func (r *claimInvoker) InvokeUpdate(ctx context.Context, obj, old runtime.Object) error { + return r.be.Claim(ctx, obj) +} + +func (r *claimInvoker) InvokeDelete(ctx context.Context, obj runtime.Object) error { + return r.be.Release(ctx, obj) +} + +func NewIndexInvoker(be Backend) options.BackendInvoker { + return &indexPreparator{ + be: be, + } +} + +type indexPreparator struct { + be Backend +} + +func (r *indexPreparator) InvokeCreate(ctx context.Context, obj runtime.Object) error { + return r.be.CreateIndex(ctx, obj) +} + +func (r *indexPreparator) InvokeUpdate(ctx context.Context, obj, old runtime.Object) error { + return r.be.CreateIndex(ctx, obj) +} + +func (r *indexPreparator) InvokeDelete(ctx context.Context, obj runtime.Object) error { + return r.be.DeleteIndex(ctx, obj) +} diff --git a/pkg/backend/ipam/applicator.go b/pkg/backend/ipam/applicator.go deleted file mode 100644 index 98be60c..0000000 --- a/pkg/backend/ipam/applicator.go +++ /dev/null @@ -1,520 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 ipam - -import ( - "context" - "errors" - "fmt" - "strings" - - "github.com/hansthienpondt/nipam/pkg/table" - "github.com/henderiw/idxtable/pkg/iptable" - "github.com/henderiw/iputil" - "github.com/henderiw/logger/log" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - ipambev1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - "go4.org/netipx" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/utils/ptr" -) -/* -type Validator interface { - Validate(ctx context.Context, claim *ipambev1alpha1.IPClaim) error -} -*/ - -type Applicator interface { - Validate(ctx context.Context, claim *ipambev1alpha1.IPClaim) error - Apply(ctx context.Context, claim *ipambev1alpha1.IPClaim) error - Delete(ctx context.Context, claim *ipambev1alpha1.IPClaim) error -} - -type applicator struct { - cacheCtx *CacheContext -} - -// apply only works on the main rib -func (r *applicator) apply(ctx context.Context, claim *ipambev1alpha1.IPClaim, pis []*iputil.Prefix, networkParent bool, parentLabels map[string]string) error { - log := log.FromContext(ctx) - // check if the prefix/claim already exists in the routing table - // based on the name of the claim - existingRoutes, err := r.getRoutesByOwner(ctx, claim) - if err != nil { - return err - } - // get the new routes from claim and claimed prefix - // for network prefixes the routes can get expanded - newRoutes := table.Routes{} - for _, pi := range pis { - pi := pi - newRoutes = append(newRoutes, getRoutesFromClaim(ctx, claim, pi, networkParent, parentLabels)...) - - } - for _, newRoute := range newRoutes { - //fmt.Println("newRoute", newRoute.Prefix().String()) - newRoute := newRoute - exists := false - var curRoute table.Route - for i, existingRoute := range existingRoutes[""] { - if existingRoute.Prefix().String() == newRoute.Prefix().String() { - // remove the route from the existing route list as we will delete the remaining - // existing routes later on - existingRoutes[""] = append(existingRoutes[""][:i], existingRoutes[""][i+1:]...) - exists = true - curRoute = existingRoute - } - } - log.Info("apply route", "newRoute", newRoute.Prefix().String(), "exists", exists, "existsingRoutes", getExistingRoutes(existingRoutes[""])) - if exists { - // update - if err := r.updateRib(ctx, newRoute, curRoute); err != nil { - return err - } - } else { - // add - if err := r.addRib(ctx, newRoute); err != nil { - return err - } - } - } - for _, existingRoute := range existingRoutes[""] { - log.Info("delete existsingRoute", "route", existingRoute.Prefix().String()) - if err := r.cacheCtx.rib.Delete(existingRoute); err != nil { - log.Error("cannot delete route from rib", "route", existingRoute, "error", err.Error()) - } - } - return nil -} - -func (r *applicator) applyRange(ctx context.Context, claim *ipambev1alpha1.IPClaim, ipRange netipx.IPRange) error { - k := store.ToKey(claim.Name) - if _, err := r.cacheCtx.ranges.Get(ctx, k); err != nil { - ipTable := iptable.New(ipRange.From(), ipRange.To()) - if err := r.cacheCtx.ranges.Create(ctx, k, ipTable); err != nil { - return err - } - } - return nil -} - -func (r *applicator) applyAddressInRange(ctx context.Context, claim *ipambev1alpha1.IPClaim, pi *iputil.Prefix, rangeName string, labels map[string]string) error { - k := store.ToKey(rangeName) - ipTable, err := r.cacheCtx.ranges.Get(ctx, k) - if err != nil { - return err - } - routes := getRoutesFromClaim(ctx, claim, pi, false, labels) - addr := pi.Addr().String() - route, err := ipTable.Get(addr) - if err != nil { - ipTable.Claim(pi.Addr().String(), routes[0]) - return nil - } - if err := claim.ValidateOwner(route.Labels()); err != nil { - return err - } - return ipTable.Update(addr, routes[0]) -} - -func (r *applicator) addRib(ctx context.Context, route table.Route) error { - log := log.FromContext(ctx) - if err := r.cacheCtx.rib.Add(route); err != nil { - if !strings.Contains(err.Error(), "already exists") { - log.Error("cannot add prefix") - return fmt.Errorf("cannot add prefix, err: %s", err.Error()) - } - } - return nil -} - -func (r *applicator) updateRib(ctx context.Context, newRoute, existingRoute table.Route) error { - log := log.FromContext(ctx) - // check if the labels changed - // if changed inform the owner GVKs through the watch - if !labels.Equals(newRoute.Labels(), existingRoute.Labels()) { - // workaround -> should become an atomic update - //route = route.DeleteLabels() - //route = route.UpdateLabel(lbls) - log.Info("update rib with new label info", "route prefix", newRoute.Prefix().String(), "newRoute labels", newRoute.Labels(), "existsingRoute labels", existingRoute.Labels()) - if err := r.cacheCtx.rib.Set(newRoute); err != nil { - if !strings.Contains(err.Error(), "already exists") { - log.Error("cannot update prefix", "error", err.Error()) - return fmt.Errorf("cannot update prefix, err: %s", err.Error()) - } - } - // this is an update where the labels changed - // only update when not initializing - // only update when the prefix is a non /32 or /128 - pi := iputil.NewPrefixInfo(newRoute.Prefix()) - if pi != nil && !pi.IsAddressPrefix() { - log.Info("inform children of the change/update", "existingRoute", existingRoute.Prefix().String(), "labels", newRoute.Labels()) - // delete the children from the rib - // update the once that have a nsn different from the origin - childRoutesToBeUpdated := []table.Route{} - for _, childRoute := range existingRoute.Children(r.cacheCtx.rib) { - log.Info("inform children of the change/update", "existingRoute", existingRoute.Prefix().String(), "child route", childRoute) - if childRoute.Labels()[backend.KuidClaimNameKey] != newRoute.Labels()[backend.KuidClaimNameKey] { - childRoutesToBeUpdated = append(childRoutesToBeUpdated, childRoute) - if err := r.cacheCtx.rib.Delete(childRoute); err != nil { - log.Error("cannot delete route from rib", "route", childRoute, "error", err.Error()) - continue - } - } - } - // handler watch update to the source owner controller - log.Info("inform children of the change/update", "existingRoute", existingRoute.Prefix().String(), "child routes", childRoutesToBeUpdated) - } - } - return nil -} - -func (r *applicator) updateClaimAddressStatus(ctx context.Context, claim *ipambev1alpha1.IPClaim, pi *iputil.Prefix, networkParent bool) { - // update the status - claim.Status.Address = ptr.To[string](pi.String()) - if claim.GetIPPrefixType() == ipambev1alpha1.IPPrefixType_Network || networkParent { - defaultGateway := r.getDefaultGateway(ctx, claim, pi) - if defaultGateway != "" { - claim.Status.DefaultGateway = ptr.To[string](defaultGateway) - } - } - claim.SetConditions(conditionv1alpha1.Ready()) -} - -func (r *applicator) updateClaimPrefixStatus(ctx context.Context, claim *ipambev1alpha1.IPClaim, pi *iputil.Prefix) { - // update the status - claim.Status.Prefix = ptr.To[string](pi.String()) - if claim.GetIPPrefixType() == ipambev1alpha1.IPPrefixType_Network { - defaultGateway := r.getDefaultGateway(ctx, claim, pi) - if defaultGateway != "" { - claim.Status.DefaultGateway = ptr.To[string](defaultGateway) - } - } - claim.SetConditions(conditionv1alpha1.Ready()) -} - -func (r *applicator) updateClaimRangeStatus(_ context.Context, claim *ipambev1alpha1.IPClaim) { - // update the status - claim.Status.Range = claim.Spec.Range - claim.SetConditions(conditionv1alpha1.Ready()) -} - -// getRoutesFromClaim return the reoutes with the assocated labels from the claim -// for network based prefixes multiple routes can be returned as they might get expanded -func getRoutesFromClaim(_ context.Context, claim *ipambev1alpha1.IPClaim, pi *iputil.Prefix, networkParent bool, parentLabels map[string]string) []table.Route { - routes := []table.Route{} - - ipClaimType, _ := claim.GetIPClaimType() - labels := claim.Spec.GetUserDefinedLabels() - for k, v := range parentLabels { - labels[k] = v - } - // system defined labels - labels[backend.KuidIPAMIPPrefixTypeKey] = string(claim.GetIPPrefixType()) - labels[backend.KuidIPAMClaimSummaryTypeKey] = string(claim.GetIPClaimSummaryType()) - labels[backend.KuidClaimTypeKey] = string(ipClaimType) - labels[backend.KuidIPAMddressFamilyKey] = string(pi.GetAddressFamily()) - labels[backend.KuidIPAMSubnetKey] = pi.GetSubnetName() - labels[backend.KuidClaimNameKey] = claim.Name - labels[backend.KuidOwnerGroupKey] = claim.Spec.Owner.Group - labels[backend.KuidOwnerVersionKey] = claim.Spec.Owner.Version - labels[backend.KuidOwnerKindKey] = claim.Spec.Owner.Kind - labels[backend.KuidOwnerNamespaceKey] = claim.Spec.Owner.Namespace - labels[backend.KuidOwnerNameKey] = claim.Spec.Owner.Name - if claim.Spec.DefaultGateway != nil && *claim.Spec.DefaultGateway { - labels[backend.KuidIPAMDefaultGatewayKey] = "true" - } - - prefix := pi.GetIPPrefix() - // networkParent is there for dynamic addresses as we dont know ahead of time - // if the dynamic address matches a network or other parent prefix - if claim.GetIPPrefixType() == ipambev1alpha1.IPPrefixType_Network || networkParent { - if claim.Spec.CreatePrefix != nil { - switch { - case pi.GetAddressFamily() == iputil.AddressFamilyIpv4 && pi.GetPrefixLength().Int() == 31, - pi.GetAddressFamily() == iputil.AddressFamilyIpv6 && pi.GetPrefixLength().Int() == 127: - routes = append(routes, getNetworkNetRoute(labels, pi)) - case pi.IsNorLastNorFirst(): - routes = append(routes, getNetworkNetRoute(labels, pi)) - routes = append(routes, getNetworIPAddressRoute(labels, pi)) - routes = append(routes, getNetworFirstAddressRoute(labels, pi)) - routes = append(routes, getNetworLastAddressRoute(labels, pi)) - case pi.IsFirst(): - routes = append(routes, getNetworkNetRoute(labels, pi)) - routes = append(routes, getNetworIPAddressRoute(labels, pi)) - routes = append(routes, getNetworLastAddressRoute(labels, pi)) - case pi.IsLast(): - routes = append(routes, getNetworkNetRoute(labels, pi)) - routes = append(routes, getNetworIPAddressRoute(labels, pi)) - routes = append(routes, getNetworFirstAddressRoute(labels, pi)) - } - return routes - } else { - // return address - //labels[ipamv1alpha1.NephioParentPrefixLengthKey] = r.pi.GetPrefixLength().String() - //fmt.Println("getRoutesFromClaim addressPrefix") - prefix = pi.GetIPAddressPrefix() - } - } - //fmt.Println("getRoutesFromClaim", claim.GetInfo(), pi.Prefix.String()) - routes = append(routes, table.NewRoute(prefix, labels, map[string]any{})) - return routes -} - -func getNetworkNetRoute(l map[string]string, pi *iputil.Prefix) table.Route { - labels := map[string]string{} - for k, v := range l { - labels[k] = v - } - delete(labels, backend.KuidIPAMDefaultGatewayKey) - delete(labels, backend.KuidINVEndpointKey) - return table.NewRoute(pi.GetIPSubnet(), labels, map[string]any{}) -} - -func getNetworIPAddressRoute(l map[string]string, pi *iputil.Prefix) table.Route { - labels := map[string]string{} - for k, v := range l { - labels[k] = v - } - if pi.IsFirst() || pi.IsLast() { - delete(labels, backend.KuidIPAMDefaultGatewayKey) - } - return table.NewRoute(pi.GetIPAddressPrefix(), labels, map[string]any{}) -} - -func getNetworFirstAddressRoute(l map[string]string, pi *iputil.Prefix) table.Route { - labels := map[string]string{} - for k, v := range l { - labels[k] = v - } - delete(labels, backend.KuidIPAMDefaultGatewayKey) - delete(labels, backend.KuidINVEndpointKey) - return table.NewRoute(pi.GetFirstIPPrefix(), labels, map[string]any{}) -} - -func getNetworLastAddressRoute(l map[string]string, pi *iputil.Prefix) table.Route { - labels := map[string]string{} - for k, v := range l { - labels[k] = v - } - delete(labels, backend.KuidIPAMDefaultGatewayKey) - delete(labels, backend.KuidINVEndpointKey) - return table.NewRoute(pi.GetLastIPPrefix(), labels, map[string]any{}) -} - -func (r *applicator) getDefaultGateway(ctx context.Context, claim *ipambev1alpha1.IPClaim, pi *iputil.Prefix) string { - log := log.FromContext(ctx) - /* - pi, err := iputil.New(prefix) - if err != nil { - log.Error("cannot get gateway parent rpefix", "error", err.Error()) - return "" - } - */ - - defaultGatewaySelector, err := claim.GetDefaultGatewayLabelSelector(string(pi.GetSubnetName())) - if err != nil { - log.Error("cannot get gateway label selector", "error", err.Error()) - return "" - } - log.Debug("defaultGateway", "defaultGatewaySelector", defaultGatewaySelector) - routes := r.cacheCtx.rib.GetByLabel(defaultGatewaySelector) - if len(routes) > 0 { - log.Debug("defaultGateway", "routes", routes) - return routes[0].Prefix().Addr().String() - } - return "" -} - -func (r *applicator) getRoutesByOwner(ctx context.Context, claim *ipambev1alpha1.IPClaim) (map[string]table.Routes, error) { - ribRoutes := map[string]table.Routes{} - // check if the prefix/claim already exists in the routing table - // based on the owner and the name of the claim - ownerSelector, err := claim.GetOwnerSelector() - if err != nil { - return ribRoutes, err - } - - claimSummaryType := claim.GetIPClaimSummaryType() - claimPrefixType := claim.GetIPPrefixType() - - ribRoutes[""] = r.cacheCtx.rib.GetByLabel(ownerSelector) - if len(ribRoutes[""]) != 0 { - // ranges and prefixes using network type can have multiple plrefixes - if len(ribRoutes[""]) > 1 && (claimSummaryType == ipambev1alpha1.IPClaimSummaryType_Address || - claimSummaryType == ipambev1alpha1.IPClaimSummaryType_Prefix && claimPrefixType != ipambev1alpha1.IPPrefixType_Network) { - return ribRoutes, fmt.Errorf("multiple prefixes match the owner, %v", ribRoutes[""]) - } - } - // add the search in the iptable - if claimSummaryType == ipambev1alpha1.IPClaimSummaryType_Address { - var errm error - r.cacheCtx.ranges.List(ctx, func(ctx context.Context, k store.Key, ipTable iptable.IPTable) { - ribRoutes[k.Name] = ipTable.GetByLabel(ownerSelector) - if len(ribRoutes[k.Name]) > 1 { - errm = errors.Join(errm, fmt.Errorf("multiple address match the owner, %v", ribRoutes[k.Name])) - return - } - }) - if errm != nil { - return ribRoutes, errm - } - } - return ribRoutes, nil -} - -func (r *applicator) getRoutesByLabel(ctx context.Context, claim *ipambev1alpha1.IPClaim) table.Routes { - log := log.FromContext(ctx) - labelSelector, err := claim.GetLabelSelector() - if err != nil { - log.Error("cannot get label selector", "error", err.Error()) - return []table.Route{} - } - return r.cacheCtx.rib.GetByLabel(labelSelector) -} - -// Delete deletes the claimation based on the ownerslector and deletes all prefixes associated with the ownerseelctor -// if no prefixes are found, no error is returned -func (r *applicator) Delete(ctx context.Context, claim *ipambev1alpha1.IPClaim) error { - log := log.FromContext(ctx) - log.Info("delete") - - existingRoutes, err := r.getRoutesByOwner(ctx, claim) - if err != nil { - return err - } - - for ribName, existingRoutes := range existingRoutes { - if ribName == "" { - for _, existingRoute := range existingRoutes { - log = log.With("route prefix", existingRoute.Prefix()) - // this is a delete - // only update when not initializing - // only update when the prefix is a non /32 or /128 - // only update when the parent is a create prefix type - pi := iputil.NewPrefixInfo(existingRoute.Prefix()) - if pi != nil && !pi.IsAddressPrefix() { - log.Info("inform children of the delete", "existingRoute", existingRoute.Prefix().String(), "labels", existingRoute.Labels()) - // delete the children from the rib - // update the once that have a nsn different from the origin - childRoutesToBeUpdated := []table.Route{} - for _, childRoute := range existingRoute.Children(r.cacheCtx.rib) { - log.Info("route exists", "handle delete for route", existingRoute, "child route", childRoute) - if childRoute.Labels()[backend.KuidClaimNameKey] != claim.Name { - childRoutesToBeUpdated = append(childRoutesToBeUpdated, childRoute) - if err := r.cacheCtx.rib.Delete(childRoute); err != nil { - log.Error("cannot delete route from rib", "route", childRoute, "error", err.Error()) - } - } - } - // handler watch update to the source owner controller - log.Info("route exists", "handle update for route", existingRoute, "child routes", childRoutesToBeUpdated) - } - - if err := r.cacheCtx.rib.Delete(existingRoute); err != nil { - return err - } - - // check if the route was a range -> if so delete the range table - routeLabels := existingRoute.Labels() - //parentClaimType := ipambev1alpha1.GetIPClaimTypeFromString(routeLabels[backend.KuidIPAMTypeKey]) - parentSummaryType := ipambev1alpha1.GetIPClaimSummaryTypeFromString(routeLabels[backend.KuidIPAMClaimSummaryTypeKey]) - parentClaimName := routeLabels[backend.KuidClaimNameKey] - - if parentSummaryType == ipambev1alpha1.IPClaimSummaryType_Range { - k := store.ToKey(parentClaimName) // this is the name of the range - if _, err := r.cacheCtx.ranges.Get(ctx, k); err == nil { - // the table exists -> delete it - if err := r.cacheCtx.ranges.Delete(ctx, k); err != nil { - return err - } - } - } - } - } else { - k := store.ToKey(ribName) - if len(existingRoutes) > 0 { - if ipTable, err := r.cacheCtx.ranges.Get(ctx, k); err == nil { - // the table exists - for _, existingRoute := range existingRoutes { - if _, err := ipTable.Get(existingRoute.Prefix().Addr().String()); err == nil { - if err := ipTable.Release(existingRoute.Prefix().Addr().String()); err != nil { - return err - } - } - } - } - } - } - } - return nil -} - -func isParentRouteSelectable(route table.Route, prefixLength uint8) bool { - // return the first route that has a routes with the prefixlength available - return route.Prefix().Bits() < int(prefixLength) -} - -func getExistingRoutes(existingRoutes table.Routes) []string { - routes := []string{} - for _, existingRoute := range existingRoutes { - routes = append(routes, existingRoute.Prefix().String()) - } - return routes -} - -func findParent(routes table.Routes) table.Route { - parentRoute := routes[0] - for _, route := range routes { - if route.Prefix().Bits() > parentRoute.Prefix().Bits() { - parentRoute = route - } - } - return parentRoute -} - -func validateNoParent(ipClaim *ipambev1alpha1.IPClaim) error { - if ipClaim.Spec.Owner.Group != ipambev1alpha1.SchemeGroupVersion.Group || - ipClaim.Spec.Owner.Version != ipambev1alpha1.SchemeGroupVersion.Version || - ipClaim.Spec.Owner.Kind != ipambev1alpha1.IPIndexKind { - ownerRef := commonv1alpha1.OwnerReference{ - Group: ipambev1alpha1.SchemeGroupVersion.Group, - Version: ipambev1alpha1.SchemeGroupVersion.Version, - Kind: ipambev1alpha1.IPIndexKind, - } - return fmt.Errorf("an agregate route is required %s/%s", ipClaim.Spec.Owner.String(), ownerRef) - } - return nil // an aggregate coming from a network Instance can be created -} - -func getUserDefinedLabels(labels map[string]string) map[string]string { - udmLabels := map[string]string{} - for k, v := range labels { - //fmt.Println("getUserDefinedLabels", k, v) - if backend.BackendIPAMSystemKeys.Has(k) { - continue - } - if backend.BackendSystemKeys.Has(k) { - continue - } - udmLabels[k] = v - } - return udmLabels -} diff --git a/pkg/backend/ipam/applicator_dynamic_address_apply.go b/pkg/backend/ipam/applicator_dynamic_address_apply.go deleted file mode 100644 index 2e302a9..0000000 --- a/pkg/backend/ipam/applicator_dynamic_address_apply.go +++ /dev/null @@ -1,222 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 ipam - -import ( - "context" - "fmt" - "net/netip" - - "github.com/hansthienpondt/nipam/pkg/table" - "github.com/henderiw/iputil" - "github.com/henderiw/logger/log" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - ipambev1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" -) - -func (r *dynamicAddressApplicator) Apply(ctx context.Context, claim *ipambev1alpha1.IPClaim) error { - log := log.FromContext(ctx).With("name", claim.GetName()) - log.Info("dynamic address claim") - - // claim a address - pi, err := r.claimAddress(ctx, claim) - if err != nil { - return err - } - //fmt.Println("claimAddress", pi.Prefix.String(), r.parentClaimSummaryType, r.parentRangeName, r.parentNetwork, r.parentLabels) - if r.parentClaimSummaryType == ipambev1alpha1.IPClaimSummaryType_Range { - if err := r.applyAddressInRange(ctx, claim, pi, r.parentRangeName, r.parentLabels); err != nil { - return err - } - } else { - // the claimType is coming from the parent for addresses - if err := r.apply(ctx, claim, []*iputil.Prefix{pi}, r.parentNetwork, r.parentLabels); err != nil { - return err - } - } - //fmt.Println("claimAddress after apply", pi.Prefix.String()) - r.updateClaimAddressStatus(ctx, claim, pi, r.parentNetwork) - return nil -} - -// claimPrefix claims a prefix from the rib based on the claim (dynamic) -func (r *dynamicAddressApplicator) claimAddress(ctx context.Context, claim *ipambev1alpha1.IPClaim) (*iputil.Prefix, error) { - //log := log.FromContext(ctx) - - // first check if the resource is already claimed - existingRoutes, err := r.getRoutesByOwner(ctx, claim) - if err != nil { - return nil, err - } - - for ribName, existingRoutes := range existingRoutes { - if len(existingRoutes) > 1 { - return nil, fmt.Errorf("cannot have multiple routes for an address entry") - } - if ribName == "" { - for _, existingRoute := range existingRoutes { - // Now we have only 1 route - if claim.Status.Address != nil { - spi, err := iputil.New(*claim.Status.Address) - if err != nil { - return nil, err - } - // since network based addresses return the parent prefixlength - // we need to return the same address from the status iso the one - // in the rib - // e.g. 10.0.0.1/24 is in the rib 10.0.0.1/32 but the status reflects - // 10.0.0.1/24 - //fmt.Println("claim Address", spi.Addr().String(), existingRoute.Prefix().Addr().String()) - if spi.Addr().String() == existingRoute.Prefix().Addr().String() { - if spi.GetPrefixLength() != spi.GetAddressPrefixLength() { - r.parentLabels = getUserDefinedLabels(findParent(existingRoute.Parents(r.cacheCtx.rib)).Labels()) - r.parentNetwork = true - } - return spi, nil - } - } - // we delete the route if the claim status is empty or does not match - // and reallocate - if err := r.cacheCtx.rib.Delete(existingRoutes[0]); err != nil { - return nil, err - } - } - } else { - k := store.ToKey(ribName) - if len(existingRoutes) > 0 { - if ipTable, err := r.cacheCtx.ranges.Get(ctx, k); err == nil { - // the table exists - for _, existingRoute := range existingRoutes { - r.parentRangeName = ribName - r.parentClaimSummaryType = ipambev1alpha1.IPClaimSummaryType_Range - if claim.Status.Address != nil { - spi, err := iputil.New(*claim.Status.Address) - if err != nil { - return nil, err - } - if spi.Addr().String() == existingRoute.Prefix().Addr().String() { - return spi, nil - } - } - // we delete the route if the claim status is empty or does not match - // and reallocate - if err := ipTable.Release(existingRoute.Prefix().Addr().String()); err != nil { - return nil, err - } - } - } - } - } - } - - // if not claimed, try to claim an address - parentRoutes := r.getRoutesByLabel(ctx, claim) - if len(parentRoutes) == 0 { - return nil, fmt.Errorf("dynamic claim: no available routes based on the selector labels %v", claim.Spec.GetSelectorLabels()) - } - - return r.selectAddress(ctx, claim, parentRoutes) -} - -/* -walk over the routes -*/ -func (r *dynamicAddressApplicator) selectAddress(ctx context.Context, claim *ipambev1alpha1.IPClaim, parentRoutes table.Routes) (*iputil.Prefix, error) { - routes := make([]string, 0, len(parentRoutes)) - for _, parentRoute := range parentRoutes { - routes = append(routes, parentRoute.Prefix().String()) - routeLabels := parentRoute.Labels() - parentIPPrefixType := ipambev1alpha1.GetIPPrefixTypeFromString(routeLabels[backend.KuidIPAMIPPrefixTypeKey]) - parentClaimSummaryType := ipambev1alpha1.GetIPClaimSummaryTypeFromString(routeLabels[backend.KuidIPAMClaimSummaryTypeKey]) - parentClaimName := routeLabels[backend.KuidClaimNameKey] - // update the context such that the applicator can use this information to apply the IP - r.parentClaimSummaryType = parentClaimSummaryType - r.parentRangeName = parentClaimName - r.parentLabels = getUserDefinedLabels(routeLabels) - if parentIPPrefixType != nil && *parentIPPrefixType == ipambev1alpha1.IPPrefixType_Network { - r.parentNetwork = true - } - - pi := iputil.NewPrefixInfo(parentRoute.Prefix()) - - switch parentClaimSummaryType { - case ipambev1alpha1.IPClaimSummaryType_Range: - // lookup range -> try to claim an ip from the range - k := store.ToKey(parentClaimName) - ipTable, err := r.cacheCtx.ranges.Get(ctx, k) - if err != nil { - return nil, fmt.Errorf("selectAddress range does not have corresponding range table: err: %s", err.Error()) - } - if claim.Status.Address != nil { - statuspi, err := iputil.New(*claim.Status.Address) - if err != nil { - return nil, err - } - - route, err := ipTable.Get(statuspi.GetIPAddress().String()) - if err == nil { // error means found - if err := claim.ValidateOwner(route.Labels()); err == nil { - return statuspi, nil // route already exists - } - } - } - addr, err := ipTable.FindFree() - if err != nil { - return nil, err - } - return iputil.NewPrefixInfo(netip.PrefixFrom(addr, int(pi.GetAddressPrefixLength()))), nil - - case ipambev1alpha1.IPClaimSummaryType_Prefix: - if parentIPPrefixType != nil && (*parentIPPrefixType == ipambev1alpha1.IPPrefixType_Network || *parentIPPrefixType == ipambev1alpha1.IPPrefixType_Pool) { - parentpi := iputil.NewPrefixInfo(parentRoute.Prefix()) - if claim.Status.Address != nil { - statuspi, err := iputil.New(*claim.Status.Address) - if err != nil { - return nil, err - } - //fmt.Println("address status not empty", statuspi.Prefix.String()) - // check if the route is free in the rib - prefixLength := pi.GetAddressPrefixLength() - if _, ok := r.cacheCtx.rib.Get(netip.PrefixFrom(statuspi.Addr(), prefixLength.Int())); !ok { - return statuspi, nil - } - } - - // gather the prefixLength - use address based prefixLength /32 or /128 to validate the rib - // for netowork allocations use the parent prefixLength - prefixLength := pi.GetAddressPrefixLength() - //fmt.Println("prefixLength", prefixLength) - if isParentRouteSelectable(parentRoute, uint8(prefixLength)) { - p := r.cacheCtx.rib.GetAvailablePrefixByBitLen(pi.GetIPPrefix(), uint8(prefixLength.Int())) - //fmt.Println("addr", p.Addr().String()) - if p.IsValid() { - // success, parentClaimType was already checked for non nil - if *parentIPPrefixType == ipambev1alpha1.IPPrefixType_Network { - //fmt.Println("parent prefixLength", parentpi.GetPrefixLength()) - return iputil.NewPrefixInfo(netip.PrefixFrom(p.Addr(), int(parentpi.GetPrefixLength()))), nil - } else { - return iputil.NewPrefixInfo(p), nil - } - } - } - } - default: - } - } - return nil, fmt.Errorf("no free addresses found in routes: %v", routes) -} diff --git a/pkg/backend/ipam/applicator_dynamic_prefix_apply.go b/pkg/backend/ipam/applicator_dynamic_prefix_apply.go deleted file mode 100644 index 750c4b7..0000000 --- a/pkg/backend/ipam/applicator_dynamic_prefix_apply.go +++ /dev/null @@ -1,119 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 ipam - -import ( - "context" - "fmt" - - "github.com/henderiw/iputil" - "github.com/henderiw/logger/log" - ipambev1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" - "github.com/pkg/errors" -) - -func (r *dynamicPrefixApplicator) Apply(ctx context.Context, claim *ipambev1alpha1.IPClaim) error { - log := log.FromContext(ctx).With("name", claim.GetName()) - log.Info("dynamic prefix claim") - - // claim a prefix - pi, err := r.claimPrefix(ctx, claim) - if err != nil { - return err - } - - if err := r.apply(ctx, claim, []*iputil.Prefix{pi}, false, map[string]string{}); err != nil { - return err - } - r.updateClaimPrefixStatus(ctx, claim, pi) - return nil -} - -// claimPrefix claims a prefix from the rib based on the claim (dynamic) -func (r *dynamicPrefixApplicator) claimPrefix(ctx context.Context, claim *ipambev1alpha1.IPClaim) (*iputil.Prefix, error) { - log := log.FromContext(ctx) - - // first check if the resource is already claimed - existingRoutes, err := r.getRoutesByOwner(ctx, claim) - if err != nil { - return nil, err - } - found := false - var spi *iputil.Prefix - for _, existingRoute := range existingRoutes[""] { - // validate if the existing prefix/address is in the routing - // table -> if so we return -> apply takes care of the cleanup - if claim.Status.Prefix != nil { - spi, err = iputil.New(*claim.Status.Prefix) - if err != nil { - return nil, err - } - epi := iputil.NewPrefixInfo(existingRoute.Prefix()) - if spi.GetIPAddress() == epi.GetIPAddress() { - found = true - break - } - } - } - if found { - return spi, nil - } - - // if not claimed, try to claim the ip - parentRoutes := r.getRoutesByLabel(ctx, claim) - if len(parentRoutes) == 0 { - return nil, fmt.Errorf("dynamic claim: no available routes based on the selector labels %v", claim.Spec.GetSelectorLabels()) - } - - // try to reclaim the prefix if the prefix was already claimed - if claim.Status.Prefix != nil { - pi, err := iputil.New(*claim.Status.Prefix) - if err != nil { - return nil, err - } - log.Info("refresh claimed prefix", - "claimedPrefix", claim.Status.Prefix, - "prefixlength", pi.GetPrefixLength()) - - // check if the prefix is available - p := r.cacheCtx.rib.GetAvailablePrefixByBitLen(pi.GetIPPrefix(), uint8(pi.GetPrefixLength())) - if p.IsValid() { - log.Info("refresh claimed prefix finished", - "claimedPrefix", claim.Status.Prefix) - // previously claimed prefix is available and reassigned - return iputil.NewPrefixInfo(p), nil - } - log.Info("refresh claim prefix not available", - "claimedPrefix", claim.Status.Prefix, - "prefixlength", pi.GetPrefixLength()) - } - - // A prefix claim always need a prefix length - prefixLength := iputil.PrefixLength(*claim.Spec.PrefixLength) - for _, parentRoute := range parentRoutes { - if isParentRouteSelectable(parentRoute, uint8(prefixLength)) { - pi := iputil.NewPrefixInfo(parentRoute.Prefix()) - p := r.cacheCtx.rib.GetAvailablePrefixByBitLen(pi.GetIPPrefix(), uint8(prefixLength.Int())) - if p.IsValid() { - // success - return iputil.NewPrefixInfo(p), nil - } - } - } - return nil, errors.New("no free prefix found") - -} diff --git a/pkg/backend/ipam/applicator_static_address_apply.go b/pkg/backend/ipam/applicator_static_address_apply.go deleted file mode 100644 index dd6586c..0000000 --- a/pkg/backend/ipam/applicator_static_address_apply.go +++ /dev/null @@ -1,47 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 ipam - -import ( - "context" - - "github.com/henderiw/iputil" - "github.com/henderiw/logger/log" - ipambev1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" -) - -func (r *staticAddressApplicator) Apply(ctx context.Context, claim *ipambev1alpha1.IPClaim) error { - log := log.FromContext(ctx).With("name", claim.GetName()) - log.Info("static address claim") - pi, err := iputil.New(*claim.Spec.Address) - if err != nil { - return err - } - //fmt.Println("applyAddress", *claim.Spec.Address, r.parentClaimSummaryType, r.parentRangeName, r.parentNetwork, r.parentLabels) - if r.parentClaimSummaryType == ipambev1alpha1.IPClaimSummaryType_Range { - if err := r.applyAddressInRange(ctx, claim, pi, r.parentRangeName, r.parentLabels); err != nil { - return err - } - } else { - if err := r.apply(ctx, claim, []*iputil.Prefix{pi}, false, r.parentLabels); err != nil { - return err - } - } - - r.updateClaimAddressStatus(ctx, claim, pi, r.parentNetwork) - return nil -} diff --git a/pkg/backend/ipam/applicator_static_address_validate.go b/pkg/backend/ipam/applicator_static_address_validate.go deleted file mode 100644 index b9be795..0000000 --- a/pkg/backend/ipam/applicator_static_address_validate.go +++ /dev/null @@ -1,154 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 ipam - -import ( - "context" - "fmt" - - "github.com/hansthienpondt/nipam/pkg/table" - "github.com/henderiw/iputil" - "github.com/henderiw/logger/log" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - ipambev1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" -) - -type staticAddressApplicator struct { - name string - applicator - parentClaimSummaryType ipambev1alpha1.IPClaimSummaryType - parentRangeName string - parentNetwork bool - parentLabels map[string]string -} - -func (r *staticAddressApplicator) Validate(ctx context.Context, claim *ipambev1alpha1.IPClaim) error { - log := log.FromContext(ctx) - pi, err := iputil.New(*claim.Spec.Address) - if err != nil { - return err - } - // get dryrun rib - dryrunRib := r.cacheCtx.rib.Clone() - - // There is 2 scenario's: - // an address with /32 or /128 prefixLength: 10.0.0.1/32 -> address prefix - // an address with a dedicated prefixLength: 10.0.0.1/24 (onlky allowed for network) - // check the /32 or /128 equivalent in the rib - route, ok := dryrunRib.Get(pi.GetIPAddressPrefix()) - if ok { - //fmt.Println("static address route exists", *claim.Spec.Address, route.Prefix().String()) - // if the route exists validate the owner - routeLabels := route.Labels() - // a range is an exception as it can overlap with an address - if routeLabels[backend.KuidIPAMClaimSummaryTypeKey] == string(ipambev1alpha1.IPClaimSummaryType_Range) { - r.parentClaimSummaryType = ipambev1alpha1.IPClaimSummaryType_Range - r.parentRangeName = routeLabels[backend.KuidClaimNameKey] - return nil - } else { - if err := claim.ValidateOwner(routeLabels); err != nil { - return err - } - return nil - } - } - route = table.NewRoute( - pi.GetIPAddressPrefix(), - map[string]string{}, - map[string]any{}, - ) - if err := dryrunRib.Add(route); err != nil { - log.Error("cannot add route", "route", route, "error", err.Error()) - return err - } - // get the route again and check for children - route, ok = dryrunRib.Get(pi.GetIPAddressPrefix()) - if !ok { - err := fmt.Errorf("cannot get route %s which just got addded", pi.GetIPSubnet()) - log.Error(err.Error()) - return err - } - // check for children - routes := route.Children(dryrunRib) - if len(routes) > 0 { - err := fmt.Errorf("cannot have children for an address %s", pi.GetIPPrefix()) - log.Error(err.Error()) - return err - } - // get parents - routes = route.Parents(dryrunRib) - if len(routes) == 0 { - // no parents exist - if err := validateNoParent(claim); err != nil { - return err - } - } - // parents exist - parentRoute := findParent(routes) - //fmt.Println("static address parent route", parentRoute.Prefix(), parentRoute.Labels()) - if err := r.validateExistingParent(ctx, claim, pi, parentRoute); err != nil { - log.Error(err.Error()) - return err - } - return nil -} - -func (r *staticAddressApplicator) validateExistingParent(ctx context.Context, claim *ipambev1alpha1.IPClaim, pi *iputil.Prefix, route table.Route) error { - routeLabels := route.Labels() - parentIPPrefixType := ipambev1alpha1.GetIPPrefixTypeFromString(routeLabels[backend.KuidIPAMIPPrefixTypeKey]) - parentClaimSummaryType := ipambev1alpha1.GetIPClaimSummaryTypeFromString(routeLabels[backend.KuidIPAMClaimSummaryTypeKey]) - parentClaimName := routeLabels[backend.KuidClaimNameKey] - // update the context such that the applicator can use this information to apply the IP - r.parentClaimSummaryType = parentClaimSummaryType - r.parentRangeName = parentClaimName - r.parentLabels = getUserDefinedLabels(routeLabels) - - if pi.IsAddressPrefix() { - // 32 or /128 -> cannot be claimed in a network or aggregate - if parentIPPrefixType != nil && - (*parentIPPrefixType == ipambev1alpha1.IPPrefixType_Network || *parentIPPrefixType == ipambev1alpha1.IPPrefixType_Aggregate) { - return fmt.Errorf("a /32 or /128 address is not possible with a parent of type %s", *parentIPPrefixType) - } - if parentClaimSummaryType == ipambev1alpha1.IPClaimSummaryType_Range { - k := store.ToKey(parentClaimName) - ipTable, err := r.applicator.cacheCtx.ranges.Get(ctx, k) - if err != nil { - return err - } - route, err := ipTable.Get(pi.GetIPAddress().String()) - if err == nil { // error means not found - //fmt.Println("range address labels", route.Labels()) - if err := claim.ValidateOwner(route.Labels()); err != nil { - //fmt.Println("owner error", err.Error()) - return fmt.Errorf("address is already allocated in range %s, err: %s", parentClaimName, err.Error()) - } - } - return nil - } - } else { - // an address with a dedicated prefixLength is only possible for network prefix parents - if parentIPPrefixType != nil && *parentIPPrefixType != ipambev1alpha1.IPPrefixType_Network { - return fmt.Errorf("a prefix based address is not possible with a parent of type %s", *parentIPPrefixType) - } - if parentClaimSummaryType == ipambev1alpha1.IPClaimSummaryType_Range { - return fmt.Errorf("a prefix based address is not possible for a %v", parentIPPrefixType) - } - r.parentNetwork = true - } - return nil -} diff --git a/pkg/backend/ipam/applicator_static_prefix_apply.go b/pkg/backend/ipam/applicator_static_prefix_apply.go deleted file mode 100644 index ace7e43..0000000 --- a/pkg/backend/ipam/applicator_static_prefix_apply.go +++ /dev/null @@ -1,40 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 ipam - -import ( - "context" - - "github.com/henderiw/iputil" - "github.com/henderiw/logger/log" - ipambev1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" -) - -func (r *staticPrefixApplicator) Apply(ctx context.Context, claim *ipambev1alpha1.IPClaim) error { - log := log.FromContext(ctx).With("name", claim.GetName()) - log.Info("static prefix claim") - pi, err := iputil.New(*claim.Spec.Prefix) - if err != nil { - return err - } - - if err := r.apply(ctx, claim, []*iputil.Prefix{pi}, false, map[string]string{}); err != nil { - return err - } - r.updateClaimPrefixStatus(ctx, claim, pi) - return nil -} diff --git a/pkg/backend/ipam/applicator_static_prefix_validate.go b/pkg/backend/ipam/applicator_static_prefix_validate.go deleted file mode 100644 index cf1efc4..0000000 --- a/pkg/backend/ipam/applicator_static_prefix_validate.go +++ /dev/null @@ -1,177 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 ipam - -import ( - "context" - "fmt" - - "github.com/hansthienpondt/nipam/pkg/table" - "github.com/henderiw/iputil" - "github.com/henderiw/logger/log" - "github.com/kuidio/kuid/apis/backend" - ipambev1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" -) - -type staticPrefixApplicator struct { - name string - applicator -} - -func (r *staticPrefixApplicator) Validate(ctx context.Context, claim *ipambev1alpha1.IPClaim) error { - log := log.FromContext(ctx) - pi, err := iputil.New(*claim.Spec.Prefix) - if err != nil { - return err - } - // get dryrun rib - dryrunRib := r.cacheCtx.rib.Clone() - - // There is 2 scenario's: - // a regular prefix w/o address: 10.0.0.0/24 - // an address based prefix: 10.0.0.1/24 -> only allowed for claimType network - // check if the net prefix/subnet exists - route, ok := dryrunRib.Get(pi.GetIPSubnet()) - if ok { - // route exists -> the owner need to match - routeLabels := route.Labels() - if err := claim.ValidateOwner(routeLabels); err != nil { - return err - } - // for an address based prefix (which is only allowed) for networks - // we need to also validate if the address part does not exist - if pi.GetIPSubnet().String() != pi.GetIPPrefix().String() { - // check if the existing net prefix/subnet is of type network - if claim.GetIPPrefixType() != ipambev1alpha1.IPPrefixType_Network { - return fmt.Errorf("a static address based prefix (net <> address) is only allowed for claimType network") - } - route, ok = dryrunRib.Get(pi.GetIPAddressPrefix()) - if ok { - // if the route exists validate the owner - routeLabels := route.Labels() - if err := claim.ValidateOwner(routeLabels); err != nil { - return err - } - } - } - return nil - } - // Route does not exist -> dry run - route = table.NewRoute( - pi.GetIPSubnet(), - claim.GetDummyLabelsFromPrefix(*pi), - map[string]any{}, - ) - if err := dryrunRib.Add(route); err != nil { - log.Error("cannot add route", "route", route, "error", err.Error()) - return err - } - // get the route again and check for children - route, ok = dryrunRib.Get(pi.GetIPSubnet()) - if !ok { - err := fmt.Errorf("cannot get route %s which just got addded", pi.GetIPSubnet()) - log.Error(err.Error()) - return err - } - // check for children - routes := route.Children(dryrunRib) - if len(routes) > 0 { - if err := r.validateExistingChildren(claim, routes); err != nil { - return err - } - } - // get parents - routes = route.Parents(dryrunRib) - if len(routes) == 0 { - // no parents exist - if err := validateNoParent(claim); err != nil { - return err - } - return nil - } - // parents exist - parentRoute := findParent(routes) - if err := r.validateExistingParent(claim, pi, parentRoute); err != nil { - log.Error(err.Error()) - return err - } - return nil -} - -func (r *staticPrefixApplicator) validateExistingChildren(claim *ipambev1alpha1.IPClaim, routes table.Routes) error { - prefixType := claim.GetIPPrefixType() - - for _, route := range routes { - routeLabels := route.Labels() - childClaimSummaryType := routeLabels[backend.KuidIPAMClaimSummaryTypeKey] - childPrefixType := routeLabels[backend.KuidIPAMIPPrefixTypeKey] - switch prefixType { - case ipambev1alpha1.IPPrefixType_Aggregate, ipambev1alpha1.IPPrefixType_Other: // the claim is of type aggregate - // we only allow prefixes -> validate aggregate type - if childClaimSummaryType == string(ipambev1alpha1.IPClaimSummaryType_Address) || - childClaimSummaryType == string(ipambev1alpha1.IPClaimSummaryType_Range) { - return fmt.Errorf("child with addressing %s not allowed in claim of type %s", childClaimSummaryType, prefixType) - } - if childPrefixType == string(ipambev1alpha1.IPPrefixType_Aggregate) { - return fmt.Errorf("nesting %s is not possible", childPrefixType) - } - case ipambev1alpha1.IPPrefixType_Network, ipambev1alpha1.IPPrefixType_Pool: - // we only allow range and addresses -> these dont have a claimType - if childClaimSummaryType == string(ipambev1alpha1.IPClaimSummaryType_Prefix) { - return fmt.Errorf("child with addressing %s not allowed in claim of type %s", childClaimSummaryType, prefixType) - } - default: - return fmt.Errorf("invalid claimType: %s", prefixType) - } - } - return nil -} - -func (r *staticPrefixApplicator) validateExistingParent(claim *ipambev1alpha1.IPClaim, _ *iputil.Prefix, route table.Route) error { - prefixType := claim.GetIPPrefixType() - - routeLabels := route.Labels() - parentClaimSummaryType := routeLabels[backend.KuidIPAMClaimSummaryTypeKey] - parentClaimType := routeLabels[backend.KuidIPAMIPPrefixTypeKey] - switch prefixType { - case ipambev1alpha1.IPPrefixType_Aggregate: - return fmt.Errorf("parent %s/%s nesting %s/%s is not possible", route.Prefix().String(), *claim.Spec.Prefix, parentClaimType, prefixType) - case ipambev1alpha1.IPPrefixType_Other: // the claim is of type aggregate - // we only allow prefixes - if parentClaimSummaryType == string(ipambev1alpha1.IPClaimSummaryType_Address) || - parentClaimSummaryType == string(ipambev1alpha1.IPClaimSummaryType_Range) { - return fmt.Errorf("parent %s not allowed in claim of type %s", parentClaimSummaryType, prefixType) - } - if parentClaimType == string(ipambev1alpha1.IPPrefixType_Network) || - parentClaimType == string(ipambev1alpha1.IPPrefixType_Pool) { - return fmt.Errorf("parent %s/%s nesting %s/%s is not possible", route.Prefix().String(), *claim.Spec.Prefix, parentClaimType, prefixType) - } - case ipambev1alpha1.IPPrefixType_Network, ipambev1alpha1.IPPrefixType_Pool: - // we only allow range and addresses -> these dont have a claimType - if parentClaimSummaryType == string(ipambev1alpha1.IPClaimSummaryType_Address) || - parentClaimSummaryType == string(ipambev1alpha1.IPClaimSummaryType_Range) { - return fmt.Errorf("parent %s not allowed in claim of type %s", parentClaimSummaryType, prefixType) - } - if parentClaimType == string(ipambev1alpha1.IPPrefixType_Network) || - parentClaimType == string(ipambev1alpha1.IPPrefixType_Pool) { - return fmt.Errorf("parent %s/%s nesting %s/%s is not possible", route.Prefix().String(), *claim.Spec.Prefix, parentClaimType, prefixType) - } - default: - return fmt.Errorf("invalid claimType: %s", prefixType) - } - return nil -} diff --git a/pkg/backend/ipam/applicator_static_range_apply.go b/pkg/backend/ipam/applicator_static_range_apply.go deleted file mode 100644 index cb9d116..0000000 --- a/pkg/backend/ipam/applicator_static_range_apply.go +++ /dev/null @@ -1,50 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 ipam - -import ( - "context" - - "github.com/henderiw/iputil" - "github.com/henderiw/logger/log" - ipambev1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" - "go4.org/netipx" -) - -func (r *staticRangeApplicator) Apply(ctx context.Context, claim *ipambev1alpha1.IPClaim) error { - log := log.FromContext(ctx).With("name", claim.GetName()) - log.Info("static range claim") - ipRange, err := netipx.ParseIPRange(*claim.Spec.Range) - if err != nil { - return err - } - - // add each prefix in the routing table -> we convey them all together - pis := make([]*iputil.Prefix, 0, len(ipRange.Prefixes())) - for _, prefix := range ipRange.Prefixes() { - pis = append(pis, iputil.NewPrefixInfo(prefix)) - } - if err := r.apply(ctx, claim, pis, false, map[string]string{}); err != nil { - return err - } - if err := r.applyRange(ctx, claim, ipRange); err != nil { - return err - } - - r.updateClaimRangeStatus(ctx, claim) - return nil -} diff --git a/pkg/backend/ipam/applicator_static_range_validate.go b/pkg/backend/ipam/applicator_static_range_validate.go deleted file mode 100644 index 7736f07..0000000 --- a/pkg/backend/ipam/applicator_static_range_validate.go +++ /dev/null @@ -1,130 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 ipam - -import ( - "context" - "fmt" - - "github.com/hansthienpondt/nipam/pkg/table" - "github.com/henderiw/iputil" - "github.com/henderiw/logger/log" - "github.com/kuidio/kuid/apis/backend" - ipambev1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" - "go4.org/netipx" -) - -type staticRangeApplicator struct { - name string - applicator -} - -func (r *staticRangeApplicator) Validate(ctx context.Context, claim *ipambev1alpha1.IPClaim) error { - log := log.FromContext(ctx) - ipRange, err := netipx.ParseIPRange(*claim.Spec.Range) - if err != nil { - return err - } - // get dryrun rib - dryrunRib := r.cacheCtx.rib.Clone() - - // expand the prefixes - exists := false - for _, prefix := range ipRange.Prefixes() { - route, ok := dryrunRib.Get(prefix) - if ok { - exists = true - // if the route exists validate the owner - routeLabels := route.Labels() - if err := claim.ValidateOwner(routeLabels); err != nil { - return err - } - } else { - // check if some exists and others not - if exists { - return fmt.Errorf("some routes in the range exists and others not, it should be all or nothing") - } - } - } - if exists { - return nil // all prefixes of the range exists so we are good - } - // insert in the routing table - var singlParentPrefix string - for _, prefix := range ipRange.Prefixes() { - //dryrunRib := r.cacheCtx.rib.Clone() - route := table.NewRoute( - prefix, - map[string]string{}, - map[string]any{}, - ) - if err := dryrunRib.Add(route); err != nil { - log.Error("cannot add route", "route", route, "error", err.Error()) - return err - } - // get the route again and check for children - route, ok := dryrunRib.Get(prefix) - if !ok { - err := fmt.Errorf("cannot get route %s which just got addded", prefix) - log.Error(err.Error()) - return err - } - // check for children - routes := route.Children(dryrunRib) - if len(routes) > 0 { - err := fmt.Errorf("cannot have children for a range %s", prefix) - log.Error(err.Error()) - return err - } - // get parents - routes = route.Parents(dryrunRib) - if len(routes) == 0 { - // no parents exist - if err := validateNoParent(claim); err != nil { - return err - } - } - // parents exist - parentRoute := findParent(routes) - if err := r.validateExistingParent(claim, iputil.NewPrefixInfo(prefix), parentRoute); err != nil { - log.Error(err.Error()) - return err - } - if singlParentPrefix != "" { - if parentRoute.Prefix().String() != singlParentPrefix { - err := fmt.Errorf("a range has to fit into a single parent prefix got %s and %s", singlParentPrefix, parentRoute.Prefix().String()) - log.Error(err.Error()) - return err - } - } else { - singlParentPrefix = parentRoute.Prefix().String() - } - } - - return nil -} - -func (r *staticRangeApplicator) validateExistingParent(_ *ipambev1alpha1.IPClaim, _ *iputil.Prefix, route table.Route) error { - routeLabels := route.Labels() - parentClaimType := routeLabels[backend.KuidIPAMIPPrefixTypeKey] - - if parentClaimType == string(ipambev1alpha1.IPPrefixType_Aggregate) { - return fmt.Errorf("a range is not possible with a parent of type %s", parentClaimType) - } - - return nil -} diff --git a/pkg/backend/ipam/context.go b/pkg/backend/ipam/context.go deleted file mode 100644 index 77e1efd..0000000 --- a/pkg/backend/ipam/context.go +++ /dev/null @@ -1,78 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 ipam - -import ( - "context" - "fmt" - "log/slog" - - "github.com/henderiw/logger/log" - ipambev1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" -) - -func initClaimContext(ctx context.Context, op string, claim *ipambev1alpha1.IPClaim) context.Context { - var l *slog.Logger - - ipClaimType, err := claim.GetIPClaimType() - if err != nil { - return ctx - } - switch ipClaimType { - case ipambev1alpha1.IPClaimType_DynamicAddress: - l = log.FromContext(ctx). - With( - "op", fmt.Sprintf("%s dynamic address claim", op), - "nsn", claim.GetNamespacedName().String(), - "index", claim.Spec.Index, - ) - case ipambev1alpha1.IPClaimType_DynamicPrefix: - l = log.FromContext(ctx). - With( - "op", fmt.Sprintf("%s dynamic prefix claim", op), - "nsn", claim.GetNamespacedName().String(), - "index", claim.Spec.Index, - "prefixType", claim.GetIPPrefixType(), - ) - case ipambev1alpha1.IPClaimType_StaticAddress: - l = log.FromContext(ctx). - With( - "op", fmt.Sprintf("%s static address claim", op), - "nsn", claim.GetNamespacedName().String(), - "index", claim.Spec.Idx, - "address", *claim.Spec.Address, - ) - case ipambev1alpha1.IPClaimType_StaticPrefix: - l = log.FromContext(ctx). - With( - "op", fmt.Sprintf("%s static prefix claim", op), - "nsn", claim.GetNamespacedName().String(), - "index", claim.Spec.Index, - "prefix", *claim.Spec.Prefix, - "prefixType", claim.GetIPPrefixType(), - ) - case ipambev1alpha1.IPClaimType_StaticRange: - l = log.FromContext(ctx). - With( - "op", fmt.Sprintf("%s static range claim", op), - "nsn", claim.GetNamespacedName().String(), - "index", claim.Spec.Index, - "range", *claim.Spec.Range, - ) - } - return log.IntoContext(ctx, l) -} diff --git a/pkg/backend/ipam/ipam.go b/pkg/backend/ipam/ipam.go deleted file mode 100644 index 729450b..0000000 --- a/pkg/backend/ipam/ipam.go +++ /dev/null @@ -1,211 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 ipam - -import ( - "context" - "fmt" - "reflect" - - "github.com/henderiw/idxtable/pkg/iptable" - "github.com/henderiw/logger/log" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - ipambev1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" - bebackend "github.com/kuidio/kuid/pkg/backend/backend" - "sigs.k8s.io/controller-runtime/pkg/client" -) - -func New(c client.Client) bebackend.Backend { - cache := bebackend.NewCache[*CacheContext]() - - store := bebackend.NewNopStore() - if c != nil { - store = NewStore(c, cache) - } - return &be{ - cache: cache, - store: store, - } -} - -type be struct { - cache bebackend.Cache[*CacheContext] - store bebackend.Store -} - -// CreateIndex creates a backend index -func (r *be) CreateIndex(ctx context.Context, idx backend.IndexObject) error { - //cr, ok := obj.(*ipamresv1alpha1.NetworkInstance) - //if !ok { - // return fmt.Errorf("cannot create index expecting %s, got %s", ipamresv1alpha1.NetworkInstanceKind, reflect.TypeOf(obj).Name()) - //} - ctx = bebackend.InitIndexContext(ctx, "create", idx) - log := log.FromContext(ctx) - log.Info("start") - key := idx.GetKey() - //log := log.FromContext(ctx).With("key", key) - - log.Info("start", "isInitialized", r.cache.IsInitialized(ctx, key)) - // if the Cache is not initialized -> restore the cache - // this happens upon initialization or backend restart - r.cache.Create(ctx, key, NewCacheContext()) - if r.cache.IsInitialized(ctx, key) { - log.Info("already initialized") - return nil - } - if err := r.store.Restore(ctx, key); err != nil { - log.Error("cannot restore index", "error", err.Error()) - return err - } - log.Info("finished") - return r.cache.SetInitialized(ctx, key) -} - -// DeleteIndex deletes a backend index -func (r *be) DeleteIndex(ctx context.Context, idx backend.IndexObject) error { - //cr, ok := obj.(*ipamresv1alpha1.NetworkInstance) - //if !ok { - // return fmt.Errorf("cannot delete index expecting %s, got %s", ipamresv1alpha1.NetworkInstanceKind, reflect.TypeOf(obj).Name()) - //} - ctx = bebackend.InitIndexContext(ctx, "delete", idx) - log := log.FromContext(ctx) - log.Debug("start") - key := idx.GetKey() - - log.Debug("start", "isInitialized", r.cache.IsInitialized(ctx, key)) - // delete the data from the backend - if err := r.store.Destroy(ctx, key); err != nil { - log.Error("cannot delete Index", "error", err.Error()) - return err - } - r.cache.Delete(ctx, key) - - log.Debug("finished") - return nil - -} - -// Claim claims an entry in the backend index -func (r *be) Claim(ctx context.Context, obj backend.ClaimObject) error { - claim, ok := obj.(*ipambev1alpha1.IPClaim) - if !ok { - return fmt.Errorf("cannot claim ip expecting %s, got %s", ipambev1alpha1.IPClaimKind, reflect.TypeOf(obj).Name()) - } - ctx = initClaimContext(ctx, "create", claim) - log := log.FromContext(ctx) - log.Debug("start") - - cacheCtx, err := r.cache.Get(ctx, claim.GetKey(), false) - if err != nil { - return err - } - - a, err := getApplicator(ctx, cacheCtx, claim) - if err != nil { - return err - } - if err := a.Validate(ctx, claim); err != nil { - return err - } - if err := a.Apply(ctx, claim); err != nil { - return err - } - - // store the resources in the backend - return r.store.SaveAll(ctx, claim.GetKey()) -} - -// Release delete a claim in the backend index -func (r *be) Release(ctx context.Context, obj backend.ClaimObject) error { - claim, ok := obj.(*ipambev1alpha1.IPClaim) - if !ok { - return fmt.Errorf("cannot delete claimm expecting %s, got %s", ipambev1alpha1.IPClaimKind, reflect.TypeOf(obj).Name()) - } - ctx = initClaimContext(ctx, "delete", claim) - log := log.FromContext(ctx) - log.Debug("start") - - cacheCtx, err := r.cache.Get(ctx, claim.GetKey(), false) - if err != nil { - return err - } - - // ip claim delete and store - a, err := getApplicator(ctx, cacheCtx, claim) - if err != nil { - // error gets returned when rib is not initialized -> this means we can safely return - // and pretend nothing is wrong (hence return nil) since the cleanup already happened - return nil - } - if err := a.Delete(ctx, claim); err != nil { - return err - } - - return r.store.SaveAll(ctx, claim.GetKey()) -} - -func (r *be) GetCache(ctx context.Context, key store.Key) (*CacheContext, error) { - return r.cache.Get(ctx, key, false) -} - -func getApplicator(_ context.Context, cacheCtx *CacheContext, claim *ipambev1alpha1.IPClaim) (Applicator, error) { - ipClaimType, err := claim.GetIPClaimType() - if err != nil { - return nil, err - } - var a Applicator - switch ipClaimType { - case ipambev1alpha1.IPClaimType_StaticAddress: - a = &staticAddressApplicator{name: string(ipambev1alpha1.IPClaimType_StaticAddress), applicator: applicator{cacheCtx: cacheCtx}} - case ipambev1alpha1.IPClaimType_StaticPrefix: - a = &staticPrefixApplicator{name: string(ipambev1alpha1.IPClaimType_StaticPrefix), applicator: applicator{cacheCtx: cacheCtx}} - case ipambev1alpha1.IPClaimType_StaticRange: - a = &staticRangeApplicator{name: string(ipambev1alpha1.IPClaimType_StaticRange), applicator: applicator{cacheCtx: cacheCtx}} - case ipambev1alpha1.IPClaimType_DynamicAddress: - a = &dynamicAddressApplicator{name: string(ipambev1alpha1.IPClaimType_DynamicAddress), applicator: applicator{cacheCtx: cacheCtx}} - case ipambev1alpha1.IPClaimType_DynamicPrefix: - a = &dynamicPrefixApplicator{name: string(ipambev1alpha1.IPClaimType_DynamicPrefix), applicator: applicator{cacheCtx: cacheCtx}} - default: - return nil, fmt.Errorf("invalid addressing, got: %s", string(ipClaimType)) - } - - return a, nil -} - -func (r *be) PrintEntries(ctx context.Context, k store.Key) error { - cachectx, err := r.cache.Get(ctx, k, false) - if err != nil { - return fmt.Errorf("key not found: %s", err.Error()) - } - fmt.Println("---------") - for _, entry := range cachectx.rib.GetTable() { - entry := entry - fmt.Println("entry", entry.String()) - } - cachectx.ranges.List(ctx, func(ctx context.Context, k store.Key, t iptable.IPTable) { - fmt.Println("range", k.Name) - if t != nil { - for _, entry := range t.GetAll() { - entry := entry - fmt.Println("entry", entry.String()) - } - } - - }) - return nil -} diff --git a/pkg/backend/ipam/ipam_dynamic_address_test.go b/pkg/backend/ipam/ipam_dynamic_address_test.go deleted file mode 100644 index a9d1037..0000000 --- a/pkg/backend/ipam/ipam_dynamic_address_test.go +++ /dev/null @@ -1,167 +0,0 @@ -package ipam - -import ( - "context" - "testing" - - "github.com/kuidio/kuid/apis/backend" - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" - "github.com/stretchr/testify/assert" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -func TestIPAMDynamicAddress(t *testing.T) { - tests := map[string]struct { - index string - prefixes []testprefix - }{ - "FromAggregate": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "10.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: dynamicAddress, name: "addrClaim1", expectedError: true}, - }, - }, - "FromNetwork": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "10.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "10.0.0.0/24", prefixType: network, expectedError: false}, - {claimType: dynamicAddress, name: "addrClaim1", expectedError: false, expectedIP: "10.0.0.1/24"}, - {claimType: dynamicAddress, name: "addrClaim1", expectedError: false, expectedIP: "10.0.0.1/24"}, // we explicitly reclaim the same ip - {claimType: dynamicAddress, name: "addrClaim2", expectedError: false, expectedIP: "10.0.0.254/24"}, - {claimType: dynamicAddress, name: "addrClaim3", expectedError: false, expectedIP: "10.0.0.2/24"}, - {claimType: dynamicAddress, name: "addrClaim4", expectedError: false, expectedIP: "10.0.0.3/24"}, - {claimType: dynamicAddress, name: "addrClaim5", expectedError: false, expectedIP: "10.0.0.252/24"}, - }, - }, - "FromPool": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "10.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "10.0.0.0/24", prefixType: pool, expectedError: false}, - {claimType: dynamicAddress, name: "addrClaim1", expectedError: false, expectedIP: "10.0.0.0/32"}, - {claimType: dynamicAddress, name: "addrClaim1", expectedError: false, expectedIP: "10.0.0.0/32"}, // we explicitly reclaim the same ip - {claimType: dynamicAddress, name: "addrClaim2", expectedError: false, expectedIP: "10.0.0.1/32"}, - {claimType: dynamicAddress, name: "addrClaim3", expectedError: false, expectedIP: "10.0.0.2/32"}, - {claimType: dynamicAddress, name: "addrClaim4", expectedError: false, expectedIP: "10.0.0.3/32"}, - {claimType: dynamicAddress, name: "addrClaim5", expectedError: false, expectedIP: "10.0.0.4/32"}, - }, - }, - "FromOther": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "10.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "10.0.0.0/24", expectedError: false}, - {claimType: dynamicAddress, name: "addrClaim1", expectedError: true}, - }, - }, - "FromRange": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "10.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "10.0.0.0/24", expectedError: false}, - {claimType: staticRange, name: "range1", ip: "10.0.0.10-10.0.0.100", expectedError: false}, - {claimType: dynamicAddress, name: "addrClaim1", expectedError: false, expectedIP: "10.0.0.10/32", selector: &metav1.LabelSelector{ - MatchLabels: map[string]string{backend.KuidClaimNameKey: "range1"}, - }}, - {claimType: dynamicAddress, name: "addrClaim1", expectedError: false, expectedIP: "10.0.0.10/32", selector: &metav1.LabelSelector{ - MatchLabels: map[string]string{backend.KuidClaimNameKey: "range1"}, // we explicitly reclaim the same ip - }}, - {claimType: dynamicAddress, name: "addrClaim2", expectedError: false, expectedIP: "10.0.0.11/32", selector: &metav1.LabelSelector{ - MatchLabels: map[string]string{backend.KuidClaimNameKey: "range1"}, - }}, - }, - }, - } - - for name, tc := range tests { - tc := tc - t.Run(name, func(t *testing.T) { - be := New(nil) - ctx := context.Background() - if tc.index != "" { - index := getIndex(tc.index) - err := be.CreateIndex(ctx, index) - assert.NoError(t, err) - } - - for _, p := range tc.prefixes { - p := p - var ipClaim *v1alpha1.IPClaim - var err error - - switch p.claimType { - case staticPrefix: - if p.prefixType != nil && *p.prefixType == *aggregate { - ipClaim, err = p.getIPClaimFromNetworkPrefix(tc.index) - } else { - ipClaim, err = p.getStaticPrefixIPClaim(tc.index) - } - case staticRange: - ipClaim, err = p.getStaticRangeIPClaim(tc.index) - case staticAddress: - ipClaim, err = p.getStaticAddressIPClaim(tc.index) - case dynamicPrefix: - ipClaim, err = p.getDynamicPrefixIPClaim(tc.index) - case dynamicAddress: - ipClaim, err = p.getDynamicAddressIPClaim(tc.index) - } - assert.NoError(t, err) - - err = be.Claim(ctx, ipClaim) - if p.expectedError { - assert.Error(t, err) - } else { - assert.NoError(t, err) - switch p.claimType { - case staticPrefix, dynamicPrefix: - if ipClaim.Status.Prefix == nil { - t.Errorf("expecting prefix status got nil") - } else { - expectedIP := p.ip - if p.expectedIP != "" { - expectedIP = p.expectedIP - } - if *ipClaim.Status.Prefix != expectedIP { - t.Errorf("expecting prefix got %s, want %s\n", *ipClaim.Status.Prefix, expectedIP) - } - } - case staticAddress, dynamicAddress: - if ipClaim.Status.Address == nil { - t.Errorf("expecting address status got nil") - } else { - expectedIP := p.ip - if p.expectedIP != "" { - expectedIP = p.expectedIP - } - if *ipClaim.Status.Address != expectedIP { - t.Errorf("expecting address got %s, want %s\n", *ipClaim.Status.Address, expectedIP) - } - } - if ipClaim.Status.DefaultGateway == nil { - if p.expectedDG != "" { - t.Errorf("expecting defaultGateway %s got nil", p.expectedDG) - } - } else { - if p.expectedDG == "" { - t.Errorf("unexpected defaultGateway got %s", *ipClaim.Status.DefaultGateway) - } - if *ipClaim.Status.DefaultGateway != p.expectedDG { - t.Errorf("expecting defaultGateway got %s, want %s\n", *ipClaim.Status.DefaultGateway, p.expectedDG) - } - } - case staticRange: - if ipClaim.Status.Range == nil { - t.Errorf("expecting range status got nil") - } else { - if *ipClaim.Status.Range != p.ip { - t.Errorf("expecting prefix got %s, want %s\n", *ipClaim.Status.Range, p.ip) - } - } - } - } - } - }) - } -} diff --git a/pkg/backend/ipam/ipam_dynamic_prefix_test.go b/pkg/backend/ipam/ipam_dynamic_prefix_test.go deleted file mode 100644 index 369eaa6..0000000 --- a/pkg/backend/ipam/ipam_dynamic_prefix_test.go +++ /dev/null @@ -1,131 +0,0 @@ -package ipam - -import ( - "context" - "testing" - - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" - "github.com/stretchr/testify/assert" -) - -func TestIPAMDynamicPrefix(t *testing.T) { - tests := map[string]struct { - index string - prefixes []testprefix - }{ - "Normal": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "10.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: dynamicPrefix, name: "prefix1", prefixLength: 24, expectedError: false, expectedIP: "10.0.0.0/24"}, - {claimType: dynamicPrefix, name: "prefix2", prefixLength: 24, prefixType: pool, expectedError: false, expectedIP: "10.0.1.0/24"}, - {claimType: dynamicPrefix, name: "prefix3", prefixLength: 24, prefixType: network, expectedError: false, expectedIP: "10.0.2.0/24"}, - {claimType: dynamicPrefix, name: "prefix4", prefixLength: 24, prefixType: network, expectedError: false, expectedIP: "10.0.3.0/24"}, - {claimType: dynamicPrefix, name: "prefix5", prefixLength: 24, expectedError: false, expectedIP: "10.0.4.0/24"}, - }, - }, - "NoAvailable": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "10.0.0.0/24", prefixType: aggregate, expectedError: false}, - {claimType: dynamicPrefix, name: "prefix1", prefixLength: 24, expectedError: true}, - }, - }, - "NoAggregate": { - index: "a", - prefixes: []testprefix{ - {claimType: dynamicPrefix, name: "prefix1", prefixLength: 24, expectedError: true}, - }, - }, - } - - for name, tc := range tests { - tc := tc - t.Run(name, func(t *testing.T) { - be := New(nil) - ctx := context.Background() - if tc.index != "" { - index := getIndex(tc.index) - err := be.CreateIndex(ctx, index) - assert.NoError(t, err) - } - - for _, p := range tc.prefixes { - p := p - var ipClaim *v1alpha1.IPClaim - var err error - - switch p.claimType { - case staticPrefix: - if p.prefixType != nil && *p.prefixType == *aggregate { - ipClaim, err = p.getIPClaimFromNetworkPrefix(tc.index) - } else { - ipClaim, err = p.getStaticPrefixIPClaim(tc.index) - } - case staticRange: - ipClaim, err = p.getStaticRangeIPClaim(tc.index) - case staticAddress: - ipClaim, err = p.getStaticAddressIPClaim(tc.index) - case dynamicPrefix: - ipClaim, err = p.getDynamicPrefixIPClaim(tc.index) - case dynamicAddress: - ipClaim, err = p.getDynamicAddressIPClaim(tc.index) - } - assert.NoError(t, err) - - err = be.Claim(ctx, ipClaim) - if p.expectedError { - assert.Error(t, err) - } else { - assert.NoError(t, err) - switch p.claimType { - case staticPrefix, dynamicPrefix: - if ipClaim.Status.Prefix == nil { - t.Errorf("expecting prefix status got nil") - } else { - expectedIP := p.ip - if p.expectedIP != "" { - expectedIP = p.expectedIP - } - if *ipClaim.Status.Prefix != expectedIP { - t.Errorf("expecting prefix got %s, want %s\n", *ipClaim.Status.Prefix, expectedIP) - } - } - case staticAddress, dynamicAddress: - if ipClaim.Status.Address == nil { - t.Errorf("expecting address status got nil") - } else { - expectedIP := p.ip - if p.expectedIP != "" { - expectedIP = p.expectedIP - } - if *ipClaim.Status.Address != expectedIP { - t.Errorf("expecting address got %s, want %s\n", *ipClaim.Status.Address, expectedIP) - } - } - if ipClaim.Status.DefaultGateway == nil { - if p.expectedDG != "" { - t.Errorf("expecting defaultGateway %s got nil", p.expectedDG) - } - } else { - if p.expectedDG == "" { - t.Errorf("unexpected defaultGateway got %s", *ipClaim.Status.DefaultGateway) - } - if *ipClaim.Status.DefaultGateway != p.expectedDG { - t.Errorf("expecting defaultGateway got %s, want %s\n", *ipClaim.Status.DefaultGateway, p.expectedDG) - } - } - case staticRange: - if ipClaim.Status.Range == nil { - t.Errorf("expecting range status got nil") - } else { - if *ipClaim.Status.Range != p.ip { - t.Errorf("expecting prefix got %s, want %s\n", *ipClaim.Status.Range, p.ip) - } - } - } - } - } - }) - } -} diff --git a/pkg/backend/ipam/ipam_index_test.go b/pkg/backend/ipam/ipam_index_test.go deleted file mode 100644 index 818681d..0000000 --- a/pkg/backend/ipam/ipam_index_test.go +++ /dev/null @@ -1,35 +0,0 @@ -package ipam - -import ( - "context" - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestIPAMIndexNormal(t *testing.T) { - tests := map[string]struct { - index string - }{ - "CreateDelete": { - index: "a", - }, - } - - for name, tc := range tests { - t.Run(name, func(t *testing.T) { - be := New(nil) - ctx := context.Background() - index := getIndex(tc.index) - if err := be.CreateIndex(ctx, index); err != nil { - assert.Error(t, err) - } - if err := be.DeleteIndex(ctx, index); err != nil { - assert.Error(t, err) - } - if err := be.DeleteIndex(ctx, index); err != nil { - assert.Error(t, err) - } - }) - } -} diff --git a/pkg/backend/ipam/ipam_static_address_test.go b/pkg/backend/ipam/ipam_static_address_test.go deleted file mode 100644 index febdd6c..0000000 --- a/pkg/backend/ipam/ipam_static_address_test.go +++ /dev/null @@ -1,215 +0,0 @@ -package ipam - -import ( - "context" - "testing" - - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" - "github.com/stretchr/testify/assert" -) - -func TestIPAMStaticAddress(t *testing.T) { - tests := map[string]struct { - index string - prefixes []testprefix - }{ - "NoParent": { - index: "a", - prefixes: []testprefix{ - {claimType: staticAddress, ip: "172.0.0.0/32", expectedError: true}, - }, - }, - "Address_AggregateParent": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "172.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticAddress, ip: "172.0.0.0/32", expectedError: true}, - }, - }, - "Address_NetworkParent_OwnerClash": { // since netwotk prefixes get expanded the address is clashing - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "172.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: network, expectedError: false}, - {claimType: staticAddress, ip: "172.0.0.0/32", expectedError: true}, - }, - }, - "Address_NetworkParent": { // 32 or /128 not possible in network Addresses - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "172.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: network, expectedError: false}, - {claimType: staticAddress, ip: "172.0.0.1/32", expectedError: true}, - }, - }, - "Address_First_PoolParent": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "172.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: pool, expectedError: false}, - {claimType: staticAddress, ip: "172.0.0.0/32", expectedError: false}, - }, - }, - "Address_PoolParent": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "172.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: pool, expectedError: false}, - {claimType: staticAddress, ip: "172.0.0.1/32", expectedError: false}, - }, - }, - "Address_First_OtherParent": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "172.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/24", expectedError: false}, - {claimType: staticAddress, ip: "172.0.0.0/32", expectedError: false}, - }, - }, - "PrefixAddress_AggregateParent": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "172.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticAddress, ip: "172.0.0.1/24", expectedError: true}, - }, - }, - "PrefixAddress_NetworkParent_OwnerClash": { // since netwotk prefixes get expanded the address is clashing - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "172.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: network, expectedError: false}, - {claimType: staticAddress, ip: "172.0.0.0/32", expectedError: true}, - }, - }, - "PrefixAddress_NetworkParent": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "172.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: network, expectedError: false}, - {claimType: staticAddress, ip: "172.0.0.1/24", expectedError: false}, - }, - }, - "PrefixAddress_NetworkParentWithAddress": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "172.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.1/24", prefixType: network, expectedError: false}, - {claimType: staticAddress, ip: "172.0.0.2/24", expectedError: false}, - }, - }, - "PrefixAddress_First_PoolParent": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "172.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: pool, expectedError: false}, - {claimType: staticAddress, ip: "172.0.0.0/32", expectedError: false}, - }, - }, - "PrefixAddress_PoolParent": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "172.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: pool, expectedError: false}, - {claimType: staticAddress, ip: "172.0.0.1/32", expectedError: false}, - }, - }, - "PrefixAddress_First_OtherParent": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "172.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/24", expectedError: false}, - {claimType: staticAddress, ip: "172.0.0.0/32", expectedError: false}, - }, - }, - } - - for name, tc := range tests { - tc := tc - t.Run(name, func(t *testing.T) { - be := New(nil) - ctx := context.Background() - if tc.index != "" { - index := getIndex(tc.index) - err := be.CreateIndex(ctx, index) - assert.NoError(t, err) - } - - for _, p := range tc.prefixes { - p := p - var ipClaim *v1alpha1.IPClaim - var err error - - switch p.claimType { - case staticPrefix: - if p.prefixType != nil && *p.prefixType == *aggregate { - ipClaim, err = p.getIPClaimFromNetworkPrefix(tc.index) - } else { - ipClaim, err = p.getStaticPrefixIPClaim(tc.index) - } - case staticRange: - ipClaim, err = p.getStaticRangeIPClaim(tc.index) - case staticAddress: - ipClaim, err = p.getStaticAddressIPClaim(tc.index) - case dynamicPrefix: - ipClaim, err = p.getDynamicPrefixIPClaim(tc.index) - case dynamicAddress: - ipClaim, err = p.getDynamicAddressIPClaim(tc.index) - } - assert.NoError(t, err) - - err = be.Claim(ctx, ipClaim) - if p.expectedError { - assert.Error(t, err) - } else { - assert.NoError(t, err) - switch p.claimType { - case staticPrefix, dynamicPrefix: - if ipClaim.Status.Prefix == nil { - t.Errorf("expecting prefix status got nil") - } else { - expectedIP := p.ip - if p.expectedIP != "" { - expectedIP = p.expectedIP - } - if *ipClaim.Status.Prefix != expectedIP { - t.Errorf("expecting prefix got %s, want %s\n", *ipClaim.Status.Prefix, expectedIP) - } - } - case staticAddress, dynamicAddress: - if ipClaim.Status.Address == nil { - t.Errorf("expecting address status got nil") - } else { - expectedIP := p.ip - if p.expectedIP != "" { - expectedIP = p.expectedIP - } - if *ipClaim.Status.Address != expectedIP { - t.Errorf("expecting address got %s, want %s\n", *ipClaim.Status.Address, expectedIP) - } - } - if ipClaim.Status.DefaultGateway == nil { - if p.expectedDG != "" { - t.Errorf("expecting defaultGateway %s got nil", p.expectedDG) - } - } else { - if p.expectedDG == "" { - t.Errorf("unexpected defaultGateway got %s", *ipClaim.Status.DefaultGateway) - } - if *ipClaim.Status.DefaultGateway != p.expectedDG { - t.Errorf("expecting defaultGateway got %s, want %s\n", *ipClaim.Status.DefaultGateway, p.expectedDG) - } - } - case staticRange: - if ipClaim.Status.Range == nil { - t.Errorf("expecting range status got nil") - } else { - if *ipClaim.Status.Range != p.ip { - t.Errorf("expecting prefix got %s, want %s\n", *ipClaim.Status.Range, p.ip) - } - } - } - } - } - }) - } -} diff --git a/pkg/backend/ipam/ipam_static_prefix_test.go b/pkg/backend/ipam/ipam_static_prefix_test.go deleted file mode 100644 index 511ba07..0000000 --- a/pkg/backend/ipam/ipam_static_prefix_test.go +++ /dev/null @@ -1,273 +0,0 @@ -package ipam - -import ( - "context" - "testing" - - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" - "github.com/stretchr/testify/assert" -) - -func TestIPAMStaticPrefix(t *testing.T) { - tests := map[string]struct { - index string - prefixes []testprefix - }{ - "NotReady": { - index: "", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "172.0.0.0/8", prefixType: aggregate, expectedError: true}, // rib not ready - }, - }, - "AggregateNormal": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "172.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "10.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "2000::/48", prefixType: aggregate, expectedError: false}, - }, - }, - "AggregateNestingIPv4": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "172.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/16", prefixType: aggregate, expectedError: true}, // nesting aggregate - {claimType: staticPrefix, ip: "2000::/48", prefixType: aggregate, expectedError: false}, - }, - }, - "AggregateNestingIPv6": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "2000::/48", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "2000::/32", prefixType: aggregate, expectedError: true}, // nesting aggregate - }, - }, - "NoAggregate": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "172.0.0.0/8", expectedError: true}, // no aggregate - }, - }, - "NormalNesting": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "172.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/16", expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/24", expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/27", expectedError: false}, - }, - }, - "Normal2Pool": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "172.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/16", expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: pool, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/27", expectedError: true}, - }, - }, - "Normal2Network": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "172.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/16", expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: network, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/27", expectedError: true}, - }, - }, - "Network2Network": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "172.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/16", expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: network, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/27", prefixType: network, expectedError: true}, - }, - }, - "Network2Pool": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "172.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/16", expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: pool, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/27", prefixType: network, expectedError: true}, - }, - }, - "Pool2Network": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "172.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/16", expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: network, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/27", prefixType: pool, expectedError: true}, - }, - }, - "Pool2Pool": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "172.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/16", expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: pool, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/27", prefixType: pool, expectedError: true}, - }, - }, - "Pool2Aggregate": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "172.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: pool, expectedError: false}, - }, - }, - "Network2Aggregate": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "172.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: network, expectedError: false}, - }, - }, - "InsertNormal2Normal": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "172.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/16", expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/27", expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/24", expectedError: false}, - }, - }, - "InsertNormal2Pool": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "172.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/16", expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/27", prefixType: pool, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/24", expectedError: false}, - }, - }, - "InsertNormal2Network": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "172.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/16", expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/27", prefixType: network, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/24", expectedError: false}, - }, - }, - "InsertPool": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "172.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/16", expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/27", expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: pool, expectedError: true}, - }, - }, - "InsertNetwork": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "172.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/16", expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/27", expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: network, expectedError: true}, - }, - }, - "InsertAggregate": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "172.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/16", expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/27", expectedError: false}, - {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: aggregate, expectedError: true}, - }, - }, - } - - for name, tc := range tests { - tc := tc - t.Run(name, func(t *testing.T) { - be := New(nil) - ctx := context.Background() - if tc.index != "" { - index := getIndex(tc.index) - err := be.CreateIndex(ctx, index) - assert.NoError(t, err) - } - - for _, p := range tc.prefixes { - p := p - var ipClaim *v1alpha1.IPClaim - var err error - - switch p.claimType { - case staticPrefix: - if p.prefixType != nil && *p.prefixType == *aggregate { - ipClaim, err = p.getIPClaimFromNetworkPrefix(tc.index) - } else { - ipClaim, err = p.getStaticPrefixIPClaim(tc.index) - } - case staticRange: - ipClaim, err = p.getStaticRangeIPClaim(tc.index) - case staticAddress: - ipClaim, err = p.getStaticAddressIPClaim(tc.index) - case dynamicPrefix: - ipClaim, err = p.getDynamicPrefixIPClaim(tc.index) - case dynamicAddress: - ipClaim, err = p.getDynamicAddressIPClaim(tc.index) - } - assert.NoError(t, err) - - err = be.Claim(ctx, ipClaim) - if p.expectedError { - assert.Error(t, err) - } else { - assert.NoError(t, err) - switch p.claimType { - case staticPrefix, dynamicPrefix: - if ipClaim.Status.Prefix == nil { - t.Errorf("expecting prefix status got nil") - } else { - expectedIP := p.ip - if p.expectedIP != "" { - expectedIP = p.expectedIP - } - if *ipClaim.Status.Prefix != expectedIP { - t.Errorf("expecting prefix got %s, want %s\n", *ipClaim.Status.Prefix, expectedIP) - } - } - case staticAddress, dynamicAddress: - if ipClaim.Status.Address == nil { - t.Errorf("expecting address status got nil") - } else { - expectedIP := p.ip - if p.expectedIP != "" { - expectedIP = p.expectedIP - } - if *ipClaim.Status.Address != expectedIP { - t.Errorf("expecting address got %s, want %s\n", *ipClaim.Status.Address, expectedIP) - } - } - if ipClaim.Status.DefaultGateway == nil { - if p.expectedDG != "" { - t.Errorf("expecting defaultGateway %s got nil", p.expectedDG) - } - } else { - if p.expectedDG == "" { - t.Errorf("unexpected defaultGateway got %s", *ipClaim.Status.DefaultGateway) - } - if *ipClaim.Status.DefaultGateway != p.expectedDG { - t.Errorf("expecting defaultGateway got %s, want %s\n", *ipClaim.Status.DefaultGateway, p.expectedDG) - } - } - case staticRange: - if ipClaim.Status.Range == nil { - t.Errorf("expecting range status got nil") - } else { - if *ipClaim.Status.Range != p.ip { - t.Errorf("expecting prefix got %s, want %s\n", *ipClaim.Status.Range, p.ip) - } - } - } - } - } - }) - } -} diff --git a/pkg/backend/ipam/ipam_static_range_test.go b/pkg/backend/ipam/ipam_static_range_test.go deleted file mode 100644 index 9d4279e..0000000 --- a/pkg/backend/ipam/ipam_static_range_test.go +++ /dev/null @@ -1,165 +0,0 @@ -package ipam - -import ( - "context" - "testing" - - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" - "github.com/stretchr/testify/assert" -) - -func TestIPAMStaticRange(t *testing.T) { - tests := map[string]struct { - index string - prefixes []testprefix - }{ - "Normal": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "10.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "10.0.0.0/24", expectedError: false}, - {claimType: staticRange, name: "range1", ip: "10.0.0.10-10.0.0.100", expectedError: false}, - {claimType: staticAddress, ip: "10.0.0.10/32", expectedError: false}, - {claimType: staticAddress, ip: "10.0.0.11/32", expectedError: false}, - {claimType: staticAddress, ip: "10.0.0.100/32", expectedError: false}, - }, - }, - "Ranges": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "10.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "10.0.0.0/24", expectedError: false}, - {claimType: staticRange, name: "range1", ip: "10.0.0.10-10.0.0.19", expectedError: false}, - {claimType: staticAddress, ip: "10.0.0.10/32", expectedError: false}, - {claimType: staticAddress, ip: "10.0.0.11/32", expectedError: false}, - {claimType: staticAddress, ip: "10.0.0.19/32", expectedError: false}, - {claimType: staticRange, name: "range2", ip: "10.0.0.20-10.0.0.29", expectedError: false}, - {claimType: staticAddress, ip: "10.0.0.20/32", expectedError: false}, - {claimType: staticAddress, ip: "10.0.0.21/32", expectedError: false}, - {claimType: staticAddress, ip: "10.0.0.29/32", expectedError: false}, - }, - }, - "Overlap": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "10.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "10.0.0.0/24", expectedError: false}, - {claimType: staticRange, name: "range1", ip: "10.0.0.10-10.0.0.20", expectedError: false}, - {claimType: staticRange, name: "range2", ip: "10.0.0.20-10.0.0.29", expectedError: true}, - }, - }, - "Range2Aggregate": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "10.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticRange, name: "range1", ip: "10.0.0.10-10.0.0.100", expectedError: true}, - }, - }, - "Range2Network": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "10.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "10.0.0.0/24", prefixType: network, expectedError: false}, - {claimType: staticRange, name: "range1", ip: "10.0.0.10-10.0.0.100", expectedError: false}, - }, - }, - "Range2Pool": { - index: "a", - prefixes: []testprefix{ - {claimType: staticPrefix, ip: "10.0.0.0/8", prefixType: aggregate, expectedError: false}, - {claimType: staticPrefix, ip: "10.0.0.0/24", prefixType: pool, expectedError: false}, - {claimType: staticRange, name: "range1", ip: "10.0.0.10-10.0.0.100", expectedError: false}, - }, - }, - } - - for name, tc := range tests { - tc := tc - t.Run(name, func(t *testing.T) { - be := New(nil) - ctx := context.Background() - if tc.index != "" { - index := getIndex(tc.index) - err := be.CreateIndex(ctx, index) - assert.NoError(t, err) - } - - for _, p := range tc.prefixes { - p := p - var ipClaim *v1alpha1.IPClaim - var err error - - switch p.claimType { - case staticPrefix: - if p.prefixType != nil && *p.prefixType == *aggregate { - ipClaim, err = p.getIPClaimFromNetworkPrefix(tc.index) - } else { - ipClaim, err = p.getStaticPrefixIPClaim(tc.index) - } - case staticRange: - ipClaim, err = p.getStaticRangeIPClaim(tc.index) - case staticAddress: - ipClaim, err = p.getStaticAddressIPClaim(tc.index) - case dynamicPrefix: - ipClaim, err = p.getDynamicPrefixIPClaim(tc.index) - case dynamicAddress: - ipClaim, err = p.getDynamicAddressIPClaim(tc.index) - } - assert.NoError(t, err) - - err = be.Claim(ctx, ipClaim) - if p.expectedError { - assert.Error(t, err) - } else { - assert.NoError(t, err) - switch p.claimType { - case staticPrefix, dynamicPrefix: - if ipClaim.Status.Prefix == nil { - t.Errorf("expecting prefix status got nil") - } else { - expectedIP := p.ip - if p.expectedIP != "" { - expectedIP = p.expectedIP - } - if *ipClaim.Status.Prefix != expectedIP { - t.Errorf("expecting prefix got %s, want %s\n", *ipClaim.Status.Prefix, expectedIP) - } - } - case staticAddress, dynamicAddress: - if ipClaim.Status.Address == nil { - t.Errorf("expecting address status got nil") - } else { - expectedIP := p.ip - if p.expectedIP != "" { - expectedIP = p.expectedIP - } - if *ipClaim.Status.Address != expectedIP { - t.Errorf("expecting address got %s, want %s\n", *ipClaim.Status.Address, expectedIP) - } - } - if ipClaim.Status.DefaultGateway == nil { - if p.expectedDG != "" { - t.Errorf("expecting defaultGateway %s got nil", p.expectedDG) - } - } else { - if p.expectedDG == "" { - t.Errorf("unexpected defaultGateway got %s", *ipClaim.Status.DefaultGateway) - } - if *ipClaim.Status.DefaultGateway != p.expectedDG { - t.Errorf("expecting defaultGateway got %s, want %s\n", *ipClaim.Status.DefaultGateway, p.expectedDG) - } - } - case staticRange: - if ipClaim.Status.Range == nil { - t.Errorf("expecting range status got nil") - } else { - if *ipClaim.Status.Range != p.ip { - t.Errorf("expecting prefix got %s, want %s\n", *ipClaim.Status.Range, p.ip) - } - } - } - } - } - }) - } -} diff --git a/pkg/backend/ipam/ipam_test_helpers.go b/pkg/backend/ipam/ipam_test_helpers.go deleted file mode 100644 index e630c80..0000000 --- a/pkg/backend/ipam/ipam_test_helpers.go +++ /dev/null @@ -1,168 +0,0 @@ -package ipam - -import ( - "fmt" - - "github.com/henderiw/iputil" - ipambev1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/utils/ptr" -) - -type testprefix struct { - name string - claimType ipambev1alpha1.IPClaimType - prefixType *ipambev1alpha1.IPPrefixType - ip string - prefixLength uint32 - labels map[string]string - selector *metav1.LabelSelector - expectedError bool - expectedDG string - expectedIP string -} - -// alias -const ( - namespace = "dummy" - staticPrefix = ipambev1alpha1.IPClaimType_StaticPrefix - staticRange = ipambev1alpha1.IPClaimType_StaticRange - staticAddress = ipambev1alpha1.IPClaimType_StaticAddress - dynamicPrefix = ipambev1alpha1.IPClaimType_DynamicPrefix - dynamicAddress = ipambev1alpha1.IPClaimType_DynamicAddress -) - -var aggregate = ptr.To[ipambev1alpha1.IPPrefixType](ipambev1alpha1.IPPrefixType_Aggregate) -var network = ptr.To[ipambev1alpha1.IPPrefixType](ipambev1alpha1.IPPrefixType_Network) -var pool = ptr.To[ipambev1alpha1.IPPrefixType](ipambev1alpha1.IPPrefixType_Pool) -var other = ptr.To[ipambev1alpha1.IPPrefixType](ipambev1alpha1.IPPrefixType_Other) - -func getIndex(index string) *ipambev1alpha1.IPIndex { - return ipambev1alpha1.BuildIPIndex( - metav1.ObjectMeta{Namespace: namespace, Name: index}, - nil, - nil, - ) -} - -func (r testprefix) getIPClaimFromNetworkPrefix(index string) (*ipambev1alpha1.IPClaim, error) { - idx := ipambev1alpha1.BuildIPIndex( - metav1.ObjectMeta{Namespace: namespace, Name: index}, - nil, - nil, - ) - return idx.GetClaim(ipambev1alpha1.Prefix{Prefix: r.ip, UserDefinedLabels: commonv1alpha1.UserDefinedLabels{Labels: r.labels}}) -} - -func (r testprefix) getStaticPrefixIPClaim(index string) (*ipambev1alpha1.IPClaim, error) { - pi, err := iputil.New(r.ip) - if err != nil { - return nil, err - } - ipClaim := ipambev1alpha1.BuildIPClaim( - metav1.ObjectMeta{Namespace: namespace, Name: pi.GetSubnetName()}, - &ipambev1alpha1.IPClaimSpec{ - Index: index, - PrefixType: r.prefixType, - Prefix: ptr.To[string](r.ip), - ClaimLabels: commonv1alpha1.ClaimLabels{ - UserDefinedLabels: commonv1alpha1.UserDefinedLabels{Labels: r.labels}, - }, - }, - nil, - ) - fielErrList := ipClaim.ValidateSyntax("") // this expands the ownerRef in the spec - if len(fielErrList) != 0 { - return nil, fmt.Errorf("invalid syntax %v", fielErrList) - } - return ipClaim, nil -} - -func (r testprefix) getDynamicPrefixIPClaim(index string) (*ipambev1alpha1.IPClaim, error) { - ipClaim := ipambev1alpha1.BuildIPClaim( - metav1.ObjectMeta{Namespace: namespace, Name: r.name}, - &ipambev1alpha1.IPClaimSpec{ - Index: index, - PrefixType: r.prefixType, - CreatePrefix: ptr.To[bool](true), - PrefixLength: ptr.To[uint32](r.prefixLength), - ClaimLabels: commonv1alpha1.ClaimLabels{ - UserDefinedLabels: commonv1alpha1.UserDefinedLabels{Labels: r.labels}, - Selector: r.selector, - }, - }, - nil, - ) - fielErrList := ipClaim.ValidateSyntax("") // this expands the ownerRef in the spec - if len(fielErrList) != 0 { - return nil, fmt.Errorf("invalid syntax %v", fielErrList) - } - return ipClaim, nil -} - -func (r testprefix) getStaticAddressIPClaim(index string) (*ipambev1alpha1.IPClaim, error) { - pi, err := iputil.New(r.ip) - if err != nil { - return nil, err - } - - pi = iputil.NewPrefixInfo(pi.GetIPAddressPrefix()) - - ipClaim := ipambev1alpha1.BuildIPClaim( - metav1.ObjectMeta{Namespace: namespace, Name: pi.GetSubnetName()}, - &ipambev1alpha1.IPClaimSpec{ - Index: index, - Address: ptr.To[string](r.ip), - ClaimLabels: commonv1alpha1.ClaimLabels{ - UserDefinedLabels: commonv1alpha1.UserDefinedLabels{Labels: r.labels}, - }, - }, - nil, - ) - fielErrList := ipClaim.ValidateSyntax("") // this expands the ownerRef in the spec - if len(fielErrList) != 0 { - return nil, fmt.Errorf("invalid syntax %v", fielErrList) - } - return ipClaim, nil -} - - -func (r testprefix) getDynamicAddressIPClaim(index string) (*ipambev1alpha1.IPClaim, error) { - ipClaim := ipambev1alpha1.BuildIPClaim( - metav1.ObjectMeta{Namespace: namespace, Name: r.name}, - &ipambev1alpha1.IPClaimSpec{ - Index: index, - PrefixType: nil, - ClaimLabels: commonv1alpha1.ClaimLabels{ - UserDefinedLabels: commonv1alpha1.UserDefinedLabels{Labels: r.labels}, - Selector: r.selector, - }, - }, - nil, - ) - fielErrList := ipClaim.ValidateSyntax("") // this expands the ownerRef in the spec - if len(fielErrList) != 0 { - return nil, fmt.Errorf("invalid syntax %v", fielErrList) - } - return ipClaim, nil -} - -func (r testprefix) getStaticRangeIPClaim(index string) (*ipambev1alpha1.IPClaim, error) { - ipClaim := ipambev1alpha1.BuildIPClaim( - metav1.ObjectMeta{Namespace: namespace, Name: r.name}, - &ipambev1alpha1.IPClaimSpec{ - Index: index, - Range: ptr.To[string](r.ip), - ClaimLabels: commonv1alpha1.ClaimLabels{ - UserDefinedLabels: commonv1alpha1.UserDefinedLabels{Labels: r.labels}, - }, - }, - nil, - ) - fielErrList := ipClaim.ValidateSyntax("") // this expands the ownerRef in the spec - if len(fielErrList) != 0 { - return nil, fmt.Errorf("invalid syntax %v", fielErrList) - } - return ipClaim, nil -} diff --git a/pkg/backend/ipam/store.go b/pkg/backend/ipam/store.go deleted file mode 100644 index 7a3915e..0000000 --- a/pkg/backend/ipam/store.go +++ /dev/null @@ -1,337 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 ipam - -import ( - "context" - "errors" - "fmt" - - "github.com/henderiw/idxtable/pkg/iptable" - "github.com/henderiw/logger/log" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - ipambev1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" - bebackend "github.com/kuidio/kuid/pkg/backend/backend" - "k8s.io/apimachinery/pkg/types" - "sigs.k8s.io/controller-runtime/pkg/client" -) - -func NewStore(c client.Client, cache bebackend.Cache[*CacheContext]) bebackend.Store { - return &bestore{ - client: c, - cache: cache, - } -} - -type bestore struct { - client client.Client - cache bebackend.Cache[*CacheContext] -} - -func (r *bestore) Restore(ctx context.Context, k store.Key) error { - log := log.FromContext(ctx).With("key", k.String()) - - cacheCtx, err := r.cache.Get(ctx, k, true) - if err != nil { - log.Error("cannot get index", "error", err.Error()) - return err - } - // Fetch the current entries that were stored - curIPEntries, err := r.listEntries(ctx, k) - if err != nil { - return err - } - - // fetch the NI, IP(s) and IPClaims - ni, niPrefixes, err := r.getIndexPrefixes(ctx, k) - if err != nil { - return nil - } - - ipclaimmap, err := r.listClaims(ctx, k) - if err != nil { - return nil - } - - if err := r.restoreIndexPrefixes(ctx, cacheCtx, curIPEntries, ni, niPrefixes); err != nil { - return err - } - if err := r.restoreIPClaims(ctx, cacheCtx, curIPEntries, ipambev1alpha1.IPClaimType_StaticPrefix, ipclaimmap); err != nil { - return err - } - if err := r.restoreIPClaims(ctx, cacheCtx, curIPEntries, ipambev1alpha1.IPClaimType_StaticRange, ipclaimmap); err != nil { - return err - } - if err := r.restoreIPClaims(ctx, cacheCtx, curIPEntries, ipambev1alpha1.IPClaimType_DynamicPrefix, ipclaimmap); err != nil { - return err - } - if err := r.restoreIPClaims(ctx, cacheCtx, curIPEntries, ipambev1alpha1.IPClaimType_StaticAddress, ipclaimmap); err != nil { - return err - } - if err := r.restoreIPClaims(ctx, cacheCtx, curIPEntries, ipambev1alpha1.IPClaimType_DynamicAddress, ipclaimmap); err != nil { - return err - } - - log.Info("restore prefixes entries left", "items", len(curIPEntries)) - - return nil - -} - -// only used in configmap -func (r *bestore) SaveAll(ctx context.Context, k store.Key) error { - log := log.FromContext(ctx) - log.Info("SaveAll", "key", k.String()) - - newIPEntries, err := r.getEntriesFromCache(ctx, k) - if err != nil { - return err - } - curIPEntries, err := r.listEntries(ctx, k) - if err != nil { - return err - } - - // debug end - for _, newIPEntry := range newIPEntries { - log.Debug("SaveAll", "newIPEntry", newIPEntry.GetNamespacedName()) - newIPEntry := newIPEntry - found := false - var ipEntry backend.EntryObject - for idx, curIPEntry := range curIPEntries { - log.Debug("SaveAll", "curIPEntry", *curIPEntry) - idx := idx - curIPEntry := curIPEntry - //fmt.Println("saveAll entries", newIPEntry.Name, curIPEntry.Name) - if curIPEntry.GetNamespace() == newIPEntry.GetNamespace() && - curIPEntry.GetName() == newIPEntry.GetName() { - curIPEntries = append(curIPEntries[:idx], curIPEntries[idx+1:]...) - found = true - ipEntry = curIPEntry - break - } - } - log.Debug("SaveAll", "found", found, "curIPEntry", ipEntry, "newIPEntry", newIPEntry) - //fmt.Println("saveAll entries", found, newIPEntry.Name) - if !found { - if err := r.client.Create(ctx, newIPEntry); err != nil { - log.Error("saveAll create failed", "nsn", newIPEntry.GetNamespacedName(), "error", err.Error()) - return err - } - continue - } - ipEntry.SetSpec(newIPEntry.GetSpec()) - log.Debug("save all ipEntry update", "nsn", ipEntry.GetNamespacedName()) - if err := r.client.Update(ctx, ipEntry); err != nil { - log.Debug("save all ipEntry failed", "nsn", ipEntry.GetNamespacedName(), "error", err.Error()) - return err - } - } - for _, curIPEntry := range curIPEntries { - if err := r.client.Delete(ctx, curIPEntry); err != nil { - return err - } - } - return nil -} - -// Destroy removes the store db -func (r *bestore) Destroy(ctx context.Context, k store.Key) error { - // no need to delete the ip index as this is what this fn is supposed to do - return r.deleteEntries(ctx, k) -} - -func (r *bestore) getEntriesFromCache(ctx context.Context, k store.Key) ([]backend.EntryObject, error) { - log := log.FromContext(ctx).With("key", k.String()) - cacheCtx, err := r.cache.Get(ctx, k, false) - if err != nil { - log.Error("cannot get index", "error", err.Error()) - return nil, err - } - - ipEntries := make([]backend.EntryObject, 0, cacheCtx.Size()) - // add the main rib entry - for _, route := range cacheCtx.rib.GetTable() { - //fmt.Println("getEntriesFromCache rib entry", route.Prefix().String()) - route := route - ipEntries = append(ipEntries, ipambev1alpha1.GetIPEntry(ctx, k, route.Prefix(), route.Labels())) - } - // add all the range entries - cacheCtx.ranges.List(ctx, func(ctx context.Context, key store.Key, i iptable.IPTable) { - for _, route := range i.GetAll() { - //fmt.Println("getEntriesFromCache range", key.Name, route.Prefix().String()) - route := route - ipEntries = append(ipEntries, ipambev1alpha1.GetIPEntry(ctx, k, route.Prefix(), route.Labels())) - } - }) - - return ipEntries, nil -} - -func (r *bestore) deleteEntries(ctx context.Context, k store.Key) error { - log := log.FromContext(ctx).With("key", k.String()) - - ipEntries, err := r.listEntries(ctx, k) - if err != nil { - log.Error("cannot list entries", "error", err) - return err - } - - var errm error - for _, ipEntry := range ipEntries { - if err := r.client.Delete(ctx, ipEntry); err != nil { - log.Error("cannot delete entry", "error", err) - errm = errors.Join(errm, err) - continue - } - } - return errm -} - -func (r *bestore) listEntries(ctx context.Context, k store.Key) ([]*ipambev1alpha1.IPEntry, error) { - opt := []client.ListOption{ - //client.MatchingFields{ - // "spec.networkInstance": k.Name, - //}, - } - - ipEntries := ipambev1alpha1.IPEntryList{} - if err := r.client.List(ctx, &ipEntries, opt...); err != nil { - return nil, err - } - ipentries := []*ipambev1alpha1.IPEntry{} - for _, ipEntry := range ipEntries.Items { - ipEntry := ipEntry - if ipEntry.Spec.Index == k.Name { - ipentries = append(ipentries, &ipEntry) - } - } - - return ipentries, nil -} - -func (r *bestore) getIndexPrefixes(ctx context.Context, k store.Key) (*ipambev1alpha1.IPIndex, map[string]ipambev1alpha1.Prefix, error) { - ni := &ipambev1alpha1.IPIndex{} - if err := r.client.Get(ctx, k.NamespacedName, ni); err != nil { - return nil, nil, err - } - niPrefixes := make(map[string]ipambev1alpha1.Prefix) - for _, prefix := range ni.Spec.Prefixes { - niPrefixes[prefix.Prefix] = prefix - } - return ni, niPrefixes, nil -} - -func (r *bestore) listClaims(ctx context.Context, k store.Key) (map[string]*ipambev1alpha1.IPClaim, error) { - opt := []client.ListOption{ - /* - client.MatchingFields{ - "spec.networkInstance": k.Name, - }, - */ - } - - claims := ipambev1alpha1.IPClaimList{} - if err := r.client.List(ctx, &claims, opt...); err != nil { - return nil, err - } - - claimmap := map[string]*ipambev1alpha1.IPClaim{} - for _, claim := range claims.Items { - claim := claim - if claim.Spec.Index == k.Name { - claimmap[(&claim).GetNamespacedName().String()] = &claim - } - - } - - return claimmap, nil -} - -func (r *bestore) restoreIndexPrefixes(ctx context.Context, cacheCtx *CacheContext, ipEntries []*ipambev1alpha1.IPEntry, index *ipambev1alpha1.IPIndex, niPrefixes map[string]ipambev1alpha1.Prefix) error { - //log := log.FromContext(ctx) - for i := len(ipEntries) - 1; i >= 0; i-- { - ipEntry := ipEntries[i] - if ipEntry.Spec.Owner.Group == ipambev1alpha1.SchemeGroupVersion.Group && - ipEntry.Spec.Owner.Version == ipambev1alpha1.SchemeGroupVersion.Version && - ipEntry.Spec.Owner.Kind == ipambev1alpha1.IPIndexKind { - - niPrefix, ok := niPrefixes[ipEntry.Spec.Prefix] - if ok { - claim, err := index.GetClaim(niPrefix) - if err != nil { - return nil - } - if err := r.restoreClaim(ctx, cacheCtx, claim); err != nil { - return err - } - // remove the entry since it is processed - ipEntries = append(ipEntries[:i], ipEntries[i+1:]...) - delete(niPrefixes, ipEntry.Spec.Prefix) - } - } - } - return nil -} - -func (r *bestore) restoreIPClaims(ctx context.Context, cacheCtx *CacheContext, ipEntries []*ipambev1alpha1.IPEntry, claimType ipambev1alpha1.IPClaimType, ipclaimmap map[string]*ipambev1alpha1.IPClaim) error { - - for i := len(ipEntries) - 1; i >= 0; i-- { - ipEntry := ipEntries[i] - if ipEntry.Spec.Owner.Group == ipambev1alpha1.SchemeGroupVersion.Group && - ipEntry.Spec.Owner.Version == ipambev1alpha1.SchemeGroupVersion.Version && - ipEntry.Spec.Owner.Kind == ipambev1alpha1.IPClaimKind { - - if claimType == ipEntry.Spec.ClaimType { - nsn := types.NamespacedName{Namespace: ipEntry.Spec.Owner.Namespace, Name: ipEntry.Spec.Owner.Name} - - claim, ok := ipclaimmap[nsn.String()] - if ok { - if err := r.restoreClaim(ctx, cacheCtx, claim); err != nil { - return err - } - // remove the entry since it is processed - ipEntries = append(ipEntries[:i], ipEntries[i+1:]...) - delete(ipclaimmap, nsn.String()) // delete the entry to optimize - } - } - } - } - return nil -} - -func (r *bestore) restoreClaim(ctx context.Context, cacheCtx *CacheContext, claim *ipambev1alpha1.IPClaim) error { - ctx = initClaimContext(ctx, "restore", claim) - a, err := getApplicator(ctx, cacheCtx, claim) - if err != nil { - return err - } - // validate is needed, mainly for addresses since the parent route determines - // e.g. the fact the address belongs to a range or not - errList := claim.ValidateSyntax("") // needed to expand the createPrefix/prefixLength and owner - if len(errList) != 0 { - return fmt.Errorf("invalid syntax %v", errList) - } - if err := a.Validate(ctx, claim); err != nil { - return err - } - if err := a.Apply(ctx, claim); err != nil { - return err - } - return nil -} diff --git a/pkg/backend/ipam/store_cache_context.go b/pkg/backend/ipam/store_cache_context.go deleted file mode 100644 index 3c5b95d..0000000 --- a/pkg/backend/ipam/store_cache_context.go +++ /dev/null @@ -1,48 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 ipam - -import ( - "context" - - "github.com/hansthienpondt/nipam/pkg/table" - "github.com/henderiw/idxtable/pkg/iptable" - "github.com/henderiw/store" - "github.com/henderiw/store/memory" -) - -type CacheContext struct { - rib *table.RIB - ranges store.Storer[iptable.IPTable] -} - -func NewCacheContext() *CacheContext { - return &CacheContext{ - rib: table.NewRIB(), - ranges: memory.NewStore[iptable.IPTable](), - } - -} - -func (r *CacheContext) Size() int { - var size int - size += r.rib.Size() - r.ranges.List(context.Background(), func(ctx context.Context, k store.Key, i iptable.IPTable) { - size +=i.Size() - }) - return size -} diff --git a/pkg/backend/vlan/vlan_helpers_test.go b/pkg/backend/vlan/vlan_helpers_test.go deleted file mode 100644 index 824a172..0000000 --- a/pkg/backend/vlan/vlan_helpers_test.go +++ /dev/null @@ -1,102 +0,0 @@ -package vlan - -import ( - "fmt" - - "github.com/kuidio/kuid/apis/backend" - vlanbev1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/utils/ptr" -) - -type testCtx struct { - name string - claimType backend.ClaimType - id uint64 - tRange string - labels map[string]string - selector *metav1.LabelSelector - expectedError bool - expectedID *uint64 - expectedRange *string -} - -// alias -const ( - namespace = "dummy" - staticClaim = backend.ClaimType_StaticID - dynamicClaim = backend.ClaimType_DynamicID - rangeClaim = backend.ClaimType_Range -) - -func getIndex(index, _ string) (*vlanbev1alpha1.VLANIndex, error) { - idx := vlanbev1alpha1.BuildVLANIndex( - metav1.ObjectMeta{Namespace: namespace, Name: index}, - nil, - nil, - ) - - fieldErrs := idx.ValidateSyntax("") - if len(fieldErrs) != 0 { - return nil, fmt.Errorf("syntax errors %v", fieldErrs) - } - return idx, nil -} - -func (r testCtx) getDynamicClaim(index, testType string) (*vlanbev1alpha1.VLANClaim, error) { - claim := vlanbev1alpha1.BuildVLANClaim( - metav1.ObjectMeta{Namespace: namespace, Name: r.name}, - &vlanbev1alpha1.VLANClaimSpec{ - Index: index, - ClaimLabels: commonv1alpha1.ClaimLabels{ - UserDefinedLabels: commonv1alpha1.UserDefinedLabels{Labels: r.labels}, - Selector: r.selector, - }, - }, - nil, - ) - fielErrList := claim.ValidateSyntax(testType) // this expands the ownerRef in the spec - if len(fielErrList) != 0 { - return nil, fmt.Errorf("invalid syntax %v", fielErrList) - } - return claim, nil -} - -func (r testCtx) getStaticClaim(index, testType string) (*vlanbev1alpha1.VLANClaim, error) { - claim := vlanbev1alpha1.BuildVLANClaim( - metav1.ObjectMeta{Namespace: namespace, Name: r.name}, - &vlanbev1alpha1.VLANClaimSpec{ - Index: index, - ID: ptr.To[uint32](uint32(r.id)), - ClaimLabels: commonv1alpha1.ClaimLabels{ - UserDefinedLabels: commonv1alpha1.UserDefinedLabels{Labels: r.labels}, - }, - }, - nil, - ) - fielErrList := claim.ValidateSyntax(testType) // this expands the ownerRef in the spec - if len(fielErrList) != 0 { - return nil, fmt.Errorf("invalid syntax %v", fielErrList) - } - return claim, nil -} - -func (r testCtx) getRangeClaim(index, testType string) (*vlanbev1alpha1.VLANClaim, error) { - claim := vlanbev1alpha1.BuildVLANClaim( - metav1.ObjectMeta{Namespace: namespace, Name: r.name}, - &vlanbev1alpha1.VLANClaimSpec{ - Index: index, - Range: ptr.To[string](r.tRange), - ClaimLabels: commonv1alpha1.ClaimLabels{ - UserDefinedLabels: commonv1alpha1.UserDefinedLabels{Labels: r.labels}, - }, - }, - nil, - ) - fielErrList := claim.ValidateSyntax(testType) // this expands the ownerRef in the spec - if len(fielErrList) != 0 { - return nil, fmt.Errorf("invalid syntax %v", fielErrList) - } - return claim, nil -} diff --git a/pkg/backend/vlan/vlan_index_test.go b/pkg/backend/vlan/vlan_index_test.go deleted file mode 100644 index 6f13291..0000000 --- a/pkg/backend/vlan/vlan_index_test.go +++ /dev/null @@ -1,40 +0,0 @@ -package vlan - -import ( - "context" - "testing" - - "github.com/kuidio/kuid/pkg/backend/backend" - "github.com/stretchr/testify/assert" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -func TestIndex(t *testing.T) { - tests := map[string]struct { - index string - testType string - }{ - "CreateDelete": { - index: "a", - testType: "", - }, - } - - for name, tc := range tests { - t.Run(name, func(t *testing.T) { - be := backend.New(nil, nil, nil, nil, nil, schema.GroupVersionKind{},schema.GroupVersionKind{}) - ctx := context.Background() - index, err := getIndex(tc.index, tc.testType) - assert.NoError(t, err) - if err := be.CreateIndex(ctx, index); err != nil { - assert.Error(t, err) - } - if err := be.DeleteIndex(ctx, index); err != nil { - assert.Error(t, err) - } - if err := be.DeleteIndex(ctx, index); err != nil { - assert.Error(t, err) - } - }) - } -} diff --git a/pkg/backend/vlan/vlan_test.go b/pkg/backend/vlan/vlan_test.go deleted file mode 100644 index c0a5476..0000000 --- a/pkg/backend/vlan/vlan_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package vlan - -import ( - "context" - "fmt" - "testing" - - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - vlanbev1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" - backendbe "github.com/kuidio/kuid/pkg/backend/backend" - "github.com/stretchr/testify/assert" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/types" - "k8s.io/utils/ptr" -) - -func Test(t *testing.T) { - tests := map[string]struct { - index string - ctxs []testCtx - }{ - "Mix": { - index: "a", - ctxs: []testCtx{ - {claimType: dynamicClaim, name: "claim1", expectedError: false, expectedID: ptr.To[uint64](0)}, - {claimType: staticClaim, name: "claim2", id: 100, expectedError: false}, - {claimType: staticClaim, name: "claim3", id: 4000, expectedError: false}, - {claimType: rangeClaim, name: "claim4", tRange: "10-19", expectedError: false}, - {claimType: rangeClaim, name: "claim4", tRange: "11-19", expectedError: false}, // reclaim - {claimType: rangeClaim, name: "claim5", tRange: "5-10", expectedError: false}, // claim a new entry - {claimType: rangeClaim, name: "claim6", tRange: "19-100", expectedError: true}, // overlap - {claimType: staticClaim, name: "claim7", id: 12, expectedError: false}, - {claimType: staticClaim, name: "claim7", id: 13, expectedError: false}, // reclaim an existing id - {claimType: dynamicClaim, name: "claim8", selector: &metav1.LabelSelector{ - MatchLabels: map[string]string{backend.KuidClaimNameKey: "claim4"}, - }, expectedError: false, expectedID: ptr.To[uint64](11)}, // a dynamic claim from a range - {claimType: dynamicClaim, name: "claim9", selector: &metav1.LabelSelector{ - MatchLabels: map[string]string{backend.KuidClaimNameKey: "claim4"}, - }, expectedError: false, expectedID: ptr.To[uint64](12)}, // a dynamic claim from a range that was claimed before - {claimType: dynamicClaim, name: "claim10", selector: &metav1.LabelSelector{ - MatchLabels: map[string]string{backend.KuidClaimNameKey: "claim4"}, - }, expectedError: false, expectedID: ptr.To[uint64](14)}, - {claimType: dynamicClaim, name: "claim10", selector: &metav1.LabelSelector{ - MatchLabels: map[string]string{backend.KuidClaimNameKey: "claim4"}, // update - }, expectedError: false, expectedID: ptr.To[uint64](14)}, - {claimType: rangeClaim, name: "claim4", tRange: "11-19", expectedError: false}, // update - }, - }, - } - - for name, tc := range tests { - tc := tc - - testTypes := []string{""} - - for _, testType := range testTypes { - t.Run(name, func(t *testing.T) { - be := backendbe.New(nil, nil, nil, nil, nil, schema.GroupVersionKind{},schema.GroupVersionKind{}) - ctx := context.Background() - if tc.index != "" { - index, err := getIndex(tc.index, testType) - assert.NoError(t, err) - err = be.CreateIndex(ctx, index) - assert.NoError(t, err) - } - - for _, v := range tc.ctxs { - v := v - var claim *vlanbev1alpha1.VLANClaim - var err error - - switch v.claimType { - case staticClaim: - claim, err = v.getStaticClaim(tc.index, testType) - case dynamicClaim: - claim, err = v.getDynamicClaim(tc.index, testType) - case rangeClaim: - claim, err = v.getRangeClaim(tc.index, testType) - } - assert.NoError(t, err) - if err != nil { - return - } - - err = be.Claim(ctx, claim) - if v.expectedError { - assert.Error(t, err) - continue - } else { - assert.NoError(t, err) - } - switch v.claimType { - case staticClaim, dynamicClaim: - if claim.Status.ID == nil { - t.Errorf("expecting status id got nil") - } else { - expectedID := v.id - if v.expectedID != nil { - expectedID = *v.expectedID - } - if uint64(*claim.Status.ID) != expectedID { - t.Errorf("expecting id got %d, want %d\n", *claim.Status.ID, expectedID) - } - } - case rangeClaim: - if claim.Status.Range == nil { - t.Errorf("expecting status id got nil") - } else { - expectedRange := v.tRange - if v.expectedRange != nil { - expectedRange = *v.expectedRange - } - if *claim.Status.Range != expectedRange { - t.Errorf("expecting range got %s, want %s\n", *claim.Status.Range, expectedRange) - } - } - } - fmt.Println("entries after claim", v.name) - key := store.KeyFromNSN(types.NamespacedName{Namespace: namespace, Name: tc.index}) - err = be.PrintEntries(ctx, key) - assert.NoError(t, err) - } - }) - } - } -} diff --git a/pkg/backend/vxlan/vxlan_helpers_test.go b/pkg/backend/vxlan/vxlan_helpers_test.go deleted file mode 100644 index 2e27f1d..0000000 --- a/pkg/backend/vxlan/vxlan_helpers_test.go +++ /dev/null @@ -1,102 +0,0 @@ -package vxlan - -import ( - "fmt" - - "github.com/kuidio/kuid/apis/backend" - vxlanbev1alpha1 "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/utils/ptr" -) - -type testCtx struct { - name string - claimType backend.ClaimType - id uint64 - tRange string - labels map[string]string - selector *metav1.LabelSelector - expectedError bool - expectedID *uint64 - expectedRange *string -} - -// alias -const ( - namespace = "dummy" - staticClaim = backend.ClaimType_StaticID - dynamicClaim = backend.ClaimType_DynamicID - rangeClaim = backend.ClaimType_Range -) - -func getIndex(index, _ string) (*vxlanbev1alpha1.VXLANIndex, error) { - idx := vxlanbev1alpha1.BuildVXLANIndex( - metav1.ObjectMeta{Namespace: namespace, Name: index}, - nil, - nil, - ) - - fieldErrs := idx.ValidateSyntax("") - if len(fieldErrs) != 0 { - return nil, fmt.Errorf("syntax errors %v", fieldErrs) - } - return idx, nil -} - -func (r testCtx) getDynamicClaim(index, testType string) (*vxlanbev1alpha1.VXLANClaim, error) { - claim := vxlanbev1alpha1.BuildVXLANClaim( - metav1.ObjectMeta{Namespace: namespace, Name: r.name}, - &vxlanbev1alpha1.VXLANClaimSpec{ - Index: index, - ClaimLabels: commonv1alpha1.ClaimLabels{ - UserDefinedLabels: commonv1alpha1.UserDefinedLabels{Labels: r.labels}, - Selector: r.selector, - }, - }, - nil, - ) - fielErrList := claim.ValidateSyntax(testType) // this expands the ownerRef in the spec - if len(fielErrList) != 0 { - return nil, fmt.Errorf("invalid syntax %v", fielErrList) - } - return claim, nil -} - -func (r testCtx) getStaticClaim(index, testType string) (*vxlanbev1alpha1.VXLANClaim, error) { - claim := vxlanbev1alpha1.BuildVXLANClaim( - metav1.ObjectMeta{Namespace: namespace, Name: r.name}, - &vxlanbev1alpha1.VXLANClaimSpec{ - Index: index, - ID: ptr.To[uint32](uint32(r.id)), - ClaimLabels: commonv1alpha1.ClaimLabels{ - UserDefinedLabels: commonv1alpha1.UserDefinedLabels{Labels: r.labels}, - }, - }, - nil, - ) - fielErrList := claim.ValidateSyntax(testType) // this expands the ownerRef in the spec - if len(fielErrList) != 0 { - return nil, fmt.Errorf("invalid syntax %v", fielErrList) - } - return claim, nil -} - -func (r testCtx) getRangeClaim(index, testType string) (*vxlanbev1alpha1.VXLANClaim, error) { - claim := vxlanbev1alpha1.BuildVXLANClaim( - metav1.ObjectMeta{Namespace: namespace, Name: r.name}, - &vxlanbev1alpha1.VXLANClaimSpec{ - Index: index, - Range: ptr.To[string](r.tRange), - ClaimLabels: commonv1alpha1.ClaimLabels{ - UserDefinedLabels: commonv1alpha1.UserDefinedLabels{Labels: r.labels}, - }, - }, - nil, - ) - fielErrList := claim.ValidateSyntax(testType) // this expands the ownerRef in the spec - if len(fielErrList) != 0 { - return nil, fmt.Errorf("invalid syntax %v", fielErrList) - } - return claim, nil -} diff --git a/pkg/backend/vxlan/vxlan_index_test.go b/pkg/backend/vxlan/vxlan_index_test.go deleted file mode 100644 index de66fba..0000000 --- a/pkg/backend/vxlan/vxlan_index_test.go +++ /dev/null @@ -1,40 +0,0 @@ -package vxlan - -import ( - "context" - "testing" - - "github.com/kuidio/kuid/pkg/backend/backend" - "github.com/stretchr/testify/assert" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -func TestIndex(t *testing.T) { - tests := map[string]struct { - index string - testType string - }{ - "CreateDelete": { - index: "a", - testType: "", - }, - } - - for name, tc := range tests { - t.Run(name, func(t *testing.T) { - be := backend.New(nil, nil, nil, nil, nil, schema.GroupVersionKind{},schema.GroupVersionKind{}) - ctx := context.Background() - index, err := getIndex(tc.index, tc.testType) - assert.NoError(t, err) - if err := be.CreateIndex(ctx, index); err != nil { - assert.Error(t, err) - } - if err := be.DeleteIndex(ctx, index); err != nil { - assert.Error(t, err) - } - if err := be.DeleteIndex(ctx, index); err != nil { - assert.Error(t, err) - } - }) - } -} diff --git a/pkg/backend/vxlan/vxlan_test.go b/pkg/backend/vxlan/vxlan_test.go deleted file mode 100644 index 1355b9a..0000000 --- a/pkg/backend/vxlan/vxlan_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package vxlan - -import ( - "context" - "fmt" - "testing" - - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - vxlanbev1alpha1 "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1" - backendbe "github.com/kuidio/kuid/pkg/backend/backend" - "github.com/stretchr/testify/assert" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/types" - "k8s.io/utils/ptr" -) - -func Test(t *testing.T) { - tests := map[string]struct { - index string - ctxs []testCtx - }{ - "Mix": { - index: "a", - ctxs: []testCtx{ - {claimType: dynamicClaim, name: "claim1", expectedError: false, expectedID: ptr.To[uint64](0)}, - {claimType: staticClaim, name: "claim2", id: 100, expectedError: false}, - {claimType: staticClaim, name: "claim3", id: 4000, expectedError: false}, - {claimType: rangeClaim, name: "claim4", tRange: "10-19", expectedError: false}, - {claimType: rangeClaim, name: "claim4", tRange: "11-19", expectedError: false}, // reclaim - {claimType: rangeClaim, name: "claim5", tRange: "5-10", expectedError: false}, // claim a new entry - {claimType: rangeClaim, name: "claim6", tRange: "19-100", expectedError: true}, // overlap - {claimType: staticClaim, name: "claim7", id: 12, expectedError: false}, - {claimType: staticClaim, name: "claim7", id: 13, expectedError: false}, // reclaim an existing id - {claimType: dynamicClaim, name: "claim8", selector: &metav1.LabelSelector{ - MatchLabels: map[string]string{backend.KuidClaimNameKey: "claim4"}, - }, expectedError: false, expectedID: ptr.To[uint64](11)}, // a dynamic claim from a range - {claimType: dynamicClaim, name: "claim9", selector: &metav1.LabelSelector{ - MatchLabels: map[string]string{backend.KuidClaimNameKey: "claim4"}, - }, expectedError: false, expectedID: ptr.To[uint64](12)}, // a dynamic claim from a range that was claimed before - {claimType: dynamicClaim, name: "claim10", selector: &metav1.LabelSelector{ - MatchLabels: map[string]string{backend.KuidClaimNameKey: "claim4"}, - }, expectedError: false, expectedID: ptr.To[uint64](14)}, - {claimType: dynamicClaim, name: "claim10", selector: &metav1.LabelSelector{ - MatchLabels: map[string]string{backend.KuidClaimNameKey: "claim4"}, // update - }, expectedError: false, expectedID: ptr.To[uint64](14)}, - {claimType: rangeClaim, name: "claim4", tRange: "11-19", expectedError: false}, // update - }, - }, - } - - for name, tc := range tests { - tc := tc - - testTypes := []string{""} - - for _, testType := range testTypes { - t.Run(name, func(t *testing.T) { - be := backendbe.New(nil, nil, nil, nil, nil, schema.GroupVersionKind{}, schema.GroupVersionKind{}) - ctx := context.Background() - if tc.index != "" { - index, err := getIndex(tc.index, testType) - assert.NoError(t, err) - err = be.CreateIndex(ctx, index) - assert.NoError(t, err) - } - - for _, v := range tc.ctxs { - v := v - var claim *vxlanbev1alpha1.VXLANClaim - var err error - - switch v.claimType { - case staticClaim: - claim, err = v.getStaticClaim(tc.index, testType) - case dynamicClaim: - claim, err = v.getDynamicClaim(tc.index, testType) - case rangeClaim: - claim, err = v.getRangeClaim(tc.index, testType) - } - assert.NoError(t, err) - if err != nil { - return - } - - err = be.Claim(ctx, claim) - if v.expectedError { - assert.Error(t, err) - continue - } else { - assert.NoError(t, err) - } - switch v.claimType { - case staticClaim, dynamicClaim: - if claim.Status.ID == nil { - t.Errorf("expecting status id got nil") - } else { - expectedID := v.id - if v.expectedID != nil { - expectedID = *v.expectedID - } - if uint64(*claim.Status.ID) != expectedID { - t.Errorf("expecting id got %d, want %d\n", *claim.Status.ID, expectedID) - } - } - case rangeClaim: - if claim.Status.Range == nil { - t.Errorf("expecting status id got nil") - } else { - expectedRange := v.tRange - if v.expectedRange != nil { - expectedRange = *v.expectedRange - } - if *claim.Status.Range != expectedRange { - t.Errorf("expecting range got %s, want %s\n", *claim.Status.Range, expectedRange) - } - } - } - fmt.Println("entries after claim", v.name) - key := store.KeyFromNSN(types.NamespacedName{Namespace: namespace, Name: tc.index}) - err = be.PrintEntries(ctx, key) - assert.NoError(t, err) - } - }) - } - } -} diff --git a/pkg/generated/clientset/versioned/clientset.go b/pkg/generated/clientset/versioned/clientset.go new file mode 100644 index 0000000..00f3198 --- /dev/null +++ b/pkg/generated/clientset/versioned/clientset.go @@ -0,0 +1,119 @@ +/* +Copyright 2024 Nokia. + +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 versioned + +import ( + "fmt" + "net/http" + + asv1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/as/v1alpha1" + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + AsV1alpha1() asv1alpha1.AsV1alpha1Interface +} + +// Clientset contains the clients for groups. +type Clientset struct { + *discovery.DiscoveryClient + asV1alpha1 *asv1alpha1.AsV1alpha1Client +} + +// AsV1alpha1 retrieves the AsV1alpha1Client +func (c *Clientset) AsV1alpha1() asv1alpha1.AsV1alpha1Interface { + return c.asV1alpha1 +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + if c == nil { + return nil + } + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +// If config's RateLimiter is not set and QPS and Burst are acceptable, +// NewForConfig will generate a rate-limiter in configShallowCopy. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*Clientset, error) { + configShallowCopy := *c + + if configShallowCopy.UserAgent == "" { + configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent() + } + + // share the transport between all clients + httpClient, err := rest.HTTPClientFor(&configShallowCopy) + if err != nil { + return nil, err + } + + return NewForConfigAndClient(&configShallowCopy, httpClient) +} + +// NewForConfigAndClient creates a new Clientset for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +// If config's RateLimiter is not set and QPS and Burst are acceptable, +// NewForConfigAndClient will generate a rate-limiter in configShallowCopy. +func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + if configShallowCopy.Burst <= 0 { + return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0") + } + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + + var cs Clientset + var err error + cs.asV1alpha1, err = asv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + return &cs, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *Clientset { + cs, err := NewForConfig(c) + if err != nil { + panic(err) + } + return cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.asV1alpha1 = asv1alpha1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/pkg/generated/clientset/versioned/fake/clientset_generated.go b/pkg/generated/clientset/versioned/fake/clientset_generated.go new file mode 100644 index 0000000..ab82456 --- /dev/null +++ b/pkg/generated/clientset/versioned/fake/clientset_generated.go @@ -0,0 +1,88 @@ +/* +Copyright 2024 Nokia. + +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 ( + clientset "github.com/kuidio/kuid/pkg/generated/clientset/versioned" + asv1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/as/v1alpha1" + fakeasv1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/as/v1alpha1/fake" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/discovery" + fakediscovery "k8s.io/client-go/discovery/fake" + "k8s.io/client-go/testing" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any field management, validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +// +// DEPRECATED: NewClientset replaces this with support for field management, which significantly improves +// server side apply testing. NewClientset is only available when apply configurations are generated (e.g. +// via --with-applyconfig). +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + cs := &Clientset{tracker: o} + cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} + cs.AddReactor("*", "*", testing.ObjectReaction(o)) + cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { + gvr := action.GetResource() + ns := action.GetNamespace() + watch, err := o.Watch(gvr, ns) + if err != nil { + return false, nil, err + } + return true, watch, nil + }) + + return cs +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + testing.Fake + discovery *fakediscovery.FakeDiscovery + tracker testing.ObjectTracker +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.discovery +} + +func (c *Clientset) Tracker() testing.ObjectTracker { + return c.tracker +} + +var ( + _ clientset.Interface = &Clientset{} + _ testing.FakeClient = &Clientset{} +) + +// AsV1alpha1 retrieves the AsV1alpha1Client +func (c *Clientset) AsV1alpha1() asv1alpha1.AsV1alpha1Interface { + return &fakeasv1alpha1.FakeAsV1alpha1{Fake: &c.Fake} +} diff --git a/apis/generated/clientset/versioned/fake/doc.go b/pkg/generated/clientset/versioned/fake/doc.go similarity index 100% rename from apis/generated/clientset/versioned/fake/doc.go rename to pkg/generated/clientset/versioned/fake/doc.go diff --git a/apis/generated/clientset/versioned/fake/register.go b/pkg/generated/clientset/versioned/fake/register.go similarity index 73% rename from apis/generated/clientset/versioned/fake/register.go rename to pkg/generated/clientset/versioned/fake/register.go index d306f10..aa7bf38 100644 --- a/apis/generated/clientset/versioned/fake/register.go +++ b/pkg/generated/clientset/versioned/fake/register.go @@ -19,13 +19,6 @@ package fake import ( asv1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" - esiv1alpha1 "github.com/kuidio/kuid/apis/backend/esi/v1alpha1" - extcommv1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" - genidv1alpha1 "github.com/kuidio/kuid/apis/backend/genid/v1alpha1" - infrav1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - ipamv1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" - vlanv1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" - vxlanv1alpha1 "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -38,13 +31,6 @@ var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ asv1alpha1.AddToScheme, - esiv1alpha1.AddToScheme, - extcommv1alpha1.AddToScheme, - genidv1alpha1.AddToScheme, - infrav1alpha1.AddToScheme, - ipamv1alpha1.AddToScheme, - vlanv1alpha1.AddToScheme, - vxlanv1alpha1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/apis/generated/clientset/versioned/scheme/doc.go b/pkg/generated/clientset/versioned/scheme/doc.go similarity index 100% rename from apis/generated/clientset/versioned/scheme/doc.go rename to pkg/generated/clientset/versioned/scheme/doc.go diff --git a/apis/generated/clientset/versioned/scheme/register.go b/pkg/generated/clientset/versioned/scheme/register.go similarity index 73% rename from apis/generated/clientset/versioned/scheme/register.go rename to pkg/generated/clientset/versioned/scheme/register.go index bdc45d5..0f006dc 100644 --- a/apis/generated/clientset/versioned/scheme/register.go +++ b/pkg/generated/clientset/versioned/scheme/register.go @@ -19,13 +19,6 @@ package scheme import ( asv1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" - esiv1alpha1 "github.com/kuidio/kuid/apis/backend/esi/v1alpha1" - extcommv1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" - genidv1alpha1 "github.com/kuidio/kuid/apis/backend/genid/v1alpha1" - infrav1alpha1 "github.com/kuidio/kuid/apis/backend/infra/v1alpha1" - ipamv1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" - vlanv1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" - vxlanv1alpha1 "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -38,13 +31,6 @@ var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ asv1alpha1.AddToScheme, - esiv1alpha1.AddToScheme, - extcommv1alpha1.AddToScheme, - genidv1alpha1.AddToScheme, - infrav1alpha1.AddToScheme, - ipamv1alpha1.AddToScheme, - vlanv1alpha1.AddToScheme, - vxlanv1alpha1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/apis/generated/clientset/versioned/typed/as/v1alpha1/as_client.go b/pkg/generated/clientset/versioned/typed/as/v1alpha1/as_client.go similarity index 97% rename from apis/generated/clientset/versioned/typed/as/v1alpha1/as_client.go rename to pkg/generated/clientset/versioned/typed/as/v1alpha1/as_client.go index 32ea38d..e193b38 100644 --- a/apis/generated/clientset/versioned/typed/as/v1alpha1/as_client.go +++ b/pkg/generated/clientset/versioned/typed/as/v1alpha1/as_client.go @@ -21,7 +21,7 @@ import ( "net/http" v1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" - "github.com/kuidio/kuid/apis/generated/clientset/versioned/scheme" + "github.com/kuidio/kuid/pkg/generated/clientset/versioned/scheme" rest "k8s.io/client-go/rest" ) diff --git a/pkg/generated/clientset/versioned/typed/as/v1alpha1/asclaim.go b/pkg/generated/clientset/versioned/typed/as/v1alpha1/asclaim.go new file mode 100644 index 0000000..7f576b2 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/as/v1alpha1/asclaim.go @@ -0,0 +1,68 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + + v1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" + scheme "github.com/kuidio/kuid/pkg/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// ASClaimsGetter has a method to return a ASClaimInterface. +// A group's client should implement this interface. +type ASClaimsGetter interface { + ASClaims(namespace string) ASClaimInterface +} + +// ASClaimInterface has methods to work with ASClaim resources. +type ASClaimInterface interface { + Create(ctx context.Context, aSClaim *v1alpha1.ASClaim, opts v1.CreateOptions) (*v1alpha1.ASClaim, error) + Update(ctx context.Context, aSClaim *v1alpha1.ASClaim, opts v1.UpdateOptions) (*v1alpha1.ASClaim, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, aSClaim *v1alpha1.ASClaim, opts v1.UpdateOptions) (*v1alpha1.ASClaim, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.ASClaim, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ASClaimList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ASClaim, err error) + ASClaimExpansion +} + +// aSClaims implements ASClaimInterface +type aSClaims struct { + *gentype.ClientWithList[*v1alpha1.ASClaim, *v1alpha1.ASClaimList] +} + +// newASClaims returns a ASClaims +func newASClaims(c *AsV1alpha1Client, namespace string) *aSClaims { + return &aSClaims{ + gentype.NewClientWithList[*v1alpha1.ASClaim, *v1alpha1.ASClaimList]( + "asclaims", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.ASClaim { return &v1alpha1.ASClaim{} }, + func() *v1alpha1.ASClaimList { return &v1alpha1.ASClaimList{} }), + } +} diff --git a/pkg/generated/clientset/versioned/typed/as/v1alpha1/asentry.go b/pkg/generated/clientset/versioned/typed/as/v1alpha1/asentry.go new file mode 100644 index 0000000..3d12610 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/as/v1alpha1/asentry.go @@ -0,0 +1,68 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + + v1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" + scheme "github.com/kuidio/kuid/pkg/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// ASEntriesGetter has a method to return a ASEntryInterface. +// A group's client should implement this interface. +type ASEntriesGetter interface { + ASEntries(namespace string) ASEntryInterface +} + +// ASEntryInterface has methods to work with ASEntry resources. +type ASEntryInterface interface { + Create(ctx context.Context, aSEntry *v1alpha1.ASEntry, opts v1.CreateOptions) (*v1alpha1.ASEntry, error) + Update(ctx context.Context, aSEntry *v1alpha1.ASEntry, opts v1.UpdateOptions) (*v1alpha1.ASEntry, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, aSEntry *v1alpha1.ASEntry, opts v1.UpdateOptions) (*v1alpha1.ASEntry, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.ASEntry, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ASEntryList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ASEntry, err error) + ASEntryExpansion +} + +// aSEntries implements ASEntryInterface +type aSEntries struct { + *gentype.ClientWithList[*v1alpha1.ASEntry, *v1alpha1.ASEntryList] +} + +// newASEntries returns a ASEntries +func newASEntries(c *AsV1alpha1Client, namespace string) *aSEntries { + return &aSEntries{ + gentype.NewClientWithList[*v1alpha1.ASEntry, *v1alpha1.ASEntryList]( + "asentries", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.ASEntry { return &v1alpha1.ASEntry{} }, + func() *v1alpha1.ASEntryList { return &v1alpha1.ASEntryList{} }), + } +} diff --git a/pkg/generated/clientset/versioned/typed/as/v1alpha1/asindex.go b/pkg/generated/clientset/versioned/typed/as/v1alpha1/asindex.go new file mode 100644 index 0000000..fd68c2c --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/as/v1alpha1/asindex.go @@ -0,0 +1,68 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + + v1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" + scheme "github.com/kuidio/kuid/pkg/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// ASIndexesGetter has a method to return a ASIndexInterface. +// A group's client should implement this interface. +type ASIndexesGetter interface { + ASIndexes(namespace string) ASIndexInterface +} + +// ASIndexInterface has methods to work with ASIndex resources. +type ASIndexInterface interface { + Create(ctx context.Context, aSIndex *v1alpha1.ASIndex, opts v1.CreateOptions) (*v1alpha1.ASIndex, error) + Update(ctx context.Context, aSIndex *v1alpha1.ASIndex, opts v1.UpdateOptions) (*v1alpha1.ASIndex, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, aSIndex *v1alpha1.ASIndex, opts v1.UpdateOptions) (*v1alpha1.ASIndex, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.ASIndex, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ASIndexList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ASIndex, err error) + ASIndexExpansion +} + +// aSIndexes implements ASIndexInterface +type aSIndexes struct { + *gentype.ClientWithList[*v1alpha1.ASIndex, *v1alpha1.ASIndexList] +} + +// newASIndexes returns a ASIndexes +func newASIndexes(c *AsV1alpha1Client, namespace string) *aSIndexes { + return &aSIndexes{ + gentype.NewClientWithList[*v1alpha1.ASIndex, *v1alpha1.ASIndexList]( + "asindexes", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.ASIndex { return &v1alpha1.ASIndex{} }, + func() *v1alpha1.ASIndexList { return &v1alpha1.ASIndexList{} }), + } +} diff --git a/apis/generated/clientset/versioned/typed/as/v1alpha1/doc.go b/pkg/generated/clientset/versioned/typed/as/v1alpha1/doc.go similarity index 100% rename from apis/generated/clientset/versioned/typed/as/v1alpha1/doc.go rename to pkg/generated/clientset/versioned/typed/as/v1alpha1/doc.go diff --git a/apis/generated/clientset/versioned/typed/as/v1alpha1/fake/doc.go b/pkg/generated/clientset/versioned/typed/as/v1alpha1/fake/doc.go similarity index 100% rename from apis/generated/clientset/versioned/typed/as/v1alpha1/fake/doc.go rename to pkg/generated/clientset/versioned/typed/as/v1alpha1/fake/doc.go diff --git a/apis/generated/clientset/versioned/typed/as/v1alpha1/fake/fake_as_client.go b/pkg/generated/clientset/versioned/typed/as/v1alpha1/fake/fake_as_client.go similarity index 93% rename from apis/generated/clientset/versioned/typed/as/v1alpha1/fake/fake_as_client.go rename to pkg/generated/clientset/versioned/typed/as/v1alpha1/fake/fake_as_client.go index ec3c619..1b21930 100644 --- a/apis/generated/clientset/versioned/typed/as/v1alpha1/fake/fake_as_client.go +++ b/pkg/generated/clientset/versioned/typed/as/v1alpha1/fake/fake_as_client.go @@ -18,7 +18,7 @@ limitations under the License. package fake import ( - v1alpha1 "github.com/kuidio/kuid/apis/generated/clientset/versioned/typed/as/v1alpha1" + v1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/as/v1alpha1" rest "k8s.io/client-go/rest" testing "k8s.io/client-go/testing" ) diff --git a/apis/generated/clientset/versioned/typed/as/v1alpha1/fake/fake_asclaim.go b/pkg/generated/clientset/versioned/typed/as/v1alpha1/fake/fake_asclaim.go similarity index 76% rename from apis/generated/clientset/versioned/typed/as/v1alpha1/fake/fake_asclaim.go rename to pkg/generated/clientset/versioned/typed/as/v1alpha1/fake/fake_asclaim.go index 8818881..e330340 100644 --- a/apis/generated/clientset/versioned/typed/as/v1alpha1/fake/fake_asclaim.go +++ b/pkg/generated/clientset/versioned/typed/as/v1alpha1/fake/fake_asclaim.go @@ -40,22 +40,24 @@ var asclaimsKind = v1alpha1.SchemeGroupVersion.WithKind("ASClaim") // Get takes name of the aSClaim, and returns the corresponding aSClaim object, and an error if there is any. func (c *FakeASClaims) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ASClaim, err error) { + emptyResult := &v1alpha1.ASClaim{} obj, err := c.Fake. - Invokes(testing.NewGetAction(asclaimsResource, c.ns, name), &v1alpha1.ASClaim{}) + Invokes(testing.NewGetActionWithOptions(asclaimsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ASClaim), err } // List takes label and field selectors, and returns the list of ASClaims that match those selectors. func (c *FakeASClaims) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ASClaimList, err error) { + emptyResult := &v1alpha1.ASClaimList{} obj, err := c.Fake. - Invokes(testing.NewListAction(asclaimsResource, asclaimsKind, c.ns, opts), &v1alpha1.ASClaimList{}) + Invokes(testing.NewListActionWithOptions(asclaimsResource, asclaimsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -74,40 +76,43 @@ func (c *FakeASClaims) List(ctx context.Context, opts v1.ListOptions) (result *v // Watch returns a watch.Interface that watches the requested aSClaims. func (c *FakeASClaims) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(asclaimsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(asclaimsResource, c.ns, opts)) } // Create takes the representation of a aSClaim and creates it. Returns the server's representation of the aSClaim, and an error, if there is any. func (c *FakeASClaims) Create(ctx context.Context, aSClaim *v1alpha1.ASClaim, opts v1.CreateOptions) (result *v1alpha1.ASClaim, err error) { + emptyResult := &v1alpha1.ASClaim{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(asclaimsResource, c.ns, aSClaim), &v1alpha1.ASClaim{}) + Invokes(testing.NewCreateActionWithOptions(asclaimsResource, c.ns, aSClaim, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ASClaim), err } // Update takes the representation of a aSClaim and updates it. Returns the server's representation of the aSClaim, and an error, if there is any. func (c *FakeASClaims) Update(ctx context.Context, aSClaim *v1alpha1.ASClaim, opts v1.UpdateOptions) (result *v1alpha1.ASClaim, err error) { + emptyResult := &v1alpha1.ASClaim{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(asclaimsResource, c.ns, aSClaim), &v1alpha1.ASClaim{}) + Invokes(testing.NewUpdateActionWithOptions(asclaimsResource, c.ns, aSClaim, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ASClaim), 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 *FakeASClaims) UpdateStatus(ctx context.Context, aSClaim *v1alpha1.ASClaim, opts v1.UpdateOptions) (*v1alpha1.ASClaim, error) { +func (c *FakeASClaims) UpdateStatus(ctx context.Context, aSClaim *v1alpha1.ASClaim, opts v1.UpdateOptions) (result *v1alpha1.ASClaim, err error) { + emptyResult := &v1alpha1.ASClaim{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(asclaimsResource, "status", c.ns, aSClaim), &v1alpha1.ASClaim{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(asclaimsResource, "status", c.ns, aSClaim, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ASClaim), err } @@ -122,7 +127,7 @@ func (c *FakeASClaims) Delete(ctx context.Context, name string, opts v1.DeleteOp // DeleteCollection deletes a collection of objects. func (c *FakeASClaims) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(asclaimsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(asclaimsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.ASClaimList{}) return err @@ -130,11 +135,12 @@ func (c *FakeASClaims) DeleteCollection(ctx context.Context, opts v1.DeleteOptio // Patch applies the patch and returns the patched aSClaim. func (c *FakeASClaims) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ASClaim, err error) { + emptyResult := &v1alpha1.ASClaim{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(asclaimsResource, c.ns, name, pt, data, subresources...), &v1alpha1.ASClaim{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(asclaimsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ASClaim), err } diff --git a/apis/generated/clientset/versioned/typed/as/v1alpha1/fake/fake_asentry.go b/pkg/generated/clientset/versioned/typed/as/v1alpha1/fake/fake_asentry.go similarity index 76% rename from apis/generated/clientset/versioned/typed/as/v1alpha1/fake/fake_asentry.go rename to pkg/generated/clientset/versioned/typed/as/v1alpha1/fake/fake_asentry.go index fb06631..7540248 100644 --- a/apis/generated/clientset/versioned/typed/as/v1alpha1/fake/fake_asentry.go +++ b/pkg/generated/clientset/versioned/typed/as/v1alpha1/fake/fake_asentry.go @@ -40,22 +40,24 @@ var asentriesKind = v1alpha1.SchemeGroupVersion.WithKind("ASEntry") // Get takes name of the aSEntry, and returns the corresponding aSEntry object, and an error if there is any. func (c *FakeASEntries) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ASEntry, err error) { + emptyResult := &v1alpha1.ASEntry{} obj, err := c.Fake. - Invokes(testing.NewGetAction(asentriesResource, c.ns, name), &v1alpha1.ASEntry{}) + Invokes(testing.NewGetActionWithOptions(asentriesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ASEntry), err } // List takes label and field selectors, and returns the list of ASEntries that match those selectors. func (c *FakeASEntries) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ASEntryList, err error) { + emptyResult := &v1alpha1.ASEntryList{} obj, err := c.Fake. - Invokes(testing.NewListAction(asentriesResource, asentriesKind, c.ns, opts), &v1alpha1.ASEntryList{}) + Invokes(testing.NewListActionWithOptions(asentriesResource, asentriesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -74,40 +76,43 @@ func (c *FakeASEntries) List(ctx context.Context, opts v1.ListOptions) (result * // Watch returns a watch.Interface that watches the requested aSEntries. func (c *FakeASEntries) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(asentriesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(asentriesResource, c.ns, opts)) } // Create takes the representation of a aSEntry and creates it. Returns the server's representation of the aSEntry, and an error, if there is any. func (c *FakeASEntries) Create(ctx context.Context, aSEntry *v1alpha1.ASEntry, opts v1.CreateOptions) (result *v1alpha1.ASEntry, err error) { + emptyResult := &v1alpha1.ASEntry{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(asentriesResource, c.ns, aSEntry), &v1alpha1.ASEntry{}) + Invokes(testing.NewCreateActionWithOptions(asentriesResource, c.ns, aSEntry, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ASEntry), err } // Update takes the representation of a aSEntry and updates it. Returns the server's representation of the aSEntry, and an error, if there is any. func (c *FakeASEntries) Update(ctx context.Context, aSEntry *v1alpha1.ASEntry, opts v1.UpdateOptions) (result *v1alpha1.ASEntry, err error) { + emptyResult := &v1alpha1.ASEntry{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(asentriesResource, c.ns, aSEntry), &v1alpha1.ASEntry{}) + Invokes(testing.NewUpdateActionWithOptions(asentriesResource, c.ns, aSEntry, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ASEntry), 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 *FakeASEntries) UpdateStatus(ctx context.Context, aSEntry *v1alpha1.ASEntry, opts v1.UpdateOptions) (*v1alpha1.ASEntry, error) { +func (c *FakeASEntries) UpdateStatus(ctx context.Context, aSEntry *v1alpha1.ASEntry, opts v1.UpdateOptions) (result *v1alpha1.ASEntry, err error) { + emptyResult := &v1alpha1.ASEntry{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(asentriesResource, "status", c.ns, aSEntry), &v1alpha1.ASEntry{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(asentriesResource, "status", c.ns, aSEntry, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ASEntry), err } @@ -122,7 +127,7 @@ func (c *FakeASEntries) Delete(ctx context.Context, name string, opts v1.DeleteO // DeleteCollection deletes a collection of objects. func (c *FakeASEntries) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(asentriesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(asentriesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.ASEntryList{}) return err @@ -130,11 +135,12 @@ func (c *FakeASEntries) DeleteCollection(ctx context.Context, opts v1.DeleteOpti // Patch applies the patch and returns the patched aSEntry. func (c *FakeASEntries) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ASEntry, err error) { + emptyResult := &v1alpha1.ASEntry{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(asentriesResource, c.ns, name, pt, data, subresources...), &v1alpha1.ASEntry{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(asentriesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ASEntry), err } diff --git a/apis/generated/clientset/versioned/typed/as/v1alpha1/fake/fake_asindex.go b/pkg/generated/clientset/versioned/typed/as/v1alpha1/fake/fake_asindex.go similarity index 76% rename from apis/generated/clientset/versioned/typed/as/v1alpha1/fake/fake_asindex.go rename to pkg/generated/clientset/versioned/typed/as/v1alpha1/fake/fake_asindex.go index 6b7bc0d..d4bc44f 100644 --- a/apis/generated/clientset/versioned/typed/as/v1alpha1/fake/fake_asindex.go +++ b/pkg/generated/clientset/versioned/typed/as/v1alpha1/fake/fake_asindex.go @@ -40,22 +40,24 @@ var asindexesKind = v1alpha1.SchemeGroupVersion.WithKind("ASIndex") // Get takes name of the aSIndex, and returns the corresponding aSIndex object, and an error if there is any. func (c *FakeASIndexes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ASIndex, err error) { + emptyResult := &v1alpha1.ASIndex{} obj, err := c.Fake. - Invokes(testing.NewGetAction(asindexesResource, c.ns, name), &v1alpha1.ASIndex{}) + Invokes(testing.NewGetActionWithOptions(asindexesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ASIndex), err } // List takes label and field selectors, and returns the list of ASIndexes that match those selectors. func (c *FakeASIndexes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ASIndexList, err error) { + emptyResult := &v1alpha1.ASIndexList{} obj, err := c.Fake. - Invokes(testing.NewListAction(asindexesResource, asindexesKind, c.ns, opts), &v1alpha1.ASIndexList{}) + Invokes(testing.NewListActionWithOptions(asindexesResource, asindexesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -74,40 +76,43 @@ func (c *FakeASIndexes) List(ctx context.Context, opts v1.ListOptions) (result * // Watch returns a watch.Interface that watches the requested aSIndexes. func (c *FakeASIndexes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(asindexesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(asindexesResource, c.ns, opts)) } // Create takes the representation of a aSIndex and creates it. Returns the server's representation of the aSIndex, and an error, if there is any. func (c *FakeASIndexes) Create(ctx context.Context, aSIndex *v1alpha1.ASIndex, opts v1.CreateOptions) (result *v1alpha1.ASIndex, err error) { + emptyResult := &v1alpha1.ASIndex{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(asindexesResource, c.ns, aSIndex), &v1alpha1.ASIndex{}) + Invokes(testing.NewCreateActionWithOptions(asindexesResource, c.ns, aSIndex, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ASIndex), err } // Update takes the representation of a aSIndex and updates it. Returns the server's representation of the aSIndex, and an error, if there is any. func (c *FakeASIndexes) Update(ctx context.Context, aSIndex *v1alpha1.ASIndex, opts v1.UpdateOptions) (result *v1alpha1.ASIndex, err error) { + emptyResult := &v1alpha1.ASIndex{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(asindexesResource, c.ns, aSIndex), &v1alpha1.ASIndex{}) + Invokes(testing.NewUpdateActionWithOptions(asindexesResource, c.ns, aSIndex, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ASIndex), 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 *FakeASIndexes) UpdateStatus(ctx context.Context, aSIndex *v1alpha1.ASIndex, opts v1.UpdateOptions) (*v1alpha1.ASIndex, error) { +func (c *FakeASIndexes) UpdateStatus(ctx context.Context, aSIndex *v1alpha1.ASIndex, opts v1.UpdateOptions) (result *v1alpha1.ASIndex, err error) { + emptyResult := &v1alpha1.ASIndex{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(asindexesResource, "status", c.ns, aSIndex), &v1alpha1.ASIndex{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(asindexesResource, "status", c.ns, aSIndex, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ASIndex), err } @@ -122,7 +127,7 @@ func (c *FakeASIndexes) Delete(ctx context.Context, name string, opts v1.DeleteO // DeleteCollection deletes a collection of objects. func (c *FakeASIndexes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(asindexesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(asindexesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.ASIndexList{}) return err @@ -130,11 +135,12 @@ func (c *FakeASIndexes) DeleteCollection(ctx context.Context, opts v1.DeleteOpti // Patch applies the patch and returns the patched aSIndex. func (c *FakeASIndexes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ASIndex, err error) { + emptyResult := &v1alpha1.ASIndex{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(asindexesResource, c.ns, name, pt, data, subresources...), &v1alpha1.ASIndex{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(asindexesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha1.ASIndex), err } diff --git a/apis/generated/clientset/versioned/typed/as/v1alpha1/generated_expansion.go b/pkg/generated/clientset/versioned/typed/as/v1alpha1/generated_expansion.go similarity index 100% rename from apis/generated/clientset/versioned/typed/as/v1alpha1/generated_expansion.go rename to pkg/generated/clientset/versioned/typed/as/v1alpha1/generated_expansion.go diff --git a/apis/generated/informers/externalversions/as/interface.go b/pkg/generated/informers/externalversions/as/interface.go similarity index 87% rename from apis/generated/informers/externalversions/as/interface.go rename to pkg/generated/informers/externalversions/as/interface.go index 5897486..c005f4e 100644 --- a/apis/generated/informers/externalversions/as/interface.go +++ b/pkg/generated/informers/externalversions/as/interface.go @@ -18,8 +18,8 @@ limitations under the License. package as import ( - v1alpha1 "github.com/kuidio/kuid/apis/generated/informers/externalversions/as/v1alpha1" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kuidio/kuid/pkg/generated/informers/externalversions/as/v1alpha1" + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" ) // Interface provides access to each of this group's versions. diff --git a/apis/generated/informers/externalversions/as/v1alpha1/asclaim.go b/pkg/generated/informers/externalversions/as/v1alpha1/asclaim.go similarity index 93% rename from apis/generated/informers/externalversions/as/v1alpha1/asclaim.go rename to pkg/generated/informers/externalversions/as/v1alpha1/asclaim.go index d026752..1736a91 100644 --- a/apis/generated/informers/externalversions/as/v1alpha1/asclaim.go +++ b/pkg/generated/informers/externalversions/as/v1alpha1/asclaim.go @@ -22,9 +22,9 @@ import ( time "time" asv1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/as/v1alpha1" + versioned "github.com/kuidio/kuid/pkg/generated/clientset/versioned" + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kuidio/kuid/pkg/generated/listers/as/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" diff --git a/apis/generated/informers/externalversions/as/v1alpha1/asentry.go b/pkg/generated/informers/externalversions/as/v1alpha1/asentry.go similarity index 93% rename from apis/generated/informers/externalversions/as/v1alpha1/asentry.go rename to pkg/generated/informers/externalversions/as/v1alpha1/asentry.go index c809e91..2c79976 100644 --- a/apis/generated/informers/externalversions/as/v1alpha1/asentry.go +++ b/pkg/generated/informers/externalversions/as/v1alpha1/asentry.go @@ -22,9 +22,9 @@ import ( time "time" asv1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/as/v1alpha1" + versioned "github.com/kuidio/kuid/pkg/generated/clientset/versioned" + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kuidio/kuid/pkg/generated/listers/as/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" diff --git a/apis/generated/informers/externalversions/as/v1alpha1/asindex.go b/pkg/generated/informers/externalversions/as/v1alpha1/asindex.go similarity index 93% rename from apis/generated/informers/externalversions/as/v1alpha1/asindex.go rename to pkg/generated/informers/externalversions/as/v1alpha1/asindex.go index 652440f..95d976b 100644 --- a/apis/generated/informers/externalversions/as/v1alpha1/asindex.go +++ b/pkg/generated/informers/externalversions/as/v1alpha1/asindex.go @@ -22,9 +22,9 @@ import ( time "time" asv1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/kuidio/kuid/apis/generated/listers/as/v1alpha1" + versioned "github.com/kuidio/kuid/pkg/generated/clientset/versioned" + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kuidio/kuid/pkg/generated/listers/as/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" diff --git a/apis/generated/informers/externalversions/as/v1alpha1/interface.go b/pkg/generated/informers/externalversions/as/v1alpha1/interface.go similarity index 94% rename from apis/generated/informers/externalversions/as/v1alpha1/interface.go rename to pkg/generated/informers/externalversions/as/v1alpha1/interface.go index b69f6a3..120b4ad 100644 --- a/apis/generated/informers/externalversions/as/v1alpha1/interface.go +++ b/pkg/generated/informers/externalversions/as/v1alpha1/interface.go @@ -18,7 +18,7 @@ limitations under the License. package v1alpha1 import ( - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" ) // Interface provides access to all the informers in this group version. diff --git a/apis/generated/informers/externalversions/factory.go b/pkg/generated/informers/externalversions/factory.go similarity index 83% rename from apis/generated/informers/externalversions/factory.go rename to pkg/generated/informers/externalversions/factory.go index 20266fe..9724cb9 100644 --- a/apis/generated/informers/externalversions/factory.go +++ b/pkg/generated/informers/externalversions/factory.go @@ -22,16 +22,9 @@ import ( sync "sync" time "time" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" - as "github.com/kuidio/kuid/apis/generated/informers/externalversions/as" - esi "github.com/kuidio/kuid/apis/generated/informers/externalversions/esi" - extcomm "github.com/kuidio/kuid/apis/generated/informers/externalversions/extcomm" - genid "github.com/kuidio/kuid/apis/generated/informers/externalversions/genid" - infra "github.com/kuidio/kuid/apis/generated/informers/externalversions/infra" - internalinterfaces "github.com/kuidio/kuid/apis/generated/informers/externalversions/internalinterfaces" - ipam "github.com/kuidio/kuid/apis/generated/informers/externalversions/ipam" - vlan "github.com/kuidio/kuid/apis/generated/informers/externalversions/vlan" - vxlan "github.com/kuidio/kuid/apis/generated/informers/externalversions/vxlan" + versioned "github.com/kuidio/kuid/pkg/generated/clientset/versioned" + as "github.com/kuidio/kuid/pkg/generated/informers/externalversions/as" + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -234,6 +227,7 @@ type SharedInformerFactory interface { // Start initializes all requested informers. They are handled in goroutines // which run until the stop channel gets closed. + // Warning: Start does not block. When run in a go-routine, it will race with a later WaitForCacheSync. Start(stopCh <-chan struct{}) // Shutdown marks a factory as shutting down. At that point no new @@ -260,43 +254,8 @@ type SharedInformerFactory interface { InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer As() as.Interface - Esi() esi.Interface - Extcomm() extcomm.Interface - Genid() genid.Interface - Infra() infra.Interface - Ipam() ipam.Interface - Vlan() vlan.Interface - Vxlan() vxlan.Interface } func (f *sharedInformerFactory) As() as.Interface { return as.New(f, f.namespace, f.tweakListOptions) } - -func (f *sharedInformerFactory) Esi() esi.Interface { - return esi.New(f, f.namespace, f.tweakListOptions) -} - -func (f *sharedInformerFactory) Extcomm() extcomm.Interface { - return extcomm.New(f, f.namespace, f.tweakListOptions) -} - -func (f *sharedInformerFactory) Genid() genid.Interface { - return genid.New(f, f.namespace, f.tweakListOptions) -} - -func (f *sharedInformerFactory) Infra() infra.Interface { - return infra.New(f, f.namespace, f.tweakListOptions) -} - -func (f *sharedInformerFactory) Ipam() ipam.Interface { - return ipam.New(f, f.namespace, f.tweakListOptions) -} - -func (f *sharedInformerFactory) Vlan() vlan.Interface { - return vlan.New(f, f.namespace, f.tweakListOptions) -} - -func (f *sharedInformerFactory) Vxlan() vxlan.Interface { - return vxlan.New(f, f.namespace, f.tweakListOptions) -} diff --git a/pkg/generated/informers/externalversions/generic.go b/pkg/generated/informers/externalversions/generic.go new file mode 100644 index 0000000..c92f2c2 --- /dev/null +++ b/pkg/generated/informers/externalversions/generic.go @@ -0,0 +1,65 @@ +/* +Copyright 2024 Nokia. + +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 externalversions + +import ( + "fmt" + + v1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// GenericInformer is type of SharedIndexInformer which will locate and delegate to other +// sharedInformers based on type +type GenericInformer interface { + Informer() cache.SharedIndexInformer + Lister() cache.GenericLister +} + +type genericInformer struct { + informer cache.SharedIndexInformer + resource schema.GroupResource +} + +// Informer returns the SharedIndexInformer. +func (f *genericInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +// Lister returns the GenericLister. +func (f *genericInformer) Lister() cache.GenericLister { + return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) +} + +// ForResource gives generic access to a shared informer of the matching type +// TODO extend this to unknown resources with a client pool +func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { + switch resource { + // Group=as.be.kuid.dev, Version=v1alpha1 + case v1alpha1.SchemeGroupVersion.WithResource("asclaims"): + return &genericInformer{resource: resource.GroupResource(), informer: f.As().V1alpha1().ASClaims().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("asentries"): + return &genericInformer{resource: resource.GroupResource(), informer: f.As().V1alpha1().ASEntries().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("asindexes"): + return &genericInformer{resource: resource.GroupResource(), informer: f.As().V1alpha1().ASIndexes().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/apis/generated/informers/externalversions/internalinterfaces/factory_interfaces.go b/pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go similarity index 94% rename from apis/generated/informers/externalversions/internalinterfaces/factory_interfaces.go rename to pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go index 6668117..a0e5656 100644 --- a/apis/generated/informers/externalversions/internalinterfaces/factory_interfaces.go +++ b/pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -20,7 +20,7 @@ package internalinterfaces import ( time "time" - versioned "github.com/kuidio/kuid/apis/generated/clientset/versioned" + versioned "github.com/kuidio/kuid/pkg/generated/clientset/versioned" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" cache "k8s.io/client-go/tools/cache" diff --git a/apis/generated/listers/as/v1alpha1/asclaim.go b/pkg/generated/listers/as/v1alpha1/asclaim.go similarity index 64% rename from apis/generated/listers/as/v1alpha1/asclaim.go rename to pkg/generated/listers/as/v1alpha1/asclaim.go index 3d1ba12..b736d30 100644 --- a/apis/generated/listers/as/v1alpha1/asclaim.go +++ b/pkg/generated/listers/as/v1alpha1/asclaim.go @@ -19,8 +19,8 @@ package v1alpha1 import ( v1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -37,25 +37,17 @@ type ASClaimLister interface { // aSClaimLister implements the ASClaimLister interface. type aSClaimLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.ASClaim] } // NewASClaimLister returns a new ASClaimLister. func NewASClaimLister(indexer cache.Indexer) ASClaimLister { - return &aSClaimLister{indexer: indexer} -} - -// List lists all ASClaims in the indexer. -func (s *aSClaimLister) List(selector labels.Selector) (ret []*v1alpha1.ASClaim, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ASClaim)) - }) - return ret, err + return &aSClaimLister{listers.New[*v1alpha1.ASClaim](indexer, v1alpha1.Resource("asclaim"))} } // ASClaims returns an object that can list and get ASClaims. func (s *aSClaimLister) ASClaims(namespace string) ASClaimNamespaceLister { - return aSClaimNamespaceLister{indexer: s.indexer, namespace: namespace} + return aSClaimNamespaceLister{listers.NewNamespaced[*v1alpha1.ASClaim](s.ResourceIndexer, namespace)} } // ASClaimNamespaceLister helps list and get ASClaims. @@ -73,26 +65,5 @@ type ASClaimNamespaceLister interface { // aSClaimNamespaceLister implements the ASClaimNamespaceLister // interface. type aSClaimNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all ASClaims in the indexer for a given namespace. -func (s aSClaimNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ASClaim, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ASClaim)) - }) - return ret, err -} - -// Get retrieves the ASClaim from the indexer for a given namespace and name. -func (s aSClaimNamespaceLister) Get(name string) (*v1alpha1.ASClaim, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("asclaim"), name) - } - return obj.(*v1alpha1.ASClaim), nil + listers.ResourceIndexer[*v1alpha1.ASClaim] } diff --git a/apis/generated/listers/as/v1alpha1/asentry.go b/pkg/generated/listers/as/v1alpha1/asentry.go similarity index 65% rename from apis/generated/listers/as/v1alpha1/asentry.go rename to pkg/generated/listers/as/v1alpha1/asentry.go index a38243e..cf4141d 100644 --- a/apis/generated/listers/as/v1alpha1/asentry.go +++ b/pkg/generated/listers/as/v1alpha1/asentry.go @@ -19,8 +19,8 @@ package v1alpha1 import ( v1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -37,25 +37,17 @@ type ASEntryLister interface { // aSEntryLister implements the ASEntryLister interface. type aSEntryLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.ASEntry] } // NewASEntryLister returns a new ASEntryLister. func NewASEntryLister(indexer cache.Indexer) ASEntryLister { - return &aSEntryLister{indexer: indexer} -} - -// List lists all ASEntries in the indexer. -func (s *aSEntryLister) List(selector labels.Selector) (ret []*v1alpha1.ASEntry, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ASEntry)) - }) - return ret, err + return &aSEntryLister{listers.New[*v1alpha1.ASEntry](indexer, v1alpha1.Resource("asentry"))} } // ASEntries returns an object that can list and get ASEntries. func (s *aSEntryLister) ASEntries(namespace string) ASEntryNamespaceLister { - return aSEntryNamespaceLister{indexer: s.indexer, namespace: namespace} + return aSEntryNamespaceLister{listers.NewNamespaced[*v1alpha1.ASEntry](s.ResourceIndexer, namespace)} } // ASEntryNamespaceLister helps list and get ASEntries. @@ -73,26 +65,5 @@ type ASEntryNamespaceLister interface { // aSEntryNamespaceLister implements the ASEntryNamespaceLister // interface. type aSEntryNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all ASEntries in the indexer for a given namespace. -func (s aSEntryNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ASEntry, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ASEntry)) - }) - return ret, err -} - -// Get retrieves the ASEntry from the indexer for a given namespace and name. -func (s aSEntryNamespaceLister) Get(name string) (*v1alpha1.ASEntry, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("asentry"), name) - } - return obj.(*v1alpha1.ASEntry), nil + listers.ResourceIndexer[*v1alpha1.ASEntry] } diff --git a/apis/generated/listers/as/v1alpha1/asindex.go b/pkg/generated/listers/as/v1alpha1/asindex.go similarity index 65% rename from apis/generated/listers/as/v1alpha1/asindex.go rename to pkg/generated/listers/as/v1alpha1/asindex.go index 74ded3c..37aefe7 100644 --- a/apis/generated/listers/as/v1alpha1/asindex.go +++ b/pkg/generated/listers/as/v1alpha1/asindex.go @@ -19,8 +19,8 @@ package v1alpha1 import ( v1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -37,25 +37,17 @@ type ASIndexLister interface { // aSIndexLister implements the ASIndexLister interface. type aSIndexLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha1.ASIndex] } // NewASIndexLister returns a new ASIndexLister. func NewASIndexLister(indexer cache.Indexer) ASIndexLister { - return &aSIndexLister{indexer: indexer} -} - -// List lists all ASIndexes in the indexer. -func (s *aSIndexLister) List(selector labels.Selector) (ret []*v1alpha1.ASIndex, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ASIndex)) - }) - return ret, err + return &aSIndexLister{listers.New[*v1alpha1.ASIndex](indexer, v1alpha1.Resource("asindex"))} } // ASIndexes returns an object that can list and get ASIndexes. func (s *aSIndexLister) ASIndexes(namespace string) ASIndexNamespaceLister { - return aSIndexNamespaceLister{indexer: s.indexer, namespace: namespace} + return aSIndexNamespaceLister{listers.NewNamespaced[*v1alpha1.ASIndex](s.ResourceIndexer, namespace)} } // ASIndexNamespaceLister helps list and get ASIndexes. @@ -73,26 +65,5 @@ type ASIndexNamespaceLister interface { // aSIndexNamespaceLister implements the ASIndexNamespaceLister // interface. type aSIndexNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all ASIndexes in the indexer for a given namespace. -func (s aSIndexNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ASIndex, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ASIndex)) - }) - return ret, err -} - -// Get retrieves the ASIndex from the indexer for a given namespace and name. -func (s aSIndexNamespaceLister) Get(name string) (*v1alpha1.ASIndex, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("asindex"), name) - } - return obj.(*v1alpha1.ASIndex), nil + listers.ResourceIndexer[*v1alpha1.ASIndex] } diff --git a/apis/generated/listers/as/v1alpha1/expansion_generated.go b/pkg/generated/listers/as/v1alpha1/expansion_generated.go similarity index 100% rename from apis/generated/listers/as/v1alpha1/expansion_generated.go rename to pkg/generated/listers/as/v1alpha1/expansion_generated.go diff --git a/pkg/generated/openapi/zz_generated.openapi.go b/pkg/generated/openapi/zz_generated.openapi.go new file mode 100644 index 0000000..fba8f6c --- /dev/null +++ b/pkg/generated/openapi/zz_generated.openapi.go @@ -0,0 +1,2725 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2024 Nokia. + +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 openapi-gen. DO NOT EDIT. + +package openapi + +import ( + resource "k8s.io/apimachinery/pkg/api/resource" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + common "k8s.io/kube-openapi/pkg/common" + spec "k8s.io/kube-openapi/pkg/validation/spec" +) + +func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { + return map[string]common.OpenAPIDefinition{ + "k8s.io/apimachinery/pkg/api/resource.Quantity": schema_apimachinery_pkg_api_resource_Quantity(ref), + "k8s.io/apimachinery/pkg/api/resource.int64Amount": schema_apimachinery_pkg_api_resource_int64Amount(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIGroup": schema_pkg_apis_meta_v1_APIGroup(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIGroupList": schema_pkg_apis_meta_v1_APIGroupList(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIResource": schema_pkg_apis_meta_v1_APIResource(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIResourceList": schema_pkg_apis_meta_v1_APIResourceList(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIVersions": schema_pkg_apis_meta_v1_APIVersions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ApplyOptions": schema_pkg_apis_meta_v1_ApplyOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Condition": schema_pkg_apis_meta_v1_Condition(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.CreateOptions": schema_pkg_apis_meta_v1_CreateOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.DeleteOptions": schema_pkg_apis_meta_v1_DeleteOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Duration": schema_pkg_apis_meta_v1_Duration(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.FieldSelectorRequirement": schema_pkg_apis_meta_v1_FieldSelectorRequirement(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.FieldsV1": schema_pkg_apis_meta_v1_FieldsV1(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GetOptions": schema_pkg_apis_meta_v1_GetOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupKind": schema_pkg_apis_meta_v1_GroupKind(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupResource": schema_pkg_apis_meta_v1_GroupResource(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersion": schema_pkg_apis_meta_v1_GroupVersion(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionForDiscovery": schema_pkg_apis_meta_v1_GroupVersionForDiscovery(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionKind": schema_pkg_apis_meta_v1_GroupVersionKind(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionResource": schema_pkg_apis_meta_v1_GroupVersionResource(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.InternalEvent": schema_pkg_apis_meta_v1_InternalEvent(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector": schema_pkg_apis_meta_v1_LabelSelector(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelectorRequirement": schema_pkg_apis_meta_v1_LabelSelectorRequirement(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.List": schema_pkg_apis_meta_v1_List(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta": schema_pkg_apis_meta_v1_ListMeta(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ListOptions": schema_pkg_apis_meta_v1_ListOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ManagedFieldsEntry": schema_pkg_apis_meta_v1_ManagedFieldsEntry(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.MicroTime": schema_pkg_apis_meta_v1_MicroTime(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta": schema_pkg_apis_meta_v1_ObjectMeta(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.OwnerReference": schema_pkg_apis_meta_v1_OwnerReference(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.PartialObjectMetadata": schema_pkg_apis_meta_v1_PartialObjectMetadata(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.PartialObjectMetadataList": schema_pkg_apis_meta_v1_PartialObjectMetadataList(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Patch": schema_pkg_apis_meta_v1_Patch(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.PatchOptions": schema_pkg_apis_meta_v1_PatchOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Preconditions": schema_pkg_apis_meta_v1_Preconditions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.RootPaths": schema_pkg_apis_meta_v1_RootPaths(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR": schema_pkg_apis_meta_v1_ServerAddressByClientCIDR(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Status": schema_pkg_apis_meta_v1_Status(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.StatusCause": schema_pkg_apis_meta_v1_StatusCause(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.StatusDetails": schema_pkg_apis_meta_v1_StatusDetails(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Table": schema_pkg_apis_meta_v1_Table(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.TableColumnDefinition": schema_pkg_apis_meta_v1_TableColumnDefinition(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.TableOptions": schema_pkg_apis_meta_v1_TableOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.TableRow": schema_pkg_apis_meta_v1_TableRow(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.TableRowCondition": schema_pkg_apis_meta_v1_TableRowCondition(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Time": schema_pkg_apis_meta_v1_Time(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Timestamp": schema_pkg_apis_meta_v1_Timestamp(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta": schema_pkg_apis_meta_v1_TypeMeta(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.UpdateOptions": schema_pkg_apis_meta_v1_UpdateOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.WatchEvent": schema_pkg_apis_meta_v1_WatchEvent(ref), + "k8s.io/apimachinery/pkg/runtime.RawExtension": schema_k8sio_apimachinery_pkg_runtime_RawExtension(ref), + "k8s.io/apimachinery/pkg/runtime.TypeMeta": schema_k8sio_apimachinery_pkg_runtime_TypeMeta(ref), + "k8s.io/apimachinery/pkg/runtime.Unknown": schema_k8sio_apimachinery_pkg_runtime_Unknown(ref), + "k8s.io/apimachinery/pkg/version.Info": schema_k8sio_apimachinery_pkg_version_Info(ref), + } +} + +func schema_apimachinery_pkg_api_resource_Quantity(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.EmbedOpenAPIDefinitionIntoV2Extension(common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and AsInt64() accessors.\n\nThe serialization format is:\n\n``` ::= \n\n\t(Note that may be empty, from the \"\" case in .)\n\n ::= 0 | 1 | ... | 9 ::= | ::= | . | . | . ::= \"+\" | \"-\" ::= | ::= | | ::= Ki | Mi | Gi | Ti | Pi | Ei\n\n\t(International System of units; See: http://physics.nist.gov/cuu/Units/binary.html)\n\n ::= m | \"\" | k | M | G | T | P | E\n\n\t(Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.)\n\n ::= \"e\" | \"E\" ```\n\nNo matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities.\n\nWhen a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized.\n\nBefore serializing, Quantity will be put in \"canonical form\". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that:\n\n- No precision is lost - No fractional digits will be emitted - The exponent (or suffix) is as large as possible.\n\nThe sign will be omitted unless the number is negative.\n\nExamples:\n\n- 1.5 will be serialized as \"1500m\" - 1.5Gi will be serialized as \"1536Mi\"\n\nNote that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise.\n\nNon-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.)\n\nThis format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation.", + OneOf: common.GenerateOpenAPIV3OneOfSchema(resource.Quantity{}.OpenAPIV3OneOfTypes()), + Format: resource.Quantity{}.OpenAPISchemaFormat(), + }, + }, + }, common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and AsInt64() accessors.\n\nThe serialization format is:\n\n``` ::= \n\n\t(Note that may be empty, from the \"\" case in .)\n\n ::= 0 | 1 | ... | 9 ::= | ::= | . | . | . ::= \"+\" | \"-\" ::= | ::= | | ::= Ki | Mi | Gi | Ti | Pi | Ei\n\n\t(International System of units; See: http://physics.nist.gov/cuu/Units/binary.html)\n\n ::= m | \"\" | k | M | G | T | P | E\n\n\t(Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.)\n\n ::= \"e\" | \"E\" ```\n\nNo matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities.\n\nWhen a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized.\n\nBefore serializing, Quantity will be put in \"canonical form\". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that:\n\n- No precision is lost - No fractional digits will be emitted - The exponent (or suffix) is as large as possible.\n\nThe sign will be omitted unless the number is negative.\n\nExamples:\n\n- 1.5 will be serialized as \"1500m\" - 1.5Gi will be serialized as \"1536Mi\"\n\nNote that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise.\n\nNon-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.)\n\nThis format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation.", + Type: resource.Quantity{}.OpenAPISchemaType(), + Format: resource.Quantity{}.OpenAPISchemaFormat(), + }, + }, + }) +} + +func schema_apimachinery_pkg_api_resource_int64Amount(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "int64Amount represents a fixed precision numerator and arbitrary scale exponent. It is faster than operations on inf.Dec for values that can be represented as int64.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "value": { + SchemaProps: spec.SchemaProps{ + Default: 0, + Type: []string{"integer"}, + Format: "int64", + }, + }, + "scale": { + SchemaProps: spec.SchemaProps{ + Default: 0, + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + Required: []string{"value", "scale"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_APIGroup(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "APIGroup contains the name, the supported versions, and the preferred version of a group.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "name": { + SchemaProps: spec.SchemaProps{ + Description: "name is the name of the group.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "versions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "versions are the versions supported in this group.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionForDiscovery"), + }, + }, + }, + }, + }, + "preferredVersion": { + SchemaProps: spec.SchemaProps{ + Description: "preferredVersion is the version preferred by the API server, which probably is the storage version.", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionForDiscovery"), + }, + }, + "serverAddressByClientCIDRs": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "a map of client CIDR to server address that is serving this group. This is to help clients reach servers in the most network-efficient way possible. Clients can use the appropriate server address as per the CIDR that they match. In case of multiple matches, clients should use the longest matching CIDR. The server returns only those CIDRs that it thinks that the client can match. For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP. Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR"), + }, + }, + }, + }, + }, + }, + Required: []string{"name", "versions"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionForDiscovery", "k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR"}, + } +} + +func schema_pkg_apis_meta_v1_APIGroupList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "APIGroupList is a list of APIGroup, to allow clients to discover the API at /apis.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "groups": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "groups is a list of APIGroup.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.APIGroup"), + }, + }, + }, + }, + }, + }, + Required: []string{"groups"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.APIGroup"}, + } +} + +func schema_pkg_apis_meta_v1_APIResource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "APIResource specifies the name of a resource and whether it is namespaced.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "name is the plural name of the resource.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "singularName": { + SchemaProps: spec.SchemaProps{ + Description: "singularName is the singular name of the resource. This allows clients to handle plural and singular opaquely. The singularName is more correct for reporting status on a single item and both singular and plural are allowed from the kubectl CLI interface.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "namespaced": { + SchemaProps: spec.SchemaProps{ + Description: "namespaced indicates if a resource is namespaced or not.", + Default: false, + Type: []string{"boolean"}, + Format: "", + }, + }, + "group": { + SchemaProps: spec.SchemaProps{ + Description: "group is the preferred group of the resource. Empty implies the group of the containing resource list. For subresources, this may have a different value, for example: Scale\".", + Type: []string{"string"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Description: "version is the preferred version of the resource. Empty implies the version of the containing resource list For subresources, this may have a different value, for example: v1 (while inside a v1beta1 version of the core resource's group)\".", + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "kind is the kind for the resource (e.g. 'Foo' is the kind for a resource 'foo')", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "verbs": { + SchemaProps: spec.SchemaProps{ + Description: "verbs is a list of supported kube verbs (this includes get, list, watch, create, update, patch, delete, deletecollection, and proxy)", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "shortNames": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "shortNames is a list of suggested short names of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "categories": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "categories is a list of the grouped resources this resource belongs to (e.g. 'all')", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "storageVersionHash": { + SchemaProps: spec.SchemaProps{ + Description: "The hash value of the storage version, the version this resource is converted to when written to the data store. Value must be treated as opaque by clients. Only equality comparison on the value is valid. This is an alpha feature and may change or be removed in the future. The field is populated by the apiserver only if the StorageVersionHash feature gate is enabled. This field will remain optional even if it graduates.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"name", "singularName", "namespaced", "kind", "verbs"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_APIResourceList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "APIResourceList is a list of APIResource, it is used to expose the name of the resources supported in a specific group and version, and if the resource is namespaced.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "groupVersion": { + SchemaProps: spec.SchemaProps{ + Description: "groupVersion is the group and version this APIResourceList is for.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "resources": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "resources contains the name of the resources and if they are namespaced.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.APIResource"), + }, + }, + }, + }, + }, + }, + Required: []string{"groupVersion", "resources"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.APIResource"}, + } +} + +func schema_pkg_apis_meta_v1_APIVersions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "APIVersions lists the versions that are available, to allow clients to discover the API at /api, which is the root path of the legacy v1 API.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "versions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "versions are the api versions that are available.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "serverAddressByClientCIDRs": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "a map of client CIDR to server address that is serving this group. This is to help clients reach servers in the most network-efficient way possible. Clients can use the appropriate server address as per the CIDR that they match. In case of multiple matches, clients should use the longest matching CIDR. The server returns only those CIDRs that it thinks that the client can match. For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP. Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR"), + }, + }, + }, + }, + }, + }, + Required: []string{"versions", "serverAddressByClientCIDRs"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR"}, + } +} + +func schema_pkg_apis_meta_v1_ApplyOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ApplyOptions may be provided when applying an API object. FieldManager is required for apply requests. ApplyOptions is equivalent to PatchOptions. It is provided as a convenience with documentation that speaks specifically to how the options fields relate to apply.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "dryRun": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "force": { + SchemaProps: spec.SchemaProps{ + Description: "Force is going to \"force\" Apply requests. It means user will re-acquire conflicting fields owned by other people.", + Default: false, + Type: []string{"boolean"}, + Format: "", + }, + }, + "fieldManager": { + SchemaProps: spec.SchemaProps{ + Description: "fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"force", "fieldManager"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_Condition(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Condition contains details for one aspect of the current state of this API Resource.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Description: "type of condition in CamelCase or in foo.example.com/CamelCase.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "status of the condition, one of True, False, Unknown.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "observedGeneration": { + SchemaProps: spec.SchemaProps{ + Description: "observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "lastTransitionTime": { + SchemaProps: spec.SchemaProps{ + Description: "lastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "reason": { + SchemaProps: spec.SchemaProps{ + Description: "reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "message is a human readable message indicating details about the transition. This may be an empty string.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"type", "status", "lastTransitionTime", "reason", "message"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + } +} + +func schema_pkg_apis_meta_v1_CreateOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "CreateOptions may be provided when creating an API object.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "dryRun": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "fieldManager": { + SchemaProps: spec.SchemaProps{ + Description: "fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.", + Type: []string{"string"}, + Format: "", + }, + }, + "fieldValidation": { + SchemaProps: spec.SchemaProps{ + Description: "fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_DeleteOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "DeleteOptions may be provided when deleting an API object.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "gracePeriodSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "preconditions": { + SchemaProps: spec.SchemaProps{ + Description: "Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Preconditions"), + }, + }, + "orphanDependents": { + SchemaProps: spec.SchemaProps{ + Description: "Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "propagationPolicy": { + SchemaProps: spec.SchemaProps{ + Description: "Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground.", + Type: []string{"string"}, + Format: "", + }, + }, + "dryRun": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Preconditions"}, + } +} + +func schema_pkg_apis_meta_v1_Duration(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Duration is a wrapper around time.Duration which supports correct marshaling to YAML and JSON. In particular, it marshals into strings, which can be used as map keys in json.", + Type: v1.Duration{}.OpenAPISchemaType(), + Format: v1.Duration{}.OpenAPISchemaFormat(), + }, + }, + } +} + +func schema_pkg_apis_meta_v1_FieldSelectorRequirement(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "FieldSelectorRequirement is a selector that contains values, a key, and an operator that relates the key and values.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "key": { + SchemaProps: spec.SchemaProps{ + Description: "key is the field selector key that the requirement applies to.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "operator": { + SchemaProps: spec.SchemaProps{ + Description: "operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. The list of operators may grow in the future.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "values": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"key", "operator"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_FieldsV1(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "FieldsV1 stores a set of fields in a data structure like a Trie, in JSON format.\n\nEach key is either a '.' representing the field itself, and will always map to an empty set, or a string representing a sub-field or item. The string will follow one of these four formats: 'f:', where is the name of a field in a struct, or key in a map 'v:', where is the exact json formatted value of a list item 'i:', where is position of a item in a list 'k:', where is a map of a list item's key fields to their unique values If a key maps to an empty Fields value, the field that key represents is part of the set.\n\nThe exact format is defined in sigs.k8s.io/structured-merge-diff", + Type: []string{"object"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_GetOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GetOptions is the standard query options to the standard REST get call.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "resourceVersion": { + SchemaProps: spec.SchemaProps{ + Description: "resourceVersion sets a constraint on what resource versions a request may be served from. See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details.\n\nDefaults to unset", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_GroupKind(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GroupKind specifies a Group and a Kind, but does not force a version. This is useful for identifying concepts during lookup stages without having partially valid types", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "group": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"group", "kind"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_GroupResource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GroupResource specifies a Group and a Resource, but does not force a version. This is useful for identifying concepts during lookup stages without having partially valid types", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "group": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "resource": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"group", "resource"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_GroupVersion(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GroupVersion contains the \"group\" and the \"version\", which uniquely identifies the API.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "group": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"group", "version"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_GroupVersionForDiscovery(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GroupVersion contains the \"group/version\" and \"version\" string of a version. It is made a struct to keep extensibility.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "groupVersion": { + SchemaProps: spec.SchemaProps{ + Description: "groupVersion specifies the API group and version in the form \"group/version\"", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Description: "version specifies the version in the form of \"version\". This is to save the clients the trouble of splitting the GroupVersion.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"groupVersion", "version"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_GroupVersionKind(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GroupVersionKind unambiguously identifies a kind. It doesn't anonymously include GroupVersion to avoid automatic coercion. It doesn't use a GroupVersion to avoid custom marshalling", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "group": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"group", "version", "kind"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_GroupVersionResource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GroupVersionResource unambiguously identifies a resource. It doesn't anonymously include GroupVersion to avoid automatic coercion. It doesn't use a GroupVersion to avoid custom marshalling", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "group": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "resource": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"group", "version", "resource"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_InternalEvent(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "InternalEvent makes watch.Event versioned", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "Type": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "Object": { + SchemaProps: spec.SchemaProps{ + Description: "Object is:\n * If Type is Added or Modified: the new state of the object.\n * If Type is Deleted: the state of the object immediately before deletion.\n * If Type is Bookmark: the object (instance of a type being watched) where\n only ResourceVersion field is set. On successful restart of watch from a\n bookmark resourceVersion, client is guaranteed to not get repeat event\n nor miss any events.\n * If Type is Error: *api.Status is recommended; other types may make sense\n depending on context.", + Ref: ref("k8s.io/apimachinery/pkg/runtime.Object"), + }, + }, + }, + Required: []string{"Type", "Object"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/runtime.Object"}, + } +} + +func schema_pkg_apis_meta_v1_LabelSelector(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "matchLabels": { + SchemaProps: spec.SchemaProps{ + Description: "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "matchExpressions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "matchExpressions is a list of label selector requirements. The requirements are ANDed.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelectorRequirement"), + }, + }, + }, + }, + }, + }, + }, + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-map-type": "atomic", + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelectorRequirement"}, + } +} + +func schema_pkg_apis_meta_v1_LabelSelectorRequirement(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "key": { + SchemaProps: spec.SchemaProps{ + Description: "key is the label key that the selector applies to.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "operator": { + SchemaProps: spec.SchemaProps{ + Description: "operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "values": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"key", "operator"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_List(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "List holds a list of objects, which may not be known by the server.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "List of objects", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "k8s.io/apimachinery/pkg/runtime.RawExtension"}, + } +} + +func schema_pkg_apis_meta_v1_ListMeta(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "selfLink": { + SchemaProps: spec.SchemaProps{ + Description: "Deprecated: selfLink is a legacy read-only field that is no longer populated by the system.", + Type: []string{"string"}, + Format: "", + }, + }, + "resourceVersion": { + SchemaProps: spec.SchemaProps{ + Description: "String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency", + Type: []string{"string"}, + Format: "", + }, + }, + "continue": { + SchemaProps: spec.SchemaProps{ + Description: "continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a consistent list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response, unless you have received this token from an error message.", + Type: []string{"string"}, + Format: "", + }, + }, + "remainingItemCount": { + SchemaProps: spec.SchemaProps{ + Description: "remainingItemCount is the number of subsequent items in the list which are not included in this list response. If the list request contained label or field selectors, then the number of remaining items is unknown and the field will be left unset and omitted during serialization. If the list is complete (either because it is not chunking or because this is the last chunk), then there are no more remaining items and this field will be left unset and omitted during serialization. Servers older than v1.15 do not set this field. The intended use of the remainingItemCount is *estimating* the size of a collection. Clients should not rely on the remainingItemCount to be set or to be exact.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_ListOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ListOptions is the query options to a standard REST list call.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "labelSelector": { + SchemaProps: spec.SchemaProps{ + Description: "A selector to restrict the list of returned objects by their labels. Defaults to everything.", + Type: []string{"string"}, + Format: "", + }, + }, + "fieldSelector": { + SchemaProps: spec.SchemaProps{ + Description: "A selector to restrict the list of returned objects by their fields. Defaults to everything.", + Type: []string{"string"}, + Format: "", + }, + }, + "watch": { + SchemaProps: spec.SchemaProps{ + Description: "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "allowWatchBookmarks": { + SchemaProps: spec.SchemaProps{ + Description: "allowWatchBookmarks requests watch events with type \"BOOKMARK\". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "resourceVersion": { + SchemaProps: spec.SchemaProps{ + Description: "resourceVersion sets a constraint on what resource versions a request may be served from. See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details.\n\nDefaults to unset", + Type: []string{"string"}, + Format: "", + }, + }, + "resourceVersionMatch": { + SchemaProps: spec.SchemaProps{ + Description: "resourceVersionMatch determines how resourceVersion is applied to list calls. It is highly recommended that resourceVersionMatch be set for list calls where resourceVersion is set See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details.\n\nDefaults to unset", + Type: []string{"string"}, + Format: "", + }, + }, + "timeoutSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "limit": { + SchemaProps: spec.SchemaProps{ + Description: "limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.\n\nThe server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "continue": { + SchemaProps: spec.SchemaProps{ + Description: "The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\".\n\nThis field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.", + Type: []string{"string"}, + Format: "", + }, + }, + "sendInitialEvents": { + SchemaProps: spec.SchemaProps{ + Description: "`sendInitialEvents=true` may be set together with `watch=true`. In that case, the watch stream will begin with synthetic events to produce the current state of objects in the collection. Once all such events have been sent, a synthetic \"Bookmark\" event will be sent. The bookmark will report the ResourceVersion (RV) corresponding to the set of objects, and be marked with `\"k8s.io/initial-events-end\": \"true\"` annotation. Afterwards, the watch stream will proceed as usual, sending watch events corresponding to changes (subsequent to the RV) to objects watched.\n\nWhen `sendInitialEvents` option is set, we require `resourceVersionMatch` option to also be set. The semantic of the watch request is as following: - `resourceVersionMatch` = NotOlderThan\n is interpreted as \"data at least as new as the provided `resourceVersion`\"\n and the bookmark event is send when the state is synced\n to a `resourceVersion` at least as fresh as the one provided by the ListOptions.\n If `resourceVersion` is unset, this is interpreted as \"consistent read\" and the\n bookmark event is send when the state is synced at least to the moment\n when request started being processed.\n- `resourceVersionMatch` set to any other value or unset\n Invalid error is returned.\n\nDefaults to true if `resourceVersion=\"\"` or `resourceVersion=\"0\"` (for backward compatibility reasons) and to false otherwise.", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_ManagedFieldsEntry(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ManagedFieldsEntry is a workflow-id, a FieldSet and the group version of the resource that the fieldset applies to.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "manager": { + SchemaProps: spec.SchemaProps{ + Description: "Manager is an identifier of the workflow managing these fields.", + Type: []string{"string"}, + Format: "", + }, + }, + "operation": { + SchemaProps: spec.SchemaProps{ + Description: "Operation is the type of operation which lead to this ManagedFieldsEntry being created. The only valid values for this field are 'Apply' and 'Update'.", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the version of this resource that this field set applies to. The format is \"group/version\" just like the top-level APIVersion field. It is necessary to track the version of a field set because it cannot be automatically converted.", + Type: []string{"string"}, + Format: "", + }, + }, + "time": { + SchemaProps: spec.SchemaProps{ + Description: "Time is the timestamp of when the ManagedFields entry was added. The timestamp will also be updated if a field is added, the manager changes any of the owned fields value or removes a field. The timestamp does not update when a field is removed from the entry because another manager took it over.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "fieldsType": { + SchemaProps: spec.SchemaProps{ + Description: "FieldsType is the discriminator for the different fields format and version. There is currently only one possible value: \"FieldsV1\"", + Type: []string{"string"}, + Format: "", + }, + }, + "fieldsV1": { + SchemaProps: spec.SchemaProps{ + Description: "FieldsV1 holds the first JSON version format as described in the \"FieldsV1\" type.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.FieldsV1"), + }, + }, + "subresource": { + SchemaProps: spec.SchemaProps{ + Description: "Subresource is the name of the subresource used to update that object, or empty string if the object was updated through the main resource. The value of this field is used to distinguish between managers, even if they share the same name. For example, a status update will be distinct from a regular update using the same manager name. Note that the APIVersion field is not related to the Subresource field and it always corresponds to the version of the main resource.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.FieldsV1", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + } +} + +func schema_pkg_apis_meta_v1_MicroTime(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MicroTime is version of Time with microsecond level precision.", + Type: v1.MicroTime{}.OpenAPISchemaType(), + Format: v1.MicroTime{}.OpenAPISchemaFormat(), + }, + }, + } +} + +func schema_pkg_apis_meta_v1_ObjectMeta(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names", + Type: []string{"string"}, + Format: "", + }, + }, + "generateName": { + SchemaProps: spec.SchemaProps{ + Description: "GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.\n\nIf this field is specified and the generated name exists, the server will return a 409.\n\nApplied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency", + Type: []string{"string"}, + Format: "", + }, + }, + "namespace": { + SchemaProps: spec.SchemaProps{ + Description: "Namespace defines the space within which each name must be unique. An empty namespace is equivalent to the \"default\" namespace, but \"default\" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty.\n\nMust be a DNS_LABEL. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces", + Type: []string{"string"}, + Format: "", + }, + }, + "selfLink": { + SchemaProps: spec.SchemaProps{ + Description: "Deprecated: selfLink is a legacy read-only field that is no longer populated by the system.", + Type: []string{"string"}, + Format: "", + }, + }, + "uid": { + SchemaProps: spec.SchemaProps{ + Description: "UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations.\n\nPopulated by the system. Read-only. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids", + Type: []string{"string"}, + Format: "", + }, + }, + "resourceVersion": { + SchemaProps: spec.SchemaProps{ + Description: "An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.\n\nPopulated by the system. Read-only. Value must be treated as opaque by clients and . More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency", + Type: []string{"string"}, + Format: "", + }, + }, + "generation": { + SchemaProps: spec.SchemaProps{ + Description: "A sequence number representing a specific generation of the desired state. Populated by the system. Read-only.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "creationTimestamp": { + SchemaProps: spec.SchemaProps{ + Description: "CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.\n\nPopulated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "deletionTimestamp": { + SchemaProps: spec.SchemaProps{ + Description: "DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This field is set by the server when a graceful deletion is requested by the user, and is not directly settable by a client. The resource is expected to be deleted (no longer visible from resource lists, and not reachable by name) after the time in this field, once the finalizers list is empty. As long as the finalizers list contains items, deletion is blocked. Once the deletionTimestamp is set, this value may not be unset or be set further into the future, although it may be shortened or the resource may be deleted prior to this time. For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react by sending a graceful termination signal to the containers in the pod. After that 30 seconds, the Kubelet will send a hard termination signal (SIGKILL) to the container and after cleanup, remove the pod from the API. In the presence of network partitions, this object may still exist after this timestamp, until an administrator or automated process can determine the resource is fully terminated. If not set, graceful deletion of the object has not been requested.\n\nPopulated by the system when a graceful deletion is requested. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "deletionGracePeriodSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "annotations": { + SchemaProps: spec.SchemaProps{ + Description: "Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "ownerReferences": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "uid", + }, + "x-kubernetes-list-type": "map", + "x-kubernetes-patch-merge-key": "uid", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.OwnerReference"), + }, + }, + }, + }, + }, + "finalizers": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "set", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed. Finalizers may be processed and removed in any order. Order is NOT enforced because it introduces significant risk of stuck finalizers. finalizers is a shared field, any actor with permission can reorder it. If the finalizer list is processed in order, then this can lead to a situation in which the component responsible for the first finalizer in the list is waiting for a signal (field value, external system, or other) produced by a component responsible for a finalizer later in the list, resulting in a deadlock. Without enforced ordering finalizers are free to order amongst themselves and are not vulnerable to ordering changes in the list.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "managedFields": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "ManagedFields maps workflow-id and version to the set of fields that are managed by that workflow. This is mostly for internal housekeeping, and users typically shouldn't need to set or understand this field. A workflow can be the user's name, a controller's name, or the name of a specific apply path like \"ci-cd\". The set of fields is always in the version that the workflow used when modifying the object.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ManagedFieldsEntry"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ManagedFieldsEntry", "k8s.io/apimachinery/pkg/apis/meta/v1.OwnerReference", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + } +} + +func schema_pkg_apis_meta_v1_OwnerReference(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "OwnerReference contains enough information to let you identify an owning object. An owning object must be in the same namespace as the dependent, or be cluster-scoped, so there is no namespace field.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "API version of the referent.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "uid": { + SchemaProps: spec.SchemaProps{ + Description: "UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "controller": { + SchemaProps: spec.SchemaProps{ + Description: "If true, this reference points to the managing controller.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "blockOwnerDeletion": { + SchemaProps: spec.SchemaProps{ + Description: "If true, AND if the owner has the \"foregroundDeletion\" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. See https://kubernetes.io/docs/concepts/architecture/garbage-collection/#foreground-deletion for how the garbage collector interacts with this field and enforces the foreground deletion. Defaults to false. To set this field, a user needs \"delete\" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned.", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"apiVersion", "kind", "name", "uid"}, + }, + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-map-type": "atomic", + }, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_PartialObjectMetadata(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PartialObjectMetadata is a generic representation of any object with ObjectMeta. It allows clients to get access to a particular ObjectMeta schema without knowing the details of the version.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_meta_v1_PartialObjectMetadataList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PartialObjectMetadataList contains a list of objects containing only their metadata", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "items contains each of the included items.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.PartialObjectMetadata"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "k8s.io/apimachinery/pkg/apis/meta/v1.PartialObjectMetadata"}, + } +} + +func schema_pkg_apis_meta_v1_Patch(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Patch is provided to give a concrete name and type to the Kubernetes PATCH request body.", + Type: []string{"object"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_PatchOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PatchOptions may be provided when patching an API object. PatchOptions is meant to be a superset of UpdateOptions.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "dryRun": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "force": { + SchemaProps: spec.SchemaProps{ + Description: "Force is going to \"force\" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "fieldManager": { + SchemaProps: spec.SchemaProps{ + Description: "fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch).", + Type: []string{"string"}, + Format: "", + }, + }, + "fieldValidation": { + SchemaProps: spec.SchemaProps{ + Description: "fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_Preconditions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Preconditions must be fulfilled before an operation (update, delete, etc.) is carried out.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "uid": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies the target UID.", + Type: []string{"string"}, + Format: "", + }, + }, + "resourceVersion": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies the target ResourceVersion", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_RootPaths(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RootPaths lists the paths available at root. For example: \"/healthz\", \"/apis\".", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "paths": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "paths are the paths available at root.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"paths"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_ServerAddressByClientCIDR(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ServerAddressByClientCIDR helps the client to determine the server address that they should use, depending on the clientCIDR that they match.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "clientCIDR": { + SchemaProps: spec.SchemaProps{ + Description: "The CIDR with which clients can match their IP to figure out the server address that they should use.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "serverAddress": { + SchemaProps: spec.SchemaProps{ + Description: "Address of this server, suitable for a client that matches the above CIDR. This can be a hostname, hostname:port, IP or IP:port.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"clientCIDR", "serverAddress"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_Status(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Status is a return value for calls that don't return other objects.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Status of the operation. One of: \"Success\" or \"Failure\". More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "A human-readable description of the status of this operation.", + Type: []string{"string"}, + Format: "", + }, + }, + "reason": { + SchemaProps: spec.SchemaProps{ + Description: "A machine-readable description of why this operation is in the \"Failure\" status. If this value is empty there is no information available. A Reason clarifies an HTTP status code but does not override it.", + Type: []string{"string"}, + Format: "", + }, + }, + "details": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "Extended data associated with the reason. Each reason may define its own extended details. This field is optional and the data returned is not guaranteed to conform to any schema except that defined by the reason type.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.StatusDetails"), + }, + }, + "code": { + SchemaProps: spec.SchemaProps{ + Description: "Suggested HTTP return code for this status, 0 if not set.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "k8s.io/apimachinery/pkg/apis/meta/v1.StatusDetails"}, + } +} + +func schema_pkg_apis_meta_v1_StatusCause(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "StatusCause provides more information about an api.Status failure, including cases when multiple errors are encountered.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "reason": { + SchemaProps: spec.SchemaProps{ + Description: "A machine-readable description of the cause of the error. If this value is empty there is no information available.", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "A human-readable description of the cause of the error. This field may be presented as-is to a reader.", + Type: []string{"string"}, + Format: "", + }, + }, + "field": { + SchemaProps: spec.SchemaProps{ + Description: "The field of the resource that has caused this error, as named by its JSON serialization. May include dot and postfix notation for nested attributes. Arrays are zero-indexed. Fields may appear more than once in an array of causes due to fields having multiple errors. Optional.\n\nExamples:\n \"name\" - the field \"name\" on the current resource\n \"items[0].name\" - the field \"name\" on the first array entry in \"items\"", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_StatusDetails(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "StatusDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).", + Type: []string{"string"}, + Format: "", + }, + }, + "group": { + SchemaProps: spec.SchemaProps{ + Description: "The group attribute of the resource associated with the status StatusReason.", + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "uid": { + SchemaProps: spec.SchemaProps{ + Description: "UID of the resource. (when there is a single resource which can be described). More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids", + Type: []string{"string"}, + Format: "", + }, + }, + "causes": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.StatusCause"), + }, + }, + }, + }, + }, + "retryAfterSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "If specified, the time in seconds before the operation should be retried. Some errors may indicate the client must take an alternate action - for those errors this field may indicate how long to wait before taking the alternate action.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.StatusCause"}, + } +} + +func schema_pkg_apis_meta_v1_Table(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Table is a tabular representation of a set of API resources. The server transforms the object into a set of preferred columns for quickly reviewing the objects.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "columnDefinitions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "columnDefinitions describes each column in the returned items array. The number of cells per row will always match the number of column definitions.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.TableColumnDefinition"), + }, + }, + }, + }, + }, + "rows": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "rows is the list of items in the table.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.TableRow"), + }, + }, + }, + }, + }, + }, + Required: []string{"columnDefinitions", "rows"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "k8s.io/apimachinery/pkg/apis/meta/v1.TableColumnDefinition", "k8s.io/apimachinery/pkg/apis/meta/v1.TableRow"}, + } +} + +func schema_pkg_apis_meta_v1_TableColumnDefinition(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TableColumnDefinition contains information about a column returned in the Table.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "name is a human readable name for the column.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "type": { + SchemaProps: spec.SchemaProps{ + Description: "type is an OpenAPI type definition for this column, such as number, integer, string, or array. See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "format": { + SchemaProps: spec.SchemaProps{ + Description: "format is an optional OpenAPI type modifier for this column. A format modifies the type and imposes additional rules, like date or time formatting for a string. The 'name' format is applied to the primary identifier column which has type 'string' to assist in clients identifying column is the resource name. See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "description": { + SchemaProps: spec.SchemaProps{ + Description: "description is a human readable description of this column.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "priority": { + SchemaProps: spec.SchemaProps{ + Description: "priority is an integer defining the relative importance of this column compared to others. Lower numbers are considered higher priority. Columns that may be omitted in limited space scenarios should be given a higher priority.", + Default: 0, + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + Required: []string{"name", "type", "format", "description", "priority"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_TableOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TableOptions are used when a Table is requested by the caller.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "includeObject": { + SchemaProps: spec.SchemaProps{ + Description: "includeObject decides whether to include each object along with its columnar information. Specifying \"None\" will return no object, specifying \"Object\" will return the full object contents, and specifying \"Metadata\" (the default) will return the object's metadata in the PartialObjectMetadata kind in version v1beta1 of the meta.k8s.io API group.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_TableRow(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TableRow is an individual row in a table.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "cells": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "cells will be as wide as the column definitions array and may contain strings, numbers (float64 or int64), booleans, simple maps, lists, or null. See the type field of the column definition for a more detailed description.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Format: "", + }, + }, + }, + }, + }, + "conditions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "conditions describe additional status of a row that are relevant for a human user. These conditions apply to the row, not to the object, and will be specific to table output. The only defined condition type is 'Completed', for a row that indicates a resource that has run to completion and can be given less visual priority.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.TableRowCondition"), + }, + }, + }, + }, + }, + "object": { + SchemaProps: spec.SchemaProps{ + Description: "This field contains the requested additional information about each object based on the includeObject policy when requesting the Table. If \"None\", this field is empty, if \"Object\" this will be the default serialization of the object for the current API version, and if \"Metadata\" (the default) will contain the object metadata. Check the returned kind and apiVersion of the object before parsing. The media type of the object will always match the enclosing list - if this as a JSON table, these will be JSON encoded objects.", + Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), + }, + }, + }, + Required: []string{"cells"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.TableRowCondition", "k8s.io/apimachinery/pkg/runtime.RawExtension"}, + } +} + +func schema_pkg_apis_meta_v1_TableRowCondition(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TableRowCondition allows a row to be marked with additional information.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Type of row condition. The only defined value is 'Completed' indicating that the object this row represents has reached a completed state and may be given less visual priority than other rows. Clients are not required to honor any conditions but should be consistent where possible about handling the conditions.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Status of the condition, one of True, False, Unknown.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "reason": { + SchemaProps: spec.SchemaProps{ + Description: "(brief) machine readable reason for the condition's last transition.", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "Human readable message indicating details about last transition.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"type", "status"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_Time(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.", + Type: v1.Time{}.OpenAPISchemaType(), + Format: v1.Time{}.OpenAPISchemaFormat(), + }, + }, + } +} + +func schema_pkg_apis_meta_v1_Timestamp(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Timestamp is a struct that is equivalent to Time, but intended for protobuf marshalling/unmarshalling. It is generated into a serialization that matches Time. Do not use in Go structs.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "seconds": { + SchemaProps: spec.SchemaProps{ + Description: "Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.", + Default: 0, + Type: []string{"integer"}, + Format: "int64", + }, + }, + "nanos": { + SchemaProps: spec.SchemaProps{ + Description: "Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive. This field may be limited in precision depending on context.", + Default: 0, + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + Required: []string{"seconds", "nanos"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_TypeMeta(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TypeMeta describes an individual object in an API response or request with strings representing the type of the object and its API schema version. Structures that are versioned or persisted should inline TypeMeta.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_UpdateOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "UpdateOptions may be provided when updating an API object. All fields in UpdateOptions should also be present in PatchOptions.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "dryRun": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "fieldManager": { + SchemaProps: spec.SchemaProps{ + Description: "fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.", + Type: []string{"string"}, + Format: "", + }, + }, + "fieldValidation": { + SchemaProps: spec.SchemaProps{ + Description: "fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_WatchEvent(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Event represents a single event to a watched resource.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "object": { + SchemaProps: spec.SchemaProps{ + Description: "Object is:\n * If Type is Added or Modified: the new state of the object.\n * If Type is Deleted: the state of the object immediately before deletion.\n * If Type is Error: *Status is recommended; other types may make sense\n depending on context.", + Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), + }, + }, + }, + Required: []string{"type", "object"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/runtime.RawExtension"}, + } +} + +func schema_k8sio_apimachinery_pkg_runtime_RawExtension(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RawExtension is used to hold extensions in external versions.\n\nTo use this, make a field which has RawExtension as its type in your external, versioned struct, and Object in your internal struct. You also need to register your various plugin types.\n\n// Internal package:\n\n\ttype MyAPIObject struct {\n\t\truntime.TypeMeta `json:\",inline\"`\n\t\tMyPlugin runtime.Object `json:\"myPlugin\"`\n\t}\n\n\ttype PluginA struct {\n\t\tAOption string `json:\"aOption\"`\n\t}\n\n// External package:\n\n\ttype MyAPIObject struct {\n\t\truntime.TypeMeta `json:\",inline\"`\n\t\tMyPlugin runtime.RawExtension `json:\"myPlugin\"`\n\t}\n\n\ttype PluginA struct {\n\t\tAOption string `json:\"aOption\"`\n\t}\n\n// On the wire, the JSON will look something like this:\n\n\t{\n\t\t\"kind\":\"MyAPIObject\",\n\t\t\"apiVersion\":\"v1\",\n\t\t\"myPlugin\": {\n\t\t\t\"kind\":\"PluginA\",\n\t\t\t\"aOption\":\"foo\",\n\t\t},\n\t}\n\nSo what happens? Decode first uses json or yaml to unmarshal the serialized data into your external MyAPIObject. That causes the raw JSON to be stored, but not unpacked. The next step is to copy (using pkg/conversion) into the internal struct. The runtime package's DefaultScheme has conversion functions installed which will unpack the JSON stored in RawExtension, turning it into the correct object type, and storing it in the Object. (TODO: In the case where the object is of an unknown type, a runtime.Unknown object will be created and stored.)", + Type: []string{"object"}, + }, + }, + } +} + +func schema_k8sio_apimachinery_pkg_runtime_TypeMeta(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TypeMeta is shared by all top level objects. The proper way to use it is to inline it in your type, like this:\n\n\ttype MyAwesomeAPIObject struct {\n\t runtime.TypeMeta `json:\",inline\"`\n\t ... // other fields\n\t}\n\nfunc (obj *MyAwesomeAPIObject) SetGroupVersionKind(gvk *metav1.GroupVersionKind) { metav1.UpdateTypeMeta(obj,gvk) }; GroupVersionKind() *GroupVersionKind\n\nTypeMeta is provided here for convenience. You may use it directly from this package or define your own with the same fields.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_k8sio_apimachinery_pkg_runtime_Unknown(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Unknown allows api objects with unknown types to be passed-through. This can be used to deal with the API objects from a plug-in. Unknown objects still have functioning TypeMeta features-- kind, version, etc. metadata and field mutatation.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "ContentEncoding": { + SchemaProps: spec.SchemaProps{ + Description: "ContentEncoding is encoding used to encode 'Raw' data. Unspecified means no encoding.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "ContentType": { + SchemaProps: spec.SchemaProps{ + Description: "ContentType is serialization method used to serialize 'Raw'. Unspecified means ContentTypeJSON.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"ContentEncoding", "ContentType"}, + }, + }, + } +} + +func schema_k8sio_apimachinery_pkg_version_Info(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Info contains versioning information. how we'll want to distribute that information.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "major": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "minor": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "gitVersion": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "gitCommit": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "gitTreeState": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "buildDate": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "goVersion": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "compiler": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "platform": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"major", "minor", "gitVersion", "gitCommit", "gitTreeState", "buildDate", "goVersion", "compiler", "platform"}, + }, + }, + } +} diff --git a/pkg/kuidserver/claimserver/apistore.go b/pkg/kuidserver/claimserver/apistore.go index 25e436b..c439481 100644 --- a/pkg/kuidserver/claimserver/apistore.go +++ b/pkg/kuidserver/claimserver/apistore.go @@ -16,6 +16,8 @@ limitations under the License. package claimserver +/* + import ( "context" @@ -24,7 +26,7 @@ import ( "github.com/henderiw/apiserver-store/pkg/generic/registry" "github.com/henderiw/apiserver-store/pkg/storebackend" "github.com/kuidio/kuid/apis/backend" - bebackend "github.com/kuidio/kuid/pkg/backend/backend" + bebackend "github.com/kuidio/kuid/pkg/backend" "github.com/kuidio/kuid/pkg/kuidserver/store" "go.opentelemetry.io/otel" "k8s.io/apimachinery/pkg/runtime" @@ -108,3 +110,4 @@ func NewREST(ctx context.Context, scheme *runtime.Scheme, optsGetter generic.RES } return store, nil } +*/ \ No newline at end of file diff --git a/pkg/kuidserver/claimserver/fieldselector.go b/pkg/kuidserver/claimserver/fieldselector.go index eb5baaf..bdf675d 100644 --- a/pkg/kuidserver/claimserver/fieldselector.go +++ b/pkg/kuidserver/claimserver/fieldselector.go @@ -16,6 +16,8 @@ limitations under the License. package claimserver +/* + import ( "context" "fmt" @@ -84,3 +86,4 @@ func parseFieldSelector(ctx context.Context, fieldSelector fields.Selector) (*Fi return filter, nil } +*/ \ No newline at end of file diff --git a/pkg/kuidserver/claimserver/strategy.go b/pkg/kuidserver/claimserver/strategy.go index e700f42..4c55b7a 100644 --- a/pkg/kuidserver/claimserver/strategy.go +++ b/pkg/kuidserver/claimserver/strategy.go @@ -16,6 +16,8 @@ limitations under the License. package claimserver +/* + import ( "context" "fmt" @@ -25,7 +27,7 @@ import ( "github.com/henderiw/apiserver-store/pkg/storebackend" "github.com/henderiw/logger/log" "github.com/kuidio/kuid/apis/backend" - bebackend "github.com/kuidio/kuid/pkg/backend/backend" + bebackend "github.com/kuidio/kuid/pkg/backend" watchermanager "github.com/kuidio/kuid/pkg/kuidserver/watcher-manager" "k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/labels" @@ -112,3 +114,4 @@ func (r *strategy) notifyWatcher(ctx context.Context, event watch.Event) { r.watcherManager.WatchChan() <- event } +*/ \ No newline at end of file diff --git a/pkg/kuidserver/claimserver/strategy_create.go b/pkg/kuidserver/claimserver/strategy_create.go index 91ee224..b3e4da3 100644 --- a/pkg/kuidserver/claimserver/strategy_create.go +++ b/pkg/kuidserver/claimserver/strategy_create.go @@ -16,6 +16,8 @@ limitations under the License. package claimserver +/* + import ( "context" "fmt" @@ -86,3 +88,4 @@ func (r *strategy) Create(ctx context.Context, key types.NamespacedName, obj run func (r *strategy) WarningsOnCreate(ctx context.Context, obj runtime.Object) []string { return nil } +*/ \ No newline at end of file diff --git a/pkg/kuidserver/claimserver/strategy_delete.go b/pkg/kuidserver/claimserver/strategy_delete.go index 8fea964..94b9496 100644 --- a/pkg/kuidserver/claimserver/strategy_delete.go +++ b/pkg/kuidserver/claimserver/strategy_delete.go @@ -16,6 +16,8 @@ limitations under the License. package claimserver +/* + import ( "context" @@ -42,3 +44,4 @@ func (r *strategy) Delete(ctx context.Context, key types.NamespacedName, obj run }) return obj, nil } +*/ \ No newline at end of file diff --git a/pkg/kuidserver/claimserver/strategy_get.go b/pkg/kuidserver/claimserver/strategy_get.go index b654d6c..84d20b0 100644 --- a/pkg/kuidserver/claimserver/strategy_get.go +++ b/pkg/kuidserver/claimserver/strategy_get.go @@ -16,6 +16,8 @@ limitations under the License. package claimserver +/* + import ( "context" @@ -32,3 +34,4 @@ func (r *strategy) Get(ctx context.Context, key types.NamespacedName) (runtime.O } return obj, nil } +*/ \ No newline at end of file diff --git a/pkg/kuidserver/claimserver/strategy_list.go b/pkg/kuidserver/claimserver/strategy_list.go index 23f6d3a..e694b8b 100644 --- a/pkg/kuidserver/claimserver/strategy_list.go +++ b/pkg/kuidserver/claimserver/strategy_list.go @@ -16,6 +16,8 @@ limitations under the License. package claimserver +/* + import ( "context" "fmt" @@ -119,3 +121,4 @@ func getListPrt(listObj runtime.Object) (reflect.Value, error) { func appendItem(v reflect.Value, obj runtime.Object) { v.Set(reflect.Append(v, reflect.ValueOf(obj).Elem())) } +*/ \ No newline at end of file diff --git a/pkg/kuidserver/claimserver/strategy_update.go b/pkg/kuidserver/claimserver/strategy_update.go index 8cc31e5..ad6824e 100644 --- a/pkg/kuidserver/claimserver/strategy_update.go +++ b/pkg/kuidserver/claimserver/strategy_update.go @@ -16,6 +16,8 @@ limitations under the License. package claimserver +/* + import ( "context" "encoding/hex" @@ -134,3 +136,4 @@ func updateResourceVersion(_ context.Context, obj, old runtime.Object) error { accessorNew.SetResourceVersion(strconv.Itoa(resourceVersion)) return nil } +*/ \ No newline at end of file diff --git a/pkg/kuidserver/claimserver/strategy_watch.go b/pkg/kuidserver/claimserver/strategy_watch.go index 19be945..b6e72a0 100644 --- a/pkg/kuidserver/claimserver/strategy_watch.go +++ b/pkg/kuidserver/claimserver/strategy_watch.go @@ -16,6 +16,8 @@ limitations under the License. package claimserver +/* + import ( "context" @@ -39,3 +41,4 @@ func (r *strategy) Watch(ctx context.Context, options *metainternalversion.ListO return w, nil } +*/ \ No newline at end of file diff --git a/pkg/kuidserver/claimserver/table.go b/pkg/kuidserver/claimserver/table.go index efca902..f4df0fe 100644 --- a/pkg/kuidserver/claimserver/table.go +++ b/pkg/kuidserver/claimserver/table.go @@ -16,13 +16,15 @@ limitations under the License. package claimserver +/* + import ( "github.com/henderiw/apiserver-store/pkg/generic/registry" "github.com/kuidio/kuid/apis/backend" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" ) func DefaultTableConvertor(gr schema.GroupResource) registry.TableConvertor { @@ -35,7 +37,7 @@ func DefaultTableConvertor(gr schema.GroupResource) registry.TableConvertor { } return []interface{}{ claim.GetName(), - claim.GetCondition(conditionv1alpha1.ConditionTypeReady).Status, + claim.GetCondition(condv1alpha1.ConditionTypeReady).Status, claim.GetIndex(), string(claim.GetClaimType()), claim.GetClaimRequest(), @@ -52,3 +54,4 @@ func DefaultTableConvertor(gr schema.GroupResource) registry.TableConvertor { }, } } +*/ \ No newline at end of file diff --git a/pkg/kuidserver/claimserver/watcher.go b/pkg/kuidserver/claimserver/watcher.go index ebc9442..e7c8c81 100644 --- a/pkg/kuidserver/claimserver/watcher.go +++ b/pkg/kuidserver/claimserver/watcher.go @@ -16,6 +16,8 @@ limitations under the License. package claimserver +/* + import ( "context" "fmt" @@ -218,3 +220,4 @@ func (r *watcher) setDone() { defer r.m.Unlock() r.done = true } +*/ \ No newline at end of file diff --git a/pkg/kuidserver/entryserver/apistore.go b/pkg/kuidserver/entryserver/apistore.go index 98b59ad..3ee9a40 100644 --- a/pkg/kuidserver/entryserver/apistore.go +++ b/pkg/kuidserver/entryserver/apistore.go @@ -16,6 +16,8 @@ limitations under the License. package entryserver +/* + import ( "context" @@ -23,7 +25,7 @@ import ( builderrest "github.com/henderiw/apiserver-builder/pkg/builder/rest" "github.com/henderiw/apiserver-store/pkg/generic/registry" "github.com/henderiw/apiserver-store/pkg/storebackend" - bebackend "github.com/kuidio/kuid/pkg/backend/backend" + bebackend "github.com/kuidio/kuid/pkg/backend" "github.com/kuidio/kuid/pkg/kuidserver/store" "go.opentelemetry.io/otel" "k8s.io/apimachinery/pkg/runtime" @@ -106,3 +108,4 @@ func NewREST(ctx context.Context, scheme *runtime.Scheme, optsGetter generic.RES } return store, nil } +*/ \ No newline at end of file diff --git a/pkg/kuidserver/entryserver/fieldselector.go b/pkg/kuidserver/entryserver/fieldselector.go index 920b947..1def132 100644 --- a/pkg/kuidserver/entryserver/fieldselector.go +++ b/pkg/kuidserver/entryserver/fieldselector.go @@ -15,6 +15,7 @@ limitations under the License. */ package entryserver +/* import ( "context" @@ -84,3 +85,4 @@ func parseFieldSelector(ctx context.Context, fieldSelector fields.Selector) (*Fi return filter, nil } +*/ \ No newline at end of file diff --git a/pkg/kuidserver/entryserver/strategy.go b/pkg/kuidserver/entryserver/strategy.go index e549522..0058966 100644 --- a/pkg/kuidserver/entryserver/strategy.go +++ b/pkg/kuidserver/entryserver/strategy.go @@ -16,6 +16,8 @@ limitations under the License. package entryserver +/* + import ( "context" "fmt" @@ -25,7 +27,7 @@ import ( "github.com/henderiw/apiserver-store/pkg/storebackend" "github.com/henderiw/logger/log" "github.com/kuidio/kuid/apis/backend" - bebackend "github.com/kuidio/kuid/pkg/backend/backend" + bebackend "github.com/kuidio/kuid/pkg/backend" watchermanager "github.com/kuidio/kuid/pkg/kuidserver/watcher-manager" "k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/labels" @@ -112,3 +114,4 @@ func (r *strategy) notifyWatcher(ctx context.Context, event watch.Event) { r.watcherManager.WatchChan() <- event } +*/ \ No newline at end of file diff --git a/pkg/kuidserver/entryserver/strategy_create.go b/pkg/kuidserver/entryserver/strategy_create.go index f414a90..5fbb578 100644 --- a/pkg/kuidserver/entryserver/strategy_create.go +++ b/pkg/kuidserver/entryserver/strategy_create.go @@ -16,6 +16,8 @@ limitations under the License. package entryserver +/* + import ( "context" @@ -74,3 +76,4 @@ func (r *strategy) Create(ctx context.Context, key types.NamespacedName, obj run func (r *strategy) WarningsOnCreate(ctx context.Context, obj runtime.Object) []string { return nil } +*/ \ No newline at end of file diff --git a/pkg/kuidserver/entryserver/strategy_delete.go b/pkg/kuidserver/entryserver/strategy_delete.go index a831c6a..53bb054 100644 --- a/pkg/kuidserver/entryserver/strategy_delete.go +++ b/pkg/kuidserver/entryserver/strategy_delete.go @@ -15,6 +15,7 @@ limitations under the License. */ package entryserver +/* import ( "context" @@ -45,3 +46,4 @@ func (r *strategy) Delete(ctx context.Context, key types.NamespacedName, obj run }) return obj, nil } +*/ \ No newline at end of file diff --git a/pkg/kuidserver/entryserver/strategy_get.go b/pkg/kuidserver/entryserver/strategy_get.go index 86b2fb3..81a2276 100644 --- a/pkg/kuidserver/entryserver/strategy_get.go +++ b/pkg/kuidserver/entryserver/strategy_get.go @@ -16,6 +16,8 @@ limitations under the License. package entryserver +/* + import ( "context" @@ -32,3 +34,4 @@ func (r *strategy) Get(ctx context.Context, key types.NamespacedName) (runtime.O } return obj, nil } +*/ \ No newline at end of file diff --git a/pkg/kuidserver/entryserver/strategy_list.go b/pkg/kuidserver/entryserver/strategy_list.go index a4643ad..73c02fa 100644 --- a/pkg/kuidserver/entryserver/strategy_list.go +++ b/pkg/kuidserver/entryserver/strategy_list.go @@ -16,6 +16,8 @@ limitations under the License. package entryserver +/* + import ( "context" "fmt" @@ -119,3 +121,4 @@ func getListPrt(listObj runtime.Object) (reflect.Value, error) { func appendItem(v reflect.Value, obj runtime.Object) { v.Set(reflect.Append(v, reflect.ValueOf(obj).Elem())) } +*/ \ No newline at end of file diff --git a/pkg/kuidserver/entryserver/strategy_update.go b/pkg/kuidserver/entryserver/strategy_update.go index 7041f90..a41c893 100644 --- a/pkg/kuidserver/entryserver/strategy_update.go +++ b/pkg/kuidserver/entryserver/strategy_update.go @@ -16,6 +16,8 @@ limitations under the License. package entryserver +/* + import ( "context" "encoding/hex" @@ -113,3 +115,4 @@ func updateResourceVersion(_ context.Context, obj, old runtime.Object) error { accessorNew.SetResourceVersion(strconv.Itoa(resourceVersion)) return nil } +*/ \ No newline at end of file diff --git a/pkg/kuidserver/entryserver/strategy_watch.go b/pkg/kuidserver/entryserver/strategy_watch.go index 8b4f309..8235992 100644 --- a/pkg/kuidserver/entryserver/strategy_watch.go +++ b/pkg/kuidserver/entryserver/strategy_watch.go @@ -16,6 +16,8 @@ limitations under the License. package entryserver +/* + import ( "context" @@ -39,3 +41,4 @@ func (r *strategy) Watch(ctx context.Context, options *metainternalversion.ListO return w, nil } +*/ \ No newline at end of file diff --git a/pkg/kuidserver/entryserver/table.go b/pkg/kuidserver/entryserver/table.go index e8e9139..e0e7d39 100644 --- a/pkg/kuidserver/entryserver/table.go +++ b/pkg/kuidserver/entryserver/table.go @@ -16,10 +16,12 @@ limitations under the License. package entryserver +/* + import ( "github.com/henderiw/apiserver-store/pkg/generic/registry" "github.com/kuidio/kuid/apis/backend" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" @@ -35,7 +37,7 @@ func DefaultTableConvertor(gr schema.GroupResource) registry.TableConvertor { } return []interface{}{ entry.GetName(), - entry.GetCondition(conditionv1alpha1.ConditionTypeReady).Status, + entry.GetCondition(condv1alpha1.ConditionTypeReady).Status, entry.GetIndex(), entry.GetClaimType(), entry.GetSpecID(), @@ -50,3 +52,4 @@ func DefaultTableConvertor(gr schema.GroupResource) registry.TableConvertor { }, } } +*/ \ No newline at end of file diff --git a/pkg/kuidserver/entryserver/watcher.go b/pkg/kuidserver/entryserver/watcher.go index da21491..4354fa4 100644 --- a/pkg/kuidserver/entryserver/watcher.go +++ b/pkg/kuidserver/entryserver/watcher.go @@ -16,6 +16,8 @@ limitations under the License. package entryserver +/* + import ( "context" "fmt" @@ -218,3 +220,4 @@ func (r *watcher) setDone() { defer r.m.Unlock() r.done = true } +*/ \ No newline at end of file diff --git a/pkg/kuidserver/genericserver/apistore.go b/pkg/kuidserver/genericserver/apistore.go index d3a8df2..6386a2c 100644 --- a/pkg/kuidserver/genericserver/apistore.go +++ b/pkg/kuidserver/genericserver/apistore.go @@ -16,6 +16,8 @@ limitations under the License. package genericserver +/* + import ( "context" @@ -108,3 +110,4 @@ func NewREST(ctx context.Context, scheme *runtime.Scheme, optsGetter generic.RES } return store, nil } +*/ diff --git a/pkg/kuidserver/genericserver/fieldselector.go b/pkg/kuidserver/genericserver/fieldselector.go index 9014b99..11e894b 100644 --- a/pkg/kuidserver/genericserver/fieldselector.go +++ b/pkg/kuidserver/genericserver/fieldselector.go @@ -16,6 +16,8 @@ limitations under the License. package genericserver +/* + import ( "context" "fmt" @@ -111,3 +113,4 @@ func (r *storerFilter) Filter(ctx context.Context, obj runtime.Object) bool { } return f } +*/ \ No newline at end of file diff --git a/pkg/kuidserver/genericserver/strategy.go b/pkg/kuidserver/genericserver/strategy.go index e5afa05..d485028 100644 --- a/pkg/kuidserver/genericserver/strategy.go +++ b/pkg/kuidserver/genericserver/strategy.go @@ -16,6 +16,8 @@ limitations under the License. package genericserver +/* + import ( "context" "fmt" @@ -38,7 +40,13 @@ import ( ) // NewStrategy creates and returns a fischerStrategy instance -func NewStrategy(ctx context.Context, typer runtime.ObjectTyper, client client.Client, serverObjContext *ServerObjContext, store storebackend.Storer[runtime.Object]) *strategy { +func NewStrategy( + ctx context.Context, + typer runtime.ObjectTyper, + client client.Client, + serverObjContext *ServerObjContext, + store storebackend.Storer[runtime.Object]) *strategy { + watcherManager := watchermanager.New(32) go watcherManager.Start(ctx) @@ -111,3 +119,4 @@ func (r *strategy) notifyWatcher(ctx context.Context, event watch.Event) { r.watcherManager.WatchChan() <- event } +*/ \ No newline at end of file diff --git a/pkg/kuidserver/genericserver/strategy_create.go b/pkg/kuidserver/genericserver/strategy_create.go index 1e43e2b..2d499d2 100644 --- a/pkg/kuidserver/genericserver/strategy_create.go +++ b/pkg/kuidserver/genericserver/strategy_create.go @@ -16,6 +16,8 @@ limitations under the License. package genericserver +/* + import ( "context" "fmt" @@ -72,3 +74,4 @@ func (r *strategy) Create(ctx context.Context, key types.NamespacedName, obj run func (r *strategy) WarningsOnCreate(ctx context.Context, obj runtime.Object) []string { return nil } +*/ diff --git a/pkg/kuidserver/genericserver/strategy_delete.go b/pkg/kuidserver/genericserver/strategy_delete.go index a6523ce..37829c3 100644 --- a/pkg/kuidserver/genericserver/strategy_delete.go +++ b/pkg/kuidserver/genericserver/strategy_delete.go @@ -16,6 +16,8 @@ limitations under the License. package genericserver +/* + import ( "context" @@ -45,3 +47,4 @@ func (r *strategy) Delete(ctx context.Context, key types.NamespacedName, obj run }) return obj, nil } +*/ diff --git a/pkg/kuidserver/genericserver/strategy_get.go b/pkg/kuidserver/genericserver/strategy_get.go index 54f9c79..284f073 100644 --- a/pkg/kuidserver/genericserver/strategy_get.go +++ b/pkg/kuidserver/genericserver/strategy_get.go @@ -16,6 +16,8 @@ limitations under the License. package genericserver +/* + import ( "context" @@ -32,3 +34,4 @@ func (r *strategy) Get(ctx context.Context, key types.NamespacedName) (runtime.O } return obj, nil } +*/ diff --git a/pkg/kuidserver/genericserver/strategy_list.go b/pkg/kuidserver/genericserver/strategy_list.go index 9cfb082..f118665 100644 --- a/pkg/kuidserver/genericserver/strategy_list.go +++ b/pkg/kuidserver/genericserver/strategy_list.go @@ -16,6 +16,8 @@ limitations under the License. package genericserver +/* + import ( "context" "fmt" @@ -103,3 +105,4 @@ func getListPrt(listObj runtime.Object) (reflect.Value, error) { func appendItem(v reflect.Value, obj runtime.Object) { v.Set(reflect.Append(v, reflect.ValueOf(obj).Elem())) } +*/ diff --git a/pkg/kuidserver/genericserver/strategy_update.go b/pkg/kuidserver/genericserver/strategy_update.go index 6ddaba4..cd79a87 100644 --- a/pkg/kuidserver/genericserver/strategy_update.go +++ b/pkg/kuidserver/genericserver/strategy_update.go @@ -16,6 +16,8 @@ limitations under the License. package genericserver +/* + import ( "context" "encoding/hex" @@ -122,3 +124,4 @@ func updateResourceVersion(_ context.Context, obj, old runtime.Object) error { accessorNew.SetResourceVersion(strconv.Itoa(resourceVersion)) return nil } +*/ diff --git a/pkg/kuidserver/genericserver/strategy_watch.go b/pkg/kuidserver/genericserver/strategy_watch.go index 3e7a1be..ea8f550 100644 --- a/pkg/kuidserver/genericserver/strategy_watch.go +++ b/pkg/kuidserver/genericserver/strategy_watch.go @@ -16,6 +16,8 @@ limitations under the License. package genericserver +/* + import ( "context" @@ -39,3 +41,4 @@ func (r *strategy) Watch(ctx context.Context, options *metainternalversion.ListO return w, nil } +*/ \ No newline at end of file diff --git a/pkg/kuidserver/genericserver/table.go b/pkg/kuidserver/genericserver/table.go index bc98395..2e660be 100644 --- a/pkg/kuidserver/genericserver/table.go +++ b/pkg/kuidserver/genericserver/table.go @@ -16,10 +16,12 @@ limitations under the License. package genericserver +/* + import ( "github.com/henderiw/apiserver-store/pkg/generic/registry" "github.com/kuidio/kuid/apis/backend" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" @@ -35,7 +37,7 @@ func DefaultTableConvertor(gr schema.GroupResource) registry.TableConvertor { } return []interface{}{ genObj.GetName(), - genObj.GetCondition(conditionv1alpha1.ConditionTypeReady).Status, + genObj.GetCondition(condv1alpha1.ConditionTypeReady).Status, } }, Columns: []metav1.TableColumnDefinition{ @@ -44,3 +46,4 @@ func DefaultTableConvertor(gr schema.GroupResource) registry.TableConvertor { }, } } +*/ \ No newline at end of file diff --git a/pkg/kuidserver/genericserver/watcher.go b/pkg/kuidserver/genericserver/watcher.go index 32a66c8..5c737a6 100644 --- a/pkg/kuidserver/genericserver/watcher.go +++ b/pkg/kuidserver/genericserver/watcher.go @@ -16,6 +16,8 @@ limitations under the License. package genericserver +/* + import ( "context" "fmt" @@ -218,3 +220,4 @@ func (r *watcher) setDone() { defer r.m.Unlock() r.done = true } +*/ diff --git a/pkg/kuidserver/indexserver/apistore.go b/pkg/kuidserver/indexserver/apistore.go index e67846b..0866f64 100644 --- a/pkg/kuidserver/indexserver/apistore.go +++ b/pkg/kuidserver/indexserver/apistore.go @@ -16,6 +16,8 @@ limitations under the License. package indexserver +/* + import ( "context" @@ -23,7 +25,7 @@ import ( builderrest "github.com/henderiw/apiserver-builder/pkg/builder/rest" "github.com/henderiw/apiserver-store/pkg/generic/registry" "github.com/henderiw/apiserver-store/pkg/storebackend" - bebackend "github.com/kuidio/kuid/pkg/backend/backend" + bebackend "github.com/kuidio/kuid/pkg/backend" "github.com/kuidio/kuid/pkg/kuidserver/store" "go.opentelemetry.io/otel" "k8s.io/apimachinery/pkg/runtime" @@ -106,3 +108,4 @@ func NewREST(ctx context.Context, scheme *runtime.Scheme, optsGetter generic.RES } return store, nil } +*/ \ No newline at end of file diff --git a/pkg/kuidserver/indexserver/fieldselector.go b/pkg/kuidserver/indexserver/fieldselector.go index 7e458b7..3b41b76 100644 --- a/pkg/kuidserver/indexserver/fieldselector.go +++ b/pkg/kuidserver/indexserver/fieldselector.go @@ -16,6 +16,8 @@ limitations under the License. package indexserver +/* + import ( "context" "fmt" @@ -80,3 +82,4 @@ func parseFieldSelector(ctx context.Context, fieldSelector fields.Selector) (*Fi return filter, nil } +*/ diff --git a/pkg/kuidserver/indexserver/strategy.go b/pkg/kuidserver/indexserver/strategy.go index 9b1e288..3a95ca2 100644 --- a/pkg/kuidserver/indexserver/strategy.go +++ b/pkg/kuidserver/indexserver/strategy.go @@ -16,6 +16,8 @@ limitations under the License. package indexserver +/* + import ( "context" "fmt" @@ -25,7 +27,7 @@ import ( "github.com/henderiw/apiserver-store/pkg/storebackend" "github.com/henderiw/logger/log" "github.com/kuidio/kuid/apis/backend" - bebackend "github.com/kuidio/kuid/pkg/backend/backend" + bebackend "github.com/kuidio/kuid/pkg/backend" watchermanager "github.com/kuidio/kuid/pkg/kuidserver/watcher-manager" "k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/labels" @@ -112,3 +114,4 @@ func (r *strategy) notifyWatcher(ctx context.Context, event watch.Event) { r.watcherManager.WatchChan() <- event } +*/ diff --git a/pkg/kuidserver/indexserver/strategy_create.go b/pkg/kuidserver/indexserver/strategy_create.go index f14f66e..8db82fc 100644 --- a/pkg/kuidserver/indexserver/strategy_create.go +++ b/pkg/kuidserver/indexserver/strategy_create.go @@ -16,6 +16,8 @@ limitations under the License. package indexserver +/* + import ( "context" "fmt" @@ -72,3 +74,5 @@ func (r *strategy) Create(ctx context.Context, key types.NamespacedName, obj run func (r *strategy) WarningsOnCreate(ctx context.Context, obj runtime.Object) []string { return nil } + +*/ diff --git a/pkg/kuidserver/indexserver/strategy_delete.go b/pkg/kuidserver/indexserver/strategy_delete.go index f81a1a8..7692ee9 100644 --- a/pkg/kuidserver/indexserver/strategy_delete.go +++ b/pkg/kuidserver/indexserver/strategy_delete.go @@ -16,6 +16,8 @@ limitations under the License. package indexserver +/* + import ( "context" @@ -45,3 +47,4 @@ func (r *strategy) Delete(ctx context.Context, key types.NamespacedName, obj run }) return obj, nil } +*/ diff --git a/pkg/kuidserver/indexserver/strategy_get.go b/pkg/kuidserver/indexserver/strategy_get.go index af6c7de..5fbc77e 100644 --- a/pkg/kuidserver/indexserver/strategy_get.go +++ b/pkg/kuidserver/indexserver/strategy_get.go @@ -16,6 +16,8 @@ limitations under the License. package indexserver +/* + import ( "context" @@ -32,3 +34,4 @@ func (r *strategy) Get(ctx context.Context, key types.NamespacedName) (runtime.O } return obj, nil } +*/ diff --git a/pkg/kuidserver/indexserver/strategy_list.go b/pkg/kuidserver/indexserver/strategy_list.go index 034ea04..28d075a 100644 --- a/pkg/kuidserver/indexserver/strategy_list.go +++ b/pkg/kuidserver/indexserver/strategy_list.go @@ -16,6 +16,8 @@ limitations under the License. package indexserver +/* + import ( "context" "fmt" @@ -106,3 +108,4 @@ func getListPrt(listObj runtime.Object) (reflect.Value, error) { func appendItem(v reflect.Value, obj runtime.Object) { v.Set(reflect.Append(v, reflect.ValueOf(obj).Elem())) } +*/ diff --git a/pkg/kuidserver/indexserver/strategy_update.go b/pkg/kuidserver/indexserver/strategy_update.go index cf42cb1..099d872 100644 --- a/pkg/kuidserver/indexserver/strategy_update.go +++ b/pkg/kuidserver/indexserver/strategy_update.go @@ -16,6 +16,8 @@ limitations under the License. package indexserver +/* + import ( "context" "encoding/hex" @@ -122,3 +124,4 @@ func updateResourceVersion(_ context.Context, obj, old runtime.Object) error { accessorNew.SetResourceVersion(strconv.Itoa(resourceVersion)) return nil } +*/ diff --git a/pkg/kuidserver/indexserver/strategy_watch.go b/pkg/kuidserver/indexserver/strategy_watch.go index 7eb28e9..d92bad9 100644 --- a/pkg/kuidserver/indexserver/strategy_watch.go +++ b/pkg/kuidserver/indexserver/strategy_watch.go @@ -16,6 +16,8 @@ limitations under the License. package indexserver +/* + import ( "context" @@ -39,3 +41,4 @@ func (r *strategy) Watch(ctx context.Context, options *metainternalversion.ListO return w, nil } +*/ diff --git a/pkg/kuidserver/indexserver/table.go b/pkg/kuidserver/indexserver/table.go index dacb088..dfdef1e 100644 --- a/pkg/kuidserver/indexserver/table.go +++ b/pkg/kuidserver/indexserver/table.go @@ -16,10 +16,12 @@ limitations under the License. package indexserver +/* + import ( "github.com/henderiw/apiserver-store/pkg/generic/registry" "github.com/kuidio/kuid/apis/backend" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" @@ -35,7 +37,7 @@ func DefaultTableConvertor(gr schema.GroupResource) registry.TableConvertor { } return []interface{}{ index.GetName(), - index.GetCondition(conditionv1alpha1.ConditionTypeReady).Status, + index.GetCondition(condv1alpha1.ConditionTypeReady).Status, index.GetMinID(), index.GetMaxID(), } @@ -48,3 +50,4 @@ func DefaultTableConvertor(gr schema.GroupResource) registry.TableConvertor { }, } } +*/ diff --git a/pkg/kuidserver/indexserver/watcher.go b/pkg/kuidserver/indexserver/watcher.go index f21a2ab..78745a1 100644 --- a/pkg/kuidserver/indexserver/watcher.go +++ b/pkg/kuidserver/indexserver/watcher.go @@ -16,6 +16,8 @@ limitations under the License. package indexserver +/* + import ( "context" "fmt" @@ -218,3 +220,4 @@ func (r *watcher) setDone() { defer r.m.Unlock() r.done = true } +*/ diff --git a/pkg/kuidserver/store/store.go b/pkg/kuidserver/store/store.go index bb6595e..48e98d8 100644 --- a/pkg/kuidserver/store/store.go +++ b/pkg/kuidserver/store/store.go @@ -16,6 +16,8 @@ limitations under the License. package store +/* + import ( "context" @@ -87,3 +89,4 @@ func CreateKVStore(ctx context.Context, db *badger.DB, scheme *runtime.Scheme, o func CreateMemStore(ctx context.Context) storebackend.Storer[runtime.Object] { return memory.NewStore[runtime.Object]() } +*/ diff --git a/pkg/reconcilers/all/all.go b/pkg/reconcilers/all/all.go index 043f5ce..702a0c6 100644 --- a/pkg/reconcilers/all/all.go +++ b/pkg/reconcilers/all/all.go @@ -19,14 +19,4 @@ package all import ( _ "github.com/kuidio/kuid/pkg/reconcilers/asclaim" _ "github.com/kuidio/kuid/pkg/reconcilers/asindex" - _ "github.com/kuidio/kuid/pkg/reconcilers/extcommclaim" - _ "github.com/kuidio/kuid/pkg/reconcilers/extcommindex" - _ "github.com/kuidio/kuid/pkg/reconcilers/ipclaim" - _ "github.com/kuidio/kuid/pkg/reconcilers/ipindex" - _ "github.com/kuidio/kuid/pkg/reconcilers/vlanclaim" - _ "github.com/kuidio/kuid/pkg/reconcilers/vlanindex" - _ "github.com/kuidio/kuid/pkg/reconcilers/vxlanclaim" - _ "github.com/kuidio/kuid/pkg/reconcilers/vxlanindex" - _ "github.com/kuidio/kuid/pkg/reconcilers/genidclaim" - _ "github.com/kuidio/kuid/pkg/reconcilers/genidindex" ) diff --git a/pkg/reconcilers/asclaim/reconciler.go b/pkg/reconcilers/asclaim/reconciler.go index a969d39..0922d02 100644 --- a/pkg/reconcilers/asclaim/reconciler.go +++ b/pkg/reconcilers/asclaim/reconciler.go @@ -16,6 +16,8 @@ limitations under the License. package asclaim +/* + import ( "context" "fmt" @@ -25,8 +27,8 @@ import ( "github.com/henderiw/logger/log" asbev1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - "github.com/kuidio/kuid/pkg/backend/backend" + conditionv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + "github.com/kuidio/kuid/pkg/backend" "github.com/kuidio/kuid/pkg/reconcilers" "github.com/kuidio/kuid/pkg/reconcilers/ctrlconfig" "github.com/kuidio/kuid/pkg/reconcilers/eventhandler" @@ -53,7 +55,6 @@ const ( errUpdateStatus = "cannot update status" ) - // SetupWithManager sets up the controller with the Manager. func (r *reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, c interface{}) (map[schema.GroupVersionKind]chan event.GenericEvent, error) { cfg, ok := c.(*ctrlconfig.ControllerConfig) @@ -90,7 +91,7 @@ func (r *reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu log.Info("reconcile") cr := &asbev1alpha1.ASClaim{} - if err := r.Get(ctx, req.NamespacedName, cr); err != nil { + if err := r.Client.Get(ctx, req.NamespacedName, cr); err != nil { // if the resource no longer exists the reconcile loop is done if resource.IgnoreNotFound(err) != nil { log.Error(errGetCr, "error", err) @@ -104,13 +105,13 @@ func (r *reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu if err := r.be.Release(ctx, cr); err != nil { if !strings.Contains(err.Error(), "not initialized") { r.handleError(ctx, cr, "cannot delete claim", err) - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) + return ctrl.Result{Requeue: true}, errors.Wrap(r.Client.Status().Update(ctx, cr), errUpdateStatus) } } if err := r.finalizer.RemoveFinalizer(ctx, cr); err != nil { r.handleError(ctx, cr, "cannot remove finalizer", err) - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) + return ctrl.Result{Requeue: true}, errors.Wrap(r.Client.Status().Update(ctx, cr), errUpdateStatus) } log.Debug("Successfully deleted resource") return ctrl.Result{}, nil @@ -118,21 +119,21 @@ func (r *reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu if err := r.finalizer.AddFinalizer(ctx, cr); err != nil { r.handleError(ctx, cr, "cannot add finalizer", err) - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) + return ctrl.Result{Requeue: true}, errors.Wrap(r.Client.Status().Update(ctx, cr), errUpdateStatus) } if err := r.be.Claim(ctx, cr); err != nil { r.handleError(ctx, cr, "cannot claim resource", err) if strings.Contains(err.Error(), "reserved range") { // a user need to intervene to recover - return ctrl.Result{}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) + return ctrl.Result{}, errors.Wrap(r.Client.Status().Update(ctx, cr), errUpdateStatus) } - return ctrl.Result{RequeueAfter: 5 * time.Second}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) + return ctrl.Result{RequeueAfter: 5 * time.Second}, errors.Wrap(r.Client.Status().Update(ctx, cr), errUpdateStatus) } cr.SetConditions(conditionv1alpha1.Ready()) r.recorder.Eventf(cr, corev1.EventTypeNormal, crName, "ready") - return ctrl.Result{}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) + return ctrl.Result{}, errors.Wrap(r.Client.Status().Update(ctx, cr), errUpdateStatus) } func (r *reconciler) handleError(ctx context.Context, cr *asbev1alpha1.ASClaim, msg string, err error) { @@ -147,3 +148,4 @@ func (r *reconciler) handleError(ctx context.Context, cr *asbev1alpha1.ASClaim, r.recorder.Eventf(cr, corev1.EventTypeWarning, crName, fmt.Sprintf("%s, err: %s", msg, err.Error())) } } +*/ diff --git a/pkg/reconcilers/asindex/reconciler.go b/pkg/reconcilers/asindex/reconciler.go index 21ec095..f730b94 100644 --- a/pkg/reconcilers/asindex/reconciler.go +++ b/pkg/reconcilers/asindex/reconciler.go @@ -16,6 +16,8 @@ limitations under the License. package asindex +/* + import ( "context" "fmt" @@ -23,8 +25,8 @@ import ( "github.com/henderiw/logger/log" asbev1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - "github.com/kuidio/kuid/pkg/backend/backend" + conditionv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + "github.com/kuidio/kuid/pkg/backend" "github.com/kuidio/kuid/pkg/reconcilers" "github.com/kuidio/kuid/pkg/reconcilers/ctrlconfig" "github.com/kuidio/kuid/pkg/reconcilers/eventhandler" @@ -68,7 +70,7 @@ func (r *reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, c i Named(controllerName). For(&asbev1alpha1.ASIndex{}). Watches(&asbev1alpha1.ASIndex{}, - &eventhandler.IPEntryEventHandler{ + &eventhandler.ASEntryEventHandler{ Client: mgr.GetClient(), ObjList: &asbev1alpha1.ASIndexList{}, }). @@ -201,3 +203,4 @@ func (r *reconciler) applyMinMaxRange(ctx context.Context, cr *asbev1alpha1.ASIn } return nil } +*/ diff --git a/pkg/reconcilers/ctrlconfig/config.go b/pkg/reconcilers/ctrlconfig/config.go index b2cf659..91355cd 100644 --- a/pkg/reconcilers/ctrlconfig/config.go +++ b/pkg/reconcilers/ctrlconfig/config.go @@ -20,17 +20,17 @@ import ( "context" "github.com/henderiw/logger/log" - "github.com/kuidio/kuid/pkg/backend/backend" + "github.com/kuidio/kuid/pkg/backend" "k8s.io/apimachinery/pkg/types" ) type ControllerConfig struct { - IPAMBackend backend.Backend - VLANBackend backend.Backend - VXLANBackend backend.Backend + //IPAMBackend backend.Backend + //VLANBackend backend.Backend + //VXLANBackend backend.Backend ASBackend backend.Backend - EXTCOMMBackend backend.Backend - GENIDBackend backend.Backend + //EXTCOMMBackend backend.Backend + //GENIDBackend backend.Backend } func InitContext(ctx context.Context, controllerName string, req types.NamespacedName) context.Context { diff --git a/pkg/reconcilers/eventhandler/watch_asentry.go b/pkg/reconcilers/eventhandler/watch_asentry.go index 80dedf6..9f4f849 100644 --- a/pkg/reconcilers/eventhandler/watch_asentry.go +++ b/pkg/reconcilers/eventhandler/watch_asentry.go @@ -16,11 +16,13 @@ limitations under the License. package eventhandler +/* + import ( "context" "github.com/henderiw/logger/log" - vxlanbev1alpha1 "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1" + asbev1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/util/workqueue" @@ -57,7 +59,7 @@ func (r *ASEntryEventHandler) Generic(ctx context.Context, evt event.GenericEven } func (r *ASEntryEventHandler) add(ctx context.Context, obj runtime.Object, queue adder) { - cr, ok := obj.(*vxlanbev1alpha1.VXLANEntry) + cr, ok := obj.(*asbev1alpha1.ASEntry) if !ok { return } @@ -86,3 +88,4 @@ func (r *ASEntryEventHandler) add(ctx context.Context, obj runtime.Object, queue } } } +*/ diff --git a/pkg/reconcilers/eventhandler/watch_extcommentry.go b/pkg/reconcilers/eventhandler/watch_extcommentry.go deleted file mode 100644 index 48cb7c8..0000000 --- a/pkg/reconcilers/eventhandler/watch_extcommentry.go +++ /dev/null @@ -1,88 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 eventhandler - -import ( - "context" - - "github.com/henderiw/logger/log" - "github.com/kuidio/kuid/apis/backend" - extcommbev1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/types" - "k8s.io/client-go/util/workqueue" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/event" - "sigs.k8s.io/controller-runtime/pkg/reconcile" -) - -type EXTCOMMEntryEventHandler struct { - Client client.Client - ObjList backend.ObjectList -} - -// Create enqueues a request -func (r *EXTCOMMEntryEventHandler) Create(ctx context.Context, evt event.CreateEvent, q workqueue.RateLimitingInterface) { - r.add(ctx, evt.Object, q) -} - -// Create enqueues a request -func (r *EXTCOMMEntryEventHandler) Update(ctx context.Context, evt event.UpdateEvent, q workqueue.RateLimitingInterface) { - r.add(ctx, evt.ObjectOld, q) - r.add(ctx, evt.ObjectNew, q) -} - -// Create enqueues a request -func (r *EXTCOMMEntryEventHandler) Delete(ctx context.Context, evt event.DeleteEvent, q workqueue.RateLimitingInterface) { - r.add(ctx, evt.Object, q) -} - -// Create enqueues a request -func (r *EXTCOMMEntryEventHandler) Generic(ctx context.Context, evt event.GenericEvent, q workqueue.RateLimitingInterface) { - r.add(ctx, evt.Object, q) -} - -func (r *EXTCOMMEntryEventHandler) add(ctx context.Context, obj runtime.Object, queue adder) { - cr, ok := obj.(*extcommbev1alpha1.EXTCOMMEntry) - if !ok { - return - } - - log := log.FromContext(ctx) - //log.Info("event", "gvk", ipambev1alpha1.SchemeGroupVersion.WithKind(ipambev1alpha1.IPEntryKind).String(), "name", cr.GetName()) - - opts := []client.ListOption{ - client.InNamespace(cr.Namespace), - } - objList := r.ObjList - if err := r.Client.List(ctx, objList, opts...); err != nil { - log.Error("cannot list object", "error", err) - return - } - for _, obj := range objList.GetItems() { - // check if the connection profile is referenced in the discoveryProfile - //log.Info("event", "objOwnerRef", obj.GetOwnerReference().String(), "crOwnerRef", cr.GetOwnerReference().String()) - if *obj.GetOwnerReference() == *cr.GetOwnerReference() { - key := types.NamespacedName{ - Namespace: obj.GetNamespace(), - Name: obj.GetName()} - log.Info("event requeue", "key", key.String()) - queue.Add(reconcile.Request{NamespacedName: key}) - continue - } - } -} diff --git a/pkg/reconcilers/eventhandler/watch_genidentry.go b/pkg/reconcilers/eventhandler/watch_genidentry.go deleted file mode 100644 index a1f47a7..0000000 --- a/pkg/reconcilers/eventhandler/watch_genidentry.go +++ /dev/null @@ -1,88 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 eventhandler - -import ( - "context" - - "github.com/henderiw/logger/log" - "github.com/kuidio/kuid/apis/backend" - genidbev1alpha1 "github.com/kuidio/kuid/apis/backend/genid/v1alpha1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/types" - "k8s.io/client-go/util/workqueue" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/event" - "sigs.k8s.io/controller-runtime/pkg/reconcile" -) - -type GENIDEntryEventHandler struct { - Client client.Client - ObjList backend.ObjectList -} - -// Create enqueues a request -func (r *GENIDEntryEventHandler) Create(ctx context.Context, evt event.CreateEvent, q workqueue.RateLimitingInterface) { - r.add(ctx, evt.Object, q) -} - -// Create enqueues a request -func (r *GENIDEntryEventHandler) Update(ctx context.Context, evt event.UpdateEvent, q workqueue.RateLimitingInterface) { - r.add(ctx, evt.ObjectOld, q) - r.add(ctx, evt.ObjectNew, q) -} - -// Create enqueues a request -func (r *GENIDEntryEventHandler) Delete(ctx context.Context, evt event.DeleteEvent, q workqueue.RateLimitingInterface) { - r.add(ctx, evt.Object, q) -} - -// Create enqueues a request -func (r *GENIDEntryEventHandler) Generic(ctx context.Context, evt event.GenericEvent, q workqueue.RateLimitingInterface) { - r.add(ctx, evt.Object, q) -} - -func (r *GENIDEntryEventHandler) add(ctx context.Context, obj runtime.Object, queue adder) { - cr, ok := obj.(*genidbev1alpha1.GENIDEntry) - if !ok { - return - } - - log := log.FromContext(ctx) - //log.Info("event", "gvk", ipambev1alpha1.SchemeGroupVersion.WithKind(ipambev1alpha1.IPEntryKind).String(), "name", cr.GetName()) - - opts := []client.ListOption{ - client.InNamespace(cr.Namespace), - } - objList := r.ObjList - if err := r.Client.List(ctx, objList, opts...); err != nil { - log.Error("cannot list object", "error", err) - return - } - for _, obj := range objList.GetItems() { - // check if the connection profile is referenced in the discoveryProfile - //log.Info("event", "objOwnerRef", obj.GetOwnerReference().String(), "crOwnerRef", cr.GetOwnerReference().String()) - if *obj.GetOwnerReference() == *cr.GetOwnerReference() { - key := types.NamespacedName{ - Namespace: obj.GetNamespace(), - Name: obj.GetName()} - log.Info("event requeue", "key", key.String()) - queue.Add(reconcile.Request{NamespacedName: key}) - continue - } - } -} diff --git a/pkg/reconcilers/eventhandler/watch_ipentry.go b/pkg/reconcilers/eventhandler/watch_ipentry.go deleted file mode 100644 index d45560f..0000000 --- a/pkg/reconcilers/eventhandler/watch_ipentry.go +++ /dev/null @@ -1,88 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 eventhandler - -import ( - "context" - - "github.com/henderiw/logger/log" - "github.com/kuidio/kuid/apis/backend" - ipambev1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/types" - "k8s.io/client-go/util/workqueue" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/event" - "sigs.k8s.io/controller-runtime/pkg/reconcile" -) - -type IPEntryEventHandler struct { - Client client.Client - ObjList backend.ObjectList -} - -// Create enqueues a request -func (r *IPEntryEventHandler) Create(ctx context.Context, evt event.CreateEvent, q workqueue.RateLimitingInterface) { - r.add(ctx, evt.Object, q) -} - -// Create enqueues a request -func (r *IPEntryEventHandler) Update(ctx context.Context, evt event.UpdateEvent, q workqueue.RateLimitingInterface) { - r.add(ctx, evt.ObjectOld, q) - r.add(ctx, evt.ObjectNew, q) -} - -// Create enqueues a request -func (r *IPEntryEventHandler) Delete(ctx context.Context, evt event.DeleteEvent, q workqueue.RateLimitingInterface) { - r.add(ctx, evt.Object, q) -} - -// Create enqueues a request -func (r *IPEntryEventHandler) Generic(ctx context.Context, evt event.GenericEvent, q workqueue.RateLimitingInterface) { - r.add(ctx, evt.Object, q) -} - -func (r *IPEntryEventHandler) add(ctx context.Context, obj runtime.Object, queue adder) { - cr, ok := obj.(*ipambev1alpha1.IPEntry) - if !ok { - return - } - - log := log.FromContext(ctx) - //log.Info("event", "gvk", ipambev1alpha1.SchemeGroupVersion.WithKind(ipambev1alpha1.IPEntryKind).String(), "name", cr.GetName()) - - opts := []client.ListOption{ - client.InNamespace(cr.Namespace), - } - objList := r.ObjList - if err := r.Client.List(ctx, objList, opts...); err != nil { - log.Error("cannot list object", "error", err) - return - } - for _, obj := range objList.GetItems() { - // check if the connection profile is referenced in the discoveryProfile - //log.Info("event", "objOwnerRef", obj.GetOwnerReference().String(), "crOwnerRef", cr.GetOwnerReference().String()) - if *obj.GetOwnerReference() == *cr.GetOwnerReference() { - key := types.NamespacedName{ - Namespace: obj.GetNamespace(), - Name: obj.GetName()} - log.Info("event requeue", "key", key.String()) - queue.Add(reconcile.Request{NamespacedName: key}) - continue - } - } -} diff --git a/pkg/reconcilers/eventhandler/watch_vlanentry.go b/pkg/reconcilers/eventhandler/watch_vlanentry.go deleted file mode 100644 index 7dd9bcf..0000000 --- a/pkg/reconcilers/eventhandler/watch_vlanentry.go +++ /dev/null @@ -1,88 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 eventhandler - -import ( - "context" - - "github.com/henderiw/logger/log" - "github.com/kuidio/kuid/apis/backend" - vlanbev1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/types" - "k8s.io/client-go/util/workqueue" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/event" - "sigs.k8s.io/controller-runtime/pkg/reconcile" -) - -type VLANEntryEventHandler struct { - Client client.Client - ObjList backend.ObjectList -} - -// Create enqueues a request -func (r *VLANEntryEventHandler) Create(ctx context.Context, evt event.CreateEvent, q workqueue.RateLimitingInterface) { - r.add(ctx, evt.Object, q) -} - -// Create enqueues a request -func (r *VLANEntryEventHandler) Update(ctx context.Context, evt event.UpdateEvent, q workqueue.RateLimitingInterface) { - r.add(ctx, evt.ObjectOld, q) - r.add(ctx, evt.ObjectNew, q) -} - -// Create enqueues a request -func (r *VLANEntryEventHandler) Delete(ctx context.Context, evt event.DeleteEvent, q workqueue.RateLimitingInterface) { - r.add(ctx, evt.Object, q) -} - -// Create enqueues a request -func (r *VLANEntryEventHandler) Generic(ctx context.Context, evt event.GenericEvent, q workqueue.RateLimitingInterface) { - r.add(ctx, evt.Object, q) -} - -func (r *VLANEntryEventHandler) add(ctx context.Context, obj runtime.Object, queue adder) { - cr, ok := obj.(*vlanbev1alpha1.VLANEntry) - if !ok { - return - } - - log := log.FromContext(ctx) - //log.Info("event", "gvk", ipambev1alpha1.SchemeGroupVersion.WithKind(ipambev1alpha1.IPEntryKind).String(), "name", cr.GetName()) - - opts := []client.ListOption{ - client.InNamespace(cr.Namespace), - } - objList := r.ObjList - if err := r.Client.List(ctx, objList, opts...); err != nil { - log.Error("cannot list object", "error", err) - return - } - for _, obj := range objList.GetItems() { - // check if the connection profile is referenced in the discoveryProfile - //log.Info("event", "objOwnerRef", obj.GetOwnerReference().String(), "crOwnerRef", cr.GetOwnerReference().String()) - if *obj.GetOwnerReference() == *cr.GetOwnerReference() { - key := types.NamespacedName{ - Namespace: obj.GetNamespace(), - Name: obj.GetName()} - log.Info("event requeue", "key", key.String()) - queue.Add(reconcile.Request{NamespacedName: key}) - continue - } - } -} diff --git a/pkg/reconcilers/eventhandler/watch_vxlanentry.go b/pkg/reconcilers/eventhandler/watch_vxlanentry.go deleted file mode 100644 index e1c8f7c..0000000 --- a/pkg/reconcilers/eventhandler/watch_vxlanentry.go +++ /dev/null @@ -1,88 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 eventhandler - -import ( - "context" - - "github.com/henderiw/logger/log" - "github.com/kuidio/kuid/apis/backend" - vxlanbev1alpha1 "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/types" - "k8s.io/client-go/util/workqueue" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/event" - "sigs.k8s.io/controller-runtime/pkg/reconcile" -) - -type VXLANEntryEventHandler struct { - Client client.Client - ObjList backend.ObjectList -} - -// Create enqueues a request -func (r *VXLANEntryEventHandler) Create(ctx context.Context, evt event.CreateEvent, q workqueue.RateLimitingInterface) { - r.add(ctx, evt.Object, q) -} - -// Create enqueues a request -func (r *VXLANEntryEventHandler) Update(ctx context.Context, evt event.UpdateEvent, q workqueue.RateLimitingInterface) { - r.add(ctx, evt.ObjectOld, q) - r.add(ctx, evt.ObjectNew, q) -} - -// Create enqueues a request -func (r *VXLANEntryEventHandler) Delete(ctx context.Context, evt event.DeleteEvent, q workqueue.RateLimitingInterface) { - r.add(ctx, evt.Object, q) -} - -// Create enqueues a request -func (r *VXLANEntryEventHandler) Generic(ctx context.Context, evt event.GenericEvent, q workqueue.RateLimitingInterface) { - r.add(ctx, evt.Object, q) -} - -func (r *VXLANEntryEventHandler) add(ctx context.Context, obj runtime.Object, queue adder) { - cr, ok := obj.(*vxlanbev1alpha1.VXLANEntry) - if !ok { - return - } - - log := log.FromContext(ctx) - //log.Info("event", "gvk", ipambev1alpha1.SchemeGroupVersion.WithKind(ipambev1alpha1.IPEntryKind).String(), "name", cr.GetName()) - - opts := []client.ListOption{ - client.InNamespace(cr.Namespace), - } - objList := r.ObjList - if err := r.Client.List(ctx, objList, opts...); err != nil { - log.Error("cannot list object", "error", err) - return - } - for _, obj := range objList.GetItems() { - // check if the connection profile is referenced in the discoveryProfile - //log.Info("event", "objOwnerRef", obj.GetOwnerReference().String(), "crOwnerRef", cr.GetOwnerReference().String()) - if *obj.GetOwnerReference() == *cr.GetOwnerReference() { - key := types.NamespacedName{ - Namespace: obj.GetNamespace(), - Name: obj.GetName()} - log.Info("event requeue", "key", key.String()) - queue.Add(reconcile.Request{NamespacedName: key}) - continue - } - } -} diff --git a/pkg/reconcilers/extcommclaim/reconciler.go b/pkg/reconcilers/extcommclaim/reconciler.go deleted file mode 100644 index 0ae2db0..0000000 --- a/pkg/reconcilers/extcommclaim/reconciler.go +++ /dev/null @@ -1,149 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 extcommclaim - -import ( - "context" - "fmt" - "reflect" - "strings" - "time" - - "github.com/henderiw/logger/log" - extcommbev1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - "github.com/kuidio/kuid/pkg/backend/backend" - "github.com/kuidio/kuid/pkg/reconcilers" - "github.com/kuidio/kuid/pkg/reconcilers/ctrlconfig" - "github.com/kuidio/kuid/pkg/reconcilers/eventhandler" - "github.com/kuidio/kuid/pkg/reconcilers/resource" - "github.com/pkg/errors" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/client-go/tools/record" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/event" -) - -func init() { - reconcilers.Register("extcommclaim", &reconciler{}) -} - -const ( - crName = "extcommClaim" - controllerName = "EXTCOMMClaimController" - finalizer = "extcommclaim.extcomm.be.kuid.dev/finalizer" - // errors - errGetCr = "cannot get cr" - errUpdateStatus = "cannot update status" -) - -// SetupWithManager sets up the controller with the Manager. -func (r *reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, c interface{}) (map[schema.GroupVersionKind]chan event.GenericEvent, error) { - cfg, ok := c.(*ctrlconfig.ControllerConfig) - if !ok { - return nil, fmt.Errorf("cannot initialize, expecting controllerConfig, got: %s", reflect.TypeOf(c).Name()) - } - - r.Client = mgr.GetClient() - r.finalizer = resource.NewAPIFinalizer(mgr.GetClient(), finalizer) - r.recorder = mgr.GetEventRecorderFor(controllerName) - r.be = cfg.EXTCOMMBackend - - return nil, ctrl.NewControllerManagedBy(mgr). - Named(controllerName). - For(&extcommbev1alpha1.EXTCOMMClaim{}). - Watches(&extcommbev1alpha1.EXTCOMMEntry{}, - &eventhandler.EXTCOMMEntryEventHandler{ - Client: mgr.GetClient(), - ObjList: &extcommbev1alpha1.EXTCOMMClaimList{}, - }). - Complete(r) -} - -type reconciler struct { - client.Client - finalizer *resource.APIFinalizer - recorder record.EventRecorder - be backend.Backend -} - -func (r *reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - ctx = ctrlconfig.InitContext(ctx, controllerName, req.NamespacedName) - log := log.FromContext(ctx) - log.Info("reconcile") - - cr := &extcommbev1alpha1.EXTCOMMClaim{} - if err := r.Get(ctx, req.NamespacedName, cr); err != nil { - // if the resource no longer exists the reconcile loop is done - if resource.IgnoreNotFound(err) != nil { - log.Error(errGetCr, "error", err) - return ctrl.Result{}, errors.Wrap(resource.IgnoreNotFound(err), errGetCr) - } - return ctrl.Result{}, nil - } - cr = cr.DeepCopy() - - if !cr.GetDeletionTimestamp().IsZero() { - if err := r.be.Release(ctx, cr); err != nil { - if !strings.Contains(err.Error(), "not initialized") { - r.handleError(ctx, cr, "cannot delete claim", err) - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - } - - if err := r.finalizer.RemoveFinalizer(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot remove finalizer", err) - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - log.Debug("Successfully deleted resource") - return ctrl.Result{}, nil - } - - if err := r.finalizer.AddFinalizer(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot add finalizer", err) - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - - if err := r.be.Claim(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot claim resource", err) - - if strings.Contains(err.Error(), "reserved range") { - // a user need to intervene to recover - return ctrl.Result{}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - return ctrl.Result{RequeueAfter: 5 * time.Second}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - - cr.SetConditions(conditionv1alpha1.Ready()) - r.recorder.Eventf(cr, corev1.EventTypeNormal, crName, "ready") - return ctrl.Result{}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) -} - -func (r *reconciler) handleError(ctx context.Context, cr *extcommbev1alpha1.EXTCOMMClaim, msg string, err error) { - log := log.FromContext(ctx) - if err == nil { - cr.SetConditions(conditionv1alpha1.Failed(msg)) - log.Error(msg) - r.recorder.Eventf(cr, corev1.EventTypeWarning, crName, msg) - } else { - cr.SetConditions(conditionv1alpha1.Failed(err.Error())) - log.Error(msg, "error", err) - r.recorder.Eventf(cr, corev1.EventTypeWarning, crName, fmt.Sprintf("%s, err: %s", msg, err.Error())) - } -} diff --git a/pkg/reconcilers/extcommindex/reconciler.go b/pkg/reconcilers/extcommindex/reconciler.go deleted file mode 100644 index 6803aa8..0000000 --- a/pkg/reconcilers/extcommindex/reconciler.go +++ /dev/null @@ -1,203 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 extcommindex - -import ( - "context" - "fmt" - "reflect" - - "github.com/henderiw/logger/log" - extcommbev1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - "github.com/kuidio/kuid/pkg/backend/backend" - "github.com/kuidio/kuid/pkg/reconcilers" - "github.com/kuidio/kuid/pkg/reconcilers/ctrlconfig" - "github.com/kuidio/kuid/pkg/reconcilers/eventhandler" - "github.com/kuidio/kuid/pkg/reconcilers/resource" - "github.com/pkg/errors" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/client-go/tools/record" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/event" -) - -func init() { - reconcilers.Register("extcommindex", &reconciler{}) -} - -const ( - crName = "extcommindex" - controllerName = "EXTCOMMIndexController" - finalizer = "extcommindex.extcomm.res.kuid.dev/finalizer" - // errors - errGetCr = "cannot get cr" - errUpdateStatus = "cannot update status" -) - -// SetupWithManager sets up the controller with the Manager. -func (r *reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, c interface{}) (map[schema.GroupVersionKind]chan event.GenericEvent, error) { - - cfg, ok := c.(*ctrlconfig.ControllerConfig) - if !ok { - return nil, fmt.Errorf("cannot initialize, expecting controllerConfig, got: %s", reflect.TypeOf(c).Name()) - } - - r.Client = mgr.GetClient() - r.finalizer = resource.NewAPIFinalizer(mgr.GetClient(), finalizer) - r.recorder = mgr.GetEventRecorderFor(controllerName) - r.be = cfg.EXTCOMMBackend - - return nil, ctrl.NewControllerManagedBy(mgr). - Named(controllerName). - For(&extcommbev1alpha1.EXTCOMMIndex{}). - Watches(&extcommbev1alpha1.EXTCOMMIndex{}, - &eventhandler.IPEntryEventHandler{ - Client: mgr.GetClient(), - ObjList: &extcommbev1alpha1.EXTCOMMIndexList{}, - }). - Complete(r) -} - -type reconciler struct { - client.Client - finalizer *resource.APIFinalizer - recorder record.EventRecorder - be backend.Backend -} - -func (r *reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - ctx = ctrlconfig.InitContext(ctx, controllerName, req.NamespacedName) - log := log.FromContext(ctx) - log.Info("reconcile") - - cr := &extcommbev1alpha1.EXTCOMMIndex{} - if err := r.Get(ctx, req.NamespacedName, cr); err != nil { - // if the resource no longer exists the reconcile loop is done - if resource.IgnoreNotFound(err) != nil { - log.Error(errGetCr, "error", err) - return ctrl.Result{}, errors.Wrap(resource.IgnoreNotFound(err), errGetCr) - } - return ctrl.Result{}, nil - } - cr = cr.DeepCopy() - - if !cr.GetDeletionTimestamp().IsZero() { - if err := r.deleteIndex(ctx, cr); err != nil { - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - - if err := r.finalizer.RemoveFinalizer(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot remove finalizer", err) - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - log.Debug("Successfully deleted resource") - return ctrl.Result{}, nil - } - - if err := r.finalizer.AddFinalizer(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot add finalizer", err) - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - - if r.hasMinMaxRangeChanged(cr) { - // delete index - if err := r.deleteIndex(ctx, cr); err != nil { - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - } - // create index - if err := r.applyIndex(ctx, cr); err != nil { - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - - if err := r.applyMinMaxRange(ctx, cr); err != nil { - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - - cr.SetConditions(conditionv1alpha1.Ready()) - cr.Status.MinID = cr.Spec.MinID - cr.Status.MaxID = cr.Spec.MaxID - r.recorder.Eventf(cr, corev1.EventTypeNormal, crName, "ready") - return ctrl.Result{}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) -} - -func (r *reconciler) handleError(ctx context.Context, cr *extcommbev1alpha1.EXTCOMMIndex, msg string, err error) { - log := log.FromContext(ctx) - if err == nil { - cr.SetConditions(conditionv1alpha1.Failed(msg)) - log.Error(msg) - r.recorder.Eventf(cr, corev1.EventTypeWarning, crName, msg) - } else { - cr.SetConditions(conditionv1alpha1.Failed(err.Error())) - log.Error(msg, "error", err) - r.recorder.Eventf(cr, corev1.EventTypeWarning, crName, fmt.Sprintf("%s, err: %s", msg, err.Error())) - } -} - -func (r *reconciler) deleteIndex(ctx context.Context, cr *extcommbev1alpha1.EXTCOMMIndex) error { - if err := r.be.DeleteIndex(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot delete index", err) - return err - } - return nil -} - -func (r *reconciler) applyIndex(ctx context.Context, cr *extcommbev1alpha1.EXTCOMMIndex) error { - if err := r.be.CreateIndex(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot create index", err) - return err - } - return nil -} - -func (r *reconciler) hasMinMaxRangeChanged(cr *extcommbev1alpha1.EXTCOMMIndex) bool { - return changed(cr.Status.MinID, cr.Spec.MinID) || changed(cr.Status.MaxID, cr.Spec.MaxID) -} - -func changed(status, spec *int64) bool { - if status != nil { - if spec == nil { - return true - } else { - if *status != *spec { - return true - } - } - } - return false -} - -func (r *reconciler) applyMinMaxRange(ctx context.Context, cr *extcommbev1alpha1.EXTCOMMIndex) error { - if cr.Spec.MinID != nil && *cr.Spec.MinID != extcommbev1alpha1.EXTCOMMID_Min { - claim := cr.GetMinClaim() - if err := r.be.Claim(ctx, claim); err != nil { - r.handleError(ctx, cr, "cannot claim min reserved range", err) - return err - } - } - if cr.Spec.MaxID != nil && *cr.Spec.MaxID != extcommbev1alpha1.EXTCOMMID_MaxValue[extcommbev1alpha1.GetExtendedCommunityType(cr.Spec.Type)] { - claim := cr.GetMaxClaim() - if err := r.be.Claim(ctx, claim); err != nil { - r.handleError(ctx, cr, "cannot claim max reserved range", err) - return err - } - } - return nil -} diff --git a/pkg/reconcilers/genidclaim/reconciler.go b/pkg/reconcilers/genidclaim/reconciler.go deleted file mode 100644 index a31e0fe..0000000 --- a/pkg/reconcilers/genidclaim/reconciler.go +++ /dev/null @@ -1,149 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 genidclaim - -import ( - "context" - "fmt" - "reflect" - "strings" - "time" - - "github.com/henderiw/logger/log" - genidbev1alpha1 "github.com/kuidio/kuid/apis/backend/genid/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - "github.com/kuidio/kuid/pkg/backend/backend" - "github.com/kuidio/kuid/pkg/reconcilers" - "github.com/kuidio/kuid/pkg/reconcilers/ctrlconfig" - "github.com/kuidio/kuid/pkg/reconcilers/eventhandler" - "github.com/kuidio/kuid/pkg/reconcilers/resource" - "github.com/pkg/errors" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/client-go/tools/record" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/event" -) - -func init() { - reconcilers.Register("genidclaim", &reconciler{}) -} - -const ( - crName = "genidClaim" - controllerName = "GENIDClaimController" - finalizer = "genidclaim.genid.be.kuid.dev/finalizer" - // errors - errGetCr = "cannot get cr" - errUpdateStatus = "cannot update status" -) - -// SetupWithManager sets up the controller with the Manager. -func (r *reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, c interface{}) (map[schema.GroupVersionKind]chan event.GenericEvent, error) { - cfg, ok := c.(*ctrlconfig.ControllerConfig) - if !ok { - return nil, fmt.Errorf("cannot initialize, expecting controllerConfig, got: %s", reflect.TypeOf(c).Name()) - } - - r.Client = mgr.GetClient() - r.finalizer = resource.NewAPIFinalizer(mgr.GetClient(), finalizer) - r.recorder = mgr.GetEventRecorderFor(controllerName) - r.be = cfg.GENIDBackend - - return nil, ctrl.NewControllerManagedBy(mgr). - Named(controllerName). - For(&genidbev1alpha1.GENIDClaim{}). - Watches(&genidbev1alpha1.GENIDEntry{}, - &eventhandler.GENIDEntryEventHandler{ - Client: mgr.GetClient(), - ObjList: &genidbev1alpha1.GENIDClaimList{}, - }). - Complete(r) -} - -type reconciler struct { - client.Client - finalizer *resource.APIFinalizer - recorder record.EventRecorder - be backend.Backend -} - -func (r *reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - ctx = ctrlconfig.InitContext(ctx, controllerName, req.NamespacedName) - log := log.FromContext(ctx) - log.Info("reconcile") - - cr := &genidbev1alpha1.GENIDClaim{} - if err := r.Get(ctx, req.NamespacedName, cr); err != nil { - // if the resource no longer exists the reconcile loop is done - if resource.IgnoreNotFound(err) != nil { - log.Error(errGetCr, "error", err) - return ctrl.Result{}, errors.Wrap(resource.IgnoreNotFound(err), errGetCr) - } - return ctrl.Result{}, nil - } - cr = cr.DeepCopy() - - if !cr.GetDeletionTimestamp().IsZero() { - if err := r.be.Release(ctx, cr); err != nil { - if !strings.Contains(err.Error(), "not initialized") { - r.handleError(ctx, cr, "cannot delete claim", err) - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - } - - if err := r.finalizer.RemoveFinalizer(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot remove finalizer", err) - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - log.Debug("Successfully deleted resource") - return ctrl.Result{}, nil - } - - if err := r.finalizer.AddFinalizer(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot add finalizer", err) - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - - if err := r.be.Claim(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot claim resource", err) - - if strings.Contains(err.Error(), "reserved range") { - // a user need to intervene to recover - return ctrl.Result{}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - return ctrl.Result{RequeueAfter: 5 * time.Second}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - - cr.SetConditions(conditionv1alpha1.Ready()) - r.recorder.Eventf(cr, corev1.EventTypeNormal, crName, "ready") - return ctrl.Result{}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) -} - -func (r *reconciler) handleError(ctx context.Context, cr *genidbev1alpha1.GENIDClaim, msg string, err error) { - log := log.FromContext(ctx) - if err == nil { - cr.SetConditions(conditionv1alpha1.Failed(msg)) - log.Error(msg) - r.recorder.Eventf(cr, corev1.EventTypeWarning, crName, msg) - } else { - cr.SetConditions(conditionv1alpha1.Failed(err.Error())) - log.Error(msg, "error", err) - r.recorder.Eventf(cr, corev1.EventTypeWarning, crName, fmt.Sprintf("%s, err: %s", msg, err.Error())) - } -} diff --git a/pkg/reconcilers/genidindex/reconciler.go b/pkg/reconcilers/genidindex/reconciler.go deleted file mode 100644 index de93be5..0000000 --- a/pkg/reconcilers/genidindex/reconciler.go +++ /dev/null @@ -1,203 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 genidindex - -import ( - "context" - "fmt" - "reflect" - - "github.com/henderiw/logger/log" - genidbev1alpha1 "github.com/kuidio/kuid/apis/backend/genid/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - "github.com/kuidio/kuid/pkg/backend/backend" - "github.com/kuidio/kuid/pkg/reconcilers" - "github.com/kuidio/kuid/pkg/reconcilers/ctrlconfig" - "github.com/kuidio/kuid/pkg/reconcilers/eventhandler" - "github.com/kuidio/kuid/pkg/reconcilers/resource" - "github.com/pkg/errors" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/client-go/tools/record" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/event" -) - -func init() { - reconcilers.Register("genidindex", &reconciler{}) -} - -const ( - crName = "genidindex" - controllerName = "GENIDIndexController" - finalizer = "genidindex.genid.res.kuid.dev/finalizer" - // errors - errGetCr = "cannot get cr" - errUpdateStatus = "cannot update status" -) - -// SetupWithManager sets up the controller with the Manager. -func (r *reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, c interface{}) (map[schema.GroupVersionKind]chan event.GenericEvent, error) { - - cfg, ok := c.(*ctrlconfig.ControllerConfig) - if !ok { - return nil, fmt.Errorf("cannot initialize, expecting controllerConfig, got: %s", reflect.TypeOf(c).Name()) - } - - r.Client = mgr.GetClient() - r.finalizer = resource.NewAPIFinalizer(mgr.GetClient(), finalizer) - r.recorder = mgr.GetEventRecorderFor(controllerName) - r.be = cfg.GENIDBackend - - return nil, ctrl.NewControllerManagedBy(mgr). - Named(controllerName). - For(&genidbev1alpha1.GENIDIndex{}). - Watches(&genidbev1alpha1.GENIDIndex{}, - &eventhandler.GENIDEntryEventHandler{ - Client: mgr.GetClient(), - ObjList: &genidbev1alpha1.GENIDIndexList{}, - }). - Complete(r) -} - -type reconciler struct { - client.Client - finalizer *resource.APIFinalizer - recorder record.EventRecorder - be backend.Backend -} - -func (r *reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - ctx = ctrlconfig.InitContext(ctx, controllerName, req.NamespacedName) - log := log.FromContext(ctx) - log.Info("reconcile") - - cr := &genidbev1alpha1.GENIDIndex{} - if err := r.Get(ctx, req.NamespacedName, cr); err != nil { - // if the resource no longer exists the reconcile loop is done - if resource.IgnoreNotFound(err) != nil { - log.Error(errGetCr, "error", err) - return ctrl.Result{}, errors.Wrap(resource.IgnoreNotFound(err), errGetCr) - } - return ctrl.Result{}, nil - } - cr = cr.DeepCopy() - - if !cr.GetDeletionTimestamp().IsZero() { - if err := r.deleteIndex(ctx, cr); err != nil { - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - - if err := r.finalizer.RemoveFinalizer(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot remove finalizer", err) - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - log.Debug("Successfully deleted resource") - return ctrl.Result{}, nil - } - - if err := r.finalizer.AddFinalizer(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot add finalizer", err) - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - - if r.hasMinMaxRangeChanged(cr) { - // delete index - if err := r.deleteIndex(ctx, cr); err != nil { - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - } - // create index - if err := r.applyIndex(ctx, cr); err != nil { - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - - if err := r.applyMinMaxRange(ctx, cr); err != nil { - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - - cr.SetConditions(conditionv1alpha1.Ready()) - cr.Status.MinID = cr.Spec.MinID - cr.Status.MaxID = cr.Spec.MaxID - r.recorder.Eventf(cr, corev1.EventTypeNormal, crName, "ready") - return ctrl.Result{}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) -} - -func (r *reconciler) handleError(ctx context.Context, cr *genidbev1alpha1.GENIDIndex, msg string, err error) { - log := log.FromContext(ctx) - if err == nil { - cr.SetConditions(conditionv1alpha1.Failed(msg)) - log.Error(msg) - r.recorder.Eventf(cr, corev1.EventTypeWarning, crName, msg) - } else { - cr.SetConditions(conditionv1alpha1.Failed(err.Error())) - log.Error(msg, "error", err) - r.recorder.Eventf(cr, corev1.EventTypeWarning, crName, fmt.Sprintf("%s, err: %s", msg, err.Error())) - } -} - -func (r *reconciler) deleteIndex(ctx context.Context, cr *genidbev1alpha1.GENIDIndex) error { - if err := r.be.DeleteIndex(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot delete index", err) - return err - } - return nil -} - -func (r *reconciler) applyIndex(ctx context.Context, cr *genidbev1alpha1.GENIDIndex) error { - if err := r.be.CreateIndex(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot create index", err) - return err - } - return nil -} - -func (r *reconciler) hasMinMaxRangeChanged(cr *genidbev1alpha1.GENIDIndex) bool { - return changed(cr.Status.MinID, cr.Spec.MinID) || changed(cr.Status.MaxID, cr.Spec.MaxID) -} - -func changed(status, spec *int64) bool { - if status != nil { - if spec == nil { - return true - } else { - if *status != *spec { - return true - } - } - } - return false -} - -func (r *reconciler) applyMinMaxRange(ctx context.Context, cr *genidbev1alpha1.GENIDIndex) error { - if cr.Spec.MinID != nil && *cr.Spec.MinID != genidbev1alpha1.GENIDID_Min { - claim := cr.GetMinClaim() - if err := r.be.Claim(ctx, claim); err != nil { - r.handleError(ctx, cr, "cannot claim min reserved range", err) - return err - } - } - if cr.Spec.MaxID != nil && *cr.Spec.MaxID != genidbev1alpha1.GENIDID_MaxValue[genidbev1alpha1.GetGenIDType(cr.Spec.Type)] { - claim := cr.GetMaxClaim() - if err := r.be.Claim(ctx, claim); err != nil { - r.handleError(ctx, cr, "cannot claim max reserved range", err) - return err - } - } - return nil -} diff --git a/pkg/reconcilers/ipclaim/reconciler.go b/pkg/reconcilers/ipclaim/reconciler.go deleted file mode 100644 index bfded47..0000000 --- a/pkg/reconcilers/ipclaim/reconciler.go +++ /dev/null @@ -1,147 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 ipclaim - -import ( - "context" - "fmt" - "reflect" - "strings" - "time" - - "github.com/henderiw/logger/log" - ipambev1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - "github.com/kuidio/kuid/pkg/backend/backend" - "github.com/kuidio/kuid/pkg/reconcilers" - "github.com/kuidio/kuid/pkg/reconcilers/ctrlconfig" - "github.com/kuidio/kuid/pkg/reconcilers/eventhandler" - "github.com/kuidio/kuid/pkg/reconcilers/resource" - "github.com/pkg/errors" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/client-go/tools/record" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/event" -) - -func init() { - reconcilers.Register("ipclaim", &reconciler{}) -} - -const ( - crName = "ipClaim" - controllerName = "IPClaimController" - finalizer = "ipclaim.ipam.be.kuid.dev/finalizer" - // errors - errGetCr = "cannot get cr" - errUpdateStatus = "cannot update status" -) - -//+kubebuilder:rbac:groups=ipclaim.ipam.be.kuid.dev,resources=ipclaims,verbs=get;list;watch;create;update;patch;delete -//+kubebuilder:rbac:groups=ipclaim.ipam.be.kuid.dev,resources=ipclaims/status,verbs=get;update;patch - -// SetupWithManager sets up the controller with the Manager. -func (r *reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, c interface{}) (map[schema.GroupVersionKind]chan event.GenericEvent, error) { - cfg, ok := c.(*ctrlconfig.ControllerConfig) - if !ok { - return nil, fmt.Errorf("cannot initialize, expecting controllerConfig, got: %s", reflect.TypeOf(c).Name()) - } - - r.Client = mgr.GetClient() - r.finalizer = resource.NewAPIFinalizer(mgr.GetClient(), finalizer) - r.recorder = mgr.GetEventRecorderFor(controllerName) - r.be = cfg.IPAMBackend - - return nil, ctrl.NewControllerManagedBy(mgr). - Named(controllerName). - For(&ipambev1alpha1.IPClaim{}). - Watches(&ipambev1alpha1.IPEntry{}, - &eventhandler.IPEntryEventHandler{ - Client: mgr.GetClient(), - ObjList: &ipambev1alpha1.IPClaimList{}, - }). - Complete(r) -} - -type reconciler struct { - client.Client - finalizer *resource.APIFinalizer - recorder record.EventRecorder - be backend.Backend -} - -func (r *reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - ctx = ctrlconfig.InitContext(ctx, controllerName, req.NamespacedName) - log := log.FromContext(ctx) - log.Info("reconcile") - - cr := &ipambev1alpha1.IPClaim{} - if err := r.Get(ctx, req.NamespacedName, cr); err != nil { - // if the resource no longer exists the reconcile loop is done - if resource.IgnoreNotFound(err) != nil { - log.Error(errGetCr, "error", err) - return ctrl.Result{}, errors.Wrap(resource.IgnoreNotFound(err), errGetCr) - } - return ctrl.Result{}, nil - } - cr = cr.DeepCopy() - - if !cr.GetDeletionTimestamp().IsZero() { - if err := r.be.Release(ctx, cr); err != nil { - if !strings.Contains(err.Error(), "not initialized") { - r.handleError(ctx, cr, "cannot delete ipclaim", err) - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - } - - if err := r.finalizer.RemoveFinalizer(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot remove finalizer", err) - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - log.Debug("Successfully deleted resource") - return ctrl.Result{}, nil - } - - if err := r.finalizer.AddFinalizer(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot add finalizer", err) - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - - if err := r.be.Claim(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot claim ip", err) - return ctrl.Result{RequeueAfter: 5 * time.Second}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - - cr.SetConditions(conditionv1alpha1.Ready()) - r.recorder.Eventf(cr, corev1.EventTypeNormal, crName, "ready") - return ctrl.Result{}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) -} - -func (r *reconciler) handleError(ctx context.Context, cr *ipambev1alpha1.IPClaim, msg string, err error) { - log := log.FromContext(ctx) - if err == nil { - cr.SetConditions(conditionv1alpha1.Failed(msg)) - log.Error(msg) - r.recorder.Eventf(cr, corev1.EventTypeWarning, crName, msg) - } else { - cr.SetConditions(conditionv1alpha1.Failed(err.Error())) - log.Error(msg, "error", err) - r.recorder.Eventf(cr, corev1.EventTypeWarning, crName, fmt.Sprintf("%s, err: %s", msg, err.Error())) - } -} diff --git a/pkg/reconcilers/ipindex/reconciler.go b/pkg/reconcilers/ipindex/reconciler.go deleted file mode 100644 index c4824a8..0000000 --- a/pkg/reconcilers/ipindex/reconciler.go +++ /dev/null @@ -1,224 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 ipindex - -import ( - "context" - "fmt" - "reflect" - "strings" - "time" - - "github.com/henderiw/logger/log" - ipambev1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - "github.com/kuidio/kuid/pkg/backend/backend" - "github.com/kuidio/kuid/pkg/reconcilers" - "github.com/kuidio/kuid/pkg/reconcilers/ctrlconfig" - "github.com/kuidio/kuid/pkg/reconcilers/eventhandler" - "github.com/kuidio/kuid/pkg/reconcilers/resource" - "github.com/pkg/errors" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/client-go/tools/record" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/event" -) - -func init() { - reconcilers.Register("ipindex", &reconciler{}) -} - -const ( - crName = "ipindex" - controllerName = "IPIndexController" - finalizer = "ipindex.ipam.res.kuid.dev/finalizer" - // errors - errGetCr = "cannot get cr" - errUpdateStatus = "cannot update status" -) - -// SetupWithManager sets up the controller with the Manager. -func (r *reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, c interface{}) (map[schema.GroupVersionKind]chan event.GenericEvent, error) { - - cfg, ok := c.(*ctrlconfig.ControllerConfig) - if !ok { - return nil, fmt.Errorf("cannot initialize, expecting controllerConfig, got: %s", reflect.TypeOf(c).Name()) - } - - r.Client = mgr.GetClient() - r.finalizer = resource.NewAPIFinalizer(mgr.GetClient(), finalizer) - r.recorder = mgr.GetEventRecorderFor(controllerName) - r.be = cfg.IPAMBackend - - return nil, ctrl.NewControllerManagedBy(mgr). - Named(controllerName). - For(&ipambev1alpha1.IPIndex{}). - Watches(&ipambev1alpha1.IPEntry{}, - &eventhandler.IPEntryEventHandler{ - Client: mgr.GetClient(), - ObjList: &ipambev1alpha1.IPIndexList{}, - }). - Complete(r) -} - -type reconciler struct { - client.Client - finalizer *resource.APIFinalizer - recorder record.EventRecorder - be backend.Backend -} - -func (r *reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - ctx = ctrlconfig.InitContext(ctx, controllerName, req.NamespacedName) - log := log.FromContext(ctx) - log.Info("reconcile") - - cr := &ipambev1alpha1.IPIndex{} - if err := r.Get(ctx, req.NamespacedName, cr); err != nil { - // if the resource no longer exists the reconcile loop is done - if resource.IgnoreNotFound(err) != nil { - log.Error(errGetCr, "error", err) - return ctrl.Result{}, errors.Wrap(resource.IgnoreNotFound(err), errGetCr) - } - return ctrl.Result{}, nil - } - cr = cr.DeepCopy() - - if !cr.GetDeletionTimestamp().IsZero() { - // if prefixes are provided from the network instance we treat them as - // aggregate prefixes. - for _, prefix := range cr.Spec.Prefixes { - if err := r.deleteIPClaim(ctx, cr, prefix); err != nil { - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - } - if err := r.deleteIndex(ctx, cr); err != nil { - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - - if err := r.finalizer.RemoveFinalizer(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot remove finalizer", err) - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - log.Debug("Successfully deleted resource") - return ctrl.Result{}, nil - } - - if err := r.finalizer.AddFinalizer(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot add finalizer", err) - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - - // create ip index - if err := r.applyIndex(ctx, cr); err != nil { - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - - // first validate if the previously claimed prefixes are still needed - // if not delete them - for _, claimedPrefix := range cr.Status.Prefixes { - found := false - for _, prefix := range cr.Spec.Prefixes { - if claimedPrefix.Prefix == prefix.Prefix { - found = true - break - } - } - if !found { - if err := r.deleteIPClaim(ctx, cr, claimedPrefix); err != nil { - return ctrl.Result{RequeueAfter: 1 * time.Second}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - } - } - // if prefixes are provided from the network instance we treat them as - // aggregate prefixes. - for _, prefix := range cr.Spec.Prefixes { - prefix := prefix - if err := r.applyIPClaim(ctx, cr, prefix); err != nil { - return ctrl.Result{RequeueAfter: 1 * time.Second}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - } - - cr.SetConditions(conditionv1alpha1.Ready()) - r.recorder.Eventf(cr, corev1.EventTypeNormal, crName, "ready") - return ctrl.Result{}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) -} - -func (r *reconciler) handleError(ctx context.Context, cr *ipambev1alpha1.IPIndex, msg string, err error) { - log := log.FromContext(ctx) - if err == nil { - cr.SetConditions(conditionv1alpha1.Failed(msg)) - log.Error(msg) - r.recorder.Eventf(cr, corev1.EventTypeWarning, crName, msg) - } else { - cr.SetConditions(conditionv1alpha1.Failed(err.Error())) - log.Error(msg, "error", err) - r.recorder.Eventf(cr, corev1.EventTypeWarning, crName, fmt.Sprintf("%s, err: %s", msg, err.Error())) - } -} - -func (r *reconciler) deleteIndex(ctx context.Context, cr *ipambev1alpha1.IPIndex) error { - if err := r.be.DeleteIndex(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot delete index", err) - return err - } - return nil -} - -func (r *reconciler) applyIndex(ctx context.Context, cr *ipambev1alpha1.IPIndex) error { - if err := r.be.CreateIndex(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot create index", err) - return err - } - return nil -} - -func (r *reconciler) applyIPClaim(ctx context.Context, cr *ipambev1alpha1.IPIndex, prefix ipambev1alpha1.Prefix) error { - ipclaim, err := cr.GetClaim(prefix) - if err != nil { // strange if this happens since the prefix was already processed - r.handleError(ctx, cr, "build ipclaim", err) - return err - } - if err := r.be.Claim(ctx, ipclaim); err != nil { - r.handleError(ctx, cr, "cannot claim ip", err) - return err - } - if ipclaim.Status.Prefix == nil || *ipclaim.Status.Prefix != prefix.Prefix { - //we got a different prefix than requested one - msg := fmt.Sprintf("ip prefix not ready: req/rsp %s/%v", prefix.Prefix, ipclaim.Status.Prefix) - r.handleError(ctx, cr, msg, nil) - return err - } - return nil -} - -func (r *reconciler) deleteIPClaim(ctx context.Context, cr *ipambev1alpha1.IPIndex, prefix ipambev1alpha1.Prefix) error { - //ipclaim, err := buildIPClaim(ctx, cr, prefix) - ipclaim, err := cr.GetClaim(prefix) - if err != nil { // strange if this happens since the prefix was already processed - r.handleError(ctx, cr, "cannot build ipclaim", err) - return err - } - if err := r.be.Release(ctx, ipclaim); err != nil { - if !strings.Contains(err.Error(), "not initialized") { - r.handleError(ctx, cr, "cannot delete ipclaim", err) - } - } - return nil -} diff --git a/pkg/reconcilers/vlanclaim/reconciler.go b/pkg/reconcilers/vlanclaim/reconciler.go deleted file mode 100644 index 993a132..0000000 --- a/pkg/reconcilers/vlanclaim/reconciler.go +++ /dev/null @@ -1,151 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 vlanclaim - -import ( - "context" - "fmt" - "reflect" - "strings" - "time" - - "github.com/henderiw/logger/log" - vlanbev1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - "github.com/kuidio/kuid/pkg/backend/backend" - "github.com/kuidio/kuid/pkg/reconcilers" - "github.com/kuidio/kuid/pkg/reconcilers/ctrlconfig" - "github.com/kuidio/kuid/pkg/reconcilers/eventhandler" - "github.com/kuidio/kuid/pkg/reconcilers/resource" - "github.com/pkg/errors" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/client-go/tools/record" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/event" -) - -func init() { - reconcilers.Register("vlanclaim", &reconciler{}) -} - -const ( - crName = "vlanClaim" - controllerName = "VLANClaimController" - finalizer = "vlanclaim.vlan.be.kuid.dev/finalizer" - // errors - errGetCr = "cannot get cr" - errUpdateStatus = "cannot update status" -) - -//+kubebuilder:rbac:groups=vlanclaim.vlan.be.kuid.dev,resources=vlanclaims,verbs=get;list;watch;create;update;patch;delete -//+kubebuilder:rbac:groups=vlanclaim.vlan.be.kuid.dev,resources=vlanclaims/status,verbs=get;update;patch - -// SetupWithManager sets up the controller with the Manager. -func (r *reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, c interface{}) (map[schema.GroupVersionKind]chan event.GenericEvent, error) { - cfg, ok := c.(*ctrlconfig.ControllerConfig) - if !ok { - return nil, fmt.Errorf("cannot initialize, expecting controllerConfig, got: %s", reflect.TypeOf(c).Name()) - } - - r.Client = mgr.GetClient() - r.finalizer = resource.NewAPIFinalizer(mgr.GetClient(), finalizer) - r.recorder = mgr.GetEventRecorderFor(controllerName) - r.be = cfg.VLANBackend - - return nil, ctrl.NewControllerManagedBy(mgr). - Named(controllerName). - For(&vlanbev1alpha1.VLANClaim{}). - Watches(&vlanbev1alpha1.VLANEntry{}, - &eventhandler.VLANEntryEventHandler{ - Client: mgr.GetClient(), - ObjList: &vlanbev1alpha1.VLANClaimList{}, - }). - Complete(r) -} - -type reconciler struct { - client.Client - finalizer *resource.APIFinalizer - recorder record.EventRecorder - be backend.Backend -} - -func (r *reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - ctx = ctrlconfig.InitContext(ctx, controllerName, req.NamespacedName) - log := log.FromContext(ctx) - log.Info("reconcile") - - cr := &vlanbev1alpha1.VLANClaim{} - if err := r.Get(ctx, req.NamespacedName, cr); err != nil { - // if the resource no longer exists the reconcile loop is done - if resource.IgnoreNotFound(err) != nil { - log.Error(errGetCr, "error", err) - return ctrl.Result{}, errors.Wrap(resource.IgnoreNotFound(err), errGetCr) - } - return ctrl.Result{}, nil - } - cr = cr.DeepCopy() - - if !cr.GetDeletionTimestamp().IsZero() { - if err := r.be.Release(ctx, cr); err != nil { - if !strings.Contains(err.Error(), "not initialized") { - r.handleError(ctx, cr, "cannot delete claim", err) - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - } - - if err := r.finalizer.RemoveFinalizer(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot remove finalizer", err) - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - log.Debug("Successfully deleted resource") - return ctrl.Result{}, nil - } - - if err := r.finalizer.AddFinalizer(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot add finalizer", err) - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - - if err := r.be.Claim(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot claim resource", err) - if strings.Contains(err.Error(), "reserved range") { - // a user need to intervene to recover - return ctrl.Result{}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - return ctrl.Result{RequeueAfter: 5 * time.Second}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - - cr.SetConditions(conditionv1alpha1.Ready()) - r.recorder.Eventf(cr, corev1.EventTypeNormal, crName, "ready") - return ctrl.Result{}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) -} - -func (r *reconciler) handleError(ctx context.Context, cr *vlanbev1alpha1.VLANClaim, msg string, err error) { - log := log.FromContext(ctx) - if err == nil { - cr.SetConditions(conditionv1alpha1.Failed(msg)) - log.Error(msg) - r.recorder.Eventf(cr, corev1.EventTypeWarning, crName, msg) - } else { - cr.SetConditions(conditionv1alpha1.Failed(err.Error())) - log.Error(msg, "error", err) - r.recorder.Eventf(cr, corev1.EventTypeWarning, crName, fmt.Sprintf("%s, err: %s", msg, err.Error())) - } -} diff --git a/pkg/reconcilers/vlanindex/reconciler.go b/pkg/reconcilers/vlanindex/reconciler.go deleted file mode 100644 index 1581523..0000000 --- a/pkg/reconcilers/vlanindex/reconciler.go +++ /dev/null @@ -1,206 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 vlanindex - -import ( - "context" - "fmt" - "reflect" - - "github.com/henderiw/logger/log" - vlanbev1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - "github.com/kuidio/kuid/pkg/backend/backend" - "github.com/kuidio/kuid/pkg/reconcilers" - "github.com/kuidio/kuid/pkg/reconcilers/ctrlconfig" - "github.com/kuidio/kuid/pkg/reconcilers/eventhandler" - "github.com/kuidio/kuid/pkg/reconcilers/resource" - "github.com/pkg/errors" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/client-go/tools/record" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/event" -) - -func init() { - reconcilers.Register("vlanindex", &reconciler{}) -} - -const ( - crName = "vlanindex" - controllerName = "VLANIndexController" - finalizer = "vlanindex.vlan.res.kuid.dev/finalizer" - // errors - errGetCr = "cannot get cr" - errUpdateStatus = "cannot update status" -) - -//+kubebuilder:rbac:groups=vlanindex.vlan.res.kuid.dev,resources=vlanindices,verbs=get;list;watch;create;update;patch;delete -//+kubebuilder:rbac:groups=vlanindex.vlan.res.kuid.dev,resources=vlanindices/status,verbs=get;update;patch - -// SetupWithManager sets up the controller with the Manager. -func (r *reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, c interface{}) (map[schema.GroupVersionKind]chan event.GenericEvent, error) { - - cfg, ok := c.(*ctrlconfig.ControllerConfig) - if !ok { - return nil, fmt.Errorf("cannot initialize, expecting controllerConfig, got: %s", reflect.TypeOf(c).Name()) - } - - r.Client = mgr.GetClient() - r.finalizer = resource.NewAPIFinalizer(mgr.GetClient(), finalizer) - r.recorder = mgr.GetEventRecorderFor(controllerName) - r.be = cfg.VLANBackend - - return nil, ctrl.NewControllerManagedBy(mgr). - Named(controllerName). - For(&vlanbev1alpha1.VLANIndex{}). - Watches(&vlanbev1alpha1.VLANIndex{}, - &eventhandler.IPEntryEventHandler{ - Client: mgr.GetClient(), - ObjList: &vlanbev1alpha1.VLANIndexList{}, - }). - Complete(r) -} - -type reconciler struct { - client.Client - finalizer *resource.APIFinalizer - recorder record.EventRecorder - be backend.Backend -} - -func (r *reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - ctx = ctrlconfig.InitContext(ctx, controllerName, req.NamespacedName) - log := log.FromContext(ctx) - log.Info("reconcile") - - cr := &vlanbev1alpha1.VLANIndex{} - if err := r.Get(ctx, req.NamespacedName, cr); err != nil { - // if the resource no longer exists the reconcile loop is done - if resource.IgnoreNotFound(err) != nil { - log.Error(errGetCr, "error", err) - return ctrl.Result{}, errors.Wrap(resource.IgnoreNotFound(err), errGetCr) - } - return ctrl.Result{}, nil - } - cr = cr.DeepCopy() - - if !cr.GetDeletionTimestamp().IsZero() { - if err := r.deleteIndex(ctx, cr); err != nil { - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - - if err := r.finalizer.RemoveFinalizer(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot remove finalizer", err) - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - log.Debug("Successfully deleted resource") - return ctrl.Result{}, nil - } - - if err := r.finalizer.AddFinalizer(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot add finalizer", err) - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - - if r.hasMinMaxRangeChanged(cr) { - // delete index - if err := r.deleteIndex(ctx, cr); err != nil { - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - } - // create index - if err := r.applyIndex(ctx, cr); err != nil { - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - - if err := r.applyMinMaxRange(ctx, cr); err != nil { - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - - cr.SetConditions(conditionv1alpha1.Ready()) - cr.Status.MinID = cr.Spec.MinID - cr.Status.MaxID = cr.Spec.MaxID - r.recorder.Eventf(cr, corev1.EventTypeNormal, crName, "ready") - return ctrl.Result{}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) -} - -func (r *reconciler) handleError(ctx context.Context, cr *vlanbev1alpha1.VLANIndex, msg string, err error) { - log := log.FromContext(ctx) - if err == nil { - cr.SetConditions(conditionv1alpha1.Failed(msg)) - log.Error(msg) - r.recorder.Eventf(cr, corev1.EventTypeWarning, crName, msg) - } else { - cr.SetConditions(conditionv1alpha1.Failed(err.Error())) - log.Error(msg, "error", err) - r.recorder.Eventf(cr, corev1.EventTypeWarning, crName, fmt.Sprintf("%s, err: %s", msg, err.Error())) - } -} - -func (r *reconciler) deleteIndex(ctx context.Context, cr *vlanbev1alpha1.VLANIndex) error { - if err := r.be.DeleteIndex(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot delete index", err) - return err - } - return nil -} - -func (r *reconciler) applyIndex(ctx context.Context, cr *vlanbev1alpha1.VLANIndex) error { - if err := r.be.CreateIndex(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot create index", err) - return err - } - return nil -} - -func (r *reconciler) hasMinMaxRangeChanged(cr *vlanbev1alpha1.VLANIndex) bool { - return changed(cr.Status.MinID, cr.Spec.MinID) || changed(cr.Status.MaxID, cr.Spec.MaxID) -} - -func changed(status, spec *uint32) bool { - if status != nil { - if spec == nil { - return true - } else { - if *status != *spec { - return true - } - } - } - return false -} - -func (r *reconciler) applyMinMaxRange(ctx context.Context, cr *vlanbev1alpha1.VLANIndex) error { - if cr.Spec.MinID != nil && *cr.Spec.MinID != vlanbev1alpha1.VLANID_Min { - claim := cr.GetMinClaim() - if err := r.be.Claim(ctx, claim); err != nil { - r.handleError(ctx, cr, "cannot claim min reserved range", err) - return err - } - } - if cr.Spec.MaxID != nil && *cr.Spec.MaxID != vlanbev1alpha1.VLANID_Max { - claim := cr.GetMaxClaim() - if err := r.be.Claim(ctx, claim); err != nil { - r.handleError(ctx, cr, "cannot claim max reserved range", err) - return err - } - } - return nil -} \ No newline at end of file diff --git a/pkg/reconcilers/vxlanclaim/reconciler.go b/pkg/reconcilers/vxlanclaim/reconciler.go deleted file mode 100644 index 7d93802..0000000 --- a/pkg/reconcilers/vxlanclaim/reconciler.go +++ /dev/null @@ -1,149 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 vxlanclaim - -import ( - "context" - "fmt" - "reflect" - "strings" - "time" - - "github.com/henderiw/logger/log" - vxlanbev1alpha1 "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - "github.com/kuidio/kuid/pkg/backend/backend" - "github.com/kuidio/kuid/pkg/reconcilers" - "github.com/kuidio/kuid/pkg/reconcilers/ctrlconfig" - "github.com/kuidio/kuid/pkg/reconcilers/eventhandler" - "github.com/kuidio/kuid/pkg/reconcilers/resource" - "github.com/pkg/errors" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/client-go/tools/record" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/event" -) - -func init() { - reconcilers.Register("vxlanclaim", &reconciler{}) -} - -const ( - crName = "vxlanClaim" - controllerName = "VXLANClaimController" - finalizer = "vxlanclaim.vxlan.be.kuid.dev/finalizer" - // errors - errGetCr = "cannot get cr" - errUpdateStatus = "cannot update status" -) - -// SetupWithManager sets up the controller with the Manager. -func (r *reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, c interface{}) (map[schema.GroupVersionKind]chan event.GenericEvent, error) { - cfg, ok := c.(*ctrlconfig.ControllerConfig) - if !ok { - return nil, fmt.Errorf("cannot initialize, expecting controllerConfig, got: %s", reflect.TypeOf(c).Name()) - } - - r.Client = mgr.GetClient() - r.finalizer = resource.NewAPIFinalizer(mgr.GetClient(), finalizer) - r.recorder = mgr.GetEventRecorderFor(controllerName) - r.be = cfg.VXLANBackend - - return nil, ctrl.NewControllerManagedBy(mgr). - Named(controllerName). - For(&vxlanbev1alpha1.VXLANClaim{}). - Watches(&vxlanbev1alpha1.VXLANEntry{}, - &eventhandler.ASEntryEventHandler{ - Client: mgr.GetClient(), - ObjList: &vxlanbev1alpha1.VXLANClaimList{}, - }). - Complete(r) -} - -type reconciler struct { - client.Client - finalizer *resource.APIFinalizer - recorder record.EventRecorder - be backend.Backend -} - -func (r *reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - ctx = ctrlconfig.InitContext(ctx, controllerName, req.NamespacedName) - log := log.FromContext(ctx) - log.Info("reconcile") - - cr := &vxlanbev1alpha1.VXLANClaim{} - if err := r.Get(ctx, req.NamespacedName, cr); err != nil { - // if the resource no longer exists the reconcile loop is done - if resource.IgnoreNotFound(err) != nil { - log.Error(errGetCr, "error", err) - return ctrl.Result{}, errors.Wrap(resource.IgnoreNotFound(err), errGetCr) - } - return ctrl.Result{}, nil - } - cr = cr.DeepCopy() - - if !cr.GetDeletionTimestamp().IsZero() { - if err := r.be.Release(ctx, cr); err != nil { - if !strings.Contains(err.Error(), "not initialized") { - r.handleError(ctx, cr, "cannot delete claim", err) - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - } - - if err := r.finalizer.RemoveFinalizer(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot remove finalizer", err) - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - log.Debug("Successfully deleted resource") - return ctrl.Result{}, nil - } - - if err := r.finalizer.AddFinalizer(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot add finalizer", err) - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - - if err := r.be.Claim(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot claim vxlan", err) - - if strings.Contains(err.Error(), "reserved range") { - // a user need to intervene to recover - return ctrl.Result{}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - return ctrl.Result{RequeueAfter: 5 * time.Second}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - - cr.SetConditions(conditionv1alpha1.Ready()) - r.recorder.Eventf(cr, corev1.EventTypeNormal, crName, "ready") - return ctrl.Result{}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) -} - -func (r *reconciler) handleError(ctx context.Context, cr *vxlanbev1alpha1.VXLANClaim, msg string, err error) { - log := log.FromContext(ctx) - if err == nil { - cr.SetConditions(conditionv1alpha1.Failed(msg)) - log.Error(msg) - r.recorder.Eventf(cr, corev1.EventTypeWarning, crName, msg) - } else { - cr.SetConditions(conditionv1alpha1.Failed(err.Error())) - log.Error(msg, "error", err) - r.recorder.Eventf(cr, corev1.EventTypeWarning, crName, fmt.Sprintf("%s, err: %s", msg, err.Error())) - } -} diff --git a/pkg/reconcilers/vxlanindex/reconciler.go b/pkg/reconcilers/vxlanindex/reconciler.go deleted file mode 100644 index a109248..0000000 --- a/pkg/reconcilers/vxlanindex/reconciler.go +++ /dev/null @@ -1,203 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 vxlanindex - -import ( - "context" - "fmt" - "reflect" - - "github.com/henderiw/logger/log" - vxlanbev1alpha1 "github.com/kuidio/kuid/apis/backend/vxlan/v1alpha1" - conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" - "github.com/kuidio/kuid/pkg/backend/backend" - "github.com/kuidio/kuid/pkg/reconcilers" - "github.com/kuidio/kuid/pkg/reconcilers/ctrlconfig" - "github.com/kuidio/kuid/pkg/reconcilers/eventhandler" - "github.com/kuidio/kuid/pkg/reconcilers/resource" - "github.com/pkg/errors" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/client-go/tools/record" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/event" -) - -func init() { - reconcilers.Register("vxlanindex", &reconciler{}) -} - -const ( - crName = "vxlanindex" - controllerName = "VXLANIndexController" - finalizer = "vxlanindex.vxlan.res.kuid.dev/finalizer" - // errors - errGetCr = "cannot get cr" - errUpdateStatus = "cannot update status" -) - -// SetupWithManager sets up the controller with the Manager. -func (r *reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, c interface{}) (map[schema.GroupVersionKind]chan event.GenericEvent, error) { - - cfg, ok := c.(*ctrlconfig.ControllerConfig) - if !ok { - return nil, fmt.Errorf("cannot initialize, expecting controllerConfig, got: %s", reflect.TypeOf(c).Name()) - } - - r.Client = mgr.GetClient() - r.finalizer = resource.NewAPIFinalizer(mgr.GetClient(), finalizer) - r.recorder = mgr.GetEventRecorderFor(controllerName) - r.be = cfg.VXLANBackend - - return nil, ctrl.NewControllerManagedBy(mgr). - Named(controllerName). - For(&vxlanbev1alpha1.VXLANIndex{}). - Watches(&vxlanbev1alpha1.VXLANIndex{}, - &eventhandler.IPEntryEventHandler{ - Client: mgr.GetClient(), - ObjList: &vxlanbev1alpha1.VXLANIndexList{}, - }). - Complete(r) -} - -type reconciler struct { - client.Client - finalizer *resource.APIFinalizer - recorder record.EventRecorder - be backend.Backend -} - -func (r *reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - ctx = ctrlconfig.InitContext(ctx, controllerName, req.NamespacedName) - log := log.FromContext(ctx) - log.Info("reconcile") - - cr := &vxlanbev1alpha1.VXLANIndex{} - if err := r.Get(ctx, req.NamespacedName, cr); err != nil { - // if the resource no longer exists the reconcile loop is done - if resource.IgnoreNotFound(err) != nil { - log.Error(errGetCr, "error", err) - return ctrl.Result{}, errors.Wrap(resource.IgnoreNotFound(err), errGetCr) - } - return ctrl.Result{}, nil - } - cr = cr.DeepCopy() - - if !cr.GetDeletionTimestamp().IsZero() { - if err := r.deleteIndex(ctx, cr); err != nil { - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - - if err := r.finalizer.RemoveFinalizer(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot remove finalizer", err) - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - log.Debug("Successfully deleted resource") - return ctrl.Result{}, nil - } - - if err := r.finalizer.AddFinalizer(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot add finalizer", err) - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - - if r.hasMinMaxRangeChanged(cr) { - // delete index - if err := r.deleteIndex(ctx, cr); err != nil { - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - } - // create index - if err := r.applyIndex(ctx, cr); err != nil { - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - - if err := r.applyMinMaxRange(ctx, cr); err != nil { - return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) - } - - cr.SetConditions(conditionv1alpha1.Ready()) - cr.Status.MinID = cr.Spec.MinID - cr.Status.MaxID = cr.Spec.MaxID - r.recorder.Eventf(cr, corev1.EventTypeNormal, crName, "ready") - return ctrl.Result{}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) -} - -func (r *reconciler) handleError(ctx context.Context, cr *vxlanbev1alpha1.VXLANIndex, msg string, err error) { - log := log.FromContext(ctx) - if err == nil { - cr.SetConditions(conditionv1alpha1.Failed(msg)) - log.Error(msg) - r.recorder.Eventf(cr, corev1.EventTypeWarning, crName, msg) - } else { - cr.SetConditions(conditionv1alpha1.Failed(err.Error())) - log.Error(msg, "error", err) - r.recorder.Eventf(cr, corev1.EventTypeWarning, crName, fmt.Sprintf("%s, err: %s", msg, err.Error())) - } -} - -func (r *reconciler) deleteIndex(ctx context.Context, cr *vxlanbev1alpha1.VXLANIndex) error { - if err := r.be.DeleteIndex(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot delete index", err) - return err - } - return nil -} - -func (r *reconciler) applyIndex(ctx context.Context, cr *vxlanbev1alpha1.VXLANIndex) error { - if err := r.be.CreateIndex(ctx, cr); err != nil { - r.handleError(ctx, cr, "cannot create index", err) - return err - } - return nil -} - -func (r *reconciler) hasMinMaxRangeChanged(cr *vxlanbev1alpha1.VXLANIndex) bool { - return changed(cr.Status.MinID, cr.Spec.MinID) || changed(cr.Status.MaxID, cr.Spec.MaxID) -} - -func changed(status, spec *uint32) bool { - if status != nil { - if spec == nil { - return true - } else { - if *status != *spec { - return true - } - } - } - return false -} - -func (r *reconciler) applyMinMaxRange(ctx context.Context, cr *vxlanbev1alpha1.VXLANIndex) error { - if cr.Spec.MinID != nil && *cr.Spec.MinID != vxlanbev1alpha1.VXLANID_Min { - claim := cr.GetMinClaim() - if err := r.be.Claim(ctx, claim); err != nil { - r.handleError(ctx, cr, "cannot claim min reserved range", err) - return err - } - } - if cr.Spec.MaxID != nil && *cr.Spec.MaxID != vxlanbev1alpha1.VXLANID_Max { - claim := cr.GetMaxClaim() - if err := r.be.Claim(ctx, claim); err != nil { - r.handleError(ctx, cr, "cannot claim max reserved range", err) - return err - } - } - return nil -} diff --git a/pkg/backend/ipam/applicator_dynamic_prefix_validate.go b/pkg/registry/generic/invoker.go similarity index 68% rename from pkg/backend/ipam/applicator_dynamic_prefix_validate.go rename to pkg/registry/generic/invoker.go index d2a05aa..93a80e7 100644 --- a/pkg/backend/ipam/applicator_dynamic_prefix_validate.go +++ b/pkg/registry/generic/invoker.go @@ -14,19 +14,16 @@ See the License for the specific language governing permissions and limitations under the License. */ -package ipam +package generic import ( "context" - ipambev1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" + "k8s.io/apimachinery/pkg/runtime" ) -type dynamicPrefixApplicator struct { - name string - applicator -} - -func (r *dynamicPrefixApplicator) Validate(ctx context.Context, claim *ipambev1alpha1.IPClaim) error { - return nil +type BackendInvoker interface { + InvokeCreate(ctx context.Context, obj runtime.Object) error + InvokeUpdate(ctx context.Context, obj, old runtime.Object) error + InvokeDelete(ctx context.Context, obj runtime.Object) error } diff --git a/pkg/registry/generic/store.go b/pkg/registry/generic/store.go new file mode 100644 index 0000000..7655dda --- /dev/null +++ b/pkg/registry/generic/store.go @@ -0,0 +1,140 @@ +/* +Copyright 2024 Nokia. + +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 generic + +import ( + "context" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + builderrest "github.com/henderiw/apiserver-builder/pkg/builder/rest" + "github.com/henderiw/apiserver-builder/pkg/builder/utils" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/henderiw/apiserver-store/pkg/storebackend" + watchermanager "github.com/henderiw/apiserver-store/pkg/watcher-manager" + "github.com/kuidio/kuid/pkg/registry/options" + "github.com/kuidio/kuid/pkg/registry/store" + "go.opentelemetry.io/otel" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apiserver/pkg/registry/generic" + "k8s.io/apiserver/pkg/registry/rest" +) + +func NewStorageProvider(ctx context.Context, obj resource.InternalObject, opts *options.Options) *builderrest.StorageProvider { + watcherManager := watchermanager.New(64) + + go watcherManager.Start(ctx) + + sp := &builderrest.StorageProvider{ + ResourceStorageProviderFn: func(scheme *runtime.Scheme, optsGetter generic.RESTOptionsGetter) (rest.Storage, error) { + return NewREST(obj, scheme, watcherManager, optsGetter, opts) + }, + } + if statusobj, ok := obj.(resource.ObjectWithStatusSubResource); ok { + sp.StatusSubResourceStorageProviderFn = func(scheme *runtime.Scheme, store rest.Storage) (rest.Storage, error) { + return NewStatusREST(statusobj, scheme, watcherManager, opts, store) + } + } + // Add addtional subresources + return sp +} + +func NewREST( + obj resource.InternalObject, + scheme *runtime.Scheme, + watcherManager watchermanager.WatcherManager, + optsGetter generic.RESTOptionsGetter, + opts *options.Options, +) (*registry.Store, error) { + gr := obj.GetGroupVersionResource().GroupResource() + + scheme.AddFieldLabelConversionFunc( + obj.GetObjectKind().GroupVersionKind(), + obj.FieldLabelConversion(), + ) + + var storage storebackend.Storer[runtime.Object] + var err error + switch opts.Type { + case options.StorageType_File: + storage, err = store.CreateFileStore(scheme, obj, opts.Prefix) + if err != nil { + return nil, err + } + case options.StorageType_KV: + storage, err = store.CreateKVStore(opts.DB, scheme, obj) + if err != nil { + return nil, err + } + default: + storage = store.CreateMemStore() + } + + singlularResource := gr + singlularResource.Resource = obj.GetSingularName() + strategy := NewStrategy(obj, scheme, storage, watcherManager, opts) + + store := ®istry.Store{ + Tracer: otel.Tracer(obj.GetSingularName()), + NewFunc: obj.New, + NewListFunc: obj.NewList, + PredicateFunc: utils.Match, + DefaultQualifiedResource: gr, + SingularQualifiedResource: singlularResource, + GetStrategy: strategy, + ListStrategy: strategy, + CreateStrategy: strategy, + UpdateStrategy: strategy, + DeleteStrategy: strategy, + WatchStrategy: strategy, + ResetFieldsStrategy: strategy, + TableConvertor: obj.TableConvertor()(gr), + CategoryList: obj.GetCategories(), + ShortNameList: obj.GetShortNames(), + Storage: storage, + } + options := &generic.StoreOptions{ + RESTOptions: optsGetter, + AttrFunc: utils.GetAttrs, + } + if err := store.CompleteWithOptions(options); err != nil { + return nil, err + } + return store, nil +} + +func NewStatusREST( + obj resource.ObjectWithStatusSubResource, + scheme *runtime.Scheme, + watcherManager watchermanager.WatcherManager, + opts *options.Options, + store rest.Storage, +) (*registry.Store, error) { + + registryStore, ok := store.(*registry.Store) + if !ok { + return nil, fmt.Errorf("expecting registore store") + } + + statusStore := *registryStore + statusStore.CreateStrategy = nil + statusStore.DeleteStrategy = nil + statusStrategy := NewStatusStrategy(obj, scheme, registryStore.Storage, watcherManager, opts) + statusStore.UpdateStrategy = statusStrategy + statusStore.ResetFieldsStrategy = statusStrategy + return &statusStore, nil +} diff --git a/pkg/registry/generic/strategy_resource.go b/pkg/registry/generic/strategy_resource.go new file mode 100644 index 0000000..f37fbb5 --- /dev/null +++ b/pkg/registry/generic/strategy_resource.go @@ -0,0 +1,304 @@ +/* +Copyright 2024 Nokia. + +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 generic + +import ( + "context" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-builder/pkg/builder/utils" + "github.com/henderiw/apiserver-store/pkg/rest" + "github.com/henderiw/apiserver-store/pkg/storebackend" + watchermanager "github.com/henderiw/apiserver-store/pkg/watcher-manager" + "github.com/henderiw/logger/log" + "github.com/kuidio/kuid/pkg/registry/options" + apierrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/api/meta" + metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/validation/field" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/apiserver/pkg/storage/names" + "sigs.k8s.io/structured-merge-diff/v4/fieldpath" +) + +// NewStrategy creates and returns a strategy instance +func NewStrategy( + obj resource.InternalObject, + typer runtime.ObjectTyper, + storage storebackend.Storer[runtime.Object], + watcherManager watchermanager.WatcherManager, + opts *options.Options, +) *strategy { + + return &strategy{ + ObjectTyper: typer, + NameGenerator: names.SimpleNameGenerator, + gr: obj.GetGroupVersionResource().GroupResource(), + obj: obj, + storage: storage, + watcherManager: watcherManager, + opts: opts, + } +} + +var _ rest.RESTGetStrategy = &strategy{} +var _ rest.RESTListStrategy = &strategy{} +var _ rest.RESTCreateStrategy = &strategy{} +var _ rest.RESTUpdateStrategy = &strategy{} +var _ rest.RESTDeleteStrategy = &strategy{} +var _ rest.RESTWatchStrategy = &strategy{} +var _ rest.ResetFieldsStrategy = &strategy{} + +type strategy struct { + runtime.ObjectTyper + names.NameGenerator + gr schema.GroupResource + obj resource.InternalObject + storage storebackend.Storer[runtime.Object] + watcherManager watchermanager.WatcherManager + opts *options.Options +} + +func (r *strategy) NamespaceScoped() bool { return r.obj.NamespaceScoped() } + +func (r *strategy) Canonicalize(obj runtime.Object) {} + +func (r *strategy) Get(ctx context.Context, key types.NamespacedName) (runtime.Object, error) { + obj, err := r.storage.Get(ctx, storebackend.KeyFromNSN(key)) + if err != nil { + return nil, apierrors.NewNotFound(r.gr, key.Name) + } + return obj, nil +} + +func (r *strategy) BeginCreate(ctx context.Context) error { return nil } + +func (r *strategy) PrepareForCreate(ctx context.Context, obj runtime.Object) { + r.obj.PrepareForCreate(ctx, obj) +} + +func (r *strategy) Validate(ctx context.Context, obj runtime.Object) field.ErrorList { + return r.obj.ValidateCreate(ctx, obj) +} + +func (r *strategy) InvokeCreate(ctx context.Context, obj runtime.Object) error { + if r.opts.BackendInvoker == nil { + return nil + } + return r.opts.BackendInvoker.InvokeCreate(ctx, obj) +} + +func (r *strategy) Create(ctx context.Context, key types.NamespacedName, obj runtime.Object, dryrun bool) (runtime.Object, error) { + if dryrun { + if r.opts != nil && r.opts.DryRunner != nil { + return r.opts.DryRunner.DryRunCreate(ctx, key, obj, dryrun) + } + return obj, nil + } + if err := r.storage.Create(ctx, storebackend.KeyFromNSN(key), obj); err != nil { + return obj, apierrors.NewInternalError(err) + } + r.notifyWatcher(ctx, watch.Event{ + Type: watch.Added, + Object: obj, + }) + return obj, nil +} + +func (r *strategy) WarningsOnCreate(ctx context.Context, obj runtime.Object) []string { + return nil +} + +func (r *strategy) BeginUpdate(ctx context.Context) error { return nil } + +func (r *strategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { + r.obj.PrepareForUpdate(ctx, obj, old) +} + +func (r *strategy) AllowCreateOnUpdate() bool { return false } + +func (r *strategy) AllowUnconditionalUpdate() bool { return false } + +func (r *strategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + return r.obj.ValidateUpdate(ctx, obj, old) +} + +func (r *strategy) InvokeUpdate(ctx context.Context, obj, old runtime.Object) error { + if r.opts.BackendInvoker == nil { + return nil + } + return r.opts.BackendInvoker.InvokeUpdate(ctx, obj, old) +} + +func (r *strategy) Update(ctx context.Context, key types.NamespacedName, obj, old runtime.Object, dryrun bool) (runtime.Object, error) { + if r.obj.IsEqual(ctx, obj, old) { + return obj, nil + } + + if dryrun { + if r.opts != nil && r.opts.DryRunner != nil { + return r.opts.DryRunner.DryRunUpdate(ctx, key, obj, old, dryrun) + } + return obj, nil + } + + if err := utils.UpdateResourceVersionAndGeneration(obj, old); err != nil { + return obj, apierrors.NewInternalError(err) + } + + if err := r.storage.Update(ctx, storebackend.KeyFromNSN(key), obj); err != nil { + return obj, apierrors.NewInternalError(err) + } + r.notifyWatcher(ctx, watch.Event{ + Type: watch.Modified, + Object: obj, + }) + return obj, nil +} + +func (r *strategy) WarningsOnUpdate(ctx context.Context, obj, old runtime.Object) []string { + return nil +} + +func (r *strategy) BeginDelete(ctx context.Context) error { + log := log.FromContext(ctx) + log.Debug("BeginDelete strategy") + return nil +} + +func (r *strategy) InvokeDelete(ctx context.Context, obj runtime.Object) error { + if r.opts.BackendInvoker == nil { + return nil + } + return r.opts.BackendInvoker.InvokeDelete(ctx, obj) +} + +func (r *strategy) Delete(ctx context.Context, key types.NamespacedName, obj runtime.Object, dryrun bool) (runtime.Object, error) { + log := log.FromContext(ctx) + log.Debug("Delete strategy", "key", key, "obj", obj, "dryrun", dryrun) + if dryrun { + if r.opts != nil && r.opts.DryRunner != nil { + return r.opts.DryRunner.DryRunDelete(ctx, key, obj, dryrun) + } + return obj, nil + } + + if err := r.storage.Delete(ctx, storebackend.KeyFromNSN(key)); err != nil { + return obj, apierrors.NewInternalError(err) + } + r.notifyWatcher(ctx, watch.Event{ + Type: watch.Deleted, + Object: obj, + }) + return obj, nil +} + +func (r *strategy) List(ctx context.Context, options *metainternalversion.ListOptions) (runtime.Object, error) { + log := log.FromContext(ctx) + + var filter resource.Filter + var err error + if r.obj.FieldSelector() != nil { + filter, err = r.obj.FieldSelector()(ctx, options.FieldSelector) + if err != nil { + return nil, err + } + } else { + filter, err = utils.ParseFieldSelector(ctx, options.FieldSelector) + if err != nil { + return nil, err + } + } + + newListObj := r.obj.NewList() + v, err := utils.GetListPrt(newListObj) + if err != nil { + return nil, err + } + + listFunc := func(ctx context.Context, key storebackend.Key, obj runtime.Object) { + accessor, err := meta.Accessor(obj) + if err != nil { + log.Error("cannot get meta from object", "error", err.Error()) + return + } + + if options.LabelSelector != nil || filter != nil { + f := true + if options.LabelSelector != nil { + if options.LabelSelector.Matches(labels.Set(accessor.GetLabels())) { + f = false + } + } else { + // if no labels selector is present don't filter + f = false + } + // if filtered we dont have to run this section since the label requirement was not met + if filter != nil && !f { + f = filter.Filter(ctx, obj) + } + + if !f { + utils.AppendItem(v, obj) + } + } else { + utils.AppendItem(v, obj) + } + } + + r.storage.List(ctx, listFunc) + return newListObj, nil +} + +func (r *strategy) BeginWatch(ctx context.Context) error { return nil } + +func (r *strategy) Watch(ctx context.Context, options *metainternalversion.ListOptions) (watch.Interface, error) { + ctx, cancel := context.WithCancel(ctx) + + w := &watcher{ + cancel: cancel, + resultChan: make(chan watch.Event), + watcherManager: r.watcherManager, + obj: r.obj, + } + + go w.listAndWatch(ctx, r, options) + + return w, nil +} + +// GetResetFields returns the set of fields that get reset by the strategy +// and should not be modified by the user. +func (r *strategy) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set { + fields := map[fieldpath.APIVersion]*fieldpath.Set{ + fieldpath.APIVersion(r.obj.GetGroupVersionResource().GroupVersion().String()): fieldpath.NewSet( + fieldpath.MakePathOrDie("status"), + ), + } + return fields +} + +func (r *strategy) notifyWatcher(ctx context.Context, event watch.Event) { + log := log.FromContext(ctx).With("eventType", event.Type) + log.Debug("notify watcherManager") + + r.watcherManager.WatchChan() <- event +} diff --git a/pkg/registry/generic/strategy_status.go b/pkg/registry/generic/strategy_status.go new file mode 100644 index 0000000..fd24d8b --- /dev/null +++ b/pkg/registry/generic/strategy_status.go @@ -0,0 +1,137 @@ +/* +Copyright 2024 Nokia. + +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 generic + +import ( + "context" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-builder/pkg/builder/utils" + "github.com/henderiw/apiserver-store/pkg/rest" + "github.com/henderiw/apiserver-store/pkg/storebackend" + watchermanager "github.com/henderiw/apiserver-store/pkg/watcher-manager" + "github.com/henderiw/logger/log" + "github.com/kuidio/kuid/pkg/registry/options" + apierrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/validation/field" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/apiserver/pkg/storage/names" + "sigs.k8s.io/structured-merge-diff/v4/fieldpath" +) + +// NewStatusStrategy creates and returns a sttaus strategy instance +func NewStatusStrategy( + obj resource.ObjectWithStatusSubResource, + typer runtime.ObjectTyper, + storage storebackend.Storer[runtime.Object], + watcherManager watchermanager.WatcherManager, + opts *options.Options, +) *statusStrategy { + return &statusStrategy{ + ObjectTyper: typer, + NameGenerator: names.SimpleNameGenerator, + gr: obj.GetGroupVersionResource().GroupResource(), + obj: obj, + storage: storage, + watcherManager: watcherManager, + opts: opts, + } +} + +var _ rest.RESTUpdateStrategy = &statusStrategy{} +var _ rest.ResetFieldsStrategy = &statusStrategy{} + +type statusStrategy struct { + runtime.ObjectTyper + names.NameGenerator + gr schema.GroupResource + obj resource.ObjectWithStatusSubResource + storage storebackend.Storer[runtime.Object] + watcherManager watchermanager.WatcherManager + opts *options.Options +} + +func (r *statusStrategy) NamespaceScoped() bool { return r.obj.NamespaceScoped() } + +func (r *statusStrategy) Canonicalize(obj runtime.Object) {} + +func (r *statusStrategy) AllowCreateOnUpdate() bool { return false } + +func (r *statusStrategy) AllowUnconditionalUpdate() bool { return false } + +func (r *statusStrategy) BeginUpdate(ctx context.Context) error { return nil } + +func (r *statusStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { + r.obj.PrepareForStatusUpdate(ctx, obj, old) +} + +func (r *statusStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + return r.obj.ValidateStatusUpdate(ctx, obj, old) +} + +func (r *statusStrategy) InvokeUpdate(ctx context.Context, obj, old runtime.Object) error { + return nil +} + +func (r *statusStrategy) Update(ctx context.Context, key types.NamespacedName, obj, old runtime.Object, dryrun bool) (runtime.Object, error) { + // check if there is a change + if r.obj.IsStatusEqual(ctx, obj, old) { + return obj, nil + } + + if dryrun { + return obj, nil + } + + if err := utils.UpdateResourceVersion(obj, old); err != nil { + return obj, apierrors.NewInternalError(err) + } + + if err := r.storage.Update(ctx, storebackend.KeyFromNSN(key), obj); err != nil { + return obj, apierrors.NewInternalError(err) + } + r.notifyWatcher(ctx, watch.Event{ + Type: watch.Modified, + Object: obj, + }) + return obj, nil +} + +func (r *statusStrategy) WarningsOnUpdate(ctx context.Context, obj, old runtime.Object) []string { + return nil +} + +// GetResetFields returns the set of fields that get reset by the strategy +// and should not be modified by the user. +func (r *statusStrategy) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set { + fields := map[fieldpath.APIVersion]*fieldpath.Set{ + fieldpath.APIVersion(r.obj.GetGroupVersionResource().GroupVersion().String()): fieldpath.NewSet( + fieldpath.MakePathOrDie("status"), + ), + } + return fields +} + +func (r *statusStrategy) notifyWatcher(ctx context.Context, event watch.Event) { + log := log.FromContext(ctx).With("eventType", event.Type) + log.Debug("notify watcherManager") + + r.watcherManager.WatchChan() <- event +} diff --git a/pkg/registry/generic/watcher.go b/pkg/registry/generic/watcher.go new file mode 100644 index 0000000..a8529b4 --- /dev/null +++ b/pkg/registry/generic/watcher.go @@ -0,0 +1,222 @@ +/* +Copyright 2024 Nokia. + +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 generic + +import ( + "context" + "fmt" + "reflect" + "sync" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/rest" + watchermanager "github.com/henderiw/apiserver-store/pkg/watcher-manager" + "github.com/henderiw/logger/log" + "k8s.io/apimachinery/pkg/api/meta" + metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" +) + +// implements the watchermanager Watcher interface +// implenents the k8s watch.Interface interface +type watcher struct { + // interfce to the observer + cancel func() + resultChan chan watch.Event + watcherManager watchermanager.WatcherManager + obj resource.Object + + // protection against concurrent access + m sync.Mutex + eventCallback func(eventType watch.EventType, obj runtime.Object) bool + done bool +} + +var _ watch.Interface = &watcher{} + +// Stop stops watching. Will close the channel returned by ResultChan(). Releases +// any resources used by the watch. +func (r *watcher) Stop() { + r.cancel() +} + +// ResultChan returns a chan which will receive all the events. If an error occurs +// or Stop() is called, the implementation will close this channel and +// release any resources used by the watch. +func (r *watcher) ResultChan() <-chan watch.Event { + return r.resultChan +} + +// Implement the watcchermanafer.Watcher interface +// OnChange is the callback called when a object changes. +func (r *watcher) OnChange(eventType watch.EventType, obj runtime.Object) bool { + r.m.Lock() + defer r.m.Unlock() + + return r.eventCallback(eventType, obj) +} + +func (r *watcher) listAndWatch(ctx context.Context, l rest.RESTListStrategy, options *metainternalversion.ListOptions) { + log := log.FromContext(ctx) + if err := r.innerListAndWatch(ctx, l, options); err != nil { + // TODO: We need to populate the object on this error + // Most likely happens when we cancel a context, stop a watch + log.Debug("sending error to watch stream", "error", err) + ev := watch.Event{ + Type: watch.Error, + Object: r.obj, + } + r.resultChan <- ev + } + r.cancel() + close(r.resultChan) +} + +// innerListAndWatch provides the callback handler +// 1. add a callback handler to receive any event we get while collecting the list of existing resources +// 2. +func (r *watcher) innerListAndWatch(ctx context.Context, l rest.RESTListStrategy, options *metainternalversion.ListOptions) error { + log := log.FromContext(ctx) + + errorResult := make(chan error) + + // backlog logs the events during startup + var backlog []watch.Event + // Make sure we hold the lock when setting the eventCallback, as it + // will be read by other goroutines when events happen. + r.m.Lock() + r.eventCallback = func(eventType watch.EventType, obj runtime.Object) bool { + if r.done { + return false + } + + backlog = append(backlog, watch.Event{ + Type: eventType, + Object: obj, + }) + + return true + } + r.m.Unlock() + + // we add the watcher to the watchermanager and start building a backlog for intermediate changes + // while we startup, the backlog will be replayed once synced + log.Debug("starting watch") + if err := r.watcherManager.Add(ctx, options, r); err != nil { + return err + } + + // options.Watch means watch only no listing + if !options.Watch { + log.Debug("starting list watch") + obj, err := l.List(ctx, options) + if err != nil { + r.setDone() + return err + } + + items, err := meta.ExtractList(obj) + if err != nil { + r.setDone() + return fmt.Errorf("expecting list type, got: %s, err: %s", reflect.TypeOf(obj).Name(), err.Error()) + } + + for _, obj := range items { + obj := obj + ev := watch.Event{ + Type: watch.Added, + Object: obj, + } + r.sendWatchEvent(ctx, ev) + } + + log.Debug("finished list watch") + } else { + log.Debug("watch only, no list") + } + + // Repeatedly flush the backlog until we catch up + for { + r.m.Lock() + chunk := backlog + backlog = nil + r.m.Unlock() + + if len(chunk) == 0 { + break + } + + log.Debug("flushing backlog", "chunk length", len(chunk)) + + for _, ev := range chunk { + r.sendWatchEvent(ctx, ev) + } + } + + r.m.Lock() + // Pick up anything that squeezed in + for _, ev := range backlog { + r.sendWatchEvent(ctx, ev) + } + + log.Debug("moving into streaming mode") + r.eventCallback = func(eventType watch.EventType, obj runtime.Object) bool { + accessor, _ := meta.Accessor(obj) + log.Debug("eventCallBack", "eventType", eventType, "nsn", fmt.Sprintf("%s/%s", accessor.GetNamespace(), accessor.GetName())) + if r.done { + return false + } + ev := watch.Event{ + Type: eventType, + Object: obj, + } + r.sendWatchEvent(ctx, ev) + return true + } + r.m.Unlock() + + select { + case <-ctx.Done(): + r.setDone() + return ctx.Err() + + case err := <-errorResult: + r.setDone() + return err + } +} + +func (r *watcher) sendWatchEvent(ctx context.Context, event watch.Event) { + // TODO: Handle the case that the watch channel is full? + if event.Object != nil { + accessor, _ := meta.Accessor(event.Object) + log := log.FromContext(ctx).With("event", event.Type, "nsn", fmt.Sprintf("%s/%s", accessor.GetNamespace(), accessor.GetName())) + log.Debug("sending watch event") + } else { + log := log.FromContext(ctx).With("event", event.Type) + log.Debug("sending watch event") + } + + r.resultChan <- event +} + +func (r *watcher) setDone() { + r.m.Lock() + defer r.m.Unlock() + r.done = true +} diff --git a/pkg/registry/options/options.go b/pkg/registry/options/options.go new file mode 100644 index 0000000..0cbe7ed --- /dev/null +++ b/pkg/registry/options/options.go @@ -0,0 +1,58 @@ +/* +Copyright 2024 Nokia. + +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 options + +import ( + "context" + + "github.com/dgraph-io/badger/v4" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" + //"sigs.k8s.io/controller-runtime/pkg/client" +) + +type StorageType int + +const ( + StorageType_Memory StorageType = iota + StorageType_File + StorageType_KV +) + +type Options struct { + // Storage + Prefix string + Type StorageType + DB *badger.DB + // Target + //Client client.Client + // specific functions + DryRunner DryRunner + BackendInvoker BackendInvoker +} + +type DryRunner interface { + DryRunCreate(ctx context.Context, key types.NamespacedName, obj runtime.Object, dryrun bool) (runtime.Object, error) + DryRunUpdate(ctx context.Context, key types.NamespacedName, obj, old runtime.Object, dryrun bool) (runtime.Object, error) + DryRunDelete(ctx context.Context, key types.NamespacedName, obj runtime.Object, dryrun bool) (runtime.Object, error) +} + +type BackendInvoker interface { + InvokeCreate(ctx context.Context, obj runtime.Object) error + InvokeUpdate(ctx context.Context, obj, old runtime.Object) error + InvokeDelete(ctx context.Context, obj runtime.Object) error +} diff --git a/pkg/registry/store/store.go b/pkg/registry/store/store.go new file mode 100644 index 0000000..14ca7ab --- /dev/null +++ b/pkg/registry/store/store.go @@ -0,0 +1,87 @@ +/* +Copyright 2024 Nokia. + +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 store + +import ( + "github.com/dgraph-io/badger/v4" + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/storebackend" + "github.com/henderiw/apiserver-store/pkg/storebackend/badgerdb" + "github.com/henderiw/apiserver-store/pkg/storebackend/file" + "github.com/henderiw/apiserver-store/pkg/storebackend/memory" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/serializer" + "k8s.io/apiserver/pkg/server/storage" + "k8s.io/apiserver/pkg/storage/storagebackend" +) + +type StorageType int + +const ( + StorageType_Memory StorageType = iota + StorageType_File + StorageType_KV +) + +type Config struct { + Prefix string + Type StorageType + DB *badger.DB +} + +func CreateFileStore(scheme *runtime.Scheme, obj resource.Object, prefix string) (storebackend.Storer[runtime.Object], error) { + gr := obj.GetGroupVersionResource().GroupResource() + codec, _, err := storage.NewStorageCodec(storage.StorageCodecConfig{ + StorageMediaType: runtime.ContentTypeJSON, + StorageSerializer: serializer.NewCodecFactory(scheme), + StorageVersion: scheme.PrioritizedVersionsForGroup(obj.GetGroupVersionResource().Group)[0], + MemoryVersion: scheme.PrioritizedVersionsForGroup(obj.GetGroupVersionResource().Group)[0], + Config: storagebackend.Config{}, // useless fields.. + }) + if err != nil { + return nil, err + } + return file.NewStore[runtime.Object](&storebackend.Config{ + GroupResource: gr, + Prefix: prefix, + Codec: codec, + NewFunc: obj.New, + }) +} + +func CreateKVStore(db *badger.DB, scheme *runtime.Scheme, obj resource.Object) (storebackend.Storer[runtime.Object], error) { + gr := obj.GetGroupVersionResource().GroupResource() + codec, _, err := storage.NewStorageCodec(storage.StorageCodecConfig{ + StorageMediaType: runtime.ContentTypeJSON, + StorageSerializer: serializer.NewCodecFactory(scheme), + StorageVersion: scheme.PrioritizedVersionsForGroup(obj.GetGroupVersionResource().Group)[0], + MemoryVersion: scheme.PrioritizedVersionsForGroup(obj.GetGroupVersionResource().Group)[0], + Config: storagebackend.Config{}, // useless fields.. + }) + if err != nil { + return nil, err + } + return badgerdb.NewStore[runtime.Object](db, &storebackend.Config{ + GroupResource: gr, + Codec: codec, + NewFunc: obj.New, + }) +} + +func CreateMemStore() storebackend.Storer[runtime.Object] { + return memory.NewStore[runtime.Object]() +} diff --git a/pkg/resources/recources.go b/pkg/resources/recources.go index ac10c52..b9b8707 100644 --- a/pkg/resources/recources.go +++ b/pkg/resources/recources.go @@ -112,7 +112,7 @@ func (r *Resources) getExistingResources(ctx context.Context, cr client.Object) //ownObjList := ownObj.NewObjList() list := &unstructured.UnstructuredList{} list.SetGroupVersionKind(gvk) - if err := r.List(ctx, list, opts...); err != nil { + if err := r.Client.List(ctx, list, opts...); err != nil { log.Error("getExistingResources list failed", "err", err.Error()) errm = errors.Join(errm, err) continue @@ -177,7 +177,7 @@ func (r *Resources) apiDelete(ctx context.Context) error { func (r *Resources) delete(ctx context.Context, ref corev1.ObjectReference, o client.Object) error { log := log.FromContext(ctx) log.Debug("api delete existing resource", "referernce", ref.String()) - if err := r.Delete(ctx, o); err != nil { + if err := r.Client.Delete(ctx, o); err != nil { if resource.IgnoreNotFound(err) != nil { log.Error("api delete", "error", err, "object", o) return err diff --git a/tools/apiserver-runtime-gen/main.go b/tools/apiserver-runtime-gen/main.go index bb5676d..f523910 100644 --- a/tools/apiserver-runtime-gen/main.go +++ b/tools/apiserver-runtime-gen/main.go @@ -31,7 +31,7 @@ import ( "golang.org/x/mod/modfile" ) -var bin, output string +var bin string var cmd = cobra.Command{ Use: "apiserver-runtime-gen", @@ -44,6 +44,7 @@ func preRunE(cmd *cobra.Command, args []string) error { if module == "" { return fmt.Errorf("must specify module") } + // we use the default versions now so the version input is derived from that if len(versions) == 0 { return fmt.Errorf("must specify versions") } @@ -51,8 +52,6 @@ func preRunE(cmd *cobra.Command, args []string) error { } func runE(cmd *cobra.Command, args []string) error { - var err error - // get the location the generators are installed bin = os.Getenv("GOBIN") if bin == "" { @@ -62,63 +61,54 @@ func runE(cmd *cobra.Command, args []string) error { if install { for _, gen := range generators { // nolint:gosec - err := run(exec.Command("go", "install", path.Join("k8s.io/code-generator/cmd", gen))) - if err != nil { - return err - } - if gen == "go-to-protobuf" { - - err := run(exec.Command("go", "mod", "vendor")) + if gen == "openapi-gen" { + err := run(exec.Command("go", "install", "k8s.io/kube-openapi/cmd/openapi-gen@latest")) if err != nil { return err } - err = run(exec.Command("go", "mod", "tidy")) + } else { + err := run(exec.Command("go", "install", path.Join("k8s.io/code-generator/cmd", gen))) if err != nil { return err } - } - } - } + /* + if gen == "go-to-protobuf" { + + err := run(exec.Command("go", "mod", "vendor")) + if err != nil { + return err + } + err = run(exec.Command("go", "mod", "tidy")) + if err != nil { + return err + } - // setup the directory to generate the code to. - // code generators don't work with go modules, and try the full path of the module - output, err = os.MkdirTemp("", "gen") - if err != nil { - return err - } - if clean { - // nolint:errcheck - defer os.RemoveAll(output) - } - d, l := path.Split(module) // split the directory from the link we will create - p := filepath.Join(strings.Split(d, "/")...) // convert module path to os filepath - p = filepath.Join(output, p) // create the directory which will contain the link - err = os.MkdirAll(p, 0700) - if err != nil { - return err - } - // link the tmp location to this one so the code generator writes to the correct path - wd, err := os.Getwd() - if err != nil { - return err - } - err = os.Symlink(wd, filepath.Join(p, l)) - if err != nil { - return err + } + */ + } } return doGen() } func doGen() error { - inputs := strings.Join(versions, ",") - //protoInput := versions[0] - fmt.Println("versions", versions) - clientVersions := versions[2:] - clientgenInput := strings.Join(clientVersions, ",") + // exclude condition from versions for clientgen, listergen, informergen + // clientgen + clientgenVersions := []string{} + informerListergenVersions := []string{} + protobufVersions := []string{} + for _, version := range versions { + if !strings.Contains(version, "common") && !strings.Contains(version, "id"){ + // expand the path with the module + clientgenVersions = append(clientgenVersions, path.Join(module, version)) + // dont expand the versions with modules + informerListergenVersions = append(informerListergenVersions, fmt.Sprintf("./%s", path.Join(version, "..."))) + } + protobufVersions = append(protobufVersions, version) + } - fmt.Println("inputs", inputs) + //protoInputs := strings.Join(rawVersions, ",") gen := map[string]bool{} for _, g := range generators { @@ -127,9 +117,8 @@ func doGen() error { if gen["deepcopy-gen"] { err := run(getCmd("deepcopy-gen", - "--input-dirs", inputs, - "-O", "zz_generated.deepcopy", - "--bounding-dirs", path.Join(module, "apis"))) + "--output-file", "zz_generated.deepcopy.go", + "./apis/...")) if err != nil { return err } @@ -137,62 +126,86 @@ func doGen() error { if gen["openapi-gen"] { err := run(getCmd("openapi-gen", - "--input-dirs", "k8s.io/apimachinery/pkg/api/resource,"+ - "k8s.io/apimachinery/pkg/apis/meta/v1,"+ - "k8s.io/apimachinery/pkg/runtime,"+ - "k8s.io/apimachinery/pkg/version,"+ - inputs, - "-O", "zz_generated.openapi", - "--output-package", path.Join(module, "apis/generated/openapi"))) + "--output-file", "zz_generated.openapi.go", + "--output-dir", "pkg/generated/openapi", + "--output-pkg", "openapi", + "./apis/...", + "k8s.io/apimachinery/pkg/apis/meta/v1", + "k8s.io/apimachinery/pkg/api/resource", + "k8s.io/apimachinery/pkg/runtime", + "k8s.io/apimachinery/pkg/version", + )) if err != nil { return err } } if gen["client-gen"] { - inputBase := "" - versionsInputs := clientgenInput - // e.g. base = "example.io/foo/api", strippedVersions = "v1,v1beta1" - // e.g. base = "example.io/foo/pkg/apis", strippedVersions = "test/v1,test/v1beta1" - if base, strippedVersions, ok := findInputBase(module, clientVersions); ok { - inputBase = base - versionsInputs = strings.Join(strippedVersions, ",") - } - fmt.Println("inputBase", inputBase) - //fmt.Println("clientgenInput", clientgenInput) - fmt.Println("versionsInputs", versionsInputs) - err := run(getCmd("client-gen", - "--clientset-name", "versioned", "--input-base", "", - "--input", versionsInputs, "--output-package", path.Join(module, "apis/generated/clientset"))) + err := run(getCmd( + "client-gen", + "--clientset-name", "versioned", + "--input-base", "", + "--input", strings.Join(clientgenVersions, ","), + "--output-dir", "pkg/generated/clientset", + "--output-pkg", fmt.Sprintf("%s/pkg/generated/clientset", module), + )) if err != nil { return err } } + listerGenStringer := []string{ + "--output-dir", "pkg/generated/listers", + "--output-pkg", fmt.Sprintf("%s/pkg/generated/listers", module), + } + listerGenStringer = append(listerGenStringer, informerListergenVersions...) if gen["lister-gen"] { - err := run(getCmd("lister-gen", - "--input-dirs", inputs, "--output-package", path.Join(module, "apis/generated/listers"))) - if err != nil { + if err := run(getCmd("lister-gen", listerGenStringer...)); err != nil { return err } } + informerGenStringer := []string{ + "--versioned-clientset-package", fmt.Sprintf("%s/pkg/generated/clientset/versioned", module), + "--internal-clientset-package", fmt.Sprintf("%s/pkg/generated/clientset/versioned", module), + "--listers-package", fmt.Sprintf("%s/pkg/generated/listers", module), + "--output-dir", "pkg/generated/informers", + "--output-pkg", fmt.Sprintf("%s/pkg/generated/informers", module), + } + informerGenStringer = append(informerGenStringer, informerListergenVersions...) if gen["informer-gen"] { - err := run(getCmd("informer-gen", - "--input-dirs", inputs, - "--versioned-clientset-package", path.Join(module, "apis/generated/clientset/versioned"), - "--listers-package", path.Join(module, "apis/generated/listers"), - "--output-package", path.Join(module, "apis/generated/informers"))) + if err := run(getCmd("informer-gen", informerGenStringer...)); err != nil { + return err + } + } + + if gen["defaulter-gen"] { + defaultArgs := []string{"--output-file", "zz_generated.defaults.go"} + defaultArgs = append(defaultArgs, clientgenVersions...) + err := run(getCmd("defaulter-gen", + defaultArgs..., + )) + if err != nil { + return err + } + } + + if gen["conversion-gen"] { + err := run(getCmd("conversion-gen", + "--output-file", "zz_generated.conversion.go", + "./apis/...", + )) if err != nil { return err } } if gen["go-to-protobuf"] { - err := run(getCmd("go-to-protobuf", - "--packages", inputs, - "--apimachinery-packages", "-k8s.io/apimachinery/pkg/api/resource,-k8s.io/apimachinery/pkg/runtime/schema,-k8s.io/apimachinery/pkg/runtime,-k8s.io/apimachinery/pkg/apis/meta/v1,-k8s.io/api/core/v1", - "--proto-import", "./vendor", + err := run(getCmd( + "go-to-protobuf", + "--packages", strings.Join(protobufVersions, ","), + "--apimachinery-packages", "-k8s.io/apimachinery/pkg/api/resource,-k8s.io/apimachinery/pkg/runtime/schema,-k8s.io/apimachinery/pkg/runtime,-k8s.io/apimachinery/pkg/apis/meta/v1", + //"--proto-import", "./vendor", )) if err != nil { return err @@ -207,6 +220,7 @@ var ( header string module string versions []string + rawVersions []string clean, install bool ) @@ -232,20 +246,18 @@ func main() { cmd.Flags().StringVar(&module, "module", defaultModule, "Go module of the apiserver.") // calculate the versions - //defaultVersions := []string{"github.com/kuidio/kuid/apis/backend/ipam/v1alpha1", "github.com/kuidio/kuid/apis/condition/v1alpha1"} var defaultVersions []string if err := fs.WalkDir(os.DirFS("apis"), ".", func(p string, d fs.DirEntry, err error) error { - fmt.Println("path", p) if err != nil { return err } if d.IsDir() { - if strings.HasPrefix(p, "generated") { // ship the generated directory + if strings.HasPrefix(p, "generated") { // skip the generated directory return nil } - match := versionRegexp.MatchString(p) - if !match { - defaultVersions = append(defaultVersions, path.Join(module, "apis", p)) + match := versionRegexp.MatchString(filepath.Base(p)) + if match { + defaultVersions = append(defaultVersions, path.Join("apis", p)) } } @@ -256,8 +268,6 @@ func main() { cmd.Flags().StringSliceVar( &versions, "versions", defaultVersions, "Go packages of API versions to generate code for.") - - fmt.Println("defaultVersions", defaultVersions) if err := cmd.Execute(); err != nil { log.Fatal(err) } @@ -275,7 +285,7 @@ func run(cmd *exec.Cmd) error { func getCmd(cmd string, args ...string) *exec.Cmd { // nolint:gosec - e := exec.Command(filepath.Join(bin, cmd), "--output-base", output, "--go-header-file", header) + e := exec.Command(filepath.Join(bin, cmd), "--go-header-file", header) e.Args = append(e.Args, args...) return e @@ -295,32 +305,3 @@ func findModuleRoot(dir string) string { } return "" } - -func findInputBase(module string, versions []string) (string, []string, bool) { - if allHasPrefix(filepath.Join(module, "api"), versions) { - base := filepath.Join(module, "api") - return base, allTrimPrefix(base+"/", versions), true - } - if allHasPrefix(filepath.Join(module, "apis"), versions) { - base := filepath.Join(module, "apis") - return base, allTrimPrefix(base+"/", versions), true - } - return "", nil, false -} - -func allHasPrefix(prefix string, paths []string) bool { - for _, p := range paths { - if !strings.HasPrefix(p, prefix) { - return false - } - } - return true -} - -func allTrimPrefix(prefix string, versions []string) []string { - vs := make([]string, 0) - for _, v := range versions { - vs = append(vs, strings.TrimPrefix(v, prefix)) - } - return vs -} From 749811cd7e8634a6df4c5ca6d2946534e848960f Mon Sep 17 00:00:00 2001 From: Wim Henderickx Date: Tue, 22 Oct 2024 10:30:20 -0400 Subject: [PATCH 02/23] updates after testing --- DESIGN-DEPLOYMENTS.md | 18 +- apis/backend/as/asclaim_object.go | 34 +- apis/backend/as/asclaim_resource.go | 17 +- apis/backend/as/asclaim_types.go | 9 +- apis/backend/as/asentry_resource.go | 17 +- apis/backend/as/asentry_types.go | 10 +- apis/backend/as/asindex_resource.go | 15 +- apis/backend/as/asindex_types.go | 7 + apis/backend/as/storage.go | 9 +- apis/backend/as/v1alpha1/asclaim_types.go | 7 +- apis/backend/as/v1alpha1/asentry_types.go | 8 +- apis/backend/as/v1alpha1/asindex_types.go | 8 +- .../as/v1alpha1/zz_generated.conversion.go | 596 ++++++++++++++++++ .../as/v1alpha1/zz_generated.deepcopy.go | 355 +++++++++++ apis/backend/as/zz_generated.deepcopy.go | 32 + apis/backend/object.go | 5 +- crds/as.be.kuid.dev_asclaims.yaml | 366 +++++++++++ crds/as.be.kuid.dev_asentries.yaml | 338 ++++++++++ crds/as.be.kuid.dev_asindexes.yaml | 256 ++++++++ go.mod | 10 +- go.sum | 25 +- main.go | 3 + pkg/backend/astest/as_claim_test.go | 203 ++++++ pkg/backend/astest/as_helpers_test.go | 133 ++++ pkg/backend/astest/as_index_test.go | 64 ++ pkg/backend/backend_interface.go | 5 +- pkg/backend/generic/applicator.go | 20 + pkg/backend/generic/applicator_static_id.go | 3 +- .../generic/applicator_static_range.go | 119 ++-- pkg/backend/generic/backend.go | 12 + pkg/backend/generic/backend_store.go | 131 ++-- {apis => pkg}/backend/storage_providers.go | 1 + 32 files changed, 2660 insertions(+), 176 deletions(-) create mode 100644 apis/backend/as/v1alpha1/zz_generated.conversion.go create mode 100644 apis/backend/as/v1alpha1/zz_generated.deepcopy.go create mode 100644 crds/as.be.kuid.dev_asclaims.yaml create mode 100644 crds/as.be.kuid.dev_asentries.yaml create mode 100644 crds/as.be.kuid.dev_asindexes.yaml create mode 100644 pkg/backend/astest/as_claim_test.go create mode 100644 pkg/backend/astest/as_helpers_test.go create mode 100644 pkg/backend/astest/as_index_test.go rename {apis => pkg}/backend/storage_providers.go (97%) diff --git a/DESIGN-DEPLOYMENTS.md b/DESIGN-DEPLOYMENTS.md index 4f1cd86..75d81ed 100644 --- a/DESIGN-DEPLOYMENTS.md +++ b/DESIGN-DEPLOYMENTS.md @@ -47,9 +47,25 @@ What about config maps ?? - FieldSelector would be nice when listing the items to be able to check if they belong to the index - Update? How to handle -- Conversion function for CRD(s) - how does this work ???? -> this will determine if we can keep the resources aligned or not +- Conversion function for CRD(s) - how does this work ???? -> this will determine if we can keep choreo aligned or not to be tested: - getting storage - how to walk over a list ? unstructured ? - field manager is handled by + + + +Choreo -> we need a conversion fucntion conversion function + + +TODO: +- align the rest interface from choreo with the rest interface of + + +range: +- step1: check if changed -> signal; exists/not exists: we dont care at this stage +- step2: if changed validate parents and children -> we block +- step3: manage update of the main tree + +if a range changed and there are children -> we dont allow this \ No newline at end of file diff --git a/apis/backend/as/asclaim_object.go b/apis/backend/as/asclaim_object.go index 96dcd53..580ff35 100644 --- a/apis/backend/as/asclaim_object.go +++ b/apis/backend/as/asclaim_object.go @@ -34,6 +34,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/selection" "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/validation/field" "k8s.io/utils/ptr" ) @@ -161,8 +162,17 @@ func (r *ASClaim) GetIndex() string { return r.Spec.Index } func (r *ASClaim) GetSelector() *metav1.LabelSelector { return r.Spec.Selector } -// GetOwnerSelector selects the route based on the name of the claim -func (r *ASClaim) GetOwnerSelector() (labels.Selector, error) { +func (r *ASClaim) IsOwner(labels labels.Set) bool { + ownerLabels := r.getOnwerLabels() + for k, v := range ownerLabels { + if val, ok := labels[k]; !ok || val != v { + return false + } + } + return true +} + +func (r *ASClaim) getOnwerLabels() map[string]string { claimName := r.Name claimKind := r.Kind claimUID := r.UID @@ -175,11 +185,16 @@ func (r *ASClaim) GetOwnerSelector() (labels.Selector, error) { } } - l := map[string]string{ + return map[string]string{ backend.KuidClaimNameKey: claimName, backend.KuidClaimUIDKey: string(claimUID), backend.KuidOwnerKindKey: claimKind, } +} + +// GetOwnerSelector selects the route based on the name of the claim +func (r *ASClaim) GetOwnerSelector() (labels.Selector, error) { + l := r.getOnwerLabels() fullselector := labels.NewSelector() for k, v := range l { @@ -333,6 +348,19 @@ func (r *ASClaim) GetClaimResponse() string { return "" } +func (r *ASClaim) GetClaimSet(typ string) (sets.Set[tree.ID], error) { + arange, err := r.GetRangeID(typ) + if err != nil { + return nil, fmt.Errorf("cannot get range from claim: %v", err) + } + // claim set represents the new entries + newClaimSet := sets.New[tree.ID]() + for _, rangeID := range arange.IDs() { + newClaimSet.Insert(rangeID) + } + return newClaimSet, nil +} + func ASClaimFromUnstructured(ru runtime.Unstructured) (backend.ClaimObject, error) { obj := &ASClaim{} err := runtime.DefaultUnstructuredConverter.FromUnstructured(ru.UnstructuredContent(), obj) diff --git a/apis/backend/as/asclaim_resource.go b/apis/backend/as/asclaim_resource.go index d3e1eec..74d08a0 100644 --- a/apis/backend/as/asclaim_resource.go +++ b/apis/backend/as/asclaim_resource.go @@ -179,15 +179,21 @@ func (r *ASClaim) TableConvertor() func(gr schema.GroupResource) rest.TableConve return nil } return []interface{}{ - claim.Name, + claim.GetName(), claim.GetCondition(condition.ConditionTypeReady).Status, - claim.GetCondition(condition.ConditionTypeReady).Reason, + claim.GetIndex(), + string(claim.GetClaimType()), + claim.GetClaimRequest(), + claim.GetClaimResponse(), } }, []metav1.TableColumnDefinition{ {Name: "Name", Type: "string"}, - {Name: "Ready", Type: "string"}, - {Name: "Reason", Type: "string"}, + {Name: "Ready", Type: "string"}, + {Name: "Index", Type: "string"}, + {Name: "ClaimType", Type: "string"}, + {Name: "ClaimReq", Type: "string"}, + {Name: "ClaimRsp", Type: "string"}, }, ) } @@ -269,6 +275,9 @@ func (r *ASClaimFilter) Filter(ctx context.Context, obj runtime.Object) bool { if !ok { return f } + if r == nil { + return false + } if r.Name != "" { if o.GetName() == r.Name { f = false diff --git a/apis/backend/as/asclaim_types.go b/apis/backend/as/asclaim_types.go index b66f216..c0e7208 100644 --- a/apis/backend/as/asclaim_types.go +++ b/apis/backend/as/asclaim_types.go @@ -58,6 +58,10 @@ type ASClaimStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // ASClaim is the Schema for the ASClaim API type ASClaim struct { @@ -68,8 +72,11 @@ type ASClaim struct { Status ASClaimStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } -// ASClaimList contains a list of ASClaims + // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true + +// ASClaimList contains a list of ASClaims type ASClaimList struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/apis/backend/as/asentry_resource.go b/apis/backend/as/asentry_resource.go index 848edfe..f744a9b 100644 --- a/apis/backend/as/asentry_resource.go +++ b/apis/backend/as/asentry_resource.go @@ -174,20 +174,24 @@ func (r *ASEntry) TableConvertor() func(gr schema.GroupResource) rest.TableConve return registry.NewTableConverter( gr, func(obj runtime.Object) []interface{} { - config, ok := obj.(*ASEntry) + entry, ok := obj.(*ASEntry) if !ok { return nil } return []interface{}{ - config.Name, - config.GetCondition(condition.ConditionTypeReady).Status, - config.GetCondition(condition.ConditionTypeReady).Reason, + entry.GetName(), + entry.GetCondition(condition.ConditionTypeReady).Status, + entry.GetIndex(), + entry.GetClaimType(), + entry.GetSpecID(), } }, []metav1.TableColumnDefinition{ {Name: "Name", Type: "string"}, {Name: "Ready", Type: "string"}, - {Name: "Reason", Type: "string"}, + {Name: "Index", Type: "string"}, + {Name: "ClaimType", Type: "string"}, + {Name: "ID", Type: "string"}, }, ) } @@ -269,6 +273,9 @@ func (r *ASEntryFilter) Filter(ctx context.Context, obj runtime.Object) bool { if !ok { return f } + if r == nil { + return false + } if r.Name != "" { if o.GetName() == r.Name { f = false diff --git a/apis/backend/as/asentry_types.go b/apis/backend/as/asentry_types.go index 1e5dc12..cb761b3 100644 --- a/apis/backend/as/asentry_types.go +++ b/apis/backend/as/asentry_types.go @@ -47,7 +47,10 @@ type ASEntryStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // ASEntry is the Schema for the ASentry API type ASEntry struct { metav1.TypeMeta `json:",inline" yaml:",inline"` @@ -57,8 +60,11 @@ type ASEntry struct { Status ASEntryStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } -// ASEntryList contains a list of ASEntries + // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true + +// ASEntryList contains a list of ASEntries type ASEntryList struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/apis/backend/as/asindex_resource.go b/apis/backend/as/asindex_resource.go index 2e00c9b..27ca966 100644 --- a/apis/backend/as/asindex_resource.go +++ b/apis/backend/as/asindex_resource.go @@ -174,20 +174,22 @@ func (r *ASIndex) TableConvertor() func(gr schema.GroupResource) rest.TableConve return registry.NewTableConverter( gr, func(obj runtime.Object) []interface{} { - config, ok := obj.(*ASIndex) + index, ok := obj.(*ASIndex) if !ok { return nil } return []interface{}{ - config.Name, - config.GetCondition(condition.ConditionTypeReady).Status, - config.GetCondition(condition.ConditionTypeReady).Reason, + index.GetName(), + index.GetCondition(condition.ConditionTypeReady).Status, + index.GetMinID(), + index.GetMaxID(), } }, []metav1.TableColumnDefinition{ {Name: "Name", Type: "string"}, {Name: "Ready", Type: "string"}, - {Name: "Reason", Type: "string"}, + {Name: "MinID", Type: "integer"}, + {Name: "MaxID", Type: "integer"}, }, ) } @@ -269,6 +271,9 @@ func (r *ASIndexFilter) Filter(ctx context.Context, obj runtime.Object) bool { if !ok { return f } + if r == nil { + return false + } if r.Name != "" { if o.GetName() == r.Name { f = false diff --git a/apis/backend/as/asindex_types.go b/apis/backend/as/asindex_types.go index 6a7d26f..a9ef9f5 100644 --- a/apis/backend/as/asindex_types.go +++ b/apis/backend/as/asindex_types.go @@ -52,6 +52,10 @@ type ASIndexStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // ASIndex is the Schema for the ASIndex API type ASIndex struct { @@ -64,6 +68,9 @@ type ASIndex struct { // ASIndexList contains a list of ASIndexs // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true + +// ASIndexList contains a list of ASIndexs type ASIndexList struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/apis/backend/as/storage.go b/apis/backend/as/storage.go index 8d9ab21..42b21e7 100644 --- a/apis/backend/as/storage.go +++ b/apis/backend/as/storage.go @@ -19,7 +19,6 @@ import ( "github.com/henderiw/apiserver-builder/pkg/builder" "github.com/henderiw/apiserver-builder/pkg/builder/rest" - "github.com/kuidio/kuid/apis/backend" bebackend "github.com/kuidio/kuid/pkg/backend" genericbackend "github.com/kuidio/kuid/pkg/backend/generic" genericregistry "github.com/kuidio/kuid/pkg/registry/generic" @@ -29,7 +28,7 @@ import ( "k8s.io/apiserver/pkg/registry/generic" ) -func NewStorageProviders(ctx context.Context, sync bool, options *options.Options) backend.StorageProviders { +func NewStorageProviders(ctx context.Context, sync bool, options *options.Options) bebackend.StorageProviders { r := &storageProviders{ be: genericbackend.New( ASClaimKind, @@ -87,7 +86,7 @@ func (r *storageProviders) ApplyStorageToBackend(ctx context.Context, apiServer entryStorageProvider := apiServer.StorageProvider[schema.GroupResource{ Group: SchemeGroupVersion.Group, - Resource: ASIndexPlural, + Resource: ASEntryPlural, }] entryStorage, err := entryStorageProvider.Get(ctx, apiServer.Schemes[0], &EntryGetter{}) @@ -99,6 +98,10 @@ func (r *storageProviders) ApplyStorageToBackend(ctx context.Context, apiServer return nil } +func (r *storageProviders) GetBackend() bebackend.Backend { + return r.be +} + var _ generic.RESTOptionsGetter = &ClaimGetter{} type ClaimGetter struct{} diff --git a/apis/backend/as/v1alpha1/asclaim_types.go b/apis/backend/as/v1alpha1/asclaim_types.go index 7e72a02..8e4d781 100644 --- a/apis/backend/as/v1alpha1/asclaim_types.go +++ b/apis/backend/as/v1alpha1/asclaim_types.go @@ -58,6 +58,9 @@ type ASClaimStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // ASClaim is the Schema for the ASClaim API type ASClaim struct { @@ -68,8 +71,10 @@ type ASClaim struct { Status ASClaimStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } -// ASClaimList contains a list of ASClaims // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true + +// ASClaimList contains a list of ASClaims type ASClaimList struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/apis/backend/as/v1alpha1/asentry_types.go b/apis/backend/as/v1alpha1/asentry_types.go index eed3d3b..3e80768 100644 --- a/apis/backend/as/v1alpha1/asentry_types.go +++ b/apis/backend/as/v1alpha1/asentry_types.go @@ -47,6 +47,9 @@ type ASEntryStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // ASEntry is the Schema for the ASentry API type ASEntry struct { @@ -57,8 +60,11 @@ type ASEntry struct { Status ASEntryStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } -// ASEntryList contains a list of ASEntries + // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true + +// ASEntryList contains a list of ASEntries type ASEntryList struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/apis/backend/as/v1alpha1/asindex_types.go b/apis/backend/as/v1alpha1/asindex_types.go index 58e157a..aaa3387 100644 --- a/apis/backend/as/v1alpha1/asindex_types.go +++ b/apis/backend/as/v1alpha1/asindex_types.go @@ -52,6 +52,9 @@ type ASIndexStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // ASIndex is the Schema for the ASIndex API type ASIndex struct { @@ -62,8 +65,11 @@ type ASIndex struct { Status ASIndexStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } -// ASIndexList contains a list of ASIndexs + // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true + +// ASIndexList contains a list of ASIndex type ASIndexList struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/apis/backend/as/v1alpha1/zz_generated.conversion.go b/apis/backend/as/v1alpha1/zz_generated.conversion.go new file mode 100644 index 0000000..f23f30b --- /dev/null +++ b/apis/backend/as/v1alpha1/zz_generated.conversion.go @@ -0,0 +1,596 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2024 Nokia. + +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 conversion-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + unsafe "unsafe" + + condition "github.com/kform-dev/choreo/apis/condition" + conditionv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + backend "github.com/kuidio/kuid/apis/backend" + as "github.com/kuidio/kuid/apis/backend/as" + common "github.com/kuidio/kuid/apis/common" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +func init() { + localSchemeBuilder.Register(RegisterConversions) +} + +// RegisterConversions adds conversion functions to the given scheme. +// Public to allow building arbitrary schemes. +func RegisterConversions(s *runtime.Scheme) error { + if err := s.AddGeneratedConversionFunc((*ASClaim)(nil), (*as.ASClaim)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ASClaim_To_as_ASClaim(a.(*ASClaim), b.(*as.ASClaim), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*as.ASClaim)(nil), (*ASClaim)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_as_ASClaim_To_v1alpha1_ASClaim(a.(*as.ASClaim), b.(*ASClaim), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ASClaimList)(nil), (*as.ASClaimList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ASClaimList_To_as_ASClaimList(a.(*ASClaimList), b.(*as.ASClaimList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*as.ASClaimList)(nil), (*ASClaimList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_as_ASClaimList_To_v1alpha1_ASClaimList(a.(*as.ASClaimList), b.(*ASClaimList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ASClaimSpec)(nil), (*as.ASClaimSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ASClaimSpec_To_as_ASClaimSpec(a.(*ASClaimSpec), b.(*as.ASClaimSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*as.ASClaimSpec)(nil), (*ASClaimSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_as_ASClaimSpec_To_v1alpha1_ASClaimSpec(a.(*as.ASClaimSpec), b.(*ASClaimSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ASClaimStatus)(nil), (*as.ASClaimStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ASClaimStatus_To_as_ASClaimStatus(a.(*ASClaimStatus), b.(*as.ASClaimStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*as.ASClaimStatus)(nil), (*ASClaimStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_as_ASClaimStatus_To_v1alpha1_ASClaimStatus(a.(*as.ASClaimStatus), b.(*ASClaimStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ASEntry)(nil), (*as.ASEntry)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ASEntry_To_as_ASEntry(a.(*ASEntry), b.(*as.ASEntry), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*as.ASEntry)(nil), (*ASEntry)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_as_ASEntry_To_v1alpha1_ASEntry(a.(*as.ASEntry), b.(*ASEntry), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ASEntryList)(nil), (*as.ASEntryList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ASEntryList_To_as_ASEntryList(a.(*ASEntryList), b.(*as.ASEntryList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*as.ASEntryList)(nil), (*ASEntryList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_as_ASEntryList_To_v1alpha1_ASEntryList(a.(*as.ASEntryList), b.(*ASEntryList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ASEntrySpec)(nil), (*as.ASEntrySpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ASEntrySpec_To_as_ASEntrySpec(a.(*ASEntrySpec), b.(*as.ASEntrySpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*as.ASEntrySpec)(nil), (*ASEntrySpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_as_ASEntrySpec_To_v1alpha1_ASEntrySpec(a.(*as.ASEntrySpec), b.(*ASEntrySpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ASEntryStatus)(nil), (*as.ASEntryStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ASEntryStatus_To_as_ASEntryStatus(a.(*ASEntryStatus), b.(*as.ASEntryStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*as.ASEntryStatus)(nil), (*ASEntryStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_as_ASEntryStatus_To_v1alpha1_ASEntryStatus(a.(*as.ASEntryStatus), b.(*ASEntryStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ASIndex)(nil), (*as.ASIndex)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ASIndex_To_as_ASIndex(a.(*ASIndex), b.(*as.ASIndex), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*as.ASIndex)(nil), (*ASIndex)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_as_ASIndex_To_v1alpha1_ASIndex(a.(*as.ASIndex), b.(*ASIndex), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ASIndexList)(nil), (*as.ASIndexList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ASIndexList_To_as_ASIndexList(a.(*ASIndexList), b.(*as.ASIndexList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*as.ASIndexList)(nil), (*ASIndexList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_as_ASIndexList_To_v1alpha1_ASIndexList(a.(*as.ASIndexList), b.(*ASIndexList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ASIndexSpec)(nil), (*as.ASIndexSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ASIndexSpec_To_as_ASIndexSpec(a.(*ASIndexSpec), b.(*as.ASIndexSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*as.ASIndexSpec)(nil), (*ASIndexSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_as_ASIndexSpec_To_v1alpha1_ASIndexSpec(a.(*as.ASIndexSpec), b.(*ASIndexSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ASIndexStatus)(nil), (*as.ASIndexStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ASIndexStatus_To_as_ASIndexStatus(a.(*ASIndexStatus), b.(*as.ASIndexStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*as.ASIndexStatus)(nil), (*ASIndexStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_as_ASIndexStatus_To_v1alpha1_ASIndexStatus(a.(*as.ASIndexStatus), b.(*ASIndexStatus), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*common.ClaimLabels)(nil), (*commonv1alpha1.ClaimLabels)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_common_ClaimLabels_To_v1alpha1_ClaimLabels(a.(*common.ClaimLabels), b.(*commonv1alpha1.ClaimLabels), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*common.UserDefinedLabels)(nil), (*commonv1alpha1.UserDefinedLabels)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_common_UserDefinedLabels_To_v1alpha1_UserDefinedLabels(a.(*common.UserDefinedLabels), b.(*commonv1alpha1.UserDefinedLabels), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*condition.Condition)(nil), (*conditionv1alpha1.Condition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_condition_Condition_To_v1alpha1_Condition(a.(*condition.Condition), b.(*conditionv1alpha1.Condition), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*condition.ConditionedStatus)(nil), (*conditionv1alpha1.ConditionedStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(a.(*condition.ConditionedStatus), b.(*conditionv1alpha1.ConditionedStatus), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*commonv1alpha1.ClaimLabels)(nil), (*common.ClaimLabels)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ClaimLabels_To_common_ClaimLabels(a.(*commonv1alpha1.ClaimLabels), b.(*common.ClaimLabels), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*conditionv1alpha1.Condition)(nil), (*condition.Condition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Condition_To_condition_Condition(a.(*conditionv1alpha1.Condition), b.(*condition.Condition), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*conditionv1alpha1.ConditionedStatus)(nil), (*condition.ConditionedStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(a.(*conditionv1alpha1.ConditionedStatus), b.(*condition.ConditionedStatus), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*commonv1alpha1.UserDefinedLabels)(nil), (*common.UserDefinedLabels)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_UserDefinedLabels_To_common_UserDefinedLabels(a.(*commonv1alpha1.UserDefinedLabels), b.(*common.UserDefinedLabels), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1alpha1_ASClaim_To_as_ASClaim(in *ASClaim, out *as.ASClaim, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_ASClaimSpec_To_as_ASClaimSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_ASClaimStatus_To_as_ASClaimStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_ASClaim_To_as_ASClaim is an autogenerated conversion function. +func Convert_v1alpha1_ASClaim_To_as_ASClaim(in *ASClaim, out *as.ASClaim, s conversion.Scope) error { + return autoConvert_v1alpha1_ASClaim_To_as_ASClaim(in, out, s) +} + +func autoConvert_as_ASClaim_To_v1alpha1_ASClaim(in *as.ASClaim, out *ASClaim, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_as_ASClaimSpec_To_v1alpha1_ASClaimSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_as_ASClaimStatus_To_v1alpha1_ASClaimStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_as_ASClaim_To_v1alpha1_ASClaim is an autogenerated conversion function. +func Convert_as_ASClaim_To_v1alpha1_ASClaim(in *as.ASClaim, out *ASClaim, s conversion.Scope) error { + return autoConvert_as_ASClaim_To_v1alpha1_ASClaim(in, out, s) +} + +func autoConvert_v1alpha1_ASClaimList_To_as_ASClaimList(in *ASClaimList, out *as.ASClaimList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]as.ASClaim, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_ASClaim_To_as_ASClaim(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_ASClaimList_To_as_ASClaimList is an autogenerated conversion function. +func Convert_v1alpha1_ASClaimList_To_as_ASClaimList(in *ASClaimList, out *as.ASClaimList, s conversion.Scope) error { + return autoConvert_v1alpha1_ASClaimList_To_as_ASClaimList(in, out, s) +} + +func autoConvert_as_ASClaimList_To_v1alpha1_ASClaimList(in *as.ASClaimList, out *ASClaimList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ASClaim, len(*in)) + for i := range *in { + if err := Convert_as_ASClaim_To_v1alpha1_ASClaim(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_as_ASClaimList_To_v1alpha1_ASClaimList is an autogenerated conversion function. +func Convert_as_ASClaimList_To_v1alpha1_ASClaimList(in *as.ASClaimList, out *ASClaimList, s conversion.Scope) error { + return autoConvert_as_ASClaimList_To_v1alpha1_ASClaimList(in, out, s) +} + +func autoConvert_v1alpha1_ASClaimSpec_To_as_ASClaimSpec(in *ASClaimSpec, out *as.ASClaimSpec, s conversion.Scope) error { + out.Index = in.Index + out.ID = (*uint32)(unsafe.Pointer(in.ID)) + out.Range = (*string)(unsafe.Pointer(in.Range)) + if err := Convert_v1alpha1_ClaimLabels_To_common_ClaimLabels(&in.ClaimLabels, &out.ClaimLabels, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_ASClaimSpec_To_as_ASClaimSpec is an autogenerated conversion function. +func Convert_v1alpha1_ASClaimSpec_To_as_ASClaimSpec(in *ASClaimSpec, out *as.ASClaimSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_ASClaimSpec_To_as_ASClaimSpec(in, out, s) +} + +func autoConvert_as_ASClaimSpec_To_v1alpha1_ASClaimSpec(in *as.ASClaimSpec, out *ASClaimSpec, s conversion.Scope) error { + out.Index = in.Index + out.ID = (*uint32)(unsafe.Pointer(in.ID)) + out.Range = (*string)(unsafe.Pointer(in.Range)) + if err := Convert_common_ClaimLabels_To_v1alpha1_ClaimLabels(&in.ClaimLabels, &out.ClaimLabels, s); err != nil { + return err + } + return nil +} + +// Convert_as_ASClaimSpec_To_v1alpha1_ASClaimSpec is an autogenerated conversion function. +func Convert_as_ASClaimSpec_To_v1alpha1_ASClaimSpec(in *as.ASClaimSpec, out *ASClaimSpec, s conversion.Scope) error { + return autoConvert_as_ASClaimSpec_To_v1alpha1_ASClaimSpec(in, out, s) +} + +func autoConvert_v1alpha1_ASClaimStatus_To_as_ASClaimStatus(in *ASClaimStatus, out *as.ASClaimStatus, s conversion.Scope) error { + if err := Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + out.ID = (*uint32)(unsafe.Pointer(in.ID)) + out.Range = (*string)(unsafe.Pointer(in.Range)) + out.ExpiryTime = (*string)(unsafe.Pointer(in.ExpiryTime)) + return nil +} + +// Convert_v1alpha1_ASClaimStatus_To_as_ASClaimStatus is an autogenerated conversion function. +func Convert_v1alpha1_ASClaimStatus_To_as_ASClaimStatus(in *ASClaimStatus, out *as.ASClaimStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_ASClaimStatus_To_as_ASClaimStatus(in, out, s) +} + +func autoConvert_as_ASClaimStatus_To_v1alpha1_ASClaimStatus(in *as.ASClaimStatus, out *ASClaimStatus, s conversion.Scope) error { + if err := Convert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + out.ID = (*uint32)(unsafe.Pointer(in.ID)) + out.Range = (*string)(unsafe.Pointer(in.Range)) + out.ExpiryTime = (*string)(unsafe.Pointer(in.ExpiryTime)) + return nil +} + +// Convert_as_ASClaimStatus_To_v1alpha1_ASClaimStatus is an autogenerated conversion function. +func Convert_as_ASClaimStatus_To_v1alpha1_ASClaimStatus(in *as.ASClaimStatus, out *ASClaimStatus, s conversion.Scope) error { + return autoConvert_as_ASClaimStatus_To_v1alpha1_ASClaimStatus(in, out, s) +} + +func autoConvert_v1alpha1_ASEntry_To_as_ASEntry(in *ASEntry, out *as.ASEntry, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_ASEntrySpec_To_as_ASEntrySpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_ASEntryStatus_To_as_ASEntryStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_ASEntry_To_as_ASEntry is an autogenerated conversion function. +func Convert_v1alpha1_ASEntry_To_as_ASEntry(in *ASEntry, out *as.ASEntry, s conversion.Scope) error { + return autoConvert_v1alpha1_ASEntry_To_as_ASEntry(in, out, s) +} + +func autoConvert_as_ASEntry_To_v1alpha1_ASEntry(in *as.ASEntry, out *ASEntry, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_as_ASEntrySpec_To_v1alpha1_ASEntrySpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_as_ASEntryStatus_To_v1alpha1_ASEntryStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_as_ASEntry_To_v1alpha1_ASEntry is an autogenerated conversion function. +func Convert_as_ASEntry_To_v1alpha1_ASEntry(in *as.ASEntry, out *ASEntry, s conversion.Scope) error { + return autoConvert_as_ASEntry_To_v1alpha1_ASEntry(in, out, s) +} + +func autoConvert_v1alpha1_ASEntryList_To_as_ASEntryList(in *ASEntryList, out *as.ASEntryList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]as.ASEntry, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_ASEntry_To_as_ASEntry(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_ASEntryList_To_as_ASEntryList is an autogenerated conversion function. +func Convert_v1alpha1_ASEntryList_To_as_ASEntryList(in *ASEntryList, out *as.ASEntryList, s conversion.Scope) error { + return autoConvert_v1alpha1_ASEntryList_To_as_ASEntryList(in, out, s) +} + +func autoConvert_as_ASEntryList_To_v1alpha1_ASEntryList(in *as.ASEntryList, out *ASEntryList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ASEntry, len(*in)) + for i := range *in { + if err := Convert_as_ASEntry_To_v1alpha1_ASEntry(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_as_ASEntryList_To_v1alpha1_ASEntryList is an autogenerated conversion function. +func Convert_as_ASEntryList_To_v1alpha1_ASEntryList(in *as.ASEntryList, out *ASEntryList, s conversion.Scope) error { + return autoConvert_as_ASEntryList_To_v1alpha1_ASEntryList(in, out, s) +} + +func autoConvert_v1alpha1_ASEntrySpec_To_as_ASEntrySpec(in *ASEntrySpec, out *as.ASEntrySpec, s conversion.Scope) error { + out.Index = in.Index + out.ClaimType = backend.ClaimType(in.ClaimType) + out.ID = in.ID + if err := Convert_v1alpha1_ClaimLabels_To_common_ClaimLabels(&in.ClaimLabels, &out.ClaimLabels, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_ASEntrySpec_To_as_ASEntrySpec is an autogenerated conversion function. +func Convert_v1alpha1_ASEntrySpec_To_as_ASEntrySpec(in *ASEntrySpec, out *as.ASEntrySpec, s conversion.Scope) error { + return autoConvert_v1alpha1_ASEntrySpec_To_as_ASEntrySpec(in, out, s) +} + +func autoConvert_as_ASEntrySpec_To_v1alpha1_ASEntrySpec(in *as.ASEntrySpec, out *ASEntrySpec, s conversion.Scope) error { + out.Index = in.Index + out.ClaimType = backend.ClaimType(in.ClaimType) + out.ID = in.ID + if err := Convert_common_ClaimLabels_To_v1alpha1_ClaimLabels(&in.ClaimLabels, &out.ClaimLabels, s); err != nil { + return err + } + return nil +} + +// Convert_as_ASEntrySpec_To_v1alpha1_ASEntrySpec is an autogenerated conversion function. +func Convert_as_ASEntrySpec_To_v1alpha1_ASEntrySpec(in *as.ASEntrySpec, out *ASEntrySpec, s conversion.Scope) error { + return autoConvert_as_ASEntrySpec_To_v1alpha1_ASEntrySpec(in, out, s) +} + +func autoConvert_v1alpha1_ASEntryStatus_To_as_ASEntryStatus(in *ASEntryStatus, out *as.ASEntryStatus, s conversion.Scope) error { + if err := Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_ASEntryStatus_To_as_ASEntryStatus is an autogenerated conversion function. +func Convert_v1alpha1_ASEntryStatus_To_as_ASEntryStatus(in *ASEntryStatus, out *as.ASEntryStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_ASEntryStatus_To_as_ASEntryStatus(in, out, s) +} + +func autoConvert_as_ASEntryStatus_To_v1alpha1_ASEntryStatus(in *as.ASEntryStatus, out *ASEntryStatus, s conversion.Scope) error { + if err := Convert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_as_ASEntryStatus_To_v1alpha1_ASEntryStatus is an autogenerated conversion function. +func Convert_as_ASEntryStatus_To_v1alpha1_ASEntryStatus(in *as.ASEntryStatus, out *ASEntryStatus, s conversion.Scope) error { + return autoConvert_as_ASEntryStatus_To_v1alpha1_ASEntryStatus(in, out, s) +} + +func autoConvert_v1alpha1_ASIndex_To_as_ASIndex(in *ASIndex, out *as.ASIndex, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_ASIndexSpec_To_as_ASIndexSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_ASIndexStatus_To_as_ASIndexStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_ASIndex_To_as_ASIndex is an autogenerated conversion function. +func Convert_v1alpha1_ASIndex_To_as_ASIndex(in *ASIndex, out *as.ASIndex, s conversion.Scope) error { + return autoConvert_v1alpha1_ASIndex_To_as_ASIndex(in, out, s) +} + +func autoConvert_as_ASIndex_To_v1alpha1_ASIndex(in *as.ASIndex, out *ASIndex, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_as_ASIndexSpec_To_v1alpha1_ASIndexSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_as_ASIndexStatus_To_v1alpha1_ASIndexStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_as_ASIndex_To_v1alpha1_ASIndex is an autogenerated conversion function. +func Convert_as_ASIndex_To_v1alpha1_ASIndex(in *as.ASIndex, out *ASIndex, s conversion.Scope) error { + return autoConvert_as_ASIndex_To_v1alpha1_ASIndex(in, out, s) +} + +func autoConvert_v1alpha1_ASIndexList_To_as_ASIndexList(in *ASIndexList, out *as.ASIndexList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]as.ASIndex, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_ASIndex_To_as_ASIndex(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_ASIndexList_To_as_ASIndexList is an autogenerated conversion function. +func Convert_v1alpha1_ASIndexList_To_as_ASIndexList(in *ASIndexList, out *as.ASIndexList, s conversion.Scope) error { + return autoConvert_v1alpha1_ASIndexList_To_as_ASIndexList(in, out, s) +} + +func autoConvert_as_ASIndexList_To_v1alpha1_ASIndexList(in *as.ASIndexList, out *ASIndexList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ASIndex, len(*in)) + for i := range *in { + if err := Convert_as_ASIndex_To_v1alpha1_ASIndex(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_as_ASIndexList_To_v1alpha1_ASIndexList is an autogenerated conversion function. +func Convert_as_ASIndexList_To_v1alpha1_ASIndexList(in *as.ASIndexList, out *ASIndexList, s conversion.Scope) error { + return autoConvert_as_ASIndexList_To_v1alpha1_ASIndexList(in, out, s) +} + +func autoConvert_v1alpha1_ASIndexSpec_To_as_ASIndexSpec(in *ASIndexSpec, out *as.ASIndexSpec, s conversion.Scope) error { + out.MinID = (*uint32)(unsafe.Pointer(in.MinID)) + out.MaxID = (*uint32)(unsafe.Pointer(in.MaxID)) + if err := Convert_v1alpha1_UserDefinedLabels_To_common_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_ASIndexSpec_To_as_ASIndexSpec is an autogenerated conversion function. +func Convert_v1alpha1_ASIndexSpec_To_as_ASIndexSpec(in *ASIndexSpec, out *as.ASIndexSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_ASIndexSpec_To_as_ASIndexSpec(in, out, s) +} + +func autoConvert_as_ASIndexSpec_To_v1alpha1_ASIndexSpec(in *as.ASIndexSpec, out *ASIndexSpec, s conversion.Scope) error { + out.MinID = (*uint32)(unsafe.Pointer(in.MinID)) + out.MaxID = (*uint32)(unsafe.Pointer(in.MaxID)) + if err := Convert_common_UserDefinedLabels_To_v1alpha1_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_as_ASIndexSpec_To_v1alpha1_ASIndexSpec is an autogenerated conversion function. +func Convert_as_ASIndexSpec_To_v1alpha1_ASIndexSpec(in *as.ASIndexSpec, out *ASIndexSpec, s conversion.Scope) error { + return autoConvert_as_ASIndexSpec_To_v1alpha1_ASIndexSpec(in, out, s) +} + +func autoConvert_v1alpha1_ASIndexStatus_To_as_ASIndexStatus(in *ASIndexStatus, out *as.ASIndexStatus, s conversion.Scope) error { + out.MinID = (*uint32)(unsafe.Pointer(in.MinID)) + out.MaxID = (*uint32)(unsafe.Pointer(in.MaxID)) + if err := Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_ASIndexStatus_To_as_ASIndexStatus is an autogenerated conversion function. +func Convert_v1alpha1_ASIndexStatus_To_as_ASIndexStatus(in *ASIndexStatus, out *as.ASIndexStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_ASIndexStatus_To_as_ASIndexStatus(in, out, s) +} + +func autoConvert_as_ASIndexStatus_To_v1alpha1_ASIndexStatus(in *as.ASIndexStatus, out *ASIndexStatus, s conversion.Scope) error { + out.MinID = (*uint32)(unsafe.Pointer(in.MinID)) + out.MaxID = (*uint32)(unsafe.Pointer(in.MaxID)) + if err := Convert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_as_ASIndexStatus_To_v1alpha1_ASIndexStatus is an autogenerated conversion function. +func Convert_as_ASIndexStatus_To_v1alpha1_ASIndexStatus(in *as.ASIndexStatus, out *ASIndexStatus, s conversion.Scope) error { + return autoConvert_as_ASIndexStatus_To_v1alpha1_ASIndexStatus(in, out, s) +} diff --git a/apis/backend/as/v1alpha1/zz_generated.deepcopy.go b/apis/backend/as/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 0000000..a5eeae8 --- /dev/null +++ b/apis/backend/as/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,355 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +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 *ASClaim) DeepCopyInto(out *ASClaim) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ASClaim. +func (in *ASClaim) DeepCopy() *ASClaim { + if in == nil { + return nil + } + out := new(ASClaim) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ASClaim) 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 *ASClaimList) DeepCopyInto(out *ASClaimList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ASClaim, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ASClaimList. +func (in *ASClaimList) DeepCopy() *ASClaimList { + if in == nil { + return nil + } + out := new(ASClaimList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ASClaimList) 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 *ASClaimSpec) DeepCopyInto(out *ASClaimSpec) { + *out = *in + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(uint32) + **out = **in + } + if in.Range != nil { + in, out := &in.Range, &out.Range + *out = new(string) + **out = **in + } + in.ClaimLabels.DeepCopyInto(&out.ClaimLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ASClaimSpec. +func (in *ASClaimSpec) DeepCopy() *ASClaimSpec { + if in == nil { + return nil + } + out := new(ASClaimSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ASClaimStatus) DeepCopyInto(out *ASClaimStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(uint32) + **out = **in + } + if in.Range != nil { + in, out := &in.Range, &out.Range + *out = new(string) + **out = **in + } + if in.ExpiryTime != nil { + in, out := &in.ExpiryTime, &out.ExpiryTime + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ASClaimStatus. +func (in *ASClaimStatus) DeepCopy() *ASClaimStatus { + if in == nil { + return nil + } + out := new(ASClaimStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ASEntry) DeepCopyInto(out *ASEntry) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ASEntry. +func (in *ASEntry) DeepCopy() *ASEntry { + if in == nil { + return nil + } + out := new(ASEntry) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ASEntry) 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 *ASEntryList) DeepCopyInto(out *ASEntryList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ASEntry, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ASEntryList. +func (in *ASEntryList) DeepCopy() *ASEntryList { + if in == nil { + return nil + } + out := new(ASEntryList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ASEntryList) 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 *ASEntrySpec) DeepCopyInto(out *ASEntrySpec) { + *out = *in + in.ClaimLabels.DeepCopyInto(&out.ClaimLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ASEntrySpec. +func (in *ASEntrySpec) DeepCopy() *ASEntrySpec { + if in == nil { + return nil + } + out := new(ASEntrySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ASEntryStatus) DeepCopyInto(out *ASEntryStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ASEntryStatus. +func (in *ASEntryStatus) DeepCopy() *ASEntryStatus { + if in == nil { + return nil + } + out := new(ASEntryStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ASIndex) DeepCopyInto(out *ASIndex) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ASIndex. +func (in *ASIndex) DeepCopy() *ASIndex { + if in == nil { + return nil + } + out := new(ASIndex) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ASIndex) 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 *ASIndexList) DeepCopyInto(out *ASIndexList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ASIndex, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ASIndexList. +func (in *ASIndexList) DeepCopy() *ASIndexList { + if in == nil { + return nil + } + out := new(ASIndexList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ASIndexList) 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 *ASIndexSpec) DeepCopyInto(out *ASIndexSpec) { + *out = *in + if in.MinID != nil { + in, out := &in.MinID, &out.MinID + *out = new(uint32) + **out = **in + } + if in.MaxID != nil { + in, out := &in.MaxID, &out.MaxID + *out = new(uint32) + **out = **in + } + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ASIndexSpec. +func (in *ASIndexSpec) DeepCopy() *ASIndexSpec { + if in == nil { + return nil + } + out := new(ASIndexSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ASIndexStatus) DeepCopyInto(out *ASIndexStatus) { + *out = *in + if in.MinID != nil { + in, out := &in.MinID, &out.MinID + *out = new(uint32) + **out = **in + } + if in.MaxID != nil { + in, out := &in.MaxID, &out.MaxID + *out = new(uint32) + **out = **in + } + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ASIndexStatus. +func (in *ASIndexStatus) DeepCopy() *ASIndexStatus { + if in == nil { + return nil + } + out := new(ASIndexStatus) + in.DeepCopyInto(out) + return out +} diff --git a/apis/backend/as/zz_generated.deepcopy.go b/apis/backend/as/zz_generated.deepcopy.go index 76df54f..81ecf5b 100644 --- a/apis/backend/as/zz_generated.deepcopy.go +++ b/apis/backend/as/zz_generated.deepcopy.go @@ -449,3 +449,35 @@ func (in *ASStaticIDSyntaxValidator) DeepCopy() *ASStaticIDSyntaxValidator { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClaimGetter) DeepCopyInto(out *ClaimGetter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClaimGetter. +func (in *ClaimGetter) DeepCopy() *ClaimGetter { + if in == nil { + return nil + } + out := new(ClaimGetter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EntryGetter) DeepCopyInto(out *EntryGetter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EntryGetter. +func (in *EntryGetter) DeepCopy() *EntryGetter { + if in == nil { + return nil + } + out := new(EntryGetter) + in.DeepCopyInto(out) + return out +} diff --git a/apis/backend/object.go b/apis/backend/object.go index 7860307..6b3e029 100644 --- a/apis/backend/object.go +++ b/apis/backend/object.go @@ -21,12 +21,11 @@ import ( "github.com/henderiw/idxtable/pkg/tree" "github.com/henderiw/idxtable/pkg/tree/gtree" "github.com/henderiw/store" - - //condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" "github.com/kform-dev/choreo/apis/condition" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/validation/field" "sigs.k8s.io/controller-runtime/pkg/client" ) @@ -62,6 +61,8 @@ type ClaimObject interface { GetStatusID() *uint64 GetClaimRequest() string GetClaimResponse() string + GetClaimSet(typ string) (sets.Set[tree.ID], error) + IsOwner(labels labels.Set) bool } type EntryObject interface { diff --git a/crds/as.be.kuid.dev_asclaims.yaml b/crds/as.be.kuid.dev_asclaims.yaml new file mode 100644 index 0000000..e4de9ee --- /dev/null +++ b/crds/as.be.kuid.dev_asclaims.yaml @@ -0,0 +1,366 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: asclaims.as.be.kuid.dev +spec: + group: as.be.kuid.dev + names: + categories: + - kuid + kind: ASClaim + listKind: ASClaimList + plural: asclaims + singular: asclaim + scope: Namespaced + versions: + - name: as + schema: + openAPIV3Schema: + description: ASClaim is the Schema for the ASClaim API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: ASClaimSpec defines the desired state of ASClaim + properties: + id: + description: ASID defines the AS for the AS claim + format: int32 + type: integer + index: + description: Index defines the index for the AS Claim + type: string + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + range: + description: |- + Range defines the AS range for the AS claim + The following notation is used: start-end - + the ASs in the range must be consecutive + type: string + selector: + description: Selector defines the selector criterias + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. + The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector applies + to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + required: + - index + type: object + status: + description: ASClaimStatus defines the observed state of ASClaim + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + expiryTime: + description: ExpiryTime defines when the claim expires + type: string + id: + description: ASID defines the AS for the AS claim + format: int32 + type: integer + range: + description: ASRange defines the AS range for the AS claim + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {} + - name: v1alpha1 + schema: + openAPIV3Schema: + description: ASClaim is the Schema for the ASClaim API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: ASClaimSpec defines the desired state of ASClaim + properties: + id: + description: ASID defines the AS for the AS claim + format: int32 + type: integer + index: + description: Index defines the index for the AS Claim + type: string + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + range: + description: |- + Range defines the AS range for the AS claim + The following notation is used: start-end - + the ASs in the range must be consecutive + type: string + selector: + description: Selector defines the selector criterias + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. + The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector applies + to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + required: + - index + type: object + status: + description: ASClaimStatus defines the observed state of ASClaim + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + expiryTime: + description: ExpiryTime defines when the claim expires + type: string + id: + description: ASID defines the AS for the AS claim + format: int32 + type: integer + range: + description: ASRange defines the AS range for the AS claim + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} diff --git a/crds/as.be.kuid.dev_asentries.yaml b/crds/as.be.kuid.dev_asentries.yaml new file mode 100644 index 0000000..56f923e --- /dev/null +++ b/crds/as.be.kuid.dev_asentries.yaml @@ -0,0 +1,338 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: asentries.as.be.kuid.dev +spec: + group: as.be.kuid.dev + names: + categories: + - kuid + kind: ASEntry + listKind: ASEntryList + plural: asentries + singular: asentry + scope: Namespaced + versions: + - name: as + schema: + openAPIV3Schema: + description: ASEntry is the Schema for the ASentry API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: ASEntrySpec defines the desired state of ASEntry + properties: + claimType: + description: ClaimType defines the claimType of the resource + type: string + id: + description: ID defines the id of the resource in the tree + type: string + index: + description: Index defines the index for the resource + type: string + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + selector: + description: Selector defines the selector criterias + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. + The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector applies + to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + required: + - index + type: object + status: + description: ASEntryStatus defines the observed state of ASEntry + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: true + subresources: + status: {} + - name: v1alpha1 + schema: + openAPIV3Schema: + description: ASEntry is the Schema for the ASentry API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: ASEntrySpec defines the desired state of ASEntry + properties: + claimType: + description: ClaimType defines the claimType of the resource + type: string + id: + description: ID defines the id of the resource in the tree + type: string + index: + description: Index defines the index for the resource + type: string + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + selector: + description: Selector defines the selector criterias + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. + The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector applies + to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + required: + - index + type: object + status: + description: ASEntryStatus defines the observed state of ASEntry + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: false + subresources: + status: {} diff --git a/crds/as.be.kuid.dev_asindexes.yaml b/crds/as.be.kuid.dev_asindexes.yaml new file mode 100644 index 0000000..9a48796 --- /dev/null +++ b/crds/as.be.kuid.dev_asindexes.yaml @@ -0,0 +1,256 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: asindexes.as.be.kuid.dev +spec: + group: as.be.kuid.dev + names: + categories: + - kuid + kind: ASIndex + listKind: ASIndexList + plural: asindexes + singular: asindex + scope: Namespaced + versions: + - name: as + schema: + openAPIV3Schema: + description: ASIndex is the Schema for the ASIndex API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: ASIndexSpec defines the desired state of ASIndex + properties: + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + maxID: + description: MaxID defines the max VLAN ID the index supports + format: int32 + type: integer + minID: + description: MinID defines the min VLAN ID the index supports + format: int32 + type: integer + type: object + status: + description: ASIndexStatus defines the observed state of ASIndex + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + maxID: + description: MaxID defines the max VLAN ID the index supports + format: int32 + type: integer + minID: + description: MinID defines the min VLAN ID the index supports + format: int32 + type: integer + type: object + type: object + served: true + storage: true + subresources: + status: {} + - name: v1alpha1 + schema: + openAPIV3Schema: + description: ASIndex is the Schema for the ASIndex API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: ASIndexSpec defines the desired state of ASIndex + properties: + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + maxID: + description: MaxID defines the max VLAN ID the index supports + format: int32 + type: integer + minID: + description: MinID defines the min VLAN ID the index supports + format: int32 + type: integer + type: object + status: + description: ASIndexStatus defines the observed state of ASIndex + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + maxID: + description: MaxID defines the max VLAN ID the index supports + format: int32 + type: integer + minID: + description: MinID defines the min VLAN ID the index supports + format: int32 + type: integer + type: object + type: object + served: true + storage: false + subresources: + status: {} diff --git a/go.mod b/go.mod index 697940e..3132170 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,8 @@ toolchain go1.23.2 replace k8s.io/api => k8s.io/api v0.31.1 +replace k8s.io/kms => k8s.io/kms v0.31.1 + replace k8s.io/apimachinery => k8s.io/apimachinery v0.31.1 replace k8s.io/client-go => k8s.io/client-go v0.31.1 @@ -22,12 +24,13 @@ require ( github.com/google/uuid v1.6.0 github.com/henderiw/apiserver-builder v0.0.4-0.20241020093259-47da0b178335 github.com/henderiw/apiserver-store v0.0.3-0.20241020093130-09730291ea07 - github.com/henderiw/idxtable v0.0.0-20241020093436-6b78e5fa3b3c + github.com/henderiw/idxtable v0.0.0-20241021085446-f8d804551342 github.com/henderiw/logger v0.0.0-20230911123436-8655829b1abe github.com/henderiw/store v0.0.2-0.20241020093537-5a92d3e14a02 github.com/kform-dev/choreo v0.0.11 github.com/pkg/errors v0.9.1 github.com/spf13/cobra v1.8.1 + github.com/stretchr/testify v1.9.0 go.opentelemetry.io/otel v1.28.0 go.uber.org/zap v1.27.0 golang.org/x/mod v0.21.0 @@ -61,7 +64,7 @@ require ( github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dgraph-io/ristretto v0.1.2-0.20240116140435-c67e07994f91 // indirect github.com/dustin/go-humanize v1.0.1 // indirect - github.com/emicklei/go-restful/v3 v3.11.2 // indirect + github.com/emicklei/go-restful/v3 v3.12.1 // indirect github.com/emirpasic/gods v1.18.1 // indirect github.com/evanphx/json-patch/v5 v5.9.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect @@ -85,7 +88,7 @@ require ( github.com/google/gofuzz v1.2.0 // indirect github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect - github.com/imdario/mergo v0.3.6 // indirect + github.com/imdario/mergo v0.3.13 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect github.com/josharian/intern v1.0.0 // indirect @@ -96,6 +99,7 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pjbgf/sha1cd v0.3.0 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.19.1 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.55.0 // indirect diff --git a/go.sum b/go.sum index e71a528..4efb7b3 100644 --- a/go.sum +++ b/go.sum @@ -46,8 +46,8 @@ github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WA github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -github.com/emicklei/go-restful/v3 v3.11.2 h1:1onLa9DcsMYO9P+CXaL0dStDqQ2EHHXLiz+BtnqkLAU= -github.com/emicklei/go-restful/v3 v3.11.2/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/emicklei/go-restful/v3 v3.12.1 h1:PJMDIM/ak7btuL8Ex0iYET9hxM3CI2sjZtzpL63nKAU= +github.com/emicklei/go-restful/v3 v3.12.1/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -143,14 +143,14 @@ github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4 github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0= github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k= -github.com/henderiw/idxtable v0.0.0-20241020093436-6b78e5fa3b3c h1:KAQe0QLJJaGzQ+9Xil0+xgsISqqWXbUE4DUXGRdsB2I= -github.com/henderiw/idxtable v0.0.0-20241020093436-6b78e5fa3b3c/go.mod h1:EPdUFZyKA2IORzohdu67+xBbfDmkHEDUaMN0BBsk8eY= +github.com/henderiw/idxtable v0.0.0-20241021085446-f8d804551342 h1:gkdOvjxM6rNTkcyoykZLjAfPjn06/MEY4o8cy+3uj2g= +github.com/henderiw/idxtable v0.0.0-20241021085446-f8d804551342/go.mod h1:EPdUFZyKA2IORzohdu67+xBbfDmkHEDUaMN0BBsk8eY= github.com/henderiw/logger v0.0.0-20230911123436-8655829b1abe h1:+R53KH7fW+pmqlfSYVTCGPn8pj6gqBGcQ0nq7L1h8+g= github.com/henderiw/logger v0.0.0-20230911123436-8655829b1abe/go.mod h1:KNMXpSG8v0BAfIh5rZL4hgow3pBWNbkmmb28x9C5s+Y= github.com/henderiw/store v0.0.2-0.20241020093537-5a92d3e14a02 h1:AyDjgCG9+s+ci3HNU++YZ3o3p4nxngWWhAmwU64YPs8= github.com/henderiw/store v0.0.2-0.20241020093537-5a92d3e14a02/go.mod h1:BS0axsmGORgxlBKcdl9T+oxhWEyTwSpb4ZyIqulQ2Bc= -github.com/imdario/mergo v0.3.6 h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28= -github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= +github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= @@ -185,10 +185,10 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA= -github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To= -github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk= -github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0= +github.com/onsi/ginkgo/v2 v2.19.1 h1:QXgq3Z8Crl5EL1WBAC98A5sEBHARrAJNzAmMxzLcRF0= +github.com/onsi/ginkgo/v2 v2.19.1/go.mod h1:O3DtEWQkPa/F7fBMgmZQKKsluAy8pd3rEQdrjkPb9zA= +github.com/onsi/gomega v1.34.0 h1:eSSPsPNp6ZpsG8X1OVmOTxig+CblTc4AxpPBykhe2Os= +github.com/onsi/gomega v1.34.0/go.mod h1:MIKI8c+f+QLWk+hxbePD4i0LMJSExPaZOVfkoex4cAo= github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -430,6 +430,7 @@ gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -452,8 +453,8 @@ k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 h1:NGrVE502P0s0/1hudf8zjgwki1 k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70/go.mod h1:VH3AT8AaQOqiGjMF9p0/IM1Dj+82ZwjfxUP1IxaHE+8= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= -k8s.io/kms v0.32.0-alpha.2 h1:NJN4JwERThH1UVDE8XSEXrBf4Zi8nPFpuiF3rWCjYU4= -k8s.io/kms v0.32.0-alpha.2/go.mod h1:9jVVb5kg1PXT6I5QMPUTqnr6P9Tg+6H5Y7hCML+P0k0= +k8s.io/kms v0.31.1 h1:cGLyV3cIwb0ovpP/jtyIe2mEuQ/MkbhmeBF2IYCA9Io= +k8s.io/kms v0.31.1/go.mod h1:OZKwl1fan3n3N5FFxnW5C4V3ygrah/3YXeJWS3O6+94= k8s.io/kube-openapi v0.0.0-20240827152857-f7e401e7b4c2 h1:GKE9U8BH16uynoxQii0auTjmmmuZ3O0LFMN6S0lPPhI= k8s.io/kube-openapi v0.0.0-20240827152857-f7e401e7b4c2/go.mod h1:coRQXBK9NxO98XUv3ZD6AK3xzHCxV6+b7lrquKwaKzA= k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A= diff --git a/main.go b/main.go index 72462d9..3f41349 100644 --- a/main.go +++ b/main.go @@ -241,6 +241,9 @@ func main() { WithResourceAndHandler(&as.ASIndex{}, asStorageProviders.GetIndexStorageProvider()). WithResourceAndHandler(&as.ASClaim{}, asStorageProviders.GetClaimStorageProvider()). WithResourceAndHandler(&as.ASEntry{}, asStorageProviders.GetEntryStorageProvider()). + WithResourceAndHandler(&asbev1alpha1.ASIndex{}, asStorageProviders.GetIndexStorageProvider()). + WithResourceAndHandler(&asbev1alpha1.ASClaim{}, asStorageProviders.GetClaimStorageProvider()). + WithResourceAndHandler(&asbev1alpha1.ASEntry{}, asStorageProviders.GetEntryStorageProvider()). WithoutEtcd() cmd, err := apiserver.Build(ctx) diff --git a/pkg/backend/astest/as_claim_test.go b/pkg/backend/astest/as_claim_test.go new file mode 100644 index 0000000..9f452bb --- /dev/null +++ b/pkg/backend/astest/as_claim_test.go @@ -0,0 +1,203 @@ +package astest + +import ( + "context" + "fmt" + "testing" + + "github.com/henderiw/apiserver-builder/pkg/builder" + "github.com/kuidio/kuid/apis/backend" + "github.com/kuidio/kuid/apis/backend/as" + asbev1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" + "github.com/kuidio/kuid/pkg/generated/openapi" + "github.com/kuidio/kuid/pkg/registry/options" + "github.com/stretchr/testify/assert" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" + "k8s.io/utils/ptr" +) + +func Test(t *testing.T) { + tests := map[string]struct { + index string + ctxs []testCtx + }{ + "Mix": { + index: "a", + ctxs: []testCtx{ + {claimType: dynamicClaim, name: "claim1", expectedError: false, expectedID: ptr.To[uint64](0)}, + {claimType: staticClaim, name: "claim2", id: 100, expectedError: false}, + {claimType: staticClaim, name: "claim3", id: 4000, expectedError: false}, + {claimType: rangeClaim, name: "claim4", tRange: "10-19", expectedError: false}, + {claimType: rangeClaim, name: "claim4", tRange: "11-19", expectedError: false}, // reclaim + {claimType: rangeClaim, name: "claim5", tRange: "5-10", expectedError: false}, // claim a new range + {claimType: rangeClaim, name: "claim6", tRange: "19-100", expectedError: true}, // overlap with a static id of claim2 + {claimType: staticClaim, name: "claim7", id: 12, expectedError: false}, + {claimType: staticClaim, name: "claim7", id: 13, expectedError: false}, // reclaim an existing id + {claimType: dynamicClaim, name: "claim8", selector: &metav1.LabelSelector{ + MatchLabels: map[string]string{backend.KuidClaimNameKey: "claim4"}, + }, expectedError: false, expectedID: ptr.To[uint64](11)}, // a dynamic claim from a range + {claimType: dynamicClaim, name: "claim9", selector: &metav1.LabelSelector{ + MatchLabels: map[string]string{backend.KuidClaimNameKey: "claim4"}, + }, expectedError: false, expectedID: ptr.To[uint64](12)}, // a dynamic claim from a range that was claimed before + {claimType: dynamicClaim, name: "claim10", selector: &metav1.LabelSelector{ + MatchLabels: map[string]string{backend.KuidClaimNameKey: "claim4"}, + }, expectedError: false, expectedID: ptr.To[uint64](14)}, + {claimType: dynamicClaim, name: "claim10", selector: &metav1.LabelSelector{ + MatchLabels: map[string]string{backend.KuidClaimNameKey: "claim4"}, // update + }, expectedError: false, expectedID: ptr.To[uint64](14)}, + {claimType: rangeClaim, name: "claim4", tRange: "11-19", expectedError: false}, // update + }, + }, + } + + for name, tc := range tests { + tc := tc + + testTypes := []string{""} + + for _, testType := range testTypes { + t.Run(name, func(t *testing.T) { + ctx := context.Background() + asStorageProviders := as.NewStorageProviders(ctx, true, &options.Options{ + Type: options.StorageType_Memory, + }) + apiserver := builder.APIServer. + WithServerName("kuid-api-server"). + WithOpenAPIDefinitions("Config", "v1alpha1", openapi.GetOpenAPIDefinitions). + WithResourceAndHandler(&as.ASIndex{}, asStorageProviders.GetIndexStorageProvider()). + WithResourceAndHandler(&as.ASClaim{}, asStorageProviders.GetClaimStorageProvider()). + WithResourceAndHandler(&as.ASEntry{}, asStorageProviders.GetEntryStorageProvider()). + WithResourceAndHandler(&asbev1alpha1.ASIndex{}, asStorageProviders.GetIndexStorageProvider()). + WithResourceAndHandler(&asbev1alpha1.ASClaim{}, asStorageProviders.GetClaimStorageProvider()). + WithResourceAndHandler(&asbev1alpha1.ASEntry{}, asStorageProviders.GetEntryStorageProvider()). + WithoutEtcd() + + if _, err := apiserver.Build(ctx); err != nil { + panic(err) + } + if err := asStorageProviders.ApplyStorageToBackend(ctx, apiserver); err != nil { + panic(err) + } + be := asStorageProviders.GetBackend() + claimStorage := be.GetClaimStorage() + + if tc.index != "" { + index, err := getIndex(tc.index, testType) + assert.NoError(t, err) + err = be.CreateIndex(ctx, index) + assert.NoError(t, err) + } + + for _, v := range tc.ctxs { + v := v + var claim backend.ClaimObject + var err error + + switch v.claimType { + case staticClaim: + claim, err = v.getStaticClaim(tc.index, testType) + case dynamicClaim: + claim, err = v.getDynamicClaim(tc.index, testType) + case rangeClaim: + claim, err = v.getRangeClaim(tc.index, testType) + fmt.Println("claim range", *claim.GetRange()) + } + assert.NoError(t, err) + if err != nil { + return + } + + ctx = genericapirequest.WithNamespace(ctx, claim.GetNamespace()) + + exists := true + if _, err := claimStorage.Get(ctx, claim.GetName(), &metav1.GetOptions{}); err != nil { + exists = false + } + var newClaim runtime.Object + if !exists { + newClaim, err = claimStorage.Create(ctx, claim, nil, &metav1.CreateOptions{FieldManager: "test"}) + } else { + + defaultObjInfo := rest.DefaultUpdatedObjectInfo(claim, transformer) + newClaim, _, err = claimStorage.Update(ctx, claim.GetName(), defaultObjInfo, nil, nil, false, &metav1.UpdateOptions{ + FieldManager: "backend", + }) + } + + if v.expectedError { + assert.Error(t, err) + continue + } else { + assert.NoError(t, err) + } + //fmt.Println("newCLaim", newClaim, err) + //fmt.Println("newClaim", newClaim) + + uobj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(newClaim) + if err != nil { + assert.Error(t, err) + continue + } + //u := &unstructured.Unstructured{ + // Object: uobj, + //} + status := uobj["status"] + statusObj, ok := status.(map[string]any) + if !ok { + t.Errorf("expecting status id got nil") + } + + switch v.claimType { + case staticClaim, dynamicClaim: + expectedID := v.id + if v.expectedID != nil { + expectedID = *v.expectedID + } + fmt.Printf("expected/received %v/%v\n", expectedID, statusObj["id"]) + /* + id, ok := statusObj["id"] + if !ok { + t.Errorf("expecting status id got nil") + continue + } else { + expectedID := v.id + if v.expectedID != nil { + expectedID = *v.expectedID + } + if uint64(id) != expectedID { + t.Errorf("expecting id got %d, want %d\n", *claim.Status.ID, expectedID) + } + } + */ + case rangeClaim: + expectedRange := v.tRange + if v.expectedRange != nil { + expectedRange = *v.expectedRange + } + fmt.Printf("expected/received %v/%v\n", expectedRange, statusObj["range"]) + /* + if claim.Status.Range == nil { + t.Errorf("expecting status id got nil") + } else { + expectedRange := v.tRange + if v.expectedRange != nil { + expectedRange = *v.expectedRange + } + if *claim.Status.Range != expectedRange { + t.Errorf("expecting range got %s, want %s\n", *claim.Status.Range, expectedRange) + } + } + */ + } + //fmt.Println("entries after claim", v.name) + //key := store.KeyFromNSN(types.NamespacedName{Namespace: namespace, Name: tc.index}) + //be.PrintEntries(ctx, tc.index) + //assert.NoError(t, err) + } + }) + } + } +} diff --git a/pkg/backend/astest/as_helpers_test.go b/pkg/backend/astest/as_helpers_test.go new file mode 100644 index 0000000..9b5962d --- /dev/null +++ b/pkg/backend/astest/as_helpers_test.go @@ -0,0 +1,133 @@ +package astest + +import ( + "context" + "fmt" + "reflect" + + "github.com/kuidio/kuid/apis/backend" + "github.com/kuidio/kuid/apis/backend/as" + "github.com/kuidio/kuid/apis/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/utils/ptr" +) + +type testCtx struct { + name string + claimType backend.ClaimType + id uint64 + tRange string + labels map[string]string + selector *metav1.LabelSelector + expectedError bool + expectedID *uint64 + expectedRange *string +} + +// alias +const ( + namespace = "dummy" + staticClaim = backend.ClaimType_StaticID + dynamicClaim = backend.ClaimType_DynamicID + rangeClaim = backend.ClaimType_Range +) + +func getIndex(index, _ string) (*as.ASIndex, error) { + idx := as.BuildASIndex( + metav1.ObjectMeta{Namespace: namespace, Name: index}, + nil, + nil, + ) + + fieldErrs := idx.ValidateSyntax("") + if len(fieldErrs) != 0 { + return nil, fmt.Errorf("syntax errors %v", fieldErrs) + } + return idx, nil +} + +func (r testCtx) getDynamicClaim(index, testType string) (backend.ClaimObject, error) { + claim := as.BuildASClaim( + metav1.ObjectMeta{Namespace: namespace, Name: r.name}, + &as.ASClaimSpec{ + Index: index, + ClaimLabels: common.ClaimLabels{ + UserDefinedLabels: common.UserDefinedLabels{Labels: r.labels}, + Selector: r.selector, + }, + }, + nil, + ) + fielErrList := claim.ValidateSyntax(testType) // this expands the ownerRef in the spec + if len(fielErrList) != 0 { + return nil, fmt.Errorf("invalid syntax %v", fielErrList) + } + return claim, nil +} + +func (r testCtx) getStaticClaim(index, testType string) (backend.ClaimObject, error) { + claim := as.BuildASClaim( + metav1.ObjectMeta{Namespace: namespace, Name: r.name}, + &as.ASClaimSpec{ + Index: index, + ID: ptr.To[uint32](uint32(r.id)), + ClaimLabels: common.ClaimLabels{ + UserDefinedLabels: common.UserDefinedLabels{Labels: r.labels}, + }, + }, + nil, + ) + fielErrList := claim.ValidateSyntax(testType) // this expands the ownerRef in the spec + if len(fielErrList) != 0 { + return nil, fmt.Errorf("invalid syntax %v", fielErrList) + } + return claim, nil +} + +func (r testCtx) getRangeClaim(index, testType string) (backend.ClaimObject, error) { + fmt.Println("getRangeClaim", r.name, r.tRange) + claim := as.BuildASClaim( + metav1.ObjectMeta{Namespace: namespace, Name: r.name}, + &as.ASClaimSpec{ + Index: index, + Range: ptr.To[string](r.tRange), + ClaimLabels: common.ClaimLabels{ + UserDefinedLabels: common.UserDefinedLabels{Labels: r.labels}, + }, + }, + nil, + ) + fielErrList := claim.ValidateSyntax(testType) // this expands the ownerRef in the spec + if len(fielErrList) != 0 { + return nil, fmt.Errorf("invalid syntax %v", fielErrList) + } + fmt.Println("getRangeClaim", *claim.GetRange()) + return claim, nil +} + +func transformer(_ context.Context, newObj runtime.Object, oldObj runtime.Object) (runtime.Object, error) { + // Type assertion to specific object types, assuming we are working with a type that has Spec and Status fields + new, ok := newObj.(backend.ClaimObject) + if !ok { + return nil, fmt.Errorf("newObj is not of type ClaimObject %s", reflect.TypeOf(newObj).Name()) + } + old, ok := oldObj.(backend.ClaimObject) + if !ok { + return nil, fmt.Errorf("oldObj is not of type ClaimObject %s", reflect.TypeOf(newObj).Name()) + } + + new.SetResourceVersion(old.GetResourceVersion()) + new.SetUID(old.GetUID()) + + if new.GetRange() != nil { + fmt.Println("transformer", "new", *new.GetRange() ) + } + + if old.GetRange() != nil { + fmt.Println("transformer", "old", *old.GetRange() ) + } + + + return new, nil +} diff --git a/pkg/backend/astest/as_index_test.go b/pkg/backend/astest/as_index_test.go new file mode 100644 index 0000000..b609b02 --- /dev/null +++ b/pkg/backend/astest/as_index_test.go @@ -0,0 +1,64 @@ +package astest + +import ( + "context" + "testing" + + "github.com/henderiw/apiserver-builder/pkg/builder" + "github.com/kuidio/kuid/apis/backend/as" + asbev1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" + "github.com/kuidio/kuid/pkg/generated/openapi" + "github.com/kuidio/kuid/pkg/registry/options" + "github.com/stretchr/testify/assert" +) + +func TestIndex(t *testing.T) { + tests := map[string]struct { + index string + testType string + }{ + //"CreateDelete": { + // index: "a", + // testType: "", + //}, + } + + for name, tc := range tests { + t.Run(name, func(t *testing.T) { + + ctx := context.Background() + asStorageProviders := as.NewStorageProviders(ctx, true, &options.Options{ + Type: options.StorageType_Memory, + }) + apiserver := builder.APIServer. + WithServerName("kuid-api-server"). + WithOpenAPIDefinitions("Config", "v1alpha1", openapi.GetOpenAPIDefinitions). + WithResourceAndHandler(&as.ASIndex{}, asStorageProviders.GetIndexStorageProvider()). + WithResourceAndHandler(&as.ASClaim{}, asStorageProviders.GetClaimStorageProvider()). + WithResourceAndHandler(&as.ASEntry{}, asStorageProviders.GetEntryStorageProvider()). + WithResourceAndHandler(&asbev1alpha1.ASIndex{}, asStorageProviders.GetIndexStorageProvider()). + WithResourceAndHandler(&asbev1alpha1.ASClaim{}, asStorageProviders.GetClaimStorageProvider()). + WithResourceAndHandler(&asbev1alpha1.ASEntry{}, asStorageProviders.GetEntryStorageProvider()). + WithoutEtcd() + + if _, err := apiserver.Build(ctx); err != nil { + panic(err) + } + if err := asStorageProviders.ApplyStorageToBackend(ctx, apiserver); err != nil { + panic(err) + } + be := asStorageProviders.GetBackend() + index, err := getIndex(tc.index, tc.testType) + assert.NoError(t, err) + if err := be.CreateIndex(ctx, index); err != nil { + assert.Error(t, err) + } + if err := be.DeleteIndex(ctx, index); err != nil { + assert.Error(t, err) + } + if err := be.DeleteIndex(ctx, index); err != nil { + assert.Error(t, err) + } + }) + } +} diff --git a/pkg/backend/backend_interface.go b/pkg/backend/backend_interface.go index 226887e..2e1b53e 100644 --- a/pkg/backend/backend_interface.go +++ b/pkg/backend/backend_interface.go @@ -19,6 +19,7 @@ package backend import ( "context" + "github.com/henderiw/apiserver-store/pkg/generic/registry" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apiserver/pkg/registry/rest" ) @@ -34,5 +35,7 @@ type Backend interface { // Release a claim in the backend Release(ctx context.Context, obj runtime.Object) error // PrintEntries prints the entries of the cache - //PrintEntries(ctx context.Context, k store.Key) error + PrintEntries(ctx context.Context, index string) + + GetClaimStorage() *registry.Store } diff --git a/pkg/backend/generic/applicator.go b/pkg/backend/generic/applicator.go index ba26736..6f2c197 100644 --- a/pkg/backend/generic/applicator.go +++ b/pkg/backend/generic/applicator.go @@ -10,6 +10,7 @@ import ( "github.com/henderiw/logger/log" "github.com/henderiw/store" "github.com/kuidio/kuid/apis/backend" + "k8s.io/apimachinery/pkg/util/sets" "k8s.io/utils/ptr" ) @@ -138,3 +139,22 @@ func isReserved(parentName, index string) bool { parentName == fmt.Sprintf("%s.%s", index, backend.IndexReservedMinName) */ } + +func (r *applicator) getExistingCLaimSet(ctx context.Context, claim backend.ClaimObject) (sets.Set[tree.ID], error) { + oldClaimIDSet := sets.New[tree.ID]() + + existingEntries, err := r.getEntriesByOwner(ctx, claim) + if err != nil { + return nil, err + } + // delete the entries from the claimSet that overlap + for treeName, existingEntries := range existingEntries { + if treeName != "" { + return nil, fmt.Errorf("cannot have a range in non root tree: %s", treeName) + } + for _, existingEntry := range existingEntries { + oldClaimIDSet.Insert(existingEntry.ID()) + } + } + return oldClaimIDSet, nil +} diff --git a/pkg/backend/generic/applicator_static_id.go b/pkg/backend/generic/applicator_static_id.go index 969105d..01f2169 100644 --- a/pkg/backend/generic/applicator_static_id.go +++ b/pkg/backend/generic/applicator_static_id.go @@ -41,7 +41,6 @@ func (r *staticApplicator) Validate(ctx context.Context, claim backend.ClaimObje } func (r *staticApplicator) Apply(ctx context.Context, claim backend.ClaimObject) error { - claimID, parentTreeName, err := r.validateExists(ctx, claim) if err != nil { return err @@ -101,7 +100,7 @@ func (r *staticApplicator) validateExists(ctx context.Context, claim backend.Cla } claimID, claimTreeName := reclaimIDFromExisitingEntries(existingEntries, *claim.GetStaticID()) - // remove the existing entries that done match the claimed ID + // remove the existing entries that don't match the claimed ID // should be none, but just in case if err := r.deleteNonClaimedEntries(ctx, existingEntries, claimID, claimTreeName); err != nil { return nil, "", err diff --git a/pkg/backend/generic/applicator_static_range.go b/pkg/backend/generic/applicator_static_range.go index 554018c..8696c57 100644 --- a/pkg/backend/generic/applicator_static_range.go +++ b/pkg/backend/generic/applicator_static_range.go @@ -18,6 +18,7 @@ package generic import ( "context" + "errors" "fmt" "github.com/henderiw/store" @@ -28,7 +29,6 @@ import ( type rangeApplicator struct { name string applicator - rangeExists bool } // when a range changes the start and stop we delete the range @@ -39,71 +39,43 @@ func (r *rangeApplicator) Validate(ctx context.Context, claim backend.ClaimObjec // reclaimRange gets the existing entries based on owner // -> 3 scenarios: none exist, they all exist, some exist // -> none exist -> claim them - // -> they all exist -> reclaim them - // -> same exist -> delete them including the children and reclaim the new range after the entries + // -> exists, no change -> don't do much other than updating the labels + // -> exists, change -> check childs and parents; when a parent exists and is from a different claim we stop, if children exist we block // have been deleted - exists, err := r.validateExists(ctx, claim) + changed, err := r.validateChange(ctx, claim) if err != nil { return err } - if !exists { + if changed { // we need to validate if there are no children if err := r.validateRangeOverlap(ctx, claim); err != nil { return err } } - r.rangeExists = exists return nil } -// reclaimRange gets the existing entries based on owner -// -> 3 scenarios: none exist, they all exist, some exist -// -> none exist -> claim them -// -> they all exist -> reclaim them -// -> same exist -> delete them including the children and reclaim the new range aftre the entries -// have been deleted -func (r *rangeApplicator) validateExists(ctx context.Context, claim backend.ClaimObject) (bool, error) { - arange, err := claim.GetRangeID(r.cacheInstanceCtx.Type()) +// validateChange checks if the range changed; change is only reported when the range existed +func (r *rangeApplicator) validateChange(ctx context.Context, claim backend.ClaimObject) (bool, error) { + newClaimSet, err := claim.GetClaimSet(r.cacheInstanceCtx.Type()) if err != nil { return false, err } - rangeExists := true // we are optimistic and set the claimset to true since we have entries - claimSet := map[string]struct{}{} - for _, rangeID := range arange.IDs() { - claimSet[rangeID.String()] = struct{}{} - } - existingEntries, err := r.getEntriesByOwner(ctx, claim) + oldClaimSet, err := r.getExistingCLaimSet(ctx, claim) if err != nil { return false, err } - // delete the - for treeName, existingEntries := range existingEntries { - if treeName != "" { - return false, fmt.Errorf("cannot have a range in non root tree: %s", treeName) - } - for _, existingEntry := range existingEntries { - delete(claimSet, existingEntry.ID().String()) - } - } - if len(claimSet) != 0 { - // cleanup - rangeExists = false - // remove all entries as the range change - if err := r.deleteNonClaimedEntries(ctx, existingEntries, nil, ""); err != nil { - return false, err - } - k := store.ToKey(claim.GetName()) - if _, err := r.cacheInstanceCtx.ranges.Get(k); err == nil { - // exists - if err := r.cacheInstanceCtx.ranges.Delete(k); err != nil { - return false, err - } - } + newEntries := newClaimSet.Difference(oldClaimSet) + deletedEntries := oldClaimSet.Difference(newClaimSet) + + if len(newEntries.UnsortedList()) != 0 || len(deletedEntries.UnsortedList()) != 0 { + // changed + return true, nil } - // all good -> they either all exist or none exists or we cleaned up - return rangeExists, nil + // no change + return false, nil } func (r *rangeApplicator) validateRangeOverlap(_ context.Context, claim backend.ClaimObject) error { @@ -111,25 +83,22 @@ func (r *rangeApplicator) validateRangeOverlap(_ context.Context, claim backend. if err != nil { return err } + var errm error for _, id := range arange.IDs() { - entry, err := r.cacheInstanceCtx.tree.Get(id) - if err == nil { - // this shouls always fail since the range existance was already validated - labels := entry.Labels() - if err := claim.ValidateOwner(labels); err != nil { - return err - } - } childEntries := r.cacheInstanceCtx.tree.Children(id) if len(childEntries) != 0 { - return fmt.Errorf("range overlaps with children: %v", childEntries) + errm = errors.Join(errm, fmt.Errorf("range id %s overlaps with children: %v", id.String(), childEntries)) } parentEntries := r.cacheInstanceCtx.tree.Parents(id) if len(parentEntries) > 0 { - return fmt.Errorf("range overlaps with parent: %v", parentEntries) + for _, entry := range parentEntries { + if !claim.IsOwner(entry.Labels()) { + errm = errors.Join(errm, fmt.Errorf("range id %s overlaps with parent: %v", id.String(), parentEntries)) + } + } } } - return nil + return errm } func (r *rangeApplicator) Apply(ctx context.Context, claim backend.ClaimObject) error { @@ -137,18 +106,36 @@ func (r *rangeApplicator) Apply(ctx context.Context, claim backend.ClaimObject) if err != nil { return err } - for _, id := range arange.IDs() { - if r.rangeExists { - if err := r.cacheInstanceCtx.tree.Update(id, claim.GetClaimLabels()); err != nil { - return err - } - } else { - if err := r.cacheInstanceCtx.tree.ClaimID(id, claim.GetClaimLabels()); err != nil { - return err - } - } + newClaimSet, err := claim.GetClaimSet(r.cacheInstanceCtx.Type()) + if err != nil { + return err + } + oldClaimSet, err := r.getExistingCLaimSet(ctx, claim) + if err != nil { + return err } + + newEntries := newClaimSet.Difference(oldClaimSet) + existingEntries := newClaimSet.Intersection(oldClaimSet) + deletedEntries := oldClaimSet.Difference(newClaimSet) + + for id := range deletedEntries { + if err := r.cacheInstanceCtx.tree.ReleaseID(id); err != nil { + return err + } + } + for id := range newEntries { + if err := r.cacheInstanceCtx.tree.ClaimID(id, claim.GetClaimLabels()); err != nil { + return err + } + } + for id := range existingEntries { + if err := r.cacheInstanceCtx.tree.Update(id, claim.GetClaimLabels()); err != nil { + return err + } + } + k := store.ToKey(claim.GetName()) if _, err := r.cacheInstanceCtx.ranges.Get(k); err != nil { //table := table.New(uint32(arange.From().ID()), uint32(arange.To().ID())) diff --git a/pkg/backend/generic/backend.go b/pkg/backend/generic/backend.go index 76be800..fec15eb 100644 --- a/pkg/backend/generic/backend.go +++ b/pkg/backend/generic/backend.go @@ -58,6 +58,14 @@ type be struct { claimStorage *registry.Store } +func (r *be) PrintEntries(ctx context.Context, index string) { + entries, _ := r.listEntries(ctx, store.ToKey(index)) + for _, entry := range entries { + uobj, _ := runtime.DefaultUnstructuredConverter.ToUnstructured(entry) + fmt.Println("entry", uobj) + } +} + func (r *be) AddStorage(entryStorage, claimStorage rest.Storage) error { entrystore, ok := entryStorage.(*registry.Store) if !ok { @@ -72,6 +80,10 @@ func (r *be) AddStorage(entryStorage, claimStorage rest.Storage) error { return nil } +func (r *be) GetClaimStorage() *registry.Store { + return r.claimStorage +} + // CreateIndex creates a backend index func (r *be) CreateIndex(ctx context.Context, obj runtime.Object) error { //r.m.Lock() diff --git a/pkg/backend/generic/backend_store.go b/pkg/backend/generic/backend_store.go index 4de7b8e..71312a1 100644 --- a/pkg/backend/generic/backend_store.go +++ b/pkg/backend/generic/backend_store.go @@ -4,19 +4,22 @@ import ( "context" "errors" "fmt" + "reflect" "github.com/henderiw/idxtable/pkg/table" "github.com/henderiw/logger/log" "github.com/henderiw/store" - "github.com/kform-dev/choreo/pkg/server/apiserver/rest" "github.com/kuidio/kuid/apis/backend" bebackend "github.com/kuidio/kuid/pkg/backend" + "k8s.io/apimachinery/pkg/api/meta" "k8s.io/apimachinery/pkg/apis/meta/internalversion" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/sets" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" ) func (r *be) restore(ctx context.Context, index backend.IndexObject) error { @@ -78,29 +81,22 @@ func (r *be) saveAll(ctx context.Context, k store.Key) error { for _, newEntry := range newEntries { newEntry := newEntry found := false - //var entry backend.EntryObject + var oldEntry backend.EntryObject for idx, curEntry := range curEntries { idx := idx curEntry := curEntry if curEntry.GetNamespacedName() == newEntry.GetNamespacedName() { // delete the current entry curEntries = append(curEntries[:idx], curEntries[idx+1:]...) - //found = true - //entry = curEntry + found = true + oldEntry = curEntry break } } - newuobj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(newEntry) - if err != nil { - return err - } - newu := &unstructured.Unstructured{ - Object: newuobj, - } - + ctx = genericapirequest.WithNamespace(ctx, newEntry.GetNamespace()) if !found { - if _, err := r.entryStorage.Create(ctx, newu, nil, &metav1.CreateOptions{ + if _, err := r.entryStorage.Create(ctx, newEntry, nil, &metav1.CreateOptions{ FieldManager: "backend", }); err != nil { log.Error("saveAll create failed", "name", newEntry.GetName(), "error", err.Error()) @@ -108,24 +104,18 @@ func (r *be) saveAll(ctx context.Context, k store.Key) error { } continue } - olduobj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(newEntry) - if err != nil { - return err - } - oldu := &unstructured.Unstructured{ - Object: olduobj, - } - - oldu.Object["spec"] = newu.Object["spec"] - oldu.Object["status"] = newu.Object["status"] - - //log.Debug("save all ipEntry update", "ipEntry", entry.GetName()) - if _, err := r.entryStorage.Update(ctx, newu, &rest.ApplyOptions{FieldManager: "backend"}); err != nil { + defaultObjInfo := rest.DefaultUpdatedObjectInfo(oldEntry, entryTransformer) + if _, _, err := r.entryStorage.Update(ctx, oldEntry.GetName(), defaultObjInfo, nil, nil, false, &metav1.UpdateOptions{ + FieldManager: "backend", + }); err != nil { + fmt.Println("update err", err) return err } } + for _, curEntry := range curEntries { + ctx = genericapirequest.WithNamespace(ctx, curEntry.GetNamespace()) if _, _, err := r.entryStorage.Delete(ctx, curEntry.GetName(), nil, &metav1.DeleteOptions{}); err != nil { return err } @@ -175,6 +165,7 @@ func (r *be) deleteEntries(ctx context.Context, k store.Key) error { var errm error for _, entry := range entries { + ctx = genericapirequest.WithNamespace(ctx, entry.GetNamespace()) if _, _, err := r.entryStorage.Delete(ctx, entry.GetName(), nil, &metav1.DeleteOptions{}); err != nil { log.Error("cannot delete entry", "error", err) errm = errors.Join(errm, err) @@ -185,6 +176,7 @@ func (r *be) deleteEntries(ctx context.Context, k store.Key) error { } func (r *be) listEntries(ctx context.Context, k store.Key) ([]backend.EntryObject, error) { + log := log.FromContext(ctx).With("key", k.String()) /* selector, err := selector.ExprSelectorAsSelector( &selectorv1alpha1.ExpressionSelector{ @@ -202,32 +194,29 @@ func (r *be) listEntries(ctx context.Context, k store.Key) ([]backend.EntryObjec return nil, err } - ulObj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(list) - ul := &unstructured.UnstructuredList{ - Object: ulObj, + items, err := meta.ExtractList(list) + if err != nil { + return nil, err } entryList := make([]backend.EntryObject, 0) - if ul.IsList() { - ul.EachListItem(func(obj runtime.Object) error { - u, ok := obj.(runtime.Unstructured) - if !ok { - return fmt.Errorf("not unstructured") - } - entryObj, err := r.entryObjectFn(u) - if err != nil { - return fmt.Errorf("not entry object") - } - if entryObj.GetIndex() == k.Name { - entryList = append(entryList, entryObj) - } - return nil - }) + var errm error + for _, obj := range items { + entryObj, ok := obj.(backend.EntryObject) + if !ok { + log.Error("obj is not an EntryObject", "obj", reflect.TypeOf(obj).Name()) + errm = errors.Join(errm, err) + continue + } + if entryObj.GetIndex() == k.Name { + entryList = append(entryList, entryObj) + } } - return entryList, nil + return entryList, errm } func (r *be) listClaims(ctx context.Context, k store.Key) (map[string]backend.ClaimObject, error) { + log := log.FromContext(ctx).With("key", k.String()) /* selector, err := selector.ExprSelectorAsSelector( &selectorv1alpha1.ExpressionSelector{ @@ -240,32 +229,28 @@ func (r *be) listClaims(ctx context.Context, k store.Key) (map[string]backend.Cl return nil, err } */ - list, err := r.entryStorage.List(ctx, &internalversion.ListOptions{}) + list, err := r.claimStorage.List(ctx, &internalversion.ListOptions{}) if err != nil { return nil, err } - ulObj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(list) - ul := &unstructured.UnstructuredList{ - Object: ulObj, + items, err := meta.ExtractList(list) + if err != nil { + return nil, err } claimMap := make(map[string]backend.ClaimObject) - if ul.IsList() { - ul.EachListItem(func(obj runtime.Object) error { - ru, ok := obj.(runtime.Unstructured) - if !ok { - return fmt.Errorf("not unstructured") - } - claimObj, err := r.claimObjectFn(ru) - if err != nil { - return fmt.Errorf("not claim object") - } - claimMap[claimObj.GetNamespacedName().String()] = claimObj - return nil - }) + var errm error + for _, obj := range items { + claimObj, ok := obj.(backend.ClaimObject) + if !ok { + log.Error("obj is not an ClaimObject", "obj", reflect.TypeOf(obj).Name()) + errm = errors.Join(errm, err) + continue + } + claimMap[claimObj.GetNamespacedName().String()] = claimObj } - return claimMap, nil + return claimMap, errm } func (r *be) restoreMinMaxRanges(ctx context.Context, cacheInstanceCtx *CacheInstanceContext, entries []backend.EntryObject, index backend.IndexObject) error { @@ -309,6 +294,8 @@ func (r *be) restoreMinMaxRanges(ctx context.Context, cacheInstanceCtx *CacheIns u := &unstructured.Unstructured{ Object: uobj, } + ctx = genericapirequest.WithNamespace(ctx, u.GetNamespace()) + if _, err := r.entryStorage.Create(ctx, u, nil, &metav1.CreateOptions{ FieldManager: "backend", }); err != nil { @@ -362,3 +349,21 @@ func (r *be) restoreClaim(ctx context.Context, cacheInstanceCtx *CacheInstanceCo } return nil } + + +func entryTransformer(_ context.Context, newObj runtime.Object, oldObj runtime.Object) (runtime.Object, error) { + // Type assertion to specific object types, assuming we are working with a type that has Spec and Status fields + new, ok := newObj.(backend.EntryObject) + if !ok { + return nil, fmt.Errorf("newObj is not of type EntryObject") + } + old, ok := oldObj.(backend.EntryObject) + if !ok { + return nil, fmt.Errorf("oldObj is not of type EntryObject") + } + + new.SetResourceVersion(old.GetResourceVersion()) + new.SetUID(old.GetUID()) + + return new, nil +} \ No newline at end of file diff --git a/apis/backend/storage_providers.go b/pkg/backend/storage_providers.go similarity index 97% rename from apis/backend/storage_providers.go rename to pkg/backend/storage_providers.go index dd38d28..58f552f 100644 --- a/apis/backend/storage_providers.go +++ b/pkg/backend/storage_providers.go @@ -28,4 +28,5 @@ type StorageProviders interface { GetClaimStorageProvider() *rest.StorageProvider GetEntryStorageProvider() *rest.StorageProvider ApplyStorageToBackend(ctx context.Context, apiServer *builder.Server) error + GetBackend() Backend } From 7c1f5d553a4845f4682146ea32b6fc133f09cae2 Mon Sep 17 00:00:00 2001 From: Wim Henderickx Date: Wed, 23 Oct 2024 04:47:31 -0400 Subject: [PATCH 03/23] updated go mod and dockerfile --- Dockerfile | 2 +- go.mod | 22 +++++++++------------- go.sum | 35 ++++++++++++++++++++--------------- goreleaser.dockerfile | 2 +- 4 files changed, 31 insertions(+), 30 deletions(-) diff --git a/Dockerfile b/Dockerfile index 320ac41..789e0fb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 # Build the manager binary -FROM golang:1.22 as builder +FROM golang:1.23 as builder ARG TARGETOS ARG TARGETARCH diff --git a/go.mod b/go.mod index 3132170..1c26e2e 100644 --- a/go.mod +++ b/go.mod @@ -8,26 +8,22 @@ replace k8s.io/api => k8s.io/api v0.31.1 replace k8s.io/kms => k8s.io/kms v0.31.1 -replace k8s.io/apimachinery => k8s.io/apimachinery v0.31.1 +//replace k8s.io/apimachinery => k8s.io/apimachinery v0.31.1 -replace k8s.io/client-go => k8s.io/client-go v0.31.1 +//replace k8s.io/client-go => k8s.io/client-go v0.31.1 replace k8s.io/gengo/v2 => k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 -replace github.com/henderiw/apiserver-store => /Users/henderiw/code/tmp/apiserver-store - -replace github.com/henderiw/apiserver-builder => /Users/henderiw/code/tmp/apiserver-builder - require ( github.com/dgraph-io/badger/v4 v4.3.0 github.com/google/go-cmp v0.6.0 github.com/google/uuid v1.6.0 - github.com/henderiw/apiserver-builder v0.0.4-0.20241020093259-47da0b178335 - github.com/henderiw/apiserver-store v0.0.3-0.20241020093130-09730291ea07 + github.com/henderiw/apiserver-builder v0.0.4-0.20241021160127-f10a4b489c64 + github.com/henderiw/apiserver-store v0.0.3-0.20241022143604-0995425b3d06 github.com/henderiw/idxtable v0.0.0-20241021085446-f8d804551342 github.com/henderiw/logger v0.0.0-20230911123436-8655829b1abe github.com/henderiw/store v0.0.2-0.20241020093537-5a92d3e14a02 - github.com/kform-dev/choreo v0.0.11 + github.com/kform-dev/choreo v0.0.14-0.20241022144122-dcc4abf0f562 github.com/pkg/errors v0.9.1 github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 @@ -36,9 +32,9 @@ require ( golang.org/x/mod v0.21.0 golang.org/x/sync v0.8.0 k8s.io/api v0.32.0-alpha.1 - k8s.io/apimachinery v0.32.0-alpha.1 + k8s.io/apimachinery v0.31.1 k8s.io/apiserver v0.31.1 - k8s.io/client-go v0.32.0-alpha.1 + k8s.io/client-go v0.31.1 k8s.io/code-generator v0.31.1 k8s.io/component-base v0.31.1 k8s.io/kube-openapi v0.0.0-20240827152857-f7e401e7b4c2 @@ -88,7 +84,7 @@ require ( github.com/google/gofuzz v1.2.0 // indirect github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect - github.com/imdario/mergo v0.3.13 // indirect + github.com/imdario/mergo v0.3.16 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect github.com/josharian/intern v1.0.0 // indirect @@ -134,7 +130,7 @@ require ( google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect google.golang.org/grpc v1.67.1 // indirect - google.golang.org/protobuf v1.34.2 // indirect + google.golang.org/protobuf v1.35.1 // indirect gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect diff --git a/go.sum b/go.sum index 4efb7b3..9350b9a 100644 --- a/go.sum +++ b/go.sum @@ -54,8 +54,8 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/evanphx/json-patch v0.5.2 h1:xVCHIVMUu1wtM/VkR9jVZ45N3FhZfYMMYGorLCR8P3k= -github.com/evanphx/json-patch v0.5.2/go.mod h1:ZWS5hhDbVDyob71nXKNL0+PWn6ToqBHMikGIFbs31qQ= +github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U= +github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg= github.com/evanphx/json-patch/v5 v5.9.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= @@ -143,14 +143,20 @@ github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4 github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0= github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k= +github.com/henderiw/apiserver-builder v0.0.3 h1:4QeIDiZzoB01zVTwEs5D1UYRYctnVbJQUFwnohDMDfM= +github.com/henderiw/apiserver-builder v0.0.3/go.mod h1:CRQvEpcNi1P0+yDtFHwduFMil+oOcylWsg++Fnu2SIs= +github.com/henderiw/apiserver-builder v0.0.4-0.20241021160127-f10a4b489c64 h1:7SS4TvUrTE6R18yL4ni+YML2tr/CzXJ9HzBZmn9JP98= +github.com/henderiw/apiserver-builder v0.0.4-0.20241021160127-f10a4b489c64/go.mod h1:gkE1++nC4j8rZUMqMRG3Ao8Hn21iPTeTlc/IVSW2nnI= +github.com/henderiw/apiserver-store v0.0.3-0.20241022143604-0995425b3d06 h1:1RVj1x0ykpmuxynrLww0oHgs5TdkciwJZr996SmGDf0= +github.com/henderiw/apiserver-store v0.0.3-0.20241022143604-0995425b3d06/go.mod h1:VVkUptd3MTyREmpo+C/t6l+mJAwo3A1UWvHi0QSH0yE= github.com/henderiw/idxtable v0.0.0-20241021085446-f8d804551342 h1:gkdOvjxM6rNTkcyoykZLjAfPjn06/MEY4o8cy+3uj2g= github.com/henderiw/idxtable v0.0.0-20241021085446-f8d804551342/go.mod h1:EPdUFZyKA2IORzohdu67+xBbfDmkHEDUaMN0BBsk8eY= github.com/henderiw/logger v0.0.0-20230911123436-8655829b1abe h1:+R53KH7fW+pmqlfSYVTCGPn8pj6gqBGcQ0nq7L1h8+g= github.com/henderiw/logger v0.0.0-20230911123436-8655829b1abe/go.mod h1:KNMXpSG8v0BAfIh5rZL4hgow3pBWNbkmmb28x9C5s+Y= github.com/henderiw/store v0.0.2-0.20241020093537-5a92d3e14a02 h1:AyDjgCG9+s+ci3HNU++YZ3o3p4nxngWWhAmwU64YPs8= github.com/henderiw/store v0.0.2-0.20241020093537-5a92d3e14a02/go.mod h1:BS0axsmGORgxlBKcdl9T+oxhWEyTwSpb4ZyIqulQ2Bc= -github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= -github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= +github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= +github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= @@ -163,8 +169,8 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= -github.com/kform-dev/choreo v0.0.11 h1:ISBWPKJpNO9m88FYzNu7Jj56mYWa8ko+m8nwiPJehvs= -github.com/kform-dev/choreo v0.0.11/go.mod h1:2eXUXWxyWGbLpZ965uFVzLF6755dsdYyIBcOMwXXMOw= +github.com/kform-dev/choreo v0.0.14-0.20241022144122-dcc4abf0f562 h1:PA3AyYfHpHQhMCYnaflPvZ7T1kmYr6O9zJN8smKo5DE= +github.com/kform-dev/choreo v0.0.14-0.20241022144122-dcc4abf0f562/go.mod h1:OVf/mVMKMBSZFNV3gIBe6f6zy9/FHBZCdYBWpQgMDYg= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= @@ -185,10 +191,10 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/onsi/ginkgo/v2 v2.19.1 h1:QXgq3Z8Crl5EL1WBAC98A5sEBHARrAJNzAmMxzLcRF0= -github.com/onsi/ginkgo/v2 v2.19.1/go.mod h1:O3DtEWQkPa/F7fBMgmZQKKsluAy8pd3rEQdrjkPb9zA= -github.com/onsi/gomega v1.34.0 h1:eSSPsPNp6ZpsG8X1OVmOTxig+CblTc4AxpPBykhe2Os= -github.com/onsi/gomega v1.34.0/go.mod h1:MIKI8c+f+QLWk+hxbePD4i0LMJSExPaZOVfkoex4cAo= +github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA= +github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To= +github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk= +github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0= github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -389,8 +395,8 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d h1:VBu5YqKPv6XiJ199exd8Br+Aetz+o08F+PLMnwJQHAY= -google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4= +google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f h1:Vn+VyHU5guc9KjB5KrjI2q0wCOWEOIh0OEsleqakHJg= +google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f/go.mod h1:nWSwAFPb+qfNJXsoeO3Io7zf4tMSfN8EA8RlDA04GhY= google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 h1:wKguEg1hsxI2/L3hUYrpo1RVi48K+uTyzKqprwLXsb8= google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142/go.mod h1:d6be+8HhtEtucleCbxpPW9PA9XwISACu8nvpPqF0BVo= google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= @@ -411,8 +417,8 @@ google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= +google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= @@ -430,7 +436,6 @@ gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/goreleaser.dockerfile b/goreleaser.dockerfile index f734fa7..c825da0 100644 --- a/goreleaser.dockerfile +++ b/goreleaser.dockerfile @@ -2,7 +2,7 @@ # Licensed under the Apache License 2.0 # SPDX-License-Identifier: Apache-2.0 # -FROM golang:1.22 AS builder +FROM golang:1.23 AS builder ARG USERID=10000 # no need to include cgo bindings ENV CGO_ENABLED=0 GOOS=linux GOARCH=amd64 From 3e73a68328bc716c647e5674d1e99034210bb58b Mon Sep 17 00:00:00 2001 From: Wim Henderickx Date: Thu, 24 Oct 2024 04:11:07 -0400 Subject: [PATCH 04/23] updated genclient --- DEV.md | 4 +- apis/backend/as/storage.go | 2 - apis/backend/as/v1alpha1/asindex_types.go | 2 - apis/backend/as/v1alpha1/register.go | 4 +- apis/common/v1alpha1/doc.go | 2 +- .../v1alpha1/zz_generated.defaults.go} | 15 + apis/id/id.go | 10 - apis/id/v1alpha1/doc.go | 1 + apis/id/v1alpha1/zz_generated.defaults.go | 32 + artifacts/deployment.yaml | 2 +- artifacts/out/artifacts.yaml | 1 - go.mod | 14 +- go.sum | 22 +- pkg/generated/openapi/zz_generated.openapi.go | 585 ++++++++++++++++++ testdata/listtype/atomic-list.go | 7 + testdata/listtype/map-list.go | 20 + testdata/listtype/set-list.go | 7 + testdata/listtype/untyped.go | 6 + tools/apiserver-runtime-gen/main.go | 38 +- 19 files changed, 724 insertions(+), 50 deletions(-) rename apis/{backend/as/v1alpha1/asindex_helper.go => common/v1alpha1/zz_generated.defaults.go} (57%) create mode 100644 apis/id/v1alpha1/zz_generated.defaults.go create mode 100644 testdata/listtype/atomic-list.go create mode 100644 testdata/listtype/map-list.go create mode 100644 testdata/listtype/set-list.go create mode 100644 testdata/listtype/untyped.go diff --git a/DEV.md b/DEV.md index ff5e1eb..7a1868b 100644 --- a/DEV.md +++ b/DEV.md @@ -6,4 +6,6 @@ Development 4. update artifact - reconciler - permissions - - apiservice \ No newline at end of file + - apiservice + + diff --git a/apis/backend/as/storage.go b/apis/backend/as/storage.go index 42b21e7..b950d32 100644 --- a/apis/backend/as/storage.go +++ b/apis/backend/as/storage.go @@ -38,7 +38,6 @@ func NewStorageProviders(ctx context.Context, sync bool, options *options.Option GetASEntry, ), } - if sync { opts := *options opts.BackendInvoker = bebackend.NewIndexInvoker(r.be) @@ -50,7 +49,6 @@ func NewStorageProviders(ctx context.Context, sync bool, options *options.Option r.claimStorageProvider = genericregistry.NewStorageProvider(ctx, &ASClaim{}, &opts) } r.entryStorageProvider = genericregistry.NewStorageProvider(ctx, &ASEntry{}, options) - return r } diff --git a/apis/backend/as/v1alpha1/asindex_types.go b/apis/backend/as/v1alpha1/asindex_types.go index aaa3387..15402ef 100644 --- a/apis/backend/as/v1alpha1/asindex_types.go +++ b/apis/backend/as/v1alpha1/asindex_types.go @@ -55,7 +55,6 @@ type ASIndexStatus struct { // +kubebuilder:object:root=true // +kubebuilder:subresource:status // +kubebuilder:resource:categories={kuid} - // ASIndex is the Schema for the ASIndex API type ASIndex struct { metav1.TypeMeta `json:",inline" yaml:",inline"` @@ -68,7 +67,6 @@ type ASIndex struct { // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +kubebuilder:object:root=true - // ASIndexList contains a list of ASIndex type ASIndexList struct { metav1.TypeMeta `json:",inline" yaml:",inline"` diff --git a/apis/backend/as/v1alpha1/register.go b/apis/backend/as/v1alpha1/register.go index 064a86a..6adc366 100644 --- a/apis/backend/as/v1alpha1/register.go +++ b/apis/backend/as/v1alpha1/register.go @@ -54,12 +54,12 @@ func addKnownTypes(scheme *runtime.Scheme) error { // +kubebuilder:scaffold:install scheme.AddKnownTypes(SchemeGroupVersion, + &ASIndex{}, + &ASIndexList{}, &ASClaim{}, &ASClaimList{}, &ASEntry{}, &ASEntryList{}, - &ASIndex{}, - &ASIndexList{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) diff --git a/apis/common/v1alpha1/doc.go b/apis/common/v1alpha1/doc.go index c56e8ea..0ba3fb2 100644 --- a/apis/common/v1alpha1/doc.go +++ b/apis/common/v1alpha1/doc.go @@ -14,6 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. */ -// +kubebuilder:object:generate=true +// +k8s:openapi-gen=true // +k8s:deepcopy-gen=package,register package v1alpha1 diff --git a/apis/backend/as/v1alpha1/asindex_helper.go b/apis/common/v1alpha1/zz_generated.defaults.go similarity index 57% rename from apis/backend/as/v1alpha1/asindex_helper.go rename to apis/common/v1alpha1/zz_generated.defaults.go index 62c9207..c38f9bb 100644 --- a/apis/backend/as/v1alpha1/asindex_helper.go +++ b/apis/common/v1alpha1/zz_generated.defaults.go @@ -1,3 +1,6 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + /* Copyright 2024 Nokia. @@ -13,5 +16,17 @@ 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 defaulter-gen. DO NOT EDIT. package v1alpha1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// RegisterDefaults adds defaulters functions to the given scheme. +// Public to allow building arbitrary schemes. +// All generated defaulters are covering - they call all nested defaulters. +func RegisterDefaults(scheme *runtime.Scheme) error { + return nil +} diff --git a/apis/id/id.go b/apis/id/id.go index 3be3bbf..3f0a628 100644 --- a/apis/id/id.go +++ b/apis/id/id.go @@ -16,7 +16,6 @@ limitations under the License. package id -// +k8s:openapi-gen=true type SiteID struct { // Region defines the region of the resource Region string `json:"region" yaml:"region" protobuf:"bytes,1,opt,name=region"` @@ -24,14 +23,12 @@ type SiteID struct { Site string `json:"site" yaml:"site" protobuf:"bytes,2,opt,name=site"` } -// +k8s:openapi-gen=true type NodeID struct { SiteID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=siteID"` // Node defines the name of the node Node string `json:"node" yaml:"node" protobuf:"bytes,2,opt,name=node"` } -// +k8s:openapi-gen=true type PartitionNodeID struct { // Partition defines the partition this resource belongs to Partition string `json:"partition" yaml:"partition" protobuf:"bytes,1,opt,name=partition"` @@ -41,7 +38,6 @@ type PartitionNodeID struct { Node string `json:"node" yaml:"node" protobuf:"bytes,3,opt,name=node"` } -// +k8s:openapi-gen=true type PortID struct { NodeID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"` // ModuleBay defines the moduleBay reference id @@ -52,7 +48,6 @@ type PortID struct { Port int `json:"port" yaml:"port" protobuf:"bytes,4,opt,name=port"` } -// +k8s:openapi-gen=true type AdaptorID struct { NodeID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"` // ModuleBay defines the moduleBay reference id @@ -65,7 +60,6 @@ type AdaptorID struct { Adaptor string `json:"adaptor" yaml:"adaptor" protobuf:"bytes,5,opt,name=adaptor"` } -// +k8s:openapi-gen=true type EndpointID struct { NodeID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"` // ModuleBay defines the moduleBay reference id @@ -80,7 +74,6 @@ type EndpointID struct { Endpoint int `json:"endpoint" yaml:"endpoint" protobuf:"bytes,6,opt,name=endpoint"` } -// +k8s:openapi-gen=true type PartitionEndpointID struct { // Partition defines the partition this resource belongs to Partition string `json:"partition" yaml:"partition" protobuf:"bytes,1,opt,name=partition"` @@ -100,14 +93,12 @@ type PartitionEndpointID struct { Name *string `json:"name,omitempty" yaml:"name,omitempty" protobuf:"bytes,8,opt,name=name"` } -// +k8s:openapi-gen=true type ClusterID struct { SiteID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=siteID"` // Cluster defines the name of the cluster Cluster string `json:"cluster" yaml:"cluster" protobuf:"bytes,2,opt,name=cluster"` } -// +k8s:openapi-gen=true type PartitionClusterID struct { // Partition defines the partition this resource belongs to Partition string `json:"partition" yaml:"partition" protobuf:"bytes,1,opt,name=partition"` @@ -117,7 +108,6 @@ type PartitionClusterID struct { Cluster string `json:"cluster" yaml:"cluster" protobuf:"bytes,3,opt,name=cluster"` } -// +k8s:openapi-gen=true type PartitionAttachmentID struct { // Partition defines the partition this resource belongs to Partition string `json:"partition" yaml:"partition" protobuf:"bytes,1,opt,name=partition"` diff --git a/apis/id/v1alpha1/doc.go b/apis/id/v1alpha1/doc.go index c56e8ea..0dc536e 100644 --- a/apis/id/v1alpha1/doc.go +++ b/apis/id/v1alpha1/doc.go @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ +// +k8s:openapi-gen=true // +kubebuilder:object:generate=true // +k8s:deepcopy-gen=package,register package v1alpha1 diff --git a/apis/id/v1alpha1/zz_generated.defaults.go b/apis/id/v1alpha1/zz_generated.defaults.go new file mode 100644 index 0000000..c38f9bb --- /dev/null +++ b/apis/id/v1alpha1/zz_generated.defaults.go @@ -0,0 +1,32 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2024 Nokia. + +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 defaulter-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// RegisterDefaults adds defaulters functions to the given scheme. +// Public to allow building arbitrary schemes. +// All generated defaulters are covering - they call all nested defaulters. +func RegisterDefaults(scheme *runtime.Scheme) error { + return nil +} diff --git a/artifacts/deployment.yaml b/artifacts/deployment.yaml index 6320eb8..e296852 100644 --- a/artifacts/deployment.yaml +++ b/artifacts/deployment.yaml @@ -31,7 +31,7 @@ spec: args: - "--tls-cert-file=/apiserver.local.config/certificates/tls.crt" - "--tls-private-key-file=/apiserver.local.config/certificates/tls.key" - - "--feature-gates=APIPriorityAndFairness=false" + #- "--feature-gates=APIPriorityAndFairness=false" - "--audit-log-path=-" - "--audit-log-maxage=0" - "--audit-log-maxbackup=0" diff --git a/artifacts/out/artifacts.yaml b/artifacts/out/artifacts.yaml index 711f937..68fd431 100644 --- a/artifacts/out/artifacts.yaml +++ b/artifacts/out/artifacts.yaml @@ -141,7 +141,6 @@ spec: - args: - --tls-cert-file=/apiserver.local.config/certificates/tls.crt - --tls-private-key-file=/apiserver.local.config/certificates/tls.key - - --feature-gates=APIPriorityAndFairness=false - --audit-log-path=- - --audit-log-maxage=0 - --audit-log-maxbackup=0 diff --git a/go.mod b/go.mod index 1c26e2e..c4f418b 100644 --- a/go.mod +++ b/go.mod @@ -4,13 +4,9 @@ go 1.23.0 toolchain go1.23.2 -replace k8s.io/api => k8s.io/api v0.31.1 +//replace k8s.io/api => k8s.io/api v0.31.1 -replace k8s.io/kms => k8s.io/kms v0.31.1 - -//replace k8s.io/apimachinery => k8s.io/apimachinery v0.31.1 - -//replace k8s.io/client-go => k8s.io/client-go v0.31.1 +//replace k8s.io/kms => k8s.io/kms v0.31.1 replace k8s.io/gengo/v2 => k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 @@ -18,7 +14,7 @@ require ( github.com/dgraph-io/badger/v4 v4.3.0 github.com/google/go-cmp v0.6.0 github.com/google/uuid v1.6.0 - github.com/henderiw/apiserver-builder v0.0.4-0.20241021160127-f10a4b489c64 + github.com/henderiw/apiserver-builder v0.0.4-0.20241023220418-f1bacfdbb4da github.com/henderiw/apiserver-store v0.0.3-0.20241022143604-0995425b3d06 github.com/henderiw/idxtable v0.0.0-20241021085446-f8d804551342 github.com/henderiw/logger v0.0.0-20230911123436-8655829b1abe @@ -31,7 +27,7 @@ require ( go.uber.org/zap v1.27.0 golang.org/x/mod v0.21.0 golang.org/x/sync v0.8.0 - k8s.io/api v0.32.0-alpha.1 + k8s.io/api v0.31.1 k8s.io/apimachinery v0.31.1 k8s.io/apiserver v0.31.1 k8s.io/client-go v0.31.1 @@ -140,7 +136,7 @@ require ( k8s.io/apiextensions-apiserver v0.31.1 // indirect k8s.io/gengo/v2 v2.0.0-20240911193312-2b36238f13e9 // indirect k8s.io/klog/v2 v2.130.1 // indirect - k8s.io/kms v0.32.0-alpha.2 // indirect + k8s.io/kms v0.31.1 // indirect sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3 // indirect sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect ) diff --git a/go.sum b/go.sum index 9350b9a..5078c7d 100644 --- a/go.sum +++ b/go.sum @@ -54,8 +54,8 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U= -github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/evanphx/json-patch v0.5.2 h1:xVCHIVMUu1wtM/VkR9jVZ45N3FhZfYMMYGorLCR8P3k= +github.com/evanphx/json-patch v0.5.2/go.mod h1:ZWS5hhDbVDyob71nXKNL0+PWn6ToqBHMikGIFbs31qQ= github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg= github.com/evanphx/json-patch/v5 v5.9.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= @@ -143,10 +143,8 @@ github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4 github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0= github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k= -github.com/henderiw/apiserver-builder v0.0.3 h1:4QeIDiZzoB01zVTwEs5D1UYRYctnVbJQUFwnohDMDfM= -github.com/henderiw/apiserver-builder v0.0.3/go.mod h1:CRQvEpcNi1P0+yDtFHwduFMil+oOcylWsg++Fnu2SIs= -github.com/henderiw/apiserver-builder v0.0.4-0.20241021160127-f10a4b489c64 h1:7SS4TvUrTE6R18yL4ni+YML2tr/CzXJ9HzBZmn9JP98= -github.com/henderiw/apiserver-builder v0.0.4-0.20241021160127-f10a4b489c64/go.mod h1:gkE1++nC4j8rZUMqMRG3Ao8Hn21iPTeTlc/IVSW2nnI= +github.com/henderiw/apiserver-builder v0.0.4-0.20241023220418-f1bacfdbb4da h1:vAG0d1ZYB7+KS7V6YehDFJ9FMicNoBlxLM7/b4tZ/bk= +github.com/henderiw/apiserver-builder v0.0.4-0.20241023220418-f1bacfdbb4da/go.mod h1:LfJu1JURnxHwnFa8CVb2XPw50TwdU1xQvuUNxpaSOlE= github.com/henderiw/apiserver-store v0.0.3-0.20241022143604-0995425b3d06 h1:1RVj1x0ykpmuxynrLww0oHgs5TdkciwJZr996SmGDf0= github.com/henderiw/apiserver-store v0.0.3-0.20241022143604-0995425b3d06/go.mod h1:VVkUptd3MTyREmpo+C/t6l+mJAwo3A1UWvHi0QSH0yE= github.com/henderiw/idxtable v0.0.0-20241021085446-f8d804551342 h1:gkdOvjxM6rNTkcyoykZLjAfPjn06/MEY4o8cy+3uj2g= @@ -191,10 +189,10 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA= -github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To= -github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk= -github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0= +github.com/onsi/ginkgo/v2 v2.19.1 h1:QXgq3Z8Crl5EL1WBAC98A5sEBHARrAJNzAmMxzLcRF0= +github.com/onsi/ginkgo/v2 v2.19.1/go.mod h1:O3DtEWQkPa/F7fBMgmZQKKsluAy8pd3rEQdrjkPb9zA= +github.com/onsi/gomega v1.34.0 h1:eSSPsPNp6ZpsG8X1OVmOTxig+CblTc4AxpPBykhe2Os= +github.com/onsi/gomega v1.34.0/go.mod h1:MIKI8c+f+QLWk+hxbePD4i0LMJSExPaZOVfkoex4cAo= github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -395,8 +393,8 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f h1:Vn+VyHU5guc9KjB5KrjI2q0wCOWEOIh0OEsleqakHJg= -google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f/go.mod h1:nWSwAFPb+qfNJXsoeO3Io7zf4tMSfN8EA8RlDA04GhY= +google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d h1:VBu5YqKPv6XiJ199exd8Br+Aetz+o08F+PLMnwJQHAY= +google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4= google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 h1:wKguEg1hsxI2/L3hUYrpo1RVi48K+uTyzKqprwLXsb8= google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142/go.mod h1:d6be+8HhtEtucleCbxpPW9PA9XwISACu8nvpPqF0BVo= google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= diff --git a/pkg/generated/openapi/zz_generated.openapi.go b/pkg/generated/openapi/zz_generated.openapi.go index fba8f6c..2968476 100644 --- a/pkg/generated/openapi/zz_generated.openapi.go +++ b/pkg/generated/openapi/zz_generated.openapi.go @@ -29,6 +29,18 @@ import ( func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { return map[string]common.OpenAPIDefinition{ + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaim": schema_apis_backend_as_v1alpha1_ASClaim(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaimList": schema_apis_backend_as_v1alpha1_ASClaimList(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaimSpec": schema_apis_backend_as_v1alpha1_ASClaimSpec(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaimStatus": schema_apis_backend_as_v1alpha1_ASClaimStatus(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntry": schema_apis_backend_as_v1alpha1_ASEntry(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntryList": schema_apis_backend_as_v1alpha1_ASEntryList(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntrySpec": schema_apis_backend_as_v1alpha1_ASEntrySpec(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntryStatus": schema_apis_backend_as_v1alpha1_ASEntryStatus(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndex": schema_apis_backend_as_v1alpha1_ASIndex(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndexList": schema_apis_backend_as_v1alpha1_ASIndexList(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndexSpec": schema_apis_backend_as_v1alpha1_ASIndexSpec(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndexStatus": schema_apis_backend_as_v1alpha1_ASIndexStatus(ref), "k8s.io/apimachinery/pkg/api/resource.Quantity": schema_apimachinery_pkg_api_resource_Quantity(ref), "k8s.io/apimachinery/pkg/api/resource.int64Amount": schema_apimachinery_pkg_api_resource_int64Amount(ref), "k8s.io/apimachinery/pkg/apis/meta/v1.APIGroup": schema_pkg_apis_meta_v1_APIGroup(ref), @@ -87,6 +99,579 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA } } +func schema_apis_backend_as_v1alpha1_ASClaim(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ASClaim is the Schema for the ASClaim API", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaimSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaimStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaimSpec", "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaimStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_apis_backend_as_v1alpha1_ASClaimList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ASClaimList contains a list of ASClaims", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaim"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaim", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_apis_backend_as_v1alpha1_ASClaimSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ASClaimSpec defines the desired state of ASClaim", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "index": { + SchemaProps: spec.SchemaProps{ + Description: "Index defines the index for the AS Claim", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "id": { + SchemaProps: spec.SchemaProps{ + Description: "ASID defines the AS for the AS claim", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "range": { + SchemaProps: spec.SchemaProps{ + Description: "Range defines the AS range for the AS claim The following notation is used: start-end - the ASs in the range must be consecutive", + Type: []string{"string"}, + Format: "", + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels as user defined labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "selector": { + SchemaProps: spec.SchemaProps{ + Description: "Selector defines the selector criterias", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), + }, + }, + }, + Required: []string{"index"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, + } +} + +func schema_apis_backend_as_v1alpha1_ASClaimStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ASClaimStatus defines the observed state of ASClaim", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"), + }, + }, + }, + }, + }, + "id": { + SchemaProps: spec.SchemaProps{ + Description: "ASID defines the AS for the AS claim", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "range": { + SchemaProps: spec.SchemaProps{ + Description: "ASRange defines the AS range for the AS claim", + Type: []string{"string"}, + Format: "", + }, + }, + "expiryTime": { + SchemaProps: spec.SchemaProps{ + Description: "ExpiryTime defines when the claim expires", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"}, + } +} + +func schema_apis_backend_as_v1alpha1_ASEntry(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ASEntry is the Schema for the ASentry API", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntrySpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntryStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntrySpec", "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntryStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_apis_backend_as_v1alpha1_ASEntryList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ASEntryList contains a list of ASEntries", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntry"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntry", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_apis_backend_as_v1alpha1_ASEntrySpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ASEntrySpec defines the desired state of ASEntry", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "index": { + SchemaProps: spec.SchemaProps{ + Description: "Index defines the index for the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "claimType": { + SchemaProps: spec.SchemaProps{ + Description: "ClaimType defines the claimType of the resource", + Type: []string{"string"}, + Format: "", + }, + }, + "id": { + SchemaProps: spec.SchemaProps{ + Description: "ID defines the id of the resource in the tree", + Type: []string{"string"}, + Format: "", + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels as user defined labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "selector": { + SchemaProps: spec.SchemaProps{ + Description: "Selector defines the selector criterias", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), + }, + }, + }, + Required: []string{"index"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, + } +} + +func schema_apis_backend_as_v1alpha1_ASEntryStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ASEntryStatus defines the observed state of ASEntry", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"}, + } +} + +func schema_apis_backend_as_v1alpha1_ASIndex(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ASIndex is the Schema for the ASIndex API", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndexSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndexStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndexSpec", "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndexStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_apis_backend_as_v1alpha1_ASIndexList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ASIndexList contains a list of ASIndex", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndex"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndex", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_apis_backend_as_v1alpha1_ASIndexSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ASIndexSpec defines the desired state of ASIndex", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "minID": { + SchemaProps: spec.SchemaProps{ + Description: "MinID defines the min VLAN ID the index supports", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "maxID": { + SchemaProps: spec.SchemaProps{ + Description: "MaxID defines the max VLAN ID the index supports", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels as user defined labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + }, + }, + } +} + +func schema_apis_backend_as_v1alpha1_ASIndexStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ASIndexStatus defines the observed state of ASIndex", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "minID": { + SchemaProps: spec.SchemaProps{ + Description: "MinID defines the min VLAN ID the index supports", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "maxID": { + SchemaProps: spec.SchemaProps{ + Description: "MaxID defines the max VLAN ID the index supports", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"}, + } +} + func schema_apimachinery_pkg_api_resource_Quantity(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.EmbedOpenAPIDefinitionIntoV2Extension(common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/testdata/listtype/atomic-list.go b/testdata/listtype/atomic-list.go new file mode 100644 index 0000000..9029ece --- /dev/null +++ b/testdata/listtype/atomic-list.go @@ -0,0 +1,7 @@ +package listtype + +// +k8s:openapi-gen=true +type AtomicList struct { + // +listType=atomic + Field []string +} diff --git a/testdata/listtype/map-list.go b/testdata/listtype/map-list.go new file mode 100644 index 0000000..e456c6b --- /dev/null +++ b/testdata/listtype/map-list.go @@ -0,0 +1,20 @@ +package listtype + +// +k8s:openapi-gen=true +type MapList struct { + // +listType=map + // +listMapKey=port + Field []Item +} + +// +k8s:openapi-gen=true +type Item struct { + Protocol string + Port int + // +optional + A int `json:"a"` + // +optional + B int `json:"b,omitempty"` + // +optional + C int `json:"c,omitEmpty"` +} diff --git a/testdata/listtype/set-list.go b/testdata/listtype/set-list.go new file mode 100644 index 0000000..bf7b27c --- /dev/null +++ b/testdata/listtype/set-list.go @@ -0,0 +1,7 @@ +package listtype + +// +k8s:openapi-gen=true +type SetList struct { + // +listType=set + Field []string +} diff --git a/testdata/listtype/untyped.go b/testdata/listtype/untyped.go new file mode 100644 index 0000000..e960af1 --- /dev/null +++ b/testdata/listtype/untyped.go @@ -0,0 +1,6 @@ +package listtype + +// +k8s:openapi-gen=true +type UntypedList struct { + Field []string +} diff --git a/tools/apiserver-runtime-gen/main.go b/tools/apiserver-runtime-gen/main.go index f523910..b3b9542 100644 --- a/tools/apiserver-runtime-gen/main.go +++ b/tools/apiserver-runtime-gen/main.go @@ -97,18 +97,18 @@ func doGen() error { // clientgen clientgenVersions := []string{} informerListergenVersions := []string{} - protobufVersions := []string{} + typeVersions := []string{} for _, version := range versions { - if !strings.Contains(version, "common") && !strings.Contains(version, "id"){ + if !strings.Contains(version, "common") && !strings.Contains(version, "id") { // expand the path with the module clientgenVersions = append(clientgenVersions, path.Join(module, version)) // dont expand the versions with modules informerListergenVersions = append(informerListergenVersions, fmt.Sprintf("./%s", path.Join(version, "..."))) } - protobufVersions = append(protobufVersions, version) + typeVersions = append(typeVersions, version) } - //protoInputs := strings.Join(rawVersions, ",") + //versions := strings.Join(clientgenVersions, ",") gen := map[string]bool{} for _, g := range generators { @@ -124,17 +124,29 @@ func doGen() error { } } + /* + /Users/henderiw/code/tmp/kube-openapi/openapi-gen \ + --output-dir pkg/generated/openapi \ + --output-pkg openapi \ + --output-file zz_generated.openapi.go \ + --go-header-file hack/boilerplate.go.txt \ + github.com/kuidio/kuid/apis/backend/as/v1alpha1 github.com/kuidio/kuid/apis/id/v1alpha1 github.com/kuidio/kuid/apis/common/v1alpha1 + */ + if gen["openapi-gen"] { - err := run(getCmd("openapi-gen", - "--output-file", "zz_generated.openapi.go", + // HACK had to use openapi-gen and use go mod v1.23 iso go.mod v1.20 + cmdArgs := []string{ "--output-dir", "pkg/generated/openapi", "--output-pkg", "openapi", - "./apis/...", + "--output-file", "zz_generated.openapi.go", "k8s.io/apimachinery/pkg/apis/meta/v1", "k8s.io/apimachinery/pkg/api/resource", "k8s.io/apimachinery/pkg/runtime", "k8s.io/apimachinery/pkg/version", - )) + } + cmdArgs = append(cmdArgs, clientgenVersions...) + err := run(getCmdSimple("bin/openapi-gen", cmdArgs...)) + if err != nil { return err } @@ -203,7 +215,7 @@ func doGen() error { if gen["go-to-protobuf"] { err := run(getCmd( "go-to-protobuf", - "--packages", strings.Join(protobufVersions, ","), + "--packages", strings.Join(typeVersions, ","), "--apimachinery-packages", "-k8s.io/apimachinery/pkg/api/resource,-k8s.io/apimachinery/pkg/runtime/schema,-k8s.io/apimachinery/pkg/runtime,-k8s.io/apimachinery/pkg/apis/meta/v1", //"--proto-import", "./vendor", )) @@ -291,6 +303,14 @@ func getCmd(cmd string, args ...string) *exec.Cmd { return e } +func getCmdSimple(cmd string, args ...string) *exec.Cmd { + // nolint:gosec + e := exec.Command(cmd, "--go-header-file", header) + + e.Args = append(e.Args, args...) + return e +} + func findModuleRoot(dir string) string { for { if _, err := os.Stat(filepath.Join(dir, "go.mod")); err == nil { From 2a23403e38efc4cf04e1a0841f985c013d379ab2 Mon Sep 17 00:00:00 2001 From: Wim Henderickx Date: Thu, 24 Oct 2024 04:11:52 -0400 Subject: [PATCH 05/23] removed testdata --- testdata/listtype/atomic-list.go | 7 ------- testdata/listtype/map-list.go | 20 -------------------- testdata/listtype/set-list.go | 7 ------- testdata/listtype/untyped.go | 6 ------ 4 files changed, 40 deletions(-) delete mode 100644 testdata/listtype/atomic-list.go delete mode 100644 testdata/listtype/map-list.go delete mode 100644 testdata/listtype/set-list.go delete mode 100644 testdata/listtype/untyped.go diff --git a/testdata/listtype/atomic-list.go b/testdata/listtype/atomic-list.go deleted file mode 100644 index 9029ece..0000000 --- a/testdata/listtype/atomic-list.go +++ /dev/null @@ -1,7 +0,0 @@ -package listtype - -// +k8s:openapi-gen=true -type AtomicList struct { - // +listType=atomic - Field []string -} diff --git a/testdata/listtype/map-list.go b/testdata/listtype/map-list.go deleted file mode 100644 index e456c6b..0000000 --- a/testdata/listtype/map-list.go +++ /dev/null @@ -1,20 +0,0 @@ -package listtype - -// +k8s:openapi-gen=true -type MapList struct { - // +listType=map - // +listMapKey=port - Field []Item -} - -// +k8s:openapi-gen=true -type Item struct { - Protocol string - Port int - // +optional - A int `json:"a"` - // +optional - B int `json:"b,omitempty"` - // +optional - C int `json:"c,omitEmpty"` -} diff --git a/testdata/listtype/set-list.go b/testdata/listtype/set-list.go deleted file mode 100644 index bf7b27c..0000000 --- a/testdata/listtype/set-list.go +++ /dev/null @@ -1,7 +0,0 @@ -package listtype - -// +k8s:openapi-gen=true -type SetList struct { - // +listType=set - Field []string -} diff --git a/testdata/listtype/untyped.go b/testdata/listtype/untyped.go deleted file mode 100644 index e960af1..0000000 --- a/testdata/listtype/untyped.go +++ /dev/null @@ -1,6 +0,0 @@ -package listtype - -// +k8s:openapi-gen=true -type UntypedList struct { - Field []string -} From 37493d260a2c80721d7df9067d1e427bbe7803cf Mon Sep 17 00:00:00 2001 From: Wim Henderickx Date: Thu, 24 Oct 2024 14:29:53 -0400 Subject: [PATCH 06/23] enabled flexible deployments --- DESIGN-DEPLOYMENTS.md | 63 +- apis/all/all.go | 21 + apis/backend/as/asentry_resource.go | 5 +- apis/backend/as/register/register.go | 120 +++ apis/backend/as/storage.go | 105 +- apis/backend/as/v1alpha1/asentry_resource.go | 4 +- apis/backend/as/v1alpha1/asindex_resource.go | 4 +- apis/backend/as/zz_generated.deepcopy.go | 32 - artifacts/out/artifacts.yaml | 2 + ...c-cluster-role-controller-permissions.yaml | 2 +- go.mod | 6 +- go.sum | 10 + main.go | 354 ++++--- pkg/backend/astest/as_claim_test.go | 37 +- pkg/backend/astest/as_index_test.go | 36 +- pkg/config/config.go | 101 ++ pkg/config/resource.go | 55 ++ pkg/generated/openapi/zz_generated.openapi.go | 912 ++++++++++++++++-- pkg/reconcilers/ctrlconfig/config.go | 8 +- pkg/reconcilers/reconcilers.go | 11 +- tools/apiserver-runtime-gen/main.go | 8 +- 21 files changed, 1481 insertions(+), 415 deletions(-) create mode 100644 apis/all/all.go create mode 100644 apis/backend/as/register/register.go create mode 100644 pkg/config/config.go create mode 100644 pkg/config/resource.go diff --git a/DESIGN-DEPLOYMENTS.md b/DESIGN-DEPLOYMENTS.md index 75d81ed..cfe8c1c 100644 --- a/DESIGN-DEPLOYMENTS.md +++ b/DESIGN-DEPLOYMENTS.md @@ -1,71 +1,40 @@ # deployment options -- asynchronous design with a generic backend -- synchronous design with a generic backend -- synchronous design with choreo +- async design with a generic backend -> reocncilers needed +- async design with etcd -> reconcilers needed +- sync design with a generic backend +- sync design with choreo async versus sync: -- We could initialize the storage in such way that we use a special method for storing the objects -> useful for the backend object like ipam/as/vlan/etc -- Create/Update/Delete is Handled special -- List and Watch handled in the traditional way +- Async need a reconciler +- Sync can have a special way to allocate before -> create/update/delete are special; watch/list are the same +- Sync cannot be done with etcd as the storage interface changed +- Sync -> We do a special init for both options -> main reason is to use a direct storage interface for saveALL and restore functions +-> we init all 3 resources together due to the storage ## How to select which objects should be rendered? - - name: ENABLE_BE_AS (group) - value: "sync" | "true" - - name: ENABLE_BE_VLAN (group) - value: "sync" | "true" - - name: ENABLE_BE_IPAM (group) - value: "sync" | "true" +- name: ENABLE_BE_AS (group) + value: "sync,badgerdb" | "true" +- name: ENABLE_BE_VLAN (group) + value: "sync" | "true" +- name: ENABLE_BE_IPAM (group) + value: "sync" | "true" ## Select between sync and async also per group -> using ENV flags - -## sync versus async - -1. We do a special init for both options -> main reason is to use a direct storage interface for saveALL and restore functions --> we init all 3 resources together due to the storage - -2. The sync or async is decided on init - - - -## store interface - --> for tests it is better to use a regular storage interface --> memory for tests --> badgerdb or other for a real deployment - -What about config maps ?? - - ## open - FieldSelector would be nice when listing the items to be able to check if they belong to the index - Update? How to handle - Conversion function for CRD(s) - how does this work ???? -> this will determine if we can keep choreo aligned or not -to be tested: -- getting storage -- how to walk over a list ? unstructured ? -- field manager is handled by - - - -Choreo -> we need a conversion fucntion conversion function +Choreo -> we need a conversion function conversion function TODO: - align the rest interface from choreo with the rest interface of - - -range: -- step1: check if changed -> signal; exists/not exists: we dont care at this stage -- step2: if changed validate parents and children -> we block -- step3: manage update of the main tree - -if a range changed and there are children -> we dont allow this \ No newline at end of file diff --git a/apis/all/all.go b/apis/all/all.go new file mode 100644 index 0000000..7fa06bc --- /dev/null +++ b/apis/all/all.go @@ -0,0 +1,21 @@ +/* +Copyright 2024 Nokia. + +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 all + +import ( + _ "github.com/kuidio/kuid/apis/backend/as/register" +) diff --git a/apis/backend/as/asentry_resource.go b/apis/backend/as/asentry_resource.go index f744a9b..db2c290 100644 --- a/apis/backend/as/asentry_resource.go +++ b/apis/backend/as/asentry_resource.go @@ -22,7 +22,6 @@ import ( "github.com/henderiw/apiserver-builder/pkg/builder/resource" "github.com/henderiw/apiserver-store/pkg/generic/registry" - "github.com/kform-dev/choreo/apis/condition" apiequality "k8s.io/apimachinery/pkg/api/equality" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -180,7 +179,7 @@ func (r *ASEntry) TableConvertor() func(gr schema.GroupResource) rest.TableConve } return []interface{}{ entry.GetName(), - entry.GetCondition(condition.ConditionTypeReady).Status, + //entry.GetCondition(condition.ConditionTypeReady).Status, entry.GetIndex(), entry.GetClaimType(), entry.GetSpecID(), @@ -188,7 +187,7 @@ func (r *ASEntry) TableConvertor() func(gr schema.GroupResource) rest.TableConve }, []metav1.TableColumnDefinition{ {Name: "Name", Type: "string"}, - {Name: "Ready", Type: "string"}, + //{Name: "Ready", Type: "string"}, {Name: "Index", Type: "string"}, {Name: "ClaimType", Type: "string"}, {Name: "ID", Type: "string"}, diff --git a/apis/backend/as/register/register.go b/apis/backend/as/register/register.go new file mode 100644 index 0000000..08eaa41 --- /dev/null +++ b/apis/backend/as/register/register.go @@ -0,0 +1,120 @@ +/* +Copyright 2024 Nokia. + +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 register + +import ( + "context" + + "github.com/henderiw/apiserver-builder/pkg/builder" + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-builder/pkg/builder/rest" + "github.com/kuidio/kuid/apis/backend/as" + asbev1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" + bebackend "github.com/kuidio/kuid/pkg/backend" + genericbackend "github.com/kuidio/kuid/pkg/backend/generic" + "github.com/kuidio/kuid/pkg/config" + genericregistry "github.com/kuidio/kuid/pkg/registry/generic" + "github.com/kuidio/kuid/pkg/registry/options" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apiserver/pkg/registry/generic" +) + +func init() { + config.Register( + as.SchemeGroupVersion.Group, + NewBackend, + ApplyStorageToBackend, + []*config.ResourceConfig{ + {StorageProviderFn: NewIndexStorageProvider, ResourceVersions: []resource.Object{&as.ASIndex{}, &asbev1alpha1.ASIndex{}}}, + {StorageProviderFn: NewClaimStorageProvider, ResourceVersions: []resource.Object{&as.ASClaim{}, &asbev1alpha1.ASClaim{}}}, + {StorageProviderFn: NewEntryStorageProvider, ResourceVersions: []resource.Object{&as.ASEntry{}, &asbev1alpha1.ASEntry{}}}, + }, + ) +} + +func NewBackend() bebackend.Backend { + return genericbackend.New( + as.ASClaimKind, + as.ASIndexFromRuntime, + as.ASClaimFromRuntime, + as.ASEntryFromRuntime, + as.GetASEntry, + ) +} + +func NewIndexStorageProvider(ctx context.Context, be bebackend.Backend, sync bool, options *options.Options) *rest.StorageProvider { + opts := *options + if sync { + opts.BackendInvoker = bebackend.NewIndexInvoker(be) + return genericregistry.NewStorageProvider(ctx, &as.ASIndex{}, &opts) + } + return genericregistry.NewStorageProvider(ctx, &as.ASIndex{}, &opts) +} + +func NewClaimStorageProvider(ctx context.Context, be bebackend.Backend, sync bool, options *options.Options) *rest.StorageProvider { + opts := *options + if sync { + opts.BackendInvoker = bebackend.NewClaimInvoker(be) + return genericregistry.NewStorageProvider(ctx, &as.ASClaim{}, &opts) + } + return genericregistry.NewStorageProvider(ctx, &as.ASClaim{}, &opts) +} + +func NewEntryStorageProvider(ctx context.Context, be bebackend.Backend, sync bool, options *options.Options) *rest.StorageProvider { + return genericregistry.NewStorageProvider(ctx, &as.ASEntry{}, options) +} + +func ApplyStorageToBackend(ctx context.Context, be bebackend.Backend, apiServer *builder.Server) error { + claimStorageProvider := apiServer.StorageProvider[schema.GroupResource{ + Group: as.SchemeGroupVersion.Group, + Resource: as.ASClaimPlural, + }] + + claimStorage, err := claimStorageProvider.Get(ctx, apiServer.Schemes[0], &ClaimGetter{}) + if err != nil { + return err + } + + entryStorageProvider := apiServer.StorageProvider[schema.GroupResource{ + Group: as.SchemeGroupVersion.Group, + Resource: as.ASEntryPlural, + }] + + entryStorage, err := entryStorageProvider.Get(ctx, apiServer.Schemes[0], &EntryGetter{}) + if err != nil { + return err + } + + return be.AddStorage(entryStorage, claimStorage) +} + +var _ generic.RESTOptionsGetter = &ClaimGetter{} + +type ClaimGetter struct{} + +func (r *ClaimGetter) GetRESTOptions(resource schema.GroupResource, example runtime.Object) (generic.RESTOptions, error) { + return generic.RESTOptions{}, nil +} + +var _ generic.RESTOptionsGetter = &EntryGetter{} + +type EntryGetter struct{} + +func (r *EntryGetter) GetRESTOptions(resource schema.GroupResource, example runtime.Object) (generic.RESTOptions, error) { + return generic.RESTOptions{}, nil +} diff --git a/apis/backend/as/storage.go b/apis/backend/as/storage.go index b950d32..2fbae66 100644 --- a/apis/backend/as/storage.go +++ b/apis/backend/as/storage.go @@ -14,6 +14,8 @@ package as +/* + import ( "context" @@ -23,20 +25,73 @@ import ( genericbackend "github.com/kuidio/kuid/pkg/backend/generic" genericregistry "github.com/kuidio/kuid/pkg/registry/generic" "github.com/kuidio/kuid/pkg/registry/options" - "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apiserver/pkg/registry/generic" ) +// backend -> can be initialized at init +// + +func NewBackend() bebackend.Backend { + return genericbackend.New( + ASClaimKind, + ASIndexFromRuntime, + ASClaimFromRuntime, + ASEntryFromRuntime, + GetASEntry, + ) +} + +func NewIndexStorageProvider(ctx context.Context, be bebackend.Backend, sync bool, options *options.Options) *rest.StorageProvider { + opts := *options + if sync { + opts.BackendInvoker = bebackend.NewIndexInvoker(be) + return genericregistry.NewStorageProvider(ctx, &ASIndex{}, &opts) + } + return genericregistry.NewStorageProvider(ctx, &ASIndex{}, &opts) +} + +func NewClaimStorageProvider(ctx context.Context, be bebackend.Backend, sync bool, options *options.Options) *rest.StorageProvider { + opts := *options + if sync { + opts.BackendInvoker = bebackend.NewClaimInvoker(be) + return genericregistry.NewStorageProvider(ctx, &ASClaim{}, &opts) + } + return genericregistry.NewStorageProvider(ctx, &ASClaim{}, &opts) +} + +func NewEntryStorageProvider(ctx context.Context, be bebackend.Backend, sync bool, options *options.Options) *rest.StorageProvider { + return genericregistry.NewStorageProvider(ctx, &ASEntry{}, options) +} + +func ApplyStorageToBackend(ctx context.Context, be bebackend.Backend, apiServer *builder.Server) error { + claimStorageProvider := apiServer.StorageProvider[schema.GroupResource{ + Group: SchemeGroupVersion.Group, + Resource: ASClaimPlural, + }] + + claimStorage, err := claimStorageProvider.Get(ctx, apiServer.Schemes[0], &ClaimGetter{}) + if err != nil { + return err + } + + entryStorageProvider := apiServer.StorageProvider[schema.GroupResource{ + Group: SchemeGroupVersion.Group, + Resource: ASEntryPlural, + }] + + entryStorage, err := entryStorageProvider.Get(ctx, apiServer.Schemes[0], &EntryGetter{}) + if err != nil { + return err + } + + return be.AddStorage(entryStorage, claimStorage) +} +*/ + +/* func NewStorageProviders(ctx context.Context, sync bool, options *options.Options) bebackend.StorageProviders { - r := &storageProviders{ - be: genericbackend.New( - ASClaimKind, - ASIndexFromRuntime, - ASClaimFromRuntime, - ASEntryFromRuntime, - GetASEntry, - ), + r := &StorageProviders{ + be: CreateBackend(), } if sync { opts := *options @@ -52,26 +107,27 @@ func NewStorageProviders(ctx context.Context, sync bool, options *options.Option return r } -type storageProviders struct { +type StorageProviders struct { be bebackend.Backend indexStorageProvider *rest.StorageProvider claimStorageProvider *rest.StorageProvider entryStorageProvider *rest.StorageProvider } -func (r *storageProviders) GetIndexStorageProvider() *rest.StorageProvider { +func (r *StorageProviders) GetIndexStorageProvider() *rest.StorageProvider { return r.indexStorageProvider } -func (r *storageProviders) GetClaimStorageProvider() *rest.StorageProvider { +func (r *StorageProviders) GetClaimStorageProvider() *rest.StorageProvider { return r.claimStorageProvider } -func (r *storageProviders) GetEntryStorageProvider() *rest.StorageProvider { +func (r *StorageProviders) GetEntryStorageProvider() *rest.StorageProvider { return r.entryStorageProvider } -func (r *storageProviders) ApplyStorageToBackend(ctx context.Context, apiServer *builder.Server) error { + +func (r *StorageProviders) ApplyStorageToBackend(ctx context.Context, apiServer *builder.Server) error { claimStorageProvider := apiServer.StorageProvider[schema.GroupResource{ Group: SchemeGroupVersion.Group, Resource: ASClaimPlural, @@ -96,22 +152,9 @@ func (r *storageProviders) ApplyStorageToBackend(ctx context.Context, apiServer return nil } -func (r *storageProviders) GetBackend() bebackend.Backend { - return r.be -} - -var _ generic.RESTOptionsGetter = &ClaimGetter{} -type ClaimGetter struct{} - -func (r *ClaimGetter) GetRESTOptions(resource schema.GroupResource, example runtime.Object) (generic.RESTOptions, error) { - return generic.RESTOptions{}, nil +func (r *StorageProviders) GetBackend() bebackend.Backend { + return r.be } -var _ generic.RESTOptionsGetter = &EntryGetter{} - -type EntryGetter struct{} - -func (r *EntryGetter) GetRESTOptions(resource schema.GroupResource, example runtime.Object) (generic.RESTOptions, error) { - return generic.RESTOptions{}, nil -} +*/ diff --git a/apis/backend/as/v1alpha1/asentry_resource.go b/apis/backend/as/v1alpha1/asentry_resource.go index 9f2f5f7..876aea1 100644 --- a/apis/backend/as/v1alpha1/asentry_resource.go +++ b/apis/backend/as/v1alpha1/asentry_resource.go @@ -58,13 +58,13 @@ func (r *ASEntry) GetObjectMeta() *metav1.ObjectMeta { // New return an empty resource // New implements resource.Object func (ASEntry) New() runtime.Object { - return &ASClaim{} + return &ASEntry{} } // NewList return an empty resourceList // NewList implements resource.Object func (ASEntry) NewList() runtime.Object { - return &ASClaimList{} + return &ASEntryList{} } // GetListMeta returns the ListMeta diff --git a/apis/backend/as/v1alpha1/asindex_resource.go b/apis/backend/as/v1alpha1/asindex_resource.go index fd89635..958ede0 100644 --- a/apis/backend/as/v1alpha1/asindex_resource.go +++ b/apis/backend/as/v1alpha1/asindex_resource.go @@ -58,13 +58,13 @@ func (r *ASIndex) GetObjectMeta() *metav1.ObjectMeta { // New return an empty resource // New implements resource.Object func (ASIndex) New() runtime.Object { - return &ASClaim{} + return &ASIndex{} } // NewList return an empty resourceList // NewList implements resource.Object func (ASIndex) NewList() runtime.Object { - return &ASClaimList{} + return &ASIndexList{} } // GetListMeta returns the ListMeta diff --git a/apis/backend/as/zz_generated.deepcopy.go b/apis/backend/as/zz_generated.deepcopy.go index 81ecf5b..76df54f 100644 --- a/apis/backend/as/zz_generated.deepcopy.go +++ b/apis/backend/as/zz_generated.deepcopy.go @@ -449,35 +449,3 @@ func (in *ASStaticIDSyntaxValidator) DeepCopy() *ASStaticIDSyntaxValidator { in.DeepCopyInto(out) return out } - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClaimGetter) DeepCopyInto(out *ClaimGetter) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClaimGetter. -func (in *ClaimGetter) DeepCopy() *ClaimGetter { - if in == nil { - return nil - } - out := new(ClaimGetter) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EntryGetter) DeepCopyInto(out *EntryGetter) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EntryGetter. -func (in *EntryGetter) DeepCopy() *EntryGetter { - if in == nil { - return nil - } - out := new(EntryGetter) - in.DeepCopyInto(out) - return out -} diff --git a/artifacts/out/artifacts.yaml b/artifacts/out/artifacts.yaml index 68fd431..40cef2e 100644 --- a/artifacts/out/artifacts.yaml +++ b/artifacts/out/artifacts.yaml @@ -242,6 +242,8 @@ rules: resources: - mutatingwebhookconfigurations - validatingwebhookconfigurations + - validatingadmissionpolicies + - validatingadmissionpolicybindings verbs: - get - watch diff --git a/artifacts/rbac-cluster-role-controller-permissions.yaml b/artifacts/rbac-cluster-role-controller-permissions.yaml index de280d0..fa4e4fc 100644 --- a/artifacts/rbac-cluster-role-controller-permissions.yaml +++ b/artifacts/rbac-cluster-role-controller-permissions.yaml @@ -10,7 +10,7 @@ rules: resources: ["events"] verbs: ["create", "patch"] - apiGroups: ["admissionregistration.k8s.io"] - resources: ["mutatingwebhookconfigurations", "validatingwebhookconfigurations"] + resources: ["mutatingwebhookconfigurations", "validatingwebhookconfigurations", "validatingadmissionpolicies", "validatingadmissionpolicybindings"] verbs: ["get", "watch", "list"] - apiGroups: ["flowcontrol.apiserver.k8s.io"] resources: ["flowschemas", "prioritylevelconfigurations"] diff --git a/go.mod b/go.mod index c4f418b..8d08707 100644 --- a/go.mod +++ b/go.mod @@ -4,17 +4,13 @@ go 1.23.0 toolchain go1.23.2 -//replace k8s.io/api => k8s.io/api v0.31.1 - -//replace k8s.io/kms => k8s.io/kms v0.31.1 - replace k8s.io/gengo/v2 => k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 require ( github.com/dgraph-io/badger/v4 v4.3.0 github.com/google/go-cmp v0.6.0 github.com/google/uuid v1.6.0 - github.com/henderiw/apiserver-builder v0.0.4-0.20241023220418-f1bacfdbb4da + github.com/henderiw/apiserver-builder v0.0.4-0.20241024124759-f780409e1b2f github.com/henderiw/apiserver-store v0.0.3-0.20241022143604-0995425b3d06 github.com/henderiw/idxtable v0.0.0-20241021085446-f8d804551342 github.com/henderiw/logger v0.0.0-20230911123436-8655829b1abe diff --git a/go.sum b/go.sum index 5078c7d..4986848 100644 --- a/go.sum +++ b/go.sum @@ -145,6 +145,16 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1 github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k= github.com/henderiw/apiserver-builder v0.0.4-0.20241023220418-f1bacfdbb4da h1:vAG0d1ZYB7+KS7V6YehDFJ9FMicNoBlxLM7/b4tZ/bk= github.com/henderiw/apiserver-builder v0.0.4-0.20241023220418-f1bacfdbb4da/go.mod h1:LfJu1JURnxHwnFa8CVb2XPw50TwdU1xQvuUNxpaSOlE= +github.com/henderiw/apiserver-builder v0.0.4-0.20241024082441-d93c947488cc h1:fF9JSus7Tdd1nMputDiOxO7GX5wSaSQub8HB5VP4bko= +github.com/henderiw/apiserver-builder v0.0.4-0.20241024082441-d93c947488cc/go.mod h1:LfJu1JURnxHwnFa8CVb2XPw50TwdU1xQvuUNxpaSOlE= +github.com/henderiw/apiserver-builder v0.0.4-0.20241024083714-4b01a6506b20 h1:7KXAkd2pbh0x4fDF3P6+T5i9Tr13X/1h21TjZUsL++Q= +github.com/henderiw/apiserver-builder v0.0.4-0.20241024083714-4b01a6506b20/go.mod h1:LfJu1JURnxHwnFa8CVb2XPw50TwdU1xQvuUNxpaSOlE= +github.com/henderiw/apiserver-builder v0.0.4-0.20241024084215-939617b3b6a8 h1:nf+UrluqIGptmmEaPDxcAMWwNrEGrWpqEIEpOLyNbXg= +github.com/henderiw/apiserver-builder v0.0.4-0.20241024084215-939617b3b6a8/go.mod h1:LfJu1JURnxHwnFa8CVb2XPw50TwdU1xQvuUNxpaSOlE= +github.com/henderiw/apiserver-builder v0.0.4-0.20241024085036-d72069d078f8 h1:EoPSG8cO3eZdOfPR3Ih+dLwEcPkMGkXiecxKG9L07YQ= +github.com/henderiw/apiserver-builder v0.0.4-0.20241024085036-d72069d078f8/go.mod h1:LfJu1JURnxHwnFa8CVb2XPw50TwdU1xQvuUNxpaSOlE= +github.com/henderiw/apiserver-builder v0.0.4-0.20241024124759-f780409e1b2f h1:7bYTVY2xFvVh06bQkGDXVue9FutcQ7dguDvGaYAd0Ns= +github.com/henderiw/apiserver-builder v0.0.4-0.20241024124759-f780409e1b2f/go.mod h1:LfJu1JURnxHwnFa8CVb2XPw50TwdU1xQvuUNxpaSOlE= github.com/henderiw/apiserver-store v0.0.3-0.20241022143604-0995425b3d06 h1:1RVj1x0ykpmuxynrLww0oHgs5TdkciwJZr996SmGDf0= github.com/henderiw/apiserver-store v0.0.3-0.20241022143604-0995425b3d06/go.mod h1:VVkUptd3MTyREmpo+C/t6l+mJAwo3A1UWvHi0QSH0yE= github.com/henderiw/idxtable v0.0.0-20241021085446-f8d804551342 h1:gkdOvjxM6rNTkcyoykZLjAfPjn06/MEY4o8cy+3uj2g= diff --git a/main.go b/main.go index 3f41349..cdbd282 100644 --- a/main.go +++ b/main.go @@ -24,15 +24,15 @@ import ( "strings" "github.com/henderiw/apiserver-builder/pkg/builder" - "github.com/henderiw/apiserver-store/pkg/db/badgerdb" "github.com/henderiw/logger/log" - "github.com/kuidio/kuid/apis/backend/as" + _ "github.com/kuidio/kuid/apis/all" asbev1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" + "github.com/kuidio/kuid/pkg/backend" + "github.com/kuidio/kuid/pkg/config" "github.com/kuidio/kuid/pkg/generated/openapi" "github.com/kuidio/kuid/pkg/reconcilers" _ "github.com/kuidio/kuid/pkg/reconcilers/all" "github.com/kuidio/kuid/pkg/reconcilers/ctrlconfig" - "github.com/kuidio/kuid/pkg/registry/options" "go.uber.org/zap/zapcore" "k8s.io/apimachinery/pkg/runtime" clientgoscheme "k8s.io/client-go/kubernetes/scheme" @@ -44,11 +44,7 @@ import ( ) const ( - defaultEtcdPathPrefix = "/registry/backend.kuid.dev" -) - -var ( - configDir = "/config" +// defaultEtcdPathPrefix = "/registry/backend.kuid.dev" ) func main() { @@ -66,212 +62,188 @@ func main() { ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts))) - // setup controllers - runScheme := runtime.NewScheme() - // add the core object to the scheme - for _, api := range (runtime.SchemeBuilder{ - clientgoscheme.AddToScheme, - //infrabev1alpha1.AddToScheme, - //ipambev1alpha1.AddToScheme, - //vlanbev1alpha1.AddToScheme, - //vxlanbev1alpha1.AddToScheme, - asbev1alpha1.AddToScheme, - //extcommbev1alpha1.AddToScheme, - //genidbev1alpha1.AddToScheme, - }) { - if err := api(runScheme); err != nil { - log.Error("cannot add scheme", "err", err) - os.Exit(1) - } - } - - /* - runScheme.AddFieldLabelConversionFunc( - ipambev1alpha1.SchemeGroupVersion.WithKind(ipambev1alpha1.IPClaimKind), - ipambev1alpha1.IPClaimConvertFieldSelector, - ) - runScheme.AddFieldLabelConversionFunc( - ipambev1alpha1.SchemeGroupVersion.WithKind(ipambev1alpha1.IPEntryKind), - ipambev1alpha1.IPEntryConvertFieldSelector, - ) - runScheme.AddFieldLabelConversionFunc( - vlanbev1alpha1.SchemeGroupVersion.WithKind(vlanbev1alpha1.VLANClaimKind), - vlanbev1alpha1.VLANClaimConvertFieldSelector, - ) - runScheme.AddFieldLabelConversionFunc( - vlanbev1alpha1.SchemeGroupVersion.WithKind(vlanbev1alpha1.VLANEntryKind), - vlanbev1alpha1.VLANEntryConvertFieldSelector, - ) - runScheme.AddFieldLabelConversionFunc( - vxlanbev1alpha1.SchemeGroupVersion.WithKind(vxlanbev1alpha1.VXLANClaimKind), - vxlanbev1alpha1.VXLANClaimConvertFieldSelector, - ) - runScheme.AddFieldLabelConversionFunc( - vxlanbev1alpha1.SchemeGroupVersion.WithKind(vxlanbev1alpha1.VXLANEntryKind), - vxlanbev1alpha1.VXLANEntryConvertFieldSelector, - ) - runScheme.AddFieldLabelConversionFunc( - asbev1alpha1.SchemeGroupVersion.WithKind(asbev1alpha1.ASClaimKind), - asbev1alpha1.ASClaimConvertFieldSelector, - ) - runScheme.AddFieldLabelConversionFunc( - asbev1alpha1.SchemeGroupVersion.WithKind(asbev1alpha1.ASEntryKind), - asbev1alpha1.ASEntryConvertFieldSelector, - ) - runScheme.AddFieldLabelConversionFunc( - extcommbev1alpha1.SchemeGroupVersion.WithKind(extcommbev1alpha1.EXTCOMMClaimKind), - extcommbev1alpha1.EXTCOMMClaimConvertFieldSelector, - ) - runScheme.AddFieldLabelConversionFunc( - extcommbev1alpha1.SchemeGroupVersion.WithKind(extcommbev1alpha1.EXTCOMMEntryKind), - extcommbev1alpha1.EXTCOMMEntryConvertFieldSelector, - ) - runScheme.AddFieldLabelConversionFunc( - genidbev1alpha1.SchemeGroupVersion.WithKind(genidbev1alpha1.GENIDClaimKind), - genidbev1alpha1.GENIDClaimConvertFieldSelector, - ) - runScheme.AddFieldLabelConversionFunc( - genidbev1alpha1.SchemeGroupVersion.WithKind(genidbev1alpha1.GENIDEntryKind), - genidbev1alpha1.GENIDEntryConvertFieldSelector, - ) - runScheme.AddFieldLabelConversionFunc( - infrabev1alpha1.SchemeGroupVersion.WithKind(infrabev1alpha1.NodeKind), - infrabev1alpha1.NodeConvertFieldSelector, - ) - runScheme.AddFieldLabelConversionFunc( - infrabev1alpha1.SchemeGroupVersion.WithKind(infrabev1alpha1.LinkKind), - infrabev1alpha1.LinkConvertFieldSelector, - ) - */ - - mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), manager.Options{ - Scheme: runScheme, - }) + // if no async we dont have to start any, the reconcilers len will determine this + recs := map[string]reconcilers.Reconciler{} + ctrlCfg := &ctrlconfig.ControllerConfig{Backends: map[string]backend.Backend{}} + kuidConfig, err := config.GetKuidConfig() if err != nil { - log.Error("cannot start manager", "err", err) + log.Error("cannot get kuid config", "err", err) os.Exit(1) } - /* - ipbe := ipam.New(mgr.GetClient()) - vlanbe := bebackend.New( - mgr.GetClient(), - func() backend.IndexObject { return &vlanbev1alpha1.VLANIndex{} }, - func() backend.ObjectList { return &vlanbev1alpha1.VLANEntryList{} }, - func() backend.ObjectList { return &vlanbev1alpha1.VLANClaimList{} }, - vlanbev1alpha1.GetVLANEntry, - vlanbev1alpha1.SchemeGroupVersion.WithKind(vlanbev1alpha1.VLANIndexKind), - vlanbev1alpha1.SchemeGroupVersion.WithKind(vlanbev1alpha1.VLANClaimKind), - ) - vxlanbe := bebackend.New( - mgr.GetClient(), - func() backend.IndexObject { return &vxlanbev1alpha1.VXLANIndex{} }, - func() backend.ObjectList { return &vxlanbev1alpha1.VXLANEntryList{} }, - func() backend.ObjectList { return &vxlanbev1alpha1.VXLANClaimList{} }, - vxlanbev1alpha1.GetVXLANEntry, - vxlanbev1alpha1.SchemeGroupVersion.WithKind(vxlanbev1alpha1.VXLANIndexKind), - vxlanbev1alpha1.SchemeGroupVersion.WithKind(vxlanbev1alpha1.VXLANClaimKind), - ) - asbe := bebackend.New( - mgr.GetClient(), - func() backend.IndexObject { return &asbev1alpha1.ASIndex{} }, - func() backend.ObjectList { return &asbev1alpha1.ASEntryList{} }, - func() backend.ObjectList { return &asbev1alpha1.ASClaimList{} }, - asbev1alpha1.GetASEntry, - asbev1alpha1.SchemeGroupVersion.WithKind(asbev1alpha1.ASIndexKind), - asbev1alpha1.SchemeGroupVersion.WithKind(asbev1alpha1.ASClaimKind), - ) - extcommbe := bebackend.New( - mgr.GetClient(), - func() backend.IndexObject { return &extcommbev1alpha1.EXTCOMMIndex{} }, - func() backend.ObjectList { return &extcommbev1alpha1.EXTCOMMEntryList{} }, - func() backend.ObjectList { return &extcommbev1alpha1.EXTCOMMClaimList{} }, - extcommbev1alpha1.GetEXTCOMMEntry, - extcommbev1alpha1.SchemeGroupVersion.WithKind(extcommbev1alpha1.EXTCOMMIndexKind), - extcommbev1alpha1.SchemeGroupVersion.WithKind(extcommbev1alpha1.EXTCOMMClaimKind), - ) - genidbe := bebackend.New( - mgr.GetClient(), - func() backend.IndexObject { return &genidbev1alpha1.GENIDIndex{} }, - func() backend.ObjectList { return &genidbev1alpha1.GENIDEntryList{} }, - func() backend.ObjectList { return &genidbev1alpha1.GENIDClaimList{} }, - genidbev1alpha1.GetGENIDEntry, - genidbev1alpha1.SchemeGroupVersion.WithKind(genidbev1alpha1.GENIDIndexKind), - genidbev1alpha1.SchemeGroupVersion.WithKind(genidbev1alpha1.GENIDClaimKind), - ) - */ - - ctrlCfg := &ctrlconfig.ControllerConfig{ - //IPAMBackend: ipbe, - //VLANBackend: vlanbe, - //VXLANBackend: vxlanbe, - //ASBackend: asbe, - //EXTCOMMBackend: extcommbe, - //GENIDBackend: genidbe, - } - for name, reconciler := range reconcilers.Reconcilers { - log.Info("reconciler", "name", name, "enabled", IsReconcilerEnabled(name)) - if IsReconcilerEnabled(name) { - _, err := reconciler.SetupWithManager(ctx, mgr, ctrlCfg) - if err != nil { - log.Error("cannot add controllers to manager", "err", err.Error()) - os.Exit(1) - } - } - } - - db, err := badgerdb.OpenDB(ctx, configDir) + registryOptions, err := config.GetRegistryOptions(ctx, kuidConfig.Storage) if err != nil { - log.Error("cannot open db", "err", err.Error()) + log.Error("cannot get kuid storage registry options", "err", err) os.Exit(1) } - registryOptions := &options.Options{ - Prefix: configDir, - Type: options.StorageType_KV, - DB: db, - } - - asStorageProviders := as.NewStorageProviders(ctx, true, registryOptions) - - go func() { - apiserver := builder.APIServer. + // apiserver is only relevant when not using etcd + var apiserver *builder.Server + if kuidConfig.Storage != config.StorageType_Etcd { + apiserver = builder.APIServer. WithServerName("kuid-api-server"). WithOpenAPIDefinitions("Config", "v1alpha1", openapi.GetOpenAPIDefinitions). - WithResourceAndHandler(&as.ASIndex{}, asStorageProviders.GetIndexStorageProvider()). - WithResourceAndHandler(&as.ASClaim{}, asStorageProviders.GetClaimStorageProvider()). - WithResourceAndHandler(&as.ASEntry{}, asStorageProviders.GetEntryStorageProvider()). - WithResourceAndHandler(&asbev1alpha1.ASIndex{}, asStorageProviders.GetIndexStorageProvider()). - WithResourceAndHandler(&asbev1alpha1.ASClaim{}, asStorageProviders.GetClaimStorageProvider()). - WithResourceAndHandler(&asbev1alpha1.ASEntry{}, asStorageProviders.GetEntryStorageProvider()). WithoutEtcd() + } + backends := map[string]backend.Backend{} + for _, kuidGroupConfig := range kuidConfig.Groups { + group := kuidGroupConfig.Group + log.Info("kuid group configured", "group", group, "enabled", kuidGroupConfig.Enabled, "sync", kuidGroupConfig.Sync) + if !kuidGroupConfig.Enabled { + continue + } + // check if group is registered + groupConfig, ok := config.Groups[group] + if !ok { + log.Info("group configured in kuidconfig, but not registered", "group", group) + continue + } + // create the storageProvider + if kuidConfig.Storage != config.StorageType_Etcd { + if groupConfig.BackendFn != nil { + be := groupConfig.BackendFn() + backends[group] = be + for _, resource := range groupConfig.Resources { + storageProvider := resource.StorageProviderFn(ctx, be, kuidGroupConfig.Sync, registryOptions) + for _, resourceVersion := range resource.ResourceVersions { + apiserver.WithResourceAndHandler(resourceVersion, storageProvider) + } + } + } else { + for _, resource := range groupConfig.Resources { + storageProvider := resource.StorageProviderFn(ctx, nil, kuidGroupConfig.Sync, registryOptions) + for _, resourceVersion := range resource.ResourceVersions { + apiserver.WithResourceAndHandler(resourceVersion, storageProvider) + } + } + } + } + + // reconcilers get registered when async operations are configured + if !kuidGroupConfig.Sync { + if reconcilers, ok := reconcilers.ReconcilerGroups[group]; ok { + for reconilerName, reconciler := range reconcilers { + recs[reconilerName] = reconciler + } + } + // add the backend -> for etcd this needs to be configmaps -> tbd how we handle this + } + } + + if kuidConfig.Storage != config.StorageType_Etcd { cmd, err := apiserver.Build(ctx) if err != nil { panic(err) } - if err := asStorageProviders.ApplyStorageToBackend(ctx, apiserver); err != nil { - panic(err) + for _, kuidGroupConfig := range kuidConfig.Groups { + group := kuidGroupConfig.Group + if !kuidGroupConfig.Enabled { + continue + } + // check if group is registered + groupConfig, ok := config.Groups[group] + if !ok { + continue + } + + if groupConfig.ApplyStorageToBackendFn != nil { + if err := groupConfig.ApplyStorageToBackendFn(ctx, backends[group], apiserver); err != nil { + log.Error("cannot apply storage to backend", "error", err.Error()) + os.Exit(1) + } + } } if err := cmd.Execute(); err != nil { panic(err) } - }() - - if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil { - log.Error("unable to set up health check", "error", err.Error()) - os.Exit(1) - } - if err := mgr.AddReadyzCheck("readyz", healthz.Ping); err != nil { - log.Error("unable to set up ready check", "error", err.Error()) - os.Exit(1) } - log.Info("starting manager") - if err := mgr.Start(ctx); err != nil { - log.Error("problem running manager", "error", err.Error()) - os.Exit(1) + if len(recs) != 0 { + // setup scheme for controllers + runScheme := runtime.NewScheme() + // add the core object to the scheme + for _, api := range (runtime.SchemeBuilder{ + clientgoscheme.AddToScheme, + //infrabev1alpha1.AddToScheme, + asbev1alpha1.AddToScheme, + //ipambev1alpha1.AddToScheme, + //vlanbev1alpha1.AddToScheme, + //vxlanbev1alpha1.AddToScheme, + //extcommbev1alpha1.AddToScheme, + //genidbev1alpha1.AddToScheme, + }) { + if err := api(runScheme); err != nil { + log.Error("cannot add scheme", "err", err) + os.Exit(1) + } + } + + mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), manager.Options{ + Scheme: runScheme, + }) + if err != nil { + log.Error("cannot start manager", "err", err) + os.Exit(1) + } + for name, reconciler := range recs { + log.Info("reconciler", "name", name, "enabled", IsReconcilerEnabled(name)) + if IsReconcilerEnabled(name) { + _, err := reconciler.SetupWithManager(ctx, mgr, ctrlCfg) + if err != nil { + log.Error("cannot add controllers to manager", "err", err.Error()) + os.Exit(1) + } + } + } + if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil { + log.Error("unable to set up health check", "error", err.Error()) + os.Exit(1) + } + if err := mgr.AddReadyzCheck("readyz", healthz.Ping); err != nil { + log.Error("unable to set up ready check", "error", err.Error()) + os.Exit(1) + } + + log.Info("starting manager") + if err := mgr.Start(ctx); err != nil { + log.Error("problem running manager", "error", err.Error()) + os.Exit(1) + } + } else { + for range ctx.Done() { + log.Info("context cancelled...") + } } + + /* + asStorageProviders := as.NewStorageProviders(ctx, true, registryOptions) + + go func() { + apiserver := builder.APIServer. + WithServerName("kuid-api-server"). + WithOpenAPIDefinitions("Config", "v1alpha1", openapi.GetOpenAPIDefinitions). + WithoutEtcd(). + WithResourceAndHandler(&as.ASIndex{}, asStorageProviders.GetIndexStorageProvider()). + WithResourceAndHandler(&as.ASClaim{}, asStorageProviders.GetClaimStorageProvider()). + WithResourceAndHandler(&as.ASEntry{}, asStorageProviders.GetEntryStorageProvider()). + WithResourceAndHandler(&asbev1alpha1.ASIndex{}, asStorageProviders.GetIndexStorageProvider()). + WithResourceAndHandler(&asbev1alpha1.ASClaim{}, asStorageProviders.GetClaimStorageProvider()). + WithResourceAndHandler(&asbev1alpha1.ASEntry{}, asStorageProviders.GetEntryStorageProvider()) + + cmd, err := apiserver.Build(ctx) + if err != nil { + panic(err) + } + if err := asStorageProviders.ApplyStorageToBackend(ctx, apiserver); err != nil { + panic(err) + } + if err := cmd.Execute(); err != nil { + panic(err) + } + }() + */ + } // IsReconcilerEnabled checks if an environment variable `ENABLE_` exists diff --git a/pkg/backend/astest/as_claim_test.go b/pkg/backend/astest/as_claim_test.go index 9f452bb..cf60a24 100644 --- a/pkg/backend/astest/as_claim_test.go +++ b/pkg/backend/astest/as_claim_test.go @@ -6,9 +6,12 @@ import ( "testing" "github.com/henderiw/apiserver-builder/pkg/builder" + "github.com/henderiw/apiserver-builder/pkg/builder/resource" "github.com/kuidio/kuid/apis/backend" "github.com/kuidio/kuid/apis/backend/as" + "github.com/kuidio/kuid/apis/backend/as/register" asbev1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" + "github.com/kuidio/kuid/pkg/config" "github.com/kuidio/kuid/pkg/generated/openapi" "github.com/kuidio/kuid/pkg/registry/options" "github.com/stretchr/testify/assert" @@ -61,27 +64,39 @@ func Test(t *testing.T) { for _, testType := range testTypes { t.Run(name, func(t *testing.T) { ctx := context.Background() - asStorageProviders := as.NewStorageProviders(ctx, true, &options.Options{ - Type: options.StorageType_Memory, - }) + apiserver := builder.APIServer. WithServerName("kuid-api-server"). WithOpenAPIDefinitions("Config", "v1alpha1", openapi.GetOpenAPIDefinitions). - WithResourceAndHandler(&as.ASIndex{}, asStorageProviders.GetIndexStorageProvider()). - WithResourceAndHandler(&as.ASClaim{}, asStorageProviders.GetClaimStorageProvider()). - WithResourceAndHandler(&as.ASEntry{}, asStorageProviders.GetEntryStorageProvider()). - WithResourceAndHandler(&asbev1alpha1.ASIndex{}, asStorageProviders.GetIndexStorageProvider()). - WithResourceAndHandler(&asbev1alpha1.ASClaim{}, asStorageProviders.GetClaimStorageProvider()). - WithResourceAndHandler(&asbev1alpha1.ASEntry{}, asStorageProviders.GetEntryStorageProvider()). WithoutEtcd() + groupConfig := config.GroupConfig{ + BackendFn: register.NewBackend, + ApplyStorageToBackendFn: register.ApplyStorageToBackend, + Resources: []*config.ResourceConfig{ + {StorageProviderFn: register.NewIndexStorageProvider, ResourceVersions: []resource.Object{&as.ASIndex{}, &asbev1alpha1.ASIndex{}}}, + {StorageProviderFn: register.NewClaimStorageProvider, ResourceVersions: []resource.Object{&as.ASClaim{}, &asbev1alpha1.ASClaim{}}}, + {StorageProviderFn: register.NewEntryStorageProvider, ResourceVersions: []resource.Object{&as.ASEntry{}, &asbev1alpha1.ASEntry{}}}, + }, + } + + be := groupConfig.BackendFn() + for _, resource := range groupConfig.Resources { + storageProvider := resource.StorageProviderFn(ctx, be, true, &options.Options{ + Type: options.StorageType_Memory, + }) + for _, resourceVersion := range resource.ResourceVersions { + apiserver.WithResourceAndHandler(resourceVersion, storageProvider) + } + } + if _, err := apiserver.Build(ctx); err != nil { panic(err) } - if err := asStorageProviders.ApplyStorageToBackend(ctx, apiserver); err != nil { + if err := groupConfig.ApplyStorageToBackendFn(ctx, be, apiserver); err != nil { panic(err) } - be := asStorageProviders.GetBackend() + claimStorage := be.GetClaimStorage() if tc.index != "" { diff --git a/pkg/backend/astest/as_index_test.go b/pkg/backend/astest/as_index_test.go index b609b02..ab61c90 100644 --- a/pkg/backend/astest/as_index_test.go +++ b/pkg/backend/astest/as_index_test.go @@ -5,8 +5,11 @@ import ( "testing" "github.com/henderiw/apiserver-builder/pkg/builder" + "github.com/henderiw/apiserver-builder/pkg/builder/resource" "github.com/kuidio/kuid/apis/backend/as" + "github.com/kuidio/kuid/apis/backend/as/register" asbev1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" + "github.com/kuidio/kuid/pkg/config" "github.com/kuidio/kuid/pkg/generated/openapi" "github.com/kuidio/kuid/pkg/registry/options" "github.com/stretchr/testify/assert" @@ -27,27 +30,38 @@ func TestIndex(t *testing.T) { t.Run(name, func(t *testing.T) { ctx := context.Background() - asStorageProviders := as.NewStorageProviders(ctx, true, &options.Options{ - Type: options.StorageType_Memory, - }) apiserver := builder.APIServer. WithServerName("kuid-api-server"). WithOpenAPIDefinitions("Config", "v1alpha1", openapi.GetOpenAPIDefinitions). - WithResourceAndHandler(&as.ASIndex{}, asStorageProviders.GetIndexStorageProvider()). - WithResourceAndHandler(&as.ASClaim{}, asStorageProviders.GetClaimStorageProvider()). - WithResourceAndHandler(&as.ASEntry{}, asStorageProviders.GetEntryStorageProvider()). - WithResourceAndHandler(&asbev1alpha1.ASIndex{}, asStorageProviders.GetIndexStorageProvider()). - WithResourceAndHandler(&asbev1alpha1.ASClaim{}, asStorageProviders.GetClaimStorageProvider()). - WithResourceAndHandler(&asbev1alpha1.ASEntry{}, asStorageProviders.GetEntryStorageProvider()). WithoutEtcd() + groupConfig := config.GroupConfig{ + BackendFn: register.NewBackend, + ApplyStorageToBackendFn: register.ApplyStorageToBackend, + Resources: []*config.ResourceConfig{ + {StorageProviderFn: register.NewIndexStorageProvider, ResourceVersions: []resource.Object{&as.ASIndex{}, &asbev1alpha1.ASIndex{}}}, + {StorageProviderFn: register.NewClaimStorageProvider, ResourceVersions: []resource.Object{&as.ASClaim{}, &asbev1alpha1.ASClaim{}}}, + {StorageProviderFn: register.NewEntryStorageProvider, ResourceVersions: []resource.Object{&as.ASEntry{}, &asbev1alpha1.ASEntry{}}}, + }, + } + + be := groupConfig.BackendFn() + for _, resource := range groupConfig.Resources { + storageProvider := resource.StorageProviderFn(ctx, be, true, &options.Options{ + Type: options.StorageType_Memory, + }) + for _, resourceVersion := range resource.ResourceVersions { + apiserver.WithResourceAndHandler(resourceVersion, storageProvider) + } + } + if _, err := apiserver.Build(ctx); err != nil { panic(err) } - if err := asStorageProviders.ApplyStorageToBackend(ctx, apiserver); err != nil { + if err := groupConfig.ApplyStorageToBackendFn(ctx, be, apiserver); err != nil { panic(err) } - be := asStorageProviders.GetBackend() + index, err := getIndex(tc.index, tc.testType) assert.NoError(t, err) if err := be.CreateIndex(ctx, index); err != nil { diff --git a/pkg/config/config.go b/pkg/config/config.go new file mode 100644 index 0000000..e318ff0 --- /dev/null +++ b/pkg/config/config.go @@ -0,0 +1,101 @@ +/* +Copyright 2024 Nokia. + +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 config + +import ( + "context" + "encoding/json" + "os" + + "github.com/henderiw/apiserver-store/pkg/db/badgerdb" + "github.com/henderiw/logger/log" + "github.com/kuidio/kuid/pkg/registry/options" +) + +var ( + configDir = "/config" +) + +type StorageType string + +const ( + StorageType_Memory StorageType = "memory" + StorageType_File StorageType = "file" + StorageType_Git StorageType = "git" + StorageType_Badgerdb StorageType = "badgerdb" + StorageType_Etcd StorageType = "etcd" +) + +type KuidGroupConfig struct { + Group string `json:"Group"` + Enabled bool `json:"Enabled"` + Sync bool `json:"Mode"` // Sync or Async -> only possible with +} + +type KuidConfig struct { + Storage StorageType `json:"Storage"` + Groups []*KuidGroupConfig `json:"groups"` +} + +func GetKuidConfig() (*KuidConfig, error) { + if val, found := os.LookupEnv("KUID_CONFIG"); found { + cfg := &KuidConfig{} + if err := json.Unmarshal([]byte(val), cfg); err != nil { + return nil, err + } + + // need to add some validation + // sync with etcd is not possible + + return cfg, nil + } + return getDefaultConfig(), nil +} + +func getDefaultConfig() *KuidConfig { + return &KuidConfig{ + Storage: StorageType_Badgerdb, + Groups: []*KuidGroupConfig{ + {Group: "as.be.kuid.dev", Enabled: true, Sync: true}, + }, + } +} + +func GetRegistryOptions(ctx context.Context, typ StorageType) (*options.Options, error) { + log := log.FromContext(ctx) + switch typ { + case StorageType_Badgerdb: + db, err := badgerdb.OpenDB(ctx, configDir) + if err != nil { + log.Error("cannot open db", "err", err.Error()) + return nil, err + } + + return &options.Options{ + Prefix: configDir, + Type: options.StorageType_KV, + DB: db, + }, nil + case StorageType_Etcd: + return nil, nil + default: + return &options.Options{ + Prefix: configDir, + Type: options.StorageType_Memory, + }, nil + } +} diff --git a/pkg/config/resource.go b/pkg/config/resource.go new file mode 100644 index 0000000..51b11bc --- /dev/null +++ b/pkg/config/resource.go @@ -0,0 +1,55 @@ +/* +Copyright 2024 Nokia. + +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 config + +import ( + "context" + + "github.com/henderiw/apiserver-builder/pkg/builder" + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-builder/pkg/builder/rest" + bebackend "github.com/kuidio/kuid/pkg/backend" + "github.com/kuidio/kuid/pkg/registry/options" +) + +var Groups = map[string]*GroupConfig{} + +type BackendFn func() bebackend.Backend + +type StorageProviderFn func(ctx context.Context, be bebackend.Backend, sync bool, options *options.Options) *rest.StorageProvider + +type ApplyStorageToBackendFn func(ctx context.Context, be bebackend.Backend, apiServer *builder.Server) error + +type GroupConfig struct { + //AddToScheme []func(s *runtime.Scheme) error + BackendFn BackendFn + ApplyStorageToBackendFn ApplyStorageToBackendFn + Resources []*ResourceConfig +} + +type ResourceConfig struct { + StorageProviderFn StorageProviderFn + ResourceVersions []resource.Object +} + +func Register(groupName string, befn BackendFn, applybefn ApplyStorageToBackendFn, resources []*ResourceConfig) { + Groups[groupName] = &GroupConfig{ + BackendFn: befn, + ApplyStorageToBackendFn: applybefn, + Resources: resources, + } +} diff --git a/pkg/generated/openapi/zz_generated.openapi.go b/pkg/generated/openapi/zz_generated.openapi.go index 2968476..c0ec2fc 100644 --- a/pkg/generated/openapi/zz_generated.openapi.go +++ b/pkg/generated/openapi/zz_generated.openapi.go @@ -29,73 +29,237 @@ import ( func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { return map[string]common.OpenAPIDefinition{ - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaim": schema_apis_backend_as_v1alpha1_ASClaim(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaimList": schema_apis_backend_as_v1alpha1_ASClaimList(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaimSpec": schema_apis_backend_as_v1alpha1_ASClaimSpec(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaimStatus": schema_apis_backend_as_v1alpha1_ASClaimStatus(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntry": schema_apis_backend_as_v1alpha1_ASEntry(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntryList": schema_apis_backend_as_v1alpha1_ASEntryList(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntrySpec": schema_apis_backend_as_v1alpha1_ASEntrySpec(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntryStatus": schema_apis_backend_as_v1alpha1_ASEntryStatus(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndex": schema_apis_backend_as_v1alpha1_ASIndex(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndexList": schema_apis_backend_as_v1alpha1_ASIndexList(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndexSpec": schema_apis_backend_as_v1alpha1_ASIndexSpec(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndexStatus": schema_apis_backend_as_v1alpha1_ASIndexStatus(ref), - "k8s.io/apimachinery/pkg/api/resource.Quantity": schema_apimachinery_pkg_api_resource_Quantity(ref), - "k8s.io/apimachinery/pkg/api/resource.int64Amount": schema_apimachinery_pkg_api_resource_int64Amount(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.APIGroup": schema_pkg_apis_meta_v1_APIGroup(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.APIGroupList": schema_pkg_apis_meta_v1_APIGroupList(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.APIResource": schema_pkg_apis_meta_v1_APIResource(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.APIResourceList": schema_pkg_apis_meta_v1_APIResourceList(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.APIVersions": schema_pkg_apis_meta_v1_APIVersions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.ApplyOptions": schema_pkg_apis_meta_v1_ApplyOptions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.Condition": schema_pkg_apis_meta_v1_Condition(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.CreateOptions": schema_pkg_apis_meta_v1_CreateOptions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.DeleteOptions": schema_pkg_apis_meta_v1_DeleteOptions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.Duration": schema_pkg_apis_meta_v1_Duration(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.FieldSelectorRequirement": schema_pkg_apis_meta_v1_FieldSelectorRequirement(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.FieldsV1": schema_pkg_apis_meta_v1_FieldsV1(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.GetOptions": schema_pkg_apis_meta_v1_GetOptions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.GroupKind": schema_pkg_apis_meta_v1_GroupKind(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.GroupResource": schema_pkg_apis_meta_v1_GroupResource(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersion": schema_pkg_apis_meta_v1_GroupVersion(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionForDiscovery": schema_pkg_apis_meta_v1_GroupVersionForDiscovery(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionKind": schema_pkg_apis_meta_v1_GroupVersionKind(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionResource": schema_pkg_apis_meta_v1_GroupVersionResource(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.InternalEvent": schema_pkg_apis_meta_v1_InternalEvent(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector": schema_pkg_apis_meta_v1_LabelSelector(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelectorRequirement": schema_pkg_apis_meta_v1_LabelSelectorRequirement(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.List": schema_pkg_apis_meta_v1_List(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta": schema_pkg_apis_meta_v1_ListMeta(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.ListOptions": schema_pkg_apis_meta_v1_ListOptions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.ManagedFieldsEntry": schema_pkg_apis_meta_v1_ManagedFieldsEntry(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.MicroTime": schema_pkg_apis_meta_v1_MicroTime(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta": schema_pkg_apis_meta_v1_ObjectMeta(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.OwnerReference": schema_pkg_apis_meta_v1_OwnerReference(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.PartialObjectMetadata": schema_pkg_apis_meta_v1_PartialObjectMetadata(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.PartialObjectMetadataList": schema_pkg_apis_meta_v1_PartialObjectMetadataList(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.Patch": schema_pkg_apis_meta_v1_Patch(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.PatchOptions": schema_pkg_apis_meta_v1_PatchOptions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.Preconditions": schema_pkg_apis_meta_v1_Preconditions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.RootPaths": schema_pkg_apis_meta_v1_RootPaths(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR": schema_pkg_apis_meta_v1_ServerAddressByClientCIDR(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.Status": schema_pkg_apis_meta_v1_Status(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.StatusCause": schema_pkg_apis_meta_v1_StatusCause(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.StatusDetails": schema_pkg_apis_meta_v1_StatusDetails(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.Table": schema_pkg_apis_meta_v1_Table(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.TableColumnDefinition": schema_pkg_apis_meta_v1_TableColumnDefinition(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.TableOptions": schema_pkg_apis_meta_v1_TableOptions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.TableRow": schema_pkg_apis_meta_v1_TableRow(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.TableRowCondition": schema_pkg_apis_meta_v1_TableRowCondition(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.Time": schema_pkg_apis_meta_v1_Time(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.Timestamp": schema_pkg_apis_meta_v1_Timestamp(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta": schema_pkg_apis_meta_v1_TypeMeta(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.UpdateOptions": schema_pkg_apis_meta_v1_UpdateOptions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.WatchEvent": schema_pkg_apis_meta_v1_WatchEvent(ref), - "k8s.io/apimachinery/pkg/runtime.RawExtension": schema_k8sio_apimachinery_pkg_runtime_RawExtension(ref), - "k8s.io/apimachinery/pkg/runtime.TypeMeta": schema_k8sio_apimachinery_pkg_runtime_TypeMeta(ref), - "k8s.io/apimachinery/pkg/runtime.Unknown": schema_k8sio_apimachinery_pkg_runtime_Unknown(ref), - "k8s.io/apimachinery/pkg/version.Info": schema_k8sio_apimachinery_pkg_version_Info(ref), + "github.com/kform-dev/choreo/apis/condition.Condition": schema_kform_dev_choreo_apis_condition_Condition(ref), + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition": schema_choreo_apis_condition_v1alpha1_Condition(ref), + "github.com/kform-dev/choreo/apis/condition/v1alpha1.ConditionedStatus": schema_choreo_apis_condition_v1alpha1_ConditionedStatus(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaim": schema_apis_backend_as_v1alpha1_ASClaim(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaimList": schema_apis_backend_as_v1alpha1_ASClaimList(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaimSpec": schema_apis_backend_as_v1alpha1_ASClaimSpec(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaimStatus": schema_apis_backend_as_v1alpha1_ASClaimStatus(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntry": schema_apis_backend_as_v1alpha1_ASEntry(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntryList": schema_apis_backend_as_v1alpha1_ASEntryList(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntrySpec": schema_apis_backend_as_v1alpha1_ASEntrySpec(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntryStatus": schema_apis_backend_as_v1alpha1_ASEntryStatus(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndex": schema_apis_backend_as_v1alpha1_ASIndex(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndexList": schema_apis_backend_as_v1alpha1_ASIndexList(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndexSpec": schema_apis_backend_as_v1alpha1_ASIndexSpec(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndexStatus": schema_apis_backend_as_v1alpha1_ASIndexStatus(ref), + "github.com/kuidio/kuid/apis/common/v1alpha1.ClaimLabels": schema_kuid_apis_common_v1alpha1_ClaimLabels(ref), + "github.com/kuidio/kuid/apis/common/v1alpha1.UserDefinedLabels": schema_kuid_apis_common_v1alpha1_UserDefinedLabels(ref), + "github.com/kuidio/kuid/apis/id/v1alpha1.AdaptorID": schema_kuid_apis_id_v1alpha1_AdaptorID(ref), + "github.com/kuidio/kuid/apis/id/v1alpha1.ClusterID": schema_kuid_apis_id_v1alpha1_ClusterID(ref), + "github.com/kuidio/kuid/apis/id/v1alpha1.EndpointID": schema_kuid_apis_id_v1alpha1_EndpointID(ref), + "github.com/kuidio/kuid/apis/id/v1alpha1.NodeID": schema_kuid_apis_id_v1alpha1_NodeID(ref), + "github.com/kuidio/kuid/apis/id/v1alpha1.PartitionAttachmentID": schema_kuid_apis_id_v1alpha1_PartitionAttachmentID(ref), + "github.com/kuidio/kuid/apis/id/v1alpha1.PartitionClusterID": schema_kuid_apis_id_v1alpha1_PartitionClusterID(ref), + "github.com/kuidio/kuid/apis/id/v1alpha1.PartitionEndpointID": schema_kuid_apis_id_v1alpha1_PartitionEndpointID(ref), + "github.com/kuidio/kuid/apis/id/v1alpha1.PartitionNodeID": schema_kuid_apis_id_v1alpha1_PartitionNodeID(ref), + "github.com/kuidio/kuid/apis/id/v1alpha1.PortID": schema_kuid_apis_id_v1alpha1_PortID(ref), + "github.com/kuidio/kuid/apis/id/v1alpha1.SiteID": schema_kuid_apis_id_v1alpha1_SiteID(ref), + "k8s.io/apimachinery/pkg/api/resource.Quantity": schema_apimachinery_pkg_api_resource_Quantity(ref), + "k8s.io/apimachinery/pkg/api/resource.int64Amount": schema_apimachinery_pkg_api_resource_int64Amount(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIGroup": schema_pkg_apis_meta_v1_APIGroup(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIGroupList": schema_pkg_apis_meta_v1_APIGroupList(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIResource": schema_pkg_apis_meta_v1_APIResource(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIResourceList": schema_pkg_apis_meta_v1_APIResourceList(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIVersions": schema_pkg_apis_meta_v1_APIVersions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ApplyOptions": schema_pkg_apis_meta_v1_ApplyOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Condition": schema_pkg_apis_meta_v1_Condition(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.CreateOptions": schema_pkg_apis_meta_v1_CreateOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.DeleteOptions": schema_pkg_apis_meta_v1_DeleteOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Duration": schema_pkg_apis_meta_v1_Duration(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.FieldSelectorRequirement": schema_pkg_apis_meta_v1_FieldSelectorRequirement(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.FieldsV1": schema_pkg_apis_meta_v1_FieldsV1(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GetOptions": schema_pkg_apis_meta_v1_GetOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupKind": schema_pkg_apis_meta_v1_GroupKind(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupResource": schema_pkg_apis_meta_v1_GroupResource(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersion": schema_pkg_apis_meta_v1_GroupVersion(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionForDiscovery": schema_pkg_apis_meta_v1_GroupVersionForDiscovery(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionKind": schema_pkg_apis_meta_v1_GroupVersionKind(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionResource": schema_pkg_apis_meta_v1_GroupVersionResource(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.InternalEvent": schema_pkg_apis_meta_v1_InternalEvent(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector": schema_pkg_apis_meta_v1_LabelSelector(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelectorRequirement": schema_pkg_apis_meta_v1_LabelSelectorRequirement(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.List": schema_pkg_apis_meta_v1_List(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta": schema_pkg_apis_meta_v1_ListMeta(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ListOptions": schema_pkg_apis_meta_v1_ListOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ManagedFieldsEntry": schema_pkg_apis_meta_v1_ManagedFieldsEntry(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.MicroTime": schema_pkg_apis_meta_v1_MicroTime(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta": schema_pkg_apis_meta_v1_ObjectMeta(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.OwnerReference": schema_pkg_apis_meta_v1_OwnerReference(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.PartialObjectMetadata": schema_pkg_apis_meta_v1_PartialObjectMetadata(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.PartialObjectMetadataList": schema_pkg_apis_meta_v1_PartialObjectMetadataList(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Patch": schema_pkg_apis_meta_v1_Patch(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.PatchOptions": schema_pkg_apis_meta_v1_PatchOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Preconditions": schema_pkg_apis_meta_v1_Preconditions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.RootPaths": schema_pkg_apis_meta_v1_RootPaths(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR": schema_pkg_apis_meta_v1_ServerAddressByClientCIDR(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Status": schema_pkg_apis_meta_v1_Status(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.StatusCause": schema_pkg_apis_meta_v1_StatusCause(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.StatusDetails": schema_pkg_apis_meta_v1_StatusDetails(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Table": schema_pkg_apis_meta_v1_Table(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.TableColumnDefinition": schema_pkg_apis_meta_v1_TableColumnDefinition(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.TableOptions": schema_pkg_apis_meta_v1_TableOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.TableRow": schema_pkg_apis_meta_v1_TableRow(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.TableRowCondition": schema_pkg_apis_meta_v1_TableRowCondition(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Time": schema_pkg_apis_meta_v1_Time(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Timestamp": schema_pkg_apis_meta_v1_Timestamp(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta": schema_pkg_apis_meta_v1_TypeMeta(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.UpdateOptions": schema_pkg_apis_meta_v1_UpdateOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.WatchEvent": schema_pkg_apis_meta_v1_WatchEvent(ref), + "k8s.io/apimachinery/pkg/runtime.RawExtension": schema_k8sio_apimachinery_pkg_runtime_RawExtension(ref), + "k8s.io/apimachinery/pkg/runtime.TypeMeta": schema_k8sio_apimachinery_pkg_runtime_TypeMeta(ref), + "k8s.io/apimachinery/pkg/runtime.Unknown": schema_k8sio_apimachinery_pkg_runtime_Unknown(ref), + "k8s.io/apimachinery/pkg/version.Info": schema_k8sio_apimachinery_pkg_version_Info(ref), + } +} + +func schema_kform_dev_choreo_apis_condition_Condition(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Description: "type of condition in CamelCase or in foo.example.com/CamelCase.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "status of the condition, one of True, False, Unknown.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "observedGeneration": { + SchemaProps: spec.SchemaProps{ + Description: "observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "lastTransitionTime": { + SchemaProps: spec.SchemaProps{ + Description: "lastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "reason": { + SchemaProps: spec.SchemaProps{ + Description: "reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "message is a human readable message indicating details about the transition. This may be an empty string.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"type", "status", "lastTransitionTime", "reason", "message"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + } +} + +func schema_choreo_apis_condition_v1alpha1_Condition(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Description: "type of condition in CamelCase or in foo.example.com/CamelCase.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "status of the condition, one of True, False, Unknown.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "observedGeneration": { + SchemaProps: spec.SchemaProps{ + Description: "observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "lastTransitionTime": { + SchemaProps: spec.SchemaProps{ + Description: "lastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "reason": { + SchemaProps: spec.SchemaProps{ + Description: "reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "message is a human readable message indicating details about the transition. This may be an empty string.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"type", "status", "lastTransitionTime", "reason", "message"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + } +} + +func schema_choreo_apis_condition_v1alpha1_ConditionedStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "A ConditionedStatus reflects the observed status of a resource. Only one condition of each type may exist.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"}, } } @@ -672,6 +836,620 @@ func schema_apis_backend_as_v1alpha1_ASIndexStatus(ref common.ReferenceCallback) } } +func schema_kuid_apis_common_v1alpha1_ClaimLabels(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels as user defined labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "selector": { + SchemaProps: spec.SchemaProps{ + Description: "Selector defines the selector criterias", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, + } +} + +func schema_kuid_apis_common_v1alpha1_UserDefinedLabels(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "UserDefinedLabels define metadata to the resource.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels as user defined labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + }, + }, + } +} + +func schema_kuid_apis_id_v1alpha1_AdaptorID(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "region": { + SchemaProps: spec.SchemaProps{ + Description: "Region defines the region of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "site": { + SchemaProps: spec.SchemaProps{ + Description: "Site defines the site of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "node": { + SchemaProps: spec.SchemaProps{ + Description: "Node defines the name of the node", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "moduleBay": { + SchemaProps: spec.SchemaProps{ + Description: "ModuleBay defines the moduleBay reference id", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "module": { + SchemaProps: spec.SchemaProps{ + Description: "Module defines the module reference id", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "port": { + SchemaProps: spec.SchemaProps{ + Description: "Port defines the id of the port", + Default: 0, + Type: []string{"integer"}, + Format: "int32", + }, + }, + "adaptor": { + SchemaProps: spec.SchemaProps{ + Description: "Adaptor defines the name of the adaptor", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"region", "site", "node", "port", "adaptor"}, + }, + }, + } +} + +func schema_kuid_apis_id_v1alpha1_ClusterID(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "region": { + SchemaProps: spec.SchemaProps{ + Description: "Region defines the region of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "site": { + SchemaProps: spec.SchemaProps{ + Description: "Site defines the site of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "cluster": { + SchemaProps: spec.SchemaProps{ + Description: "Cluster defines the name of the cluster", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"region", "site", "cluster"}, + }, + }, + } +} + +func schema_kuid_apis_id_v1alpha1_EndpointID(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "region": { + SchemaProps: spec.SchemaProps{ + Description: "Region defines the region of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "site": { + SchemaProps: spec.SchemaProps{ + Description: "Site defines the site of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "node": { + SchemaProps: spec.SchemaProps{ + Description: "Node defines the name of the node", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "moduleBay": { + SchemaProps: spec.SchemaProps{ + Description: "ModuleBay defines the moduleBay reference id", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "module": { + SchemaProps: spec.SchemaProps{ + Description: "Module defines the module reference id", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "port": { + SchemaProps: spec.SchemaProps{ + Description: "Port defines the id of the port", + Default: 0, + Type: []string{"integer"}, + Format: "int32", + }, + }, + "adaptor": { + SchemaProps: spec.SchemaProps{ + Description: "Adaptor defines the name of the adaptor", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "endpoint": { + SchemaProps: spec.SchemaProps{ + Description: "Endpoint defines the name of the endpoint", + Default: 0, + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + Required: []string{"region", "site", "node", "port", "adaptor", "endpoint"}, + }, + }, + } +} + +func schema_kuid_apis_id_v1alpha1_NodeID(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "region": { + SchemaProps: spec.SchemaProps{ + Description: "Region defines the region of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "site": { + SchemaProps: spec.SchemaProps{ + Description: "Site defines the site of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "node": { + SchemaProps: spec.SchemaProps{ + Description: "Node defines the name of the node", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"region", "site", "node"}, + }, + }, + } +} + +func schema_kuid_apis_id_v1alpha1_PartitionAttachmentID(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "partition": { + SchemaProps: spec.SchemaProps{ + Description: "Partition defines the partition this resource belongs to", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "region": { + SchemaProps: spec.SchemaProps{ + Description: "Region defines the region of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "site": { + SchemaProps: spec.SchemaProps{ + Description: "Site defines the site of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "cluster": { + SchemaProps: spec.SchemaProps{ + Description: "Cluster defines the name of the cluster", + Type: []string{"string"}, + Format: "", + }, + }, + "node": { + SchemaProps: spec.SchemaProps{ + Description: "Node defines the name of the node", + Type: []string{"string"}, + Format: "", + }, + }, + "nodeset": { + SchemaProps: spec.SchemaProps{ + Description: "Node defines the name of the nodeset", + Type: []string{"string"}, + Format: "", + }, + }, + "interface": { + SchemaProps: spec.SchemaProps{ + Description: "Interface defines the name of the interface", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"partition", "region", "site", "interface"}, + }, + }, + } +} + +func schema_kuid_apis_id_v1alpha1_PartitionClusterID(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "partition": { + SchemaProps: spec.SchemaProps{ + Description: "Partition defines the partition this resource belongs to", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "region": { + SchemaProps: spec.SchemaProps{ + Description: "Region defines the region of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "site": { + SchemaProps: spec.SchemaProps{ + Description: "Site defines the site of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "cluster": { + SchemaProps: spec.SchemaProps{ + Description: "Cluster defines the name of the cluster", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"partition", "region", "site", "cluster"}, + }, + }, + } +} + +func schema_kuid_apis_id_v1alpha1_PartitionEndpointID(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "partition": { + SchemaProps: spec.SchemaProps{ + Description: "Partition defines the partition this resource belongs to", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "region": { + SchemaProps: spec.SchemaProps{ + Description: "Region defines the region of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "site": { + SchemaProps: spec.SchemaProps{ + Description: "Site defines the site of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "node": { + SchemaProps: spec.SchemaProps{ + Description: "Node defines the name of the node", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "moduleBay": { + SchemaProps: spec.SchemaProps{ + Description: "ModuleBay defines the moduleBay reference id", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "module": { + SchemaProps: spec.SchemaProps{ + Description: "Module defines the module reference id", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "port": { + SchemaProps: spec.SchemaProps{ + Description: "Port defines the id of the port", + Default: 0, + Type: []string{"integer"}, + Format: "int32", + }, + }, + "adaptor": { + SchemaProps: spec.SchemaProps{ + Description: "Adaptor defines the name of the adaptor", + Type: []string{"string"}, + Format: "", + }, + }, + "endpoint": { + SchemaProps: spec.SchemaProps{ + Description: "Endpoint defines the name of the endpoint", + Default: 0, + Type: []string{"integer"}, + Format: "int32", + }, + }, + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name is used to refer to internal names of the node", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"partition", "region", "site", "node", "port", "endpoint"}, + }, + }, + } +} + +func schema_kuid_apis_id_v1alpha1_PartitionNodeID(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "partition": { + SchemaProps: spec.SchemaProps{ + Description: "Partition defines the partition this resource belongs to", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "region": { + SchemaProps: spec.SchemaProps{ + Description: "Region defines the region of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "site": { + SchemaProps: spec.SchemaProps{ + Description: "Site defines the site of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "node": { + SchemaProps: spec.SchemaProps{ + Description: "Node defines the name of the node", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"partition", "region", "site", "node"}, + }, + }, + } +} + +func schema_kuid_apis_id_v1alpha1_PortID(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "region": { + SchemaProps: spec.SchemaProps{ + Description: "Region defines the region of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "site": { + SchemaProps: spec.SchemaProps{ + Description: "Site defines the site of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "node": { + SchemaProps: spec.SchemaProps{ + Description: "Node defines the name of the node", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "moduleBay": { + SchemaProps: spec.SchemaProps{ + Description: "ModuleBay defines the moduleBay reference id", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "module": { + SchemaProps: spec.SchemaProps{ + Description: "Module defines the module reference id", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "port": { + SchemaProps: spec.SchemaProps{ + Description: "Port defines the id of the port", + Default: 0, + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + Required: []string{"region", "site", "node", "port"}, + }, + }, + } +} + +func schema_kuid_apis_id_v1alpha1_SiteID(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "region": { + SchemaProps: spec.SchemaProps{ + Description: "Region defines the region of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "site": { + SchemaProps: spec.SchemaProps{ + Description: "Site defines the site of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"region", "site"}, + }, + }, + } +} + func schema_apimachinery_pkg_api_resource_Quantity(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.EmbedOpenAPIDefinitionIntoV2Extension(common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/pkg/reconcilers/ctrlconfig/config.go b/pkg/reconcilers/ctrlconfig/config.go index 91355cd..226f3a9 100644 --- a/pkg/reconcilers/ctrlconfig/config.go +++ b/pkg/reconcilers/ctrlconfig/config.go @@ -25,12 +25,8 @@ import ( ) type ControllerConfig struct { - //IPAMBackend backend.Backend - //VLANBackend backend.Backend - //VXLANBackend backend.Backend - ASBackend backend.Backend - //EXTCOMMBackend backend.Backend - //GENIDBackend backend.Backend + // key is group + Backends map[string]backend.Backend } func InitContext(ctx context.Context, controllerName string, req types.NamespacedName) context.Context { diff --git a/pkg/reconcilers/reconcilers.go b/pkg/reconcilers/reconcilers.go index 3dc1aca..c0e091e 100644 --- a/pkg/reconcilers/reconcilers.go +++ b/pkg/reconcilers/reconcilers.go @@ -33,8 +33,13 @@ type Reconciler interface { SetupWithManager(ctx context.Context, mgr ctrl.Manager, c any) (map[schema.GroupVersionKind]chan event.GenericEvent, error) } -var Reconcilers = map[string]Reconciler{} +var ReconcilerGroups = map[string]Reconcilers{} -func Register(name string, r Reconciler) { - Reconcilers[name] = r +type Reconcilers map[string]Reconciler + +func Register(groupName, reconcilerName string, r Reconciler) { + if _, ok := ReconcilerGroups[groupName]; !ok { + ReconcilerGroups[groupName] = map[string]Reconciler{} + } + ReconcilerGroups[groupName][reconcilerName] = r } diff --git a/tools/apiserver-runtime-gen/main.go b/tools/apiserver-runtime-gen/main.go index b3b9542..39ffcf6 100644 --- a/tools/apiserver-runtime-gen/main.go +++ b/tools/apiserver-runtime-gen/main.go @@ -105,10 +105,10 @@ func doGen() error { // dont expand the versions with modules informerListergenVersions = append(informerListergenVersions, fmt.Sprintf("./%s", path.Join(version, "..."))) } - typeVersions = append(typeVersions, version) + typeVersions = append(typeVersions, path.Join(module, version)) } - //versions := strings.Join(clientgenVersions, ",") + //typeVersions := strings.Join(typeVersions, ",") gen := map[string]bool{} for _, g := range generators { @@ -143,8 +143,10 @@ func doGen() error { "k8s.io/apimachinery/pkg/api/resource", "k8s.io/apimachinery/pkg/runtime", "k8s.io/apimachinery/pkg/version", + "github.com/kform-dev/choreo/apis/condition", + "github.com/kform-dev/choreo/apis/condition/v1alpha1", } - cmdArgs = append(cmdArgs, clientgenVersions...) + cmdArgs = append(cmdArgs, typeVersions...) err := run(getCmdSimple("bin/openapi-gen", cmdArgs...)) if err != nil { From 8376f89fa64003c076fc7a3d067f21e9d3b3c3cb Mon Sep 17 00:00:00 2001 From: Wim Henderickx Date: Thu, 24 Oct 2024 15:59:31 -0400 Subject: [PATCH 07/23] updated reconcilers logic --- apis/all/all.go | 7 +++ apis/backend/as/register/register.go | 1 + main.go | 86 ++++++++-------------------- pkg/config/resource.go | 6 +- 4 files changed, 35 insertions(+), 65 deletions(-) diff --git a/apis/all/all.go b/apis/all/all.go index 7fa06bc..161c7a4 100644 --- a/apis/all/all.go +++ b/apis/all/all.go @@ -19,3 +19,10 @@ package all import ( _ "github.com/kuidio/kuid/apis/backend/as/register" ) + +//infrabev1alpha1.AddToScheme, +//ipambev1alpha1.AddToScheme, +//vlanbev1alpha1.AddToScheme, +//vxlanbev1alpha1.AddToScheme, +//extcommbev1alpha1.AddToScheme, +//genidbev1alpha1.AddToScheme, diff --git a/apis/backend/as/register/register.go b/apis/backend/as/register/register.go index 08eaa41..799c7cb 100644 --- a/apis/backend/as/register/register.go +++ b/apis/backend/as/register/register.go @@ -37,6 +37,7 @@ import ( func init() { config.Register( as.SchemeGroupVersion.Group, + asbev1alpha1.AddToScheme, NewBackend, ApplyStorageToBackend, []*config.ResourceConfig{ diff --git a/main.go b/main.go index cdbd282..622f74c 100644 --- a/main.go +++ b/main.go @@ -18,15 +18,12 @@ package main import ( "context" - "fmt" "log/slog" "os" - "strings" "github.com/henderiw/apiserver-builder/pkg/builder" "github.com/henderiw/logger/log" _ "github.com/kuidio/kuid/apis/all" - asbev1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" "github.com/kuidio/kuid/pkg/backend" "github.com/kuidio/kuid/pkg/config" "github.com/kuidio/kuid/pkg/generated/openapi" @@ -47,6 +44,11 @@ const ( // defaultEtcdPathPrefix = "/registry/backend.kuid.dev" ) +type ReconcilerGroup struct { + addToSchema func(*runtime.Scheme) error + reconcilers []reconcilers.Reconciler +} + func main() { logs.InitLogs() defer logs.FlushLogs() @@ -63,7 +65,7 @@ func main() { ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts))) // if no async we dont have to start any, the reconcilers len will determine this - recs := map[string]reconcilers.Reconciler{} + groupReconcilers := map[string]*ReconcilerGroup{} ctrlCfg := &ctrlconfig.ControllerConfig{Backends: map[string]backend.Backend{}} kuidConfig, err := config.GetKuidConfig() if err != nil { @@ -122,9 +124,13 @@ func main() { // reconcilers get registered when async operations are configured if !kuidGroupConfig.Sync { - if reconcilers, ok := reconcilers.ReconcilerGroups[group]; ok { - for reconilerName, reconciler := range reconcilers { - recs[reconilerName] = reconciler + if recs, ok := reconcilers.ReconcilerGroups[group]; ok { + groupReconcilers[group] = &ReconcilerGroup{ + addToSchema: groupConfig.AddToScheme, + reconcilers: make([]reconcilers.Reconciler, 0, len(recs)), + } + for _, reconciler := range recs { + groupReconcilers[group].reconcilers = append(groupReconcilers[group].reconcilers, reconciler) } } // add the backend -> for etcd this needs to be configmaps -> tbd how we handle this @@ -159,21 +165,16 @@ func main() { } } - if len(recs) != 0 { + if len(groupReconcilers) != 0 { // setup scheme for controllers runScheme := runtime.NewScheme() - // add the core object to the scheme - for _, api := range (runtime.SchemeBuilder{ - clientgoscheme.AddToScheme, - //infrabev1alpha1.AddToScheme, - asbev1alpha1.AddToScheme, - //ipambev1alpha1.AddToScheme, - //vlanbev1alpha1.AddToScheme, - //vxlanbev1alpha1.AddToScheme, - //extcommbev1alpha1.AddToScheme, - //genidbev1alpha1.AddToScheme, - }) { - if err := api(runScheme); err != nil { + if err := clientgoscheme.AddToScheme(runScheme); err != nil { + log.Error("cannot add scheme", "err", err) + os.Exit(1) + } + // add all schemas for the reconcilers to + for _, reconcilerGroup := range groupReconcilers { + if err := reconcilerGroup.addToSchema(runScheme); err != nil { log.Error("cannot add scheme", "err", err) os.Exit(1) } @@ -186,9 +187,8 @@ func main() { log.Error("cannot start manager", "err", err) os.Exit(1) } - for name, reconciler := range recs { - log.Info("reconciler", "name", name, "enabled", IsReconcilerEnabled(name)) - if IsReconcilerEnabled(name) { + for _, reconcilerGroup := range groupReconcilers { + for _, reconciler := range reconcilerGroup.reconcilers { _, err := reconciler.SetupWithManager(ctx, mgr, ctrlCfg) if err != nil { log.Error("cannot add controllers to manager", "err", err.Error()) @@ -215,44 +215,4 @@ func main() { log.Info("context cancelled...") } } - - /* - asStorageProviders := as.NewStorageProviders(ctx, true, registryOptions) - - go func() { - apiserver := builder.APIServer. - WithServerName("kuid-api-server"). - WithOpenAPIDefinitions("Config", "v1alpha1", openapi.GetOpenAPIDefinitions). - WithoutEtcd(). - WithResourceAndHandler(&as.ASIndex{}, asStorageProviders.GetIndexStorageProvider()). - WithResourceAndHandler(&as.ASClaim{}, asStorageProviders.GetClaimStorageProvider()). - WithResourceAndHandler(&as.ASEntry{}, asStorageProviders.GetEntryStorageProvider()). - WithResourceAndHandler(&asbev1alpha1.ASIndex{}, asStorageProviders.GetIndexStorageProvider()). - WithResourceAndHandler(&asbev1alpha1.ASClaim{}, asStorageProviders.GetClaimStorageProvider()). - WithResourceAndHandler(&asbev1alpha1.ASEntry{}, asStorageProviders.GetEntryStorageProvider()) - - cmd, err := apiserver.Build(ctx) - if err != nil { - panic(err) - } - if err := asStorageProviders.ApplyStorageToBackend(ctx, apiserver); err != nil { - panic(err) - } - if err := cmd.Execute(); err != nil { - panic(err) - } - }() - */ - -} - -// IsReconcilerEnabled checks if an environment variable `ENABLE_` exists -// return "true" if the var is set and is not equal to "false". -func IsReconcilerEnabled(reconcilerName string) bool { - if val, found := os.LookupEnv(fmt.Sprintf("ENABLE_%s", strings.ToUpper(reconcilerName))); found { - if strings.ToLower(val) != "false" { - return true - } - } - return false } diff --git a/pkg/config/resource.go b/pkg/config/resource.go index 51b11bc..166790c 100644 --- a/pkg/config/resource.go +++ b/pkg/config/resource.go @@ -24,6 +24,7 @@ import ( "github.com/henderiw/apiserver-builder/pkg/builder/rest" bebackend "github.com/kuidio/kuid/pkg/backend" "github.com/kuidio/kuid/pkg/registry/options" + "k8s.io/apimachinery/pkg/runtime" ) var Groups = map[string]*GroupConfig{} @@ -35,7 +36,7 @@ type StorageProviderFn func(ctx context.Context, be bebackend.Backend, sync bool type ApplyStorageToBackendFn func(ctx context.Context, be bebackend.Backend, apiServer *builder.Server) error type GroupConfig struct { - //AddToScheme []func(s *runtime.Scheme) error + AddToScheme func(s *runtime.Scheme) error BackendFn BackendFn ApplyStorageToBackendFn ApplyStorageToBackendFn Resources []*ResourceConfig @@ -46,8 +47,9 @@ type ResourceConfig struct { ResourceVersions []resource.Object } -func Register(groupName string, befn BackendFn, applybefn ApplyStorageToBackendFn, resources []*ResourceConfig) { +func Register(groupName string, addToScheme func(s *runtime.Scheme) error, befn BackendFn, applybefn ApplyStorageToBackendFn, resources []*ResourceConfig) { Groups[groupName] = &GroupConfig{ + AddToScheme: addToScheme, BackendFn: befn, ApplyStorageToBackendFn: applybefn, Resources: resources, From 160ed3e972d8b9085aa65e6ecb04406d9cff0291 Mon Sep 17 00:00:00 2001 From: Wim Henderickx Date: Fri, 25 Oct 2024 10:20:49 +0200 Subject: [PATCH 08/23] added infra apis --- Makefile | 2 +- apis/all/all.go | 1 + apis/backend/as/asclaim_types.go | 8 - apis/backend/as/asentry_types.go | 6 - apis/backend/as/asindex_types.go | 8 - apis/backend/as/doc.go | 2 +- apis/backend/as/helper.go | 3 - apis/backend/as/register/register.go | 22 +- apis/backend/as/storage.go | 160 - apis/backend/as/v1alpha1/asclaim_types.go | 1 + apis/backend/as/v1alpha1/asentry_types.go | 1 + apis/backend/as/v1alpha1/asindex_types.go | 1 + apis/id/doc.go | 4 +- apis/id/v1alpha1/doc.go | 10 +- apis/id/v1alpha1/register.go | 27 + apis/infra/cluster_helper.go | 32 + apis/infra/cluster_resource.go | 312 ++ apis/infra/cluster_types.go | 74 + apis/infra/doc.go | 21 + apis/infra/endpoint_helper.go | 32 + apis/infra/endpoint_resource.go | 312 ++ apis/infra/endpoint_types.go | 78 + apis/infra/endpointset_helper.go | 32 + apis/infra/endpointset_resource.go | 312 ++ apis/infra/endpointset_types.go | 85 + apis/infra/link_helper.go | 32 + apis/infra/link_resource.go | 312 ++ apis/infra/link_types.go | 81 + apis/infra/linkset_helper.go | 32 + apis/infra/linkset_resource.go | 312 ++ apis/infra/linkset_types.go | 77 + apis/infra/location.go | 22 + apis/infra/module_helper.go | 32 + apis/infra/module_resource.go | 312 ++ apis/infra/module_types.go | 71 + apis/infra/modulebay_helper.go | 32 + apis/infra/modulebay_resource.go | 312 ++ apis/infra/modulebay_types.go | 71 + apis/infra/node_helper.go | 32 + apis/infra/node_resource.go | 312 ++ apis/infra/node_types.go | 97 + apis/infra/nodeitem_helper.go | 32 + apis/infra/nodeitem_resource.go | 312 ++ apis/infra/nodeitem_types.go | 70 + apis/infra/nodeset_helper.go | 32 + apis/infra/nodeset_resource.go | 312 ++ apis/infra/nodeset_types.go | 71 + apis/infra/partition_helper.go | 32 + apis/infra/partition_resource.go | 312 ++ apis/infra/partition_types.go | 62 + apis/infra/rack_helper.go | 32 + apis/infra/rack_resource.go | 312 ++ apis/infra/rack_types.go | 75 + apis/infra/region_helper.go | 32 + apis/infra/region_resource.go | 312 ++ apis/infra/region_types.go | 65 + apis/infra/register.go | 78 + apis/infra/register/register.go | 59 + apis/infra/site_helper.go | 32 + apis/infra/site_resource.go | 312 ++ apis/infra/site_types.go | 73 + apis/infra/v1alpha1/cluster_resource.go | 80 + apis/infra/v1alpha1/cluster_types.go | 81 + apis/infra/v1alpha1/conversion.go | 323 ++ apis/infra/v1alpha1/doc.go | 29 + apis/infra/v1alpha1/endpoint_resource.go | 80 + apis/infra/v1alpha1/endpoint_types.go | 78 + apis/infra/v1alpha1/endpointset_resource.go | 80 + apis/infra/v1alpha1/endpointset_types.go | 86 + apis/infra/v1alpha1/link_resource.go | 80 + apis/infra/v1alpha1/link_types.go | 82 + apis/infra/v1alpha1/linkset_resource.go | 80 + apis/infra/v1alpha1/linkset_types.go | 78 + apis/infra/v1alpha1/location.go | 22 + apis/infra/v1alpha1/module_resource.go | 80 + apis/infra/v1alpha1/module_types.go | 72 + apis/infra/v1alpha1/modulebay_resource.go | 80 + apis/infra/v1alpha1/modulebay_types.go | 72 + apis/infra/v1alpha1/node_resource.go | 80 + apis/infra/v1alpha1/node_types.go | 98 + apis/infra/v1alpha1/nodeitem_resource.go | 80 + apis/infra/v1alpha1/nodeitem_types.go | 71 + apis/infra/v1alpha1/nodeset_resource.go | 80 + apis/infra/v1alpha1/nodeset_types.go | 72 + apis/infra/v1alpha1/partition_resource.go | 80 + apis/infra/v1alpha1/partition_types.go | 64 + apis/infra/v1alpha1/rack_resource.go | 80 + apis/infra/v1alpha1/rack_types.go | 76 + apis/infra/v1alpha1/region_resource.go | 80 + apis/infra/v1alpha1/region_types.go | 66 + apis/infra/v1alpha1/register.go | 89 + apis/infra/v1alpha1/site_resource.go | 80 + apis/infra/v1alpha1/site_types.go | 73 + .../infra/v1alpha1/zz_generated.conversion.go | 2580 +++++++++++++++ apis/infra/v1alpha1/zz_generated.deepcopy.go | 1479 +++++++++ apis/infra/v1alpha1/zz_generated.defaults.go | 32 + apis/infra/zz_generated.deepcopy.go | 1703 ++++++++++ artifacts/apiservice-infra.yaml | 4 +- artifacts/out/artifacts.yaml | 4 +- crds/as.be.kuid.dev_asclaims.yaml | 6 +- crds/as.be.kuid.dev_asentries.yaml | 6 +- crds/as.be.kuid.dev_asindexes.yaml | 6 +- crds/infra.kuid.dev_clusters.yaml | 294 ++ crds/infra.kuid.dev_endpoints.yaml | 316 ++ crds/infra.kuid.dev_endpointsets.yaml | 362 +++ crds/infra.kuid.dev_links.yaml | 320 ++ crds/infra.kuid.dev_linksets.yaml | 346 +++ crds/infra.kuid.dev_modulebays.yaml | 270 ++ crds/infra.kuid.dev_modules.yaml | 268 ++ crds/infra.kuid.dev_nodeitems.yaml | 262 ++ crds/infra.kuid.dev_nodes.yaml | 330 ++ crds/infra.kuid.dev_nodesets.yaml | 360 +++ crds/infra.kuid.dev_partitions.yaml | 216 ++ crds/infra.kuid.dev_racks.yaml | 280 ++ crds/infra.kuid.dev_regions.yaml | 222 ++ crds/infra.kuid.dev_sites.yaml | 268 ++ main.go | 4 +- pkg/backend/astest/as_claim_test.go | 8 +- pkg/backend/astest/as_index_test.go | 8 +- pkg/config/config.go | 1 + pkg/config/resource.go | 3 +- .../clientset/versioned/clientset.go | 15 +- .../versioned/fake/clientset_generated.go | 7 + .../clientset/versioned/fake/register.go | 2 + .../clientset/versioned/scheme/register.go | 2 + .../versioned/typed/infra/v1alpha1/cluster.go | 68 + .../versioned/typed/infra/v1alpha1/doc.go | 19 + .../typed/infra/v1alpha1/endpoint.go | 68 + .../typed/infra/v1alpha1/endpointset.go | 68 + .../typed/infra/v1alpha1/fake/doc.go | 19 + .../typed/infra/v1alpha1/fake/fake_cluster.go | 146 + .../infra/v1alpha1/fake/fake_endpoint.go | 146 + .../infra/v1alpha1/fake/fake_endpointset.go | 146 + .../infra/v1alpha1/fake/fake_infra_client.go | 91 + .../typed/infra/v1alpha1/fake/fake_link.go | 146 + .../typed/infra/v1alpha1/fake/fake_linkset.go | 146 + .../typed/infra/v1alpha1/fake/fake_module.go | 146 + .../infra/v1alpha1/fake/fake_modulebay.go | 146 + .../typed/infra/v1alpha1/fake/fake_node.go | 146 + .../infra/v1alpha1/fake/fake_nodeitem.go | 146 + .../typed/infra/v1alpha1/fake/fake_nodeset.go | 146 + .../infra/v1alpha1/fake/fake_partition.go | 146 + .../typed/infra/v1alpha1/fake/fake_rack.go | 146 + .../typed/infra/v1alpha1/fake/fake_region.go | 146 + .../typed/infra/v1alpha1/fake/fake_site.go | 146 + .../infra/v1alpha1/generated_expansion.go | 46 + .../typed/infra/v1alpha1/infra_client.go | 171 + .../versioned/typed/infra/v1alpha1/link.go | 68 + .../versioned/typed/infra/v1alpha1/linkset.go | 68 + .../versioned/typed/infra/v1alpha1/module.go | 68 + .../typed/infra/v1alpha1/modulebay.go | 68 + .../versioned/typed/infra/v1alpha1/node.go | 68 + .../typed/infra/v1alpha1/nodeitem.go | 68 + .../versioned/typed/infra/v1alpha1/nodeset.go | 68 + .../typed/infra/v1alpha1/partition.go | 68 + .../versioned/typed/infra/v1alpha1/rack.go | 68 + .../versioned/typed/infra/v1alpha1/region.go | 68 + .../versioned/typed/infra/v1alpha1/site.go | 68 + .../informers/externalversions/factory.go | 6 + .../informers/externalversions/generic.go | 31 + .../externalversions/infra/interface.go | 45 + .../infra/v1alpha1/cluster.go | 89 + .../infra/v1alpha1/endpoint.go | 89 + .../infra/v1alpha1/endpointset.go | 89 + .../infra/v1alpha1/interface.go | 135 + .../externalversions/infra/v1alpha1/link.go | 89 + .../infra/v1alpha1/linkset.go | 89 + .../externalversions/infra/v1alpha1/module.go | 89 + .../infra/v1alpha1/modulebay.go | 89 + .../externalversions/infra/v1alpha1/node.go | 89 + .../infra/v1alpha1/nodeitem.go | 89 + .../infra/v1alpha1/nodeset.go | 89 + .../infra/v1alpha1/partition.go | 89 + .../externalversions/infra/v1alpha1/rack.go | 89 + .../externalversions/infra/v1alpha1/region.go | 89 + .../externalversions/infra/v1alpha1/site.go | 89 + .../listers/infra/v1alpha1/cluster.go | 69 + .../listers/infra/v1alpha1/endpoint.go | 69 + .../listers/infra/v1alpha1/endpointset.go | 69 + .../infra/v1alpha1/expansion_generated.go | 130 + pkg/generated/listers/infra/v1alpha1/link.go | 69 + .../listers/infra/v1alpha1/linkset.go | 69 + .../listers/infra/v1alpha1/module.go | 69 + .../listers/infra/v1alpha1/modulebay.go | 69 + pkg/generated/listers/infra/v1alpha1/node.go | 69 + .../listers/infra/v1alpha1/nodeitem.go | 69 + .../listers/infra/v1alpha1/nodeset.go | 69 + .../listers/infra/v1alpha1/partition.go | 69 + pkg/generated/listers/infra/v1alpha1/rack.go | 69 + .../listers/infra/v1alpha1/region.go | 69 + pkg/generated/listers/infra/v1alpha1/site.go | 69 + pkg/generated/openapi/zz_generated.openapi.go | 2767 +++++++++++++++++ tools/apiserver-runtime-gen/main.go | 26 +- 193 files changed, 27390 insertions(+), 242 deletions(-) delete mode 100644 apis/backend/as/storage.go create mode 100644 apis/id/v1alpha1/register.go create mode 100644 apis/infra/cluster_helper.go create mode 100644 apis/infra/cluster_resource.go create mode 100644 apis/infra/cluster_types.go create mode 100644 apis/infra/doc.go create mode 100644 apis/infra/endpoint_helper.go create mode 100644 apis/infra/endpoint_resource.go create mode 100644 apis/infra/endpoint_types.go create mode 100644 apis/infra/endpointset_helper.go create mode 100644 apis/infra/endpointset_resource.go create mode 100644 apis/infra/endpointset_types.go create mode 100644 apis/infra/link_helper.go create mode 100644 apis/infra/link_resource.go create mode 100644 apis/infra/link_types.go create mode 100644 apis/infra/linkset_helper.go create mode 100644 apis/infra/linkset_resource.go create mode 100644 apis/infra/linkset_types.go create mode 100644 apis/infra/location.go create mode 100644 apis/infra/module_helper.go create mode 100644 apis/infra/module_resource.go create mode 100644 apis/infra/module_types.go create mode 100644 apis/infra/modulebay_helper.go create mode 100644 apis/infra/modulebay_resource.go create mode 100644 apis/infra/modulebay_types.go create mode 100644 apis/infra/node_helper.go create mode 100644 apis/infra/node_resource.go create mode 100644 apis/infra/node_types.go create mode 100644 apis/infra/nodeitem_helper.go create mode 100644 apis/infra/nodeitem_resource.go create mode 100644 apis/infra/nodeitem_types.go create mode 100644 apis/infra/nodeset_helper.go create mode 100644 apis/infra/nodeset_resource.go create mode 100644 apis/infra/nodeset_types.go create mode 100644 apis/infra/partition_helper.go create mode 100644 apis/infra/partition_resource.go create mode 100644 apis/infra/partition_types.go create mode 100644 apis/infra/rack_helper.go create mode 100644 apis/infra/rack_resource.go create mode 100644 apis/infra/rack_types.go create mode 100644 apis/infra/region_helper.go create mode 100644 apis/infra/region_resource.go create mode 100644 apis/infra/region_types.go create mode 100644 apis/infra/register.go create mode 100644 apis/infra/register/register.go create mode 100644 apis/infra/site_helper.go create mode 100644 apis/infra/site_resource.go create mode 100644 apis/infra/site_types.go create mode 100644 apis/infra/v1alpha1/cluster_resource.go create mode 100644 apis/infra/v1alpha1/cluster_types.go create mode 100644 apis/infra/v1alpha1/conversion.go create mode 100644 apis/infra/v1alpha1/doc.go create mode 100644 apis/infra/v1alpha1/endpoint_resource.go create mode 100644 apis/infra/v1alpha1/endpoint_types.go create mode 100644 apis/infra/v1alpha1/endpointset_resource.go create mode 100644 apis/infra/v1alpha1/endpointset_types.go create mode 100644 apis/infra/v1alpha1/link_resource.go create mode 100644 apis/infra/v1alpha1/link_types.go create mode 100644 apis/infra/v1alpha1/linkset_resource.go create mode 100644 apis/infra/v1alpha1/linkset_types.go create mode 100644 apis/infra/v1alpha1/location.go create mode 100644 apis/infra/v1alpha1/module_resource.go create mode 100644 apis/infra/v1alpha1/module_types.go create mode 100644 apis/infra/v1alpha1/modulebay_resource.go create mode 100644 apis/infra/v1alpha1/modulebay_types.go create mode 100644 apis/infra/v1alpha1/node_resource.go create mode 100644 apis/infra/v1alpha1/node_types.go create mode 100644 apis/infra/v1alpha1/nodeitem_resource.go create mode 100644 apis/infra/v1alpha1/nodeitem_types.go create mode 100644 apis/infra/v1alpha1/nodeset_resource.go create mode 100644 apis/infra/v1alpha1/nodeset_types.go create mode 100644 apis/infra/v1alpha1/partition_resource.go create mode 100644 apis/infra/v1alpha1/partition_types.go create mode 100644 apis/infra/v1alpha1/rack_resource.go create mode 100644 apis/infra/v1alpha1/rack_types.go create mode 100644 apis/infra/v1alpha1/region_resource.go create mode 100644 apis/infra/v1alpha1/region_types.go create mode 100644 apis/infra/v1alpha1/register.go create mode 100644 apis/infra/v1alpha1/site_resource.go create mode 100644 apis/infra/v1alpha1/site_types.go create mode 100644 apis/infra/v1alpha1/zz_generated.conversion.go create mode 100644 apis/infra/v1alpha1/zz_generated.deepcopy.go create mode 100644 apis/infra/v1alpha1/zz_generated.defaults.go create mode 100644 apis/infra/zz_generated.deepcopy.go create mode 100644 crds/infra.kuid.dev_clusters.yaml create mode 100644 crds/infra.kuid.dev_endpoints.yaml create mode 100644 crds/infra.kuid.dev_endpointsets.yaml create mode 100644 crds/infra.kuid.dev_links.yaml create mode 100644 crds/infra.kuid.dev_linksets.yaml create mode 100644 crds/infra.kuid.dev_modulebays.yaml create mode 100644 crds/infra.kuid.dev_modules.yaml create mode 100644 crds/infra.kuid.dev_nodeitems.yaml create mode 100644 crds/infra.kuid.dev_nodes.yaml create mode 100644 crds/infra.kuid.dev_nodesets.yaml create mode 100644 crds/infra.kuid.dev_partitions.yaml create mode 100644 crds/infra.kuid.dev_racks.yaml create mode 100644 crds/infra.kuid.dev_regions.yaml create mode 100644 crds/infra.kuid.dev_sites.yaml create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/cluster.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/doc.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/endpoint.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/endpointset.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/doc.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_cluster.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_endpoint.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_endpointset.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_infra_client.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_link.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_linkset.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_module.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_modulebay.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_node.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_nodeitem.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_nodeset.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_partition.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_rack.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_region.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_site.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/generated_expansion.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/infra_client.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/link.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/linkset.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/module.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/modulebay.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/node.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/nodeitem.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/nodeset.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/partition.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/rack.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/region.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/site.go create mode 100644 pkg/generated/informers/externalversions/infra/interface.go create mode 100644 pkg/generated/informers/externalversions/infra/v1alpha1/cluster.go create mode 100644 pkg/generated/informers/externalversions/infra/v1alpha1/endpoint.go create mode 100644 pkg/generated/informers/externalversions/infra/v1alpha1/endpointset.go create mode 100644 pkg/generated/informers/externalversions/infra/v1alpha1/interface.go create mode 100644 pkg/generated/informers/externalversions/infra/v1alpha1/link.go create mode 100644 pkg/generated/informers/externalversions/infra/v1alpha1/linkset.go create mode 100644 pkg/generated/informers/externalversions/infra/v1alpha1/module.go create mode 100644 pkg/generated/informers/externalversions/infra/v1alpha1/modulebay.go create mode 100644 pkg/generated/informers/externalversions/infra/v1alpha1/node.go create mode 100644 pkg/generated/informers/externalversions/infra/v1alpha1/nodeitem.go create mode 100644 pkg/generated/informers/externalversions/infra/v1alpha1/nodeset.go create mode 100644 pkg/generated/informers/externalversions/infra/v1alpha1/partition.go create mode 100644 pkg/generated/informers/externalversions/infra/v1alpha1/rack.go create mode 100644 pkg/generated/informers/externalversions/infra/v1alpha1/region.go create mode 100644 pkg/generated/informers/externalversions/infra/v1alpha1/site.go create mode 100644 pkg/generated/listers/infra/v1alpha1/cluster.go create mode 100644 pkg/generated/listers/infra/v1alpha1/endpoint.go create mode 100644 pkg/generated/listers/infra/v1alpha1/endpointset.go create mode 100644 pkg/generated/listers/infra/v1alpha1/expansion_generated.go create mode 100644 pkg/generated/listers/infra/v1alpha1/link.go create mode 100644 pkg/generated/listers/infra/v1alpha1/linkset.go create mode 100644 pkg/generated/listers/infra/v1alpha1/module.go create mode 100644 pkg/generated/listers/infra/v1alpha1/modulebay.go create mode 100644 pkg/generated/listers/infra/v1alpha1/node.go create mode 100644 pkg/generated/listers/infra/v1alpha1/nodeitem.go create mode 100644 pkg/generated/listers/infra/v1alpha1/nodeset.go create mode 100644 pkg/generated/listers/infra/v1alpha1/partition.go create mode 100644 pkg/generated/listers/infra/v1alpha1/rack.go create mode 100644 pkg/generated/listers/infra/v1alpha1/region.go create mode 100644 pkg/generated/listers/infra/v1alpha1/site.go diff --git a/Makefile b/Makefile index 32d6e78..60c61da 100644 --- a/Makefile +++ b/Makefile @@ -63,7 +63,7 @@ genclients: -g lister-gen \ -g openapi-gen \ -g defaulter-gen \ - -g conversion-gen \ + #-g conversion-gen \ #-g go-to-protobuf \ --module $(REPO) \ diff --git a/apis/all/all.go b/apis/all/all.go index 161c7a4..0d574fd 100644 --- a/apis/all/all.go +++ b/apis/all/all.go @@ -18,6 +18,7 @@ package all import ( _ "github.com/kuidio/kuid/apis/backend/as/register" + _ "github.com/kuidio/kuid/apis/infra/register" ) //infrabev1alpha1.AddToScheme, diff --git a/apis/backend/as/asclaim_types.go b/apis/backend/as/asclaim_types.go index c0e7208..d218884 100644 --- a/apis/backend/as/asclaim_types.go +++ b/apis/backend/as/asclaim_types.go @@ -51,18 +51,12 @@ type ASClaimStatus struct { // +optional Range *string `json:"range,omitempty" yaml:"range,omitempty" protobuf:"bytes,3,opt,name=range"` // ExpiryTime defines when the claim expires - // +kubebuilder:validation:Optional // +optional ExpiryTime *string `json:"expiryTime,omitempty" yaml:"expiryTime,omitempty" protobuf:"bytes,4,opt,name=expiryTime"` } // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:object:root=true -// +kubebuilder:storageversion -// +kubebuilder:subresource:status -// +kubebuilder:resource:categories={kuid} - // ASClaim is the Schema for the ASClaim API type ASClaim struct { metav1.TypeMeta `json:",inline" yaml:",inline"` @@ -74,8 +68,6 @@ type ASClaim struct { // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:object:root=true - // ASClaimList contains a list of ASClaims type ASClaimList struct { metav1.TypeMeta `json:",inline" yaml:",inline"` diff --git a/apis/backend/as/asentry_types.go b/apis/backend/as/asentry_types.go index cb761b3..f2408f4 100644 --- a/apis/backend/as/asentry_types.go +++ b/apis/backend/as/asentry_types.go @@ -47,10 +47,6 @@ type ASEntryStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:object:root=true -// +kubebuilder:storageversion -// +kubebuilder:subresource:status -// +kubebuilder:resource:categories={kuid} // ASEntry is the Schema for the ASentry API type ASEntry struct { metav1.TypeMeta `json:",inline" yaml:",inline"` @@ -62,8 +58,6 @@ type ASEntry struct { // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:object:root=true - // ASEntryList contains a list of ASEntries type ASEntryList struct { metav1.TypeMeta `json:",inline" yaml:",inline"` diff --git a/apis/backend/as/asindex_types.go b/apis/backend/as/asindex_types.go index a9ef9f5..8df0ce7 100644 --- a/apis/backend/as/asindex_types.go +++ b/apis/backend/as/asindex_types.go @@ -52,11 +52,6 @@ type ASIndexStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:object:root=true -// +kubebuilder:storageversion -// +kubebuilder:subresource:status -// +kubebuilder:resource:categories={kuid} - // ASIndex is the Schema for the ASIndex API type ASIndex struct { metav1.TypeMeta `json:",inline" yaml:",inline"` @@ -66,10 +61,7 @@ type ASIndex struct { Status ASIndexStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } -// ASIndexList contains a list of ASIndexs // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:object:root=true - // ASIndexList contains a list of ASIndexs type ASIndexList struct { metav1.TypeMeta `json:",inline" yaml:",inline"` diff --git a/apis/backend/as/doc.go b/apis/backend/as/doc.go index 3e1993e..a061e82 100644 --- a/apis/backend/as/doc.go +++ b/apis/backend/as/doc.go @@ -17,5 +17,5 @@ limitations under the License. // +k8s:deepcopy-gen=package,register // +groupName=as.be.kuid.dev -// Package v1alpha1 is the internal version of the API. +// Package as is the internal version of the API. package as // import "github.com/kuidio/kuid/apis/backend/as" diff --git a/apis/backend/as/helper.go b/apis/backend/as/helper.go index e354dee..f3b88a4 100644 --- a/apis/backend/as/helper.go +++ b/apis/backend/as/helper.go @@ -42,6 +42,3 @@ func getASDot(asn uint32) string { } return strconv.Itoa(int(asn)) } - -// storage -// create a backend diff --git a/apis/backend/as/register/register.go b/apis/backend/as/register/register.go index 799c7cb..4d2685b 100644 --- a/apis/backend/as/register/register.go +++ b/apis/backend/as/register/register.go @@ -41,9 +41,9 @@ func init() { NewBackend, ApplyStorageToBackend, []*config.ResourceConfig{ - {StorageProviderFn: NewIndexStorageProvider, ResourceVersions: []resource.Object{&as.ASIndex{}, &asbev1alpha1.ASIndex{}}}, - {StorageProviderFn: NewClaimStorageProvider, ResourceVersions: []resource.Object{&as.ASClaim{}, &asbev1alpha1.ASClaim{}}}, - {StorageProviderFn: NewEntryStorageProvider, ResourceVersions: []resource.Object{&as.ASEntry{}, &asbev1alpha1.ASEntry{}}}, + {StorageProviderFn: NewIndexStorageProvider, Internal: &as.ASIndex{}, ResourceVersions: []resource.Object{&as.ASIndex{}, &asbev1alpha1.ASIndex{}}}, + {StorageProviderFn: NewClaimStorageProvider, Internal: &as.ASClaim{}, ResourceVersions: []resource.Object{&as.ASClaim{}, &asbev1alpha1.ASClaim{}}}, + {StorageProviderFn: NewStorageProvider, Internal: &as.ASEntry{}, ResourceVersions: []resource.Object{&as.ASEntry{}, &asbev1alpha1.ASEntry{}}}, }, ) } @@ -58,26 +58,26 @@ func NewBackend() bebackend.Backend { ) } -func NewIndexStorageProvider(ctx context.Context, be bebackend.Backend, sync bool, options *options.Options) *rest.StorageProvider { +func NewIndexStorageProvider(ctx context.Context, obj resource.InternalObject, be bebackend.Backend, sync bool, options *options.Options) *rest.StorageProvider { opts := *options if sync { opts.BackendInvoker = bebackend.NewIndexInvoker(be) - return genericregistry.NewStorageProvider(ctx, &as.ASIndex{}, &opts) + return genericregistry.NewStorageProvider(ctx, obj, &opts) } - return genericregistry.NewStorageProvider(ctx, &as.ASIndex{}, &opts) + return genericregistry.NewStorageProvider(ctx, obj, &opts) } -func NewClaimStorageProvider(ctx context.Context, be bebackend.Backend, sync bool, options *options.Options) *rest.StorageProvider { +func NewClaimStorageProvider(ctx context.Context, obj resource.InternalObject, be bebackend.Backend, sync bool, options *options.Options) *rest.StorageProvider { opts := *options if sync { opts.BackendInvoker = bebackend.NewClaimInvoker(be) - return genericregistry.NewStorageProvider(ctx, &as.ASClaim{}, &opts) + return genericregistry.NewStorageProvider(ctx, obj, &opts) } - return genericregistry.NewStorageProvider(ctx, &as.ASClaim{}, &opts) + return genericregistry.NewStorageProvider(ctx, obj, &opts) } -func NewEntryStorageProvider(ctx context.Context, be bebackend.Backend, sync bool, options *options.Options) *rest.StorageProvider { - return genericregistry.NewStorageProvider(ctx, &as.ASEntry{}, options) +func NewStorageProvider(ctx context.Context, obj resource.InternalObject, be bebackend.Backend, sync bool, options *options.Options) *rest.StorageProvider { + return genericregistry.NewStorageProvider(ctx, obj, options) } func ApplyStorageToBackend(ctx context.Context, be bebackend.Backend, apiServer *builder.Server) error { diff --git a/apis/backend/as/storage.go b/apis/backend/as/storage.go deleted file mode 100644 index 2fbae66..0000000 --- a/apis/backend/as/storage.go +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright 2022 The kpt 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. - -package as - -/* - -import ( - "context" - - "github.com/henderiw/apiserver-builder/pkg/builder" - "github.com/henderiw/apiserver-builder/pkg/builder/rest" - bebackend "github.com/kuidio/kuid/pkg/backend" - genericbackend "github.com/kuidio/kuid/pkg/backend/generic" - genericregistry "github.com/kuidio/kuid/pkg/registry/generic" - "github.com/kuidio/kuid/pkg/registry/options" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -// backend -> can be initialized at init -// - -func NewBackend() bebackend.Backend { - return genericbackend.New( - ASClaimKind, - ASIndexFromRuntime, - ASClaimFromRuntime, - ASEntryFromRuntime, - GetASEntry, - ) -} - -func NewIndexStorageProvider(ctx context.Context, be bebackend.Backend, sync bool, options *options.Options) *rest.StorageProvider { - opts := *options - if sync { - opts.BackendInvoker = bebackend.NewIndexInvoker(be) - return genericregistry.NewStorageProvider(ctx, &ASIndex{}, &opts) - } - return genericregistry.NewStorageProvider(ctx, &ASIndex{}, &opts) -} - -func NewClaimStorageProvider(ctx context.Context, be bebackend.Backend, sync bool, options *options.Options) *rest.StorageProvider { - opts := *options - if sync { - opts.BackendInvoker = bebackend.NewClaimInvoker(be) - return genericregistry.NewStorageProvider(ctx, &ASClaim{}, &opts) - } - return genericregistry.NewStorageProvider(ctx, &ASClaim{}, &opts) -} - -func NewEntryStorageProvider(ctx context.Context, be bebackend.Backend, sync bool, options *options.Options) *rest.StorageProvider { - return genericregistry.NewStorageProvider(ctx, &ASEntry{}, options) -} - -func ApplyStorageToBackend(ctx context.Context, be bebackend.Backend, apiServer *builder.Server) error { - claimStorageProvider := apiServer.StorageProvider[schema.GroupResource{ - Group: SchemeGroupVersion.Group, - Resource: ASClaimPlural, - }] - - claimStorage, err := claimStorageProvider.Get(ctx, apiServer.Schemes[0], &ClaimGetter{}) - if err != nil { - return err - } - - entryStorageProvider := apiServer.StorageProvider[schema.GroupResource{ - Group: SchemeGroupVersion.Group, - Resource: ASEntryPlural, - }] - - entryStorage, err := entryStorageProvider.Get(ctx, apiServer.Schemes[0], &EntryGetter{}) - if err != nil { - return err - } - - return be.AddStorage(entryStorage, claimStorage) -} -*/ - -/* -func NewStorageProviders(ctx context.Context, sync bool, options *options.Options) bebackend.StorageProviders { - r := &StorageProviders{ - be: CreateBackend(), - } - if sync { - opts := *options - opts.BackendInvoker = bebackend.NewIndexInvoker(r.be) - r.indexStorageProvider = genericregistry.NewStorageProvider(ctx, &ASIndex{}, &opts) - } - if sync { - opts := *options - opts.BackendInvoker = bebackend.NewClaimInvoker(r.be) - r.claimStorageProvider = genericregistry.NewStorageProvider(ctx, &ASClaim{}, &opts) - } - r.entryStorageProvider = genericregistry.NewStorageProvider(ctx, &ASEntry{}, options) - return r -} - -type StorageProviders struct { - be bebackend.Backend - indexStorageProvider *rest.StorageProvider - claimStorageProvider *rest.StorageProvider - entryStorageProvider *rest.StorageProvider -} - -func (r *StorageProviders) GetIndexStorageProvider() *rest.StorageProvider { - return r.indexStorageProvider - -} -func (r *StorageProviders) GetClaimStorageProvider() *rest.StorageProvider { - return r.claimStorageProvider - -} -func (r *StorageProviders) GetEntryStorageProvider() *rest.StorageProvider { - return r.entryStorageProvider -} - - -func (r *StorageProviders) ApplyStorageToBackend(ctx context.Context, apiServer *builder.Server) error { - claimStorageProvider := apiServer.StorageProvider[schema.GroupResource{ - Group: SchemeGroupVersion.Group, - Resource: ASClaimPlural, - }] - - claimStorage, err := claimStorageProvider.Get(ctx, apiServer.Schemes[0], &ClaimGetter{}) - if err != nil { - return err - } - - entryStorageProvider := apiServer.StorageProvider[schema.GroupResource{ - Group: SchemeGroupVersion.Group, - Resource: ASEntryPlural, - }] - - entryStorage, err := entryStorageProvider.Get(ctx, apiServer.Schemes[0], &EntryGetter{}) - if err != nil { - return err - } - - r.be.AddStorage(entryStorage, claimStorage) - return nil -} - - -func (r *StorageProviders) GetBackend() bebackend.Backend { - return r.be -} - -*/ diff --git a/apis/backend/as/v1alpha1/asclaim_types.go b/apis/backend/as/v1alpha1/asclaim_types.go index 8e4d781..2272cdd 100644 --- a/apis/backend/as/v1alpha1/asclaim_types.go +++ b/apis/backend/as/v1alpha1/asclaim_types.go @@ -59,6 +59,7 @@ type ASClaimStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +kubebuilder:object:root=true +// +kubebuilder:storageversion // +kubebuilder:subresource:status // +kubebuilder:resource:categories={kuid} diff --git a/apis/backend/as/v1alpha1/asentry_types.go b/apis/backend/as/v1alpha1/asentry_types.go index 3e80768..fd5081d 100644 --- a/apis/backend/as/v1alpha1/asentry_types.go +++ b/apis/backend/as/v1alpha1/asentry_types.go @@ -48,6 +48,7 @@ type ASEntryStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +kubebuilder:object:root=true +// +kubebuilder:storageversion // +kubebuilder:subresource:status // +kubebuilder:resource:categories={kuid} diff --git a/apis/backend/as/v1alpha1/asindex_types.go b/apis/backend/as/v1alpha1/asindex_types.go index 15402ef..b8a0af1 100644 --- a/apis/backend/as/v1alpha1/asindex_types.go +++ b/apis/backend/as/v1alpha1/asindex_types.go @@ -53,6 +53,7 @@ type ASIndexStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +kubebuilder:object:root=true +// +kubebuilder:storageversion // +kubebuilder:subresource:status // +kubebuilder:resource:categories={kuid} // ASIndex is the Schema for the ASIndex API diff --git a/apis/id/doc.go b/apis/id/doc.go index e8d632e..50300a1 100644 --- a/apis/id/doc.go +++ b/apis/id/doc.go @@ -16,5 +16,5 @@ limitations under the License. // +k8s:deepcopy-gen=package,register -// id defines the id api -package id +// Package id is the internal version of the API. +package id // import "github.com/kuidio/kuid/apis/id" diff --git a/apis/id/v1alpha1/doc.go b/apis/id/v1alpha1/doc.go index 0dc536e..95a32bd 100644 --- a/apis/id/v1alpha1/doc.go +++ b/apis/id/v1alpha1/doc.go @@ -14,7 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ +//go:generate deepcopy-gen -O zz_generated.deepcopy -i . -h ../../../../boilerplate.go.txt +//go:generate defaulter-gen -O zz_generated.defaults -i . -h ../../../../boilerplate.go.txt +//go:generate conversion-gen -O zz_generated.conversion -i . -h ../../../../boilerplate.go.txt + // +k8s:openapi-gen=true -// +kubebuilder:object:generate=true // +k8s:deepcopy-gen=package,register -package v1alpha1 +// +k8s:defaulter-gen=TypeMeta + +// v1alpha1 is the v1alpha1 version of the API. +package v1alpha1 \ No newline at end of file diff --git a/apis/id/v1alpha1/register.go b/apis/id/v1alpha1/register.go new file mode 100644 index 0000000..2546b1d --- /dev/null +++ b/apis/id/v1alpha1/register.go @@ -0,0 +1,27 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/runtime" +) + +var ( + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + schemeBuilder runtime.SchemeBuilder + localSchemeBuilder = &schemeBuilder +) diff --git a/apis/infra/cluster_helper.go b/apis/infra/cluster_helper.go new file mode 100644 index 0000000..dee864e --- /dev/null +++ b/apis/infra/cluster_helper.go @@ -0,0 +1,32 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "github.com/kform-dev/choreo/apis/condition" +) + +// GetCondition returns the condition based on the condition kind +func (r *Cluster) GetCondition(t condition.ConditionType) condition.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *Cluster) SetConditions(c ...condition.Condition) { + r.Status.SetConditions(c...) +} diff --git a/apis/infra/cluster_resource.go b/apis/infra/cluster_resource.go new file mode 100644 index 0000000..9c34ce5 --- /dev/null +++ b/apis/infra/cluster_resource.go @@ -0,0 +1,312 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "context" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/kform-dev/choreo/apis/condition" + apiequality "k8s.io/apimachinery/pkg/api/equality" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/util/validation/field" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +const ( + ClusterPlural = "clusters" + ClusterSingular = "cluster" +) + +var ( + ClusterShortNames = []string{} + ClusterCategories = []string{"kuid", "knet"} +) + +// +k8s:deepcopy-gen=false +var _ resource.InternalObject = &Cluster{} +var _ resource.ObjectList = &ClusterList{} +var _ resource.ObjectWithStatusSubResource = &Cluster{} +var _ resource.StatusSubResource = &ClusterStatus{} + +func (Cluster) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: ClusterPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (Cluster) IsStorageVersion() bool { + return true +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (Cluster) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *Cluster) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// GetSingularName returns the singular name of the resource +// GetSingularName implements resource.Object +func (Cluster) GetSingularName() string { + return ClusterSingular +} + +// GetShortNames returns the shortnames for the resource +// GetShortNames implements resource.Object +func (Cluster) GetShortNames() []string { + return ClusterShortNames +} + +// GetCategories return the categories of the resource +// GetCategories implements resource.Object +func (Cluster) GetCategories() []string { + return ClusterCategories +} + +// New return an empty resource +// New implements resource.Object +func (Cluster) New() runtime.Object { + return &Cluster{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (Cluster) NewList() runtime.Object { + return &ClusterList{} +} + +// IsEqual returns a bool indicating if the desired state of both resources is equal or not +func (r *Cluster) IsEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*Cluster) + oldobj := old.(*Cluster) + + if !apiequality.Semantic.DeepEqual(oldobj.ObjectMeta, newobj.ObjectMeta) { + return false + } + // if equal we also test the spec + return apiequality.Semantic.DeepEqual(oldobj.Spec, newobj.Spec) +} + +// GetStatus return the resource.StatusSubResource interface +func (r *Cluster) GetStatus() resource.StatusSubResource { + return r.Status +} + +// IsStatusEqual returns a bool indicating if the status of both resources is equal or not +func (r *Cluster) IsStatusEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*Cluster) + oldobj := old.(*Cluster) + return apiequality.Semantic.DeepEqual(oldobj.Status, newobj.Status) +} + +// PrepareForStatusUpdate prepares the status update +func (r *Cluster) PrepareForStatusUpdate(ctx context.Context, obj, old runtime.Object) { + newObj := obj.(*Cluster) + oldObj := old.(*Cluster) + newObj.Spec = oldObj.Spec + + // Status updates are for only for updating status, not objectmeta. + metav1.ResetObjectMetaForStatus(&newObj.ObjectMeta, &newObj.ObjectMeta) +} + +// ValidateStatusUpdate validates status updates +func (r *Cluster) ValidateStatusUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +// SubResourceName resturns the name of the subresource +// SubResourceName implements the resource.StatusSubResource +func (ClusterStatus) SubResourceName() string { + return fmt.Sprintf("%s/%s", ClusterPlural, "status") +} + +// CopyTo copies the content of the status subresource to a parent resource. +// CopyTo implements the resource.StatusSubResource +func (r ClusterStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { + parent, ok := obj.(*Cluster) + if ok { + parent.Status = r + } +} + +// GetListMeta returns the ListMeta +// GetListMeta implements the resource.ObjectList +func (r *ClusterList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// TableConvertor return the table format of the resource +func (r *Cluster) TableConvertor() func(gr schema.GroupResource) rest.TableConvertor { + return func(gr schema.GroupResource) rest.TableConvertor { + return registry.NewTableConverter( + gr, + func(obj runtime.Object) []interface{} { + claim, ok := obj.(*Cluster) + if !ok { + return nil + } + return []interface{}{ + claim.GetName(), + claim.GetCondition(condition.ConditionTypeReady).Status, + } + }, + []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + {Name: "Ready", Type: "string"}, + }, + ) + } +} + +// FieldLabelConversion is the schema conversion function for normalizing the FieldSelector for the resource +func (r *Cluster) FieldLabelConversion() runtime.FieldLabelConversionFunc { + return func(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } + } +} + +func (r *Cluster) FieldSelector() func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + return func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + var filter *ClusterFilter + + // add the namespace to the list + namespace, ok := genericapirequest.NamespaceFrom(ctx) + if fieldSelector == nil { + if ok { + return &ClusterFilter{Namespace: namespace}, nil + } + return filter, nil + } + requirements := fieldSelector.Requirements() + for _, requirement := range requirements { + filter = &ClusterFilter{} + switch requirement.Operator { + case selection.Equals, selection.DoesNotExist: + if requirement.Value == "" { + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) + } + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) + } + + switch requirement.Field { + case "metadata.name": + filter.Name = requirement.Value + case "metadata.namespace": + filter.Namespace = requirement.Value + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) + } + } + // add namespace to the filter selector if specified + if ok { + if filter != nil { + filter.Namespace = namespace + } else { + filter = &ClusterFilter{Namespace: namespace} + } + return filter, nil + } + + return &ClusterFilter{}, nil + } + +} + +type ClusterFilter struct { + // Name filters by the name of the objects + Name string `protobuf:"bytes,1,opt,name=name"` + + // Namespace filters by the namespace of the objects + Namespace string `protobuf:"bytes,2,opt,name=namespace"` +} + +func (r *ClusterFilter) Filter(ctx context.Context, obj runtime.Object) bool { + f := false // result of the previous filter + o, ok := obj.(*Cluster) + if !ok { + return f + } + if r == nil { + return false + } + if r.Name != "" { + if o.GetName() == r.Name { + f = false + } else { + f = true + } + } + if r.Namespace != "" { + if o.GetNamespace() == r.Namespace { + f = false + } else { + f = true + } + } + return f +} + +func (r *Cluster) PrepareForCreate(ctx context.Context, obj runtime.Object) { + // status cannot be set upon create -> reset it + newobj := obj.(*Cluster) + newobj.Status = ClusterStatus{} +} + +// ValidateCreate statically validates +func (r *Cluster) ValidateCreate(ctx context.Context, obj runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +func (r *Cluster) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { + // ensure the status dont get updated + newobj := obj.(*Cluster) + oldObj := old.(*Cluster) + newobj.Status = oldObj.Status +} + +func (r *Cluster) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} diff --git a/apis/infra/cluster_types.go b/apis/infra/cluster_types.go new file mode 100644 index 0000000..9dbf0b0 --- /dev/null +++ b/apis/infra/cluster_types.go @@ -0,0 +1,74 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "reflect" + + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/id" + "github.com/kuidio/kuid/apis/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// ClusterSpec defines the desired state of Cluster +type ClusterSpec struct { + // PartitionClusterID defines the cluster partition + id.PartitionClusterID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"` + // Provider defines the provider implementing this resource. + Provider string `json:"provider" yaml:"provider" protobuf:"bytes,2,opt,name=provider"` + // Location defines the location information where this resource is located + // in lon/lat coordinates + Location *Location `json:"location,omitempty" yaml:"location,omitempty" protobuf:"bytes,3,opt,name=location"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + common.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,4,opt,name=userDefinedLabels"` + // ParametersRef points to a provider specific configuration of the resource + // +optional + //ParametersRef *ObjectReference `json:"parametersRef,omitempty" yaml:"parametersRef,omitempty" protobuf:"bytes,5,opt,name=parametersRef"` +} + +// ClusterStatus defines the observed state of Cluster +type ClusterStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condition.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// A Cluster represents a kubernetes cluster and is typically used as a nodeGroup identifier. +type Cluster struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec ClusterSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status ClusterStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// ClusterList contains a list of Clusters +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type ClusterList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []Cluster `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + ClusterKind = reflect.TypeOf(Cluster{}).Name() + ClusterKindList = reflect.TypeOf(ClusterList{}).Name() +) diff --git a/apis/infra/doc.go b/apis/infra/doc.go new file mode 100644 index 0000000..3cf0322 --- /dev/null +++ b/apis/infra/doc.go @@ -0,0 +1,21 @@ +/* +Copyright 2024 Nokia. + +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. +*/ + +// +k8s:deepcopy-gen=package,register +// +groupName=infra.kuid.dev + +// Package infra is the internal version of the API. +package infra // import "github.com/kuidio/kuid/apis/infra" \ No newline at end of file diff --git a/apis/infra/endpoint_helper.go b/apis/infra/endpoint_helper.go new file mode 100644 index 0000000..dd3d23e --- /dev/null +++ b/apis/infra/endpoint_helper.go @@ -0,0 +1,32 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "github.com/kform-dev/choreo/apis/condition" +) + +// GetCondition returns the condition based on the condition kind +func (r *Endpoint) GetCondition(t condition.ConditionType) condition.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *Endpoint) SetConditions(c ...condition.Condition) { + r.Status.SetConditions(c...) +} diff --git a/apis/infra/endpoint_resource.go b/apis/infra/endpoint_resource.go new file mode 100644 index 0000000..28aa95d --- /dev/null +++ b/apis/infra/endpoint_resource.go @@ -0,0 +1,312 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "context" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/kform-dev/choreo/apis/condition" + apiequality "k8s.io/apimachinery/pkg/api/equality" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/util/validation/field" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +const ( + EndpointPlural = "endpoints" + EndpointSingular = "endpoint" +) + +var ( + EndpointShortNames = []string{} + EndpointCategories = []string{"kuid", "knet"} +) + +// +k8s:deepcopy-gen=false +var _ resource.InternalObject = &Endpoint{} +var _ resource.ObjectList = &EndpointList{} +var _ resource.ObjectWithStatusSubResource = &Endpoint{} +var _ resource.StatusSubResource = &EndpointStatus{} + +func (Endpoint) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: EndpointPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (Endpoint) IsStorageVersion() bool { + return true +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (Endpoint) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *Endpoint) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// GetSingularName returns the singular name of the resource +// GetSingularName implements resource.Object +func (Endpoint) GetSingularName() string { + return EndpointSingular +} + +// GetShortNames returns the shortnames for the resource +// GetShortNames implements resource.Object +func (Endpoint) GetShortNames() []string { + return EndpointShortNames +} + +// GetCategories return the categories of the resource +// GetCategories implements resource.Object +func (Endpoint) GetCategories() []string { + return EndpointCategories +} + +// New return an empty resource +// New implements resource.Object +func (Endpoint) New() runtime.Object { + return &Endpoint{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (Endpoint) NewList() runtime.Object { + return &EndpointList{} +} + +// IsEqual returns a bool indicating if the desired state of both resources is equal or not +func (r *Endpoint) IsEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*Endpoint) + oldobj := old.(*Endpoint) + + if !apiequality.Semantic.DeepEqual(oldobj.ObjectMeta, newobj.ObjectMeta) { + return false + } + // if equal we also test the spec + return apiequality.Semantic.DeepEqual(oldobj.Spec, newobj.Spec) +} + +// GetStatus return the resource.StatusSubResource interface +func (r *Endpoint) GetStatus() resource.StatusSubResource { + return r.Status +} + +// IsStatusEqual returns a bool indicating if the status of both resources is equal or not +func (r *Endpoint) IsStatusEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*Endpoint) + oldobj := old.(*Endpoint) + return apiequality.Semantic.DeepEqual(oldobj.Status, newobj.Status) +} + +// PrepareForStatusUpdate prepares the status update +func (r *Endpoint) PrepareForStatusUpdate(ctx context.Context, obj, old runtime.Object) { + newObj := obj.(*Endpoint) + oldObj := old.(*Endpoint) + newObj.Spec = oldObj.Spec + + // Status updates are for only for updating status, not objectmeta. + metav1.ResetObjectMetaForStatus(&newObj.ObjectMeta, &newObj.ObjectMeta) +} + +// ValidateStatusUpdate validates status updates +func (r *Endpoint) ValidateStatusUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +// SubResourceName resturns the name of the subresource +// SubResourceName implements the resource.StatusSubResource +func (EndpointStatus) SubResourceName() string { + return fmt.Sprintf("%s/%s", EndpointPlural, "status") +} + +// CopyTo copies the content of the status subresource to a parent resource. +// CopyTo implements the resource.StatusSubResource +func (r EndpointStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { + parent, ok := obj.(*Endpoint) + if ok { + parent.Status = r + } +} + +// GetListMeta returns the ListMeta +// GetListMeta implements the resource.ObjectList +func (r *EndpointList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// TableConvertor return the table format of the resource +func (r *Endpoint) TableConvertor() func(gr schema.GroupResource) rest.TableConvertor { + return func(gr schema.GroupResource) rest.TableConvertor { + return registry.NewTableConverter( + gr, + func(obj runtime.Object) []interface{} { + claim, ok := obj.(*Endpoint) + if !ok { + return nil + } + return []interface{}{ + claim.GetName(), + claim.GetCondition(condition.ConditionTypeReady).Status, + } + }, + []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + {Name: "Ready", Type: "string"}, + }, + ) + } +} + +// FieldLabelConversion is the schema conversion function for normalizing the FieldSelector for the resource +func (r *Endpoint) FieldLabelConversion() runtime.FieldLabelConversionFunc { + return func(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } + } +} + +func (r *Endpoint) FieldSelector() func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + return func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + var filter *EndpointFilter + + // add the namespace to the list + namespace, ok := genericapirequest.NamespaceFrom(ctx) + if fieldSelector == nil { + if ok { + return &EndpointFilter{Namespace: namespace}, nil + } + return filter, nil + } + requirements := fieldSelector.Requirements() + for _, requirement := range requirements { + filter = &EndpointFilter{} + switch requirement.Operator { + case selection.Equals, selection.DoesNotExist: + if requirement.Value == "" { + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) + } + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) + } + + switch requirement.Field { + case "metadata.name": + filter.Name = requirement.Value + case "metadata.namespace": + filter.Namespace = requirement.Value + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) + } + } + // add namespace to the filter selector if specified + if ok { + if filter != nil { + filter.Namespace = namespace + } else { + filter = &EndpointFilter{Namespace: namespace} + } + return filter, nil + } + + return &EndpointFilter{}, nil + } + +} + +type EndpointFilter struct { + // Name filters by the name of the objects + Name string `protobuf:"bytes,1,opt,name=name"` + + // Namespace filters by the namespace of the objects + Namespace string `protobuf:"bytes,2,opt,name=namespace"` +} + +func (r *EndpointFilter) Filter(ctx context.Context, obj runtime.Object) bool { + f := false // result of the previous filter + o, ok := obj.(*Endpoint) + if !ok { + return f + } + if r == nil { + return false + } + if r.Name != "" { + if o.GetName() == r.Name { + f = false + } else { + f = true + } + } + if r.Namespace != "" { + if o.GetNamespace() == r.Namespace { + f = false + } else { + f = true + } + } + return f +} + +func (r *Endpoint) PrepareForCreate(ctx context.Context, obj runtime.Object) { + // status cannot be set upon create -> reset it + newobj := obj.(*Endpoint) + newobj.Status = EndpointStatus{} +} + +// ValidateCreate statically validates +func (r *Endpoint) ValidateCreate(ctx context.Context, obj runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +func (r *Endpoint) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { + // ensure the status dont get updated + newobj := obj.(*Endpoint) + oldObj := old.(*Endpoint) + newobj.Status = oldObj.Status +} + +func (r *Endpoint) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} diff --git a/apis/infra/endpoint_types.go b/apis/infra/endpoint_types.go new file mode 100644 index 0000000..489c1f7 --- /dev/null +++ b/apis/infra/endpoint_types.go @@ -0,0 +1,78 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "reflect" + + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/id" + "github.com/kuidio/kuid/apis/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// Claims can be expressed in 3 ways +// OnwerReference, Finalizer or Status with reference to the claim onwer -> finalizer seem the best option for this + +// EndpointSpec defines the desired state of Endpoint +type EndpointSpec struct { + // NodeGroupEndpointID identifies the endpoint identity this resource belongs to + id.PartitionEndpointID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeGroupEndpointID"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + common.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` + // (Gbps) + Speed *string `json:"speed,omitempty" yaml:"speed,omitempty" protobuf:"bytes,4,opt,name=speed"` + // VLANTagging defines if VLAN tagging is enabled or disabled on the interface + VLANTagging bool `json:"vlanTagging,omitempty" yaml:"vlanTagging,omitempty" protobuf:"bytes,5,opt,name=vlanTagging"` +} + +// EndpointStatus defines the observed state of Endpoint +type EndpointStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condition.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// An Endpoint represents a communication interface or connection point within a Node, +// facilitating network communication and data transfer between different components +// or systems within the environment. `Endpoints` serve as gateways for transmitting and +// receiving data, enabling seamless communication between Nodes. +type Endpoint struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec EndpointSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status EndpointStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// EndpointList contains a list of Endpoints +type EndpointList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []Endpoint `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + EndpointKind = reflect.TypeOf(Endpoint{}).Name() + EndpointKindList = reflect.TypeOf(EndpointList{}).Name() +) diff --git a/apis/infra/endpointset_helper.go b/apis/infra/endpointset_helper.go new file mode 100644 index 0000000..1f585ed --- /dev/null +++ b/apis/infra/endpointset_helper.go @@ -0,0 +1,32 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "github.com/kform-dev/choreo/apis/condition" +) + +// GetCondition returns the condition based on the condition kind +func (r *EndpointSet) GetCondition(t condition.ConditionType) condition.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *EndpointSet) SetConditions(c ...condition.Condition) { + r.Status.SetConditions(c...) +} diff --git a/apis/infra/endpointset_resource.go b/apis/infra/endpointset_resource.go new file mode 100644 index 0000000..6d99a47 --- /dev/null +++ b/apis/infra/endpointset_resource.go @@ -0,0 +1,312 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "context" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/kform-dev/choreo/apis/condition" + apiequality "k8s.io/apimachinery/pkg/api/equality" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/util/validation/field" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +const ( + EndpointSetPlural = "endpointsets" + EndpointSetSingular = "endpointset" +) + +var ( + EndpointSetShortNames = []string{} + EndpointSetCategories = []string{"kuid", "knet"} +) + +// +k8s:deepcopy-gen=false +var _ resource.InternalObject = &EndpointSet{} +var _ resource.ObjectList = &EndpointSetList{} +var _ resource.ObjectWithStatusSubResource = &EndpointSet{} +var _ resource.StatusSubResource = &EndpointSetStatus{} + +func (EndpointSet) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: EndpointSetPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (EndpointSet) IsStorageVersion() bool { + return true +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (EndpointSet) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *EndpointSet) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// GetSingularName returns the singular name of the resource +// GetSingularName implements resource.Object +func (EndpointSet) GetSingularName() string { + return EndpointSetSingular +} + +// GetShortNames returns the shortnames for the resource +// GetShortNames implements resource.Object +func (EndpointSet) GetShortNames() []string { + return EndpointSetShortNames +} + +// GetCategories return the categories of the resource +// GetCategories implements resource.Object +func (EndpointSet) GetCategories() []string { + return EndpointSetCategories +} + +// New return an empty resource +// New implements resource.Object +func (EndpointSet) New() runtime.Object { + return &EndpointSet{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (EndpointSet) NewList() runtime.Object { + return &EndpointSetList{} +} + +// IsEqual returns a bool indicating if the desired state of both resources is equal or not +func (r *EndpointSet) IsEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*EndpointSet) + oldobj := old.(*EndpointSet) + + if !apiequality.Semantic.DeepEqual(oldobj.ObjectMeta, newobj.ObjectMeta) { + return false + } + // if equal we also test the spec + return apiequality.Semantic.DeepEqual(oldobj.Spec, newobj.Spec) +} + +// GetStatus return the resource.StatusSubResource interface +func (r *EndpointSet) GetStatus() resource.StatusSubResource { + return r.Status +} + +// IsStatusEqual returns a bool indicating if the status of both resources is equal or not +func (r *EndpointSet) IsStatusEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*EndpointSet) + oldobj := old.(*EndpointSet) + return apiequality.Semantic.DeepEqual(oldobj.Status, newobj.Status) +} + +// PrepareForStatusUpdate prepares the status update +func (r *EndpointSet) PrepareForStatusUpdate(ctx context.Context, obj, old runtime.Object) { + newObj := obj.(*EndpointSet) + oldObj := old.(*EndpointSet) + newObj.Spec = oldObj.Spec + + // Status updates are for only for updating status, not objectmeta. + metav1.ResetObjectMetaForStatus(&newObj.ObjectMeta, &newObj.ObjectMeta) +} + +// ValidateStatusUpdate validates status updates +func (r *EndpointSet) ValidateStatusUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +// SubResourceName resturns the name of the subresource +// SubResourceName implements the resource.StatusSubResource +func (EndpointSetStatus) SubResourceName() string { + return fmt.Sprintf("%s/%s", EndpointSetPlural, "status") +} + +// CopyTo copies the content of the status subresource to a parent resource. +// CopyTo implements the resource.StatusSubResource +func (r EndpointSetStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { + parent, ok := obj.(*EndpointSet) + if ok { + parent.Status = r + } +} + +// GetListMeta returns the ListMeta +// GetListMeta implements the resource.ObjectList +func (r *EndpointSetList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// TableConvertor return the table format of the resource +func (r *EndpointSet) TableConvertor() func(gr schema.GroupResource) rest.TableConvertor { + return func(gr schema.GroupResource) rest.TableConvertor { + return registry.NewTableConverter( + gr, + func(obj runtime.Object) []interface{} { + claim, ok := obj.(*EndpointSet) + if !ok { + return nil + } + return []interface{}{ + claim.GetName(), + claim.GetCondition(condition.ConditionTypeReady).Status, + } + }, + []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + {Name: "Ready", Type: "string"}, + }, + ) + } +} + +// FieldLabelConversion is the schema conversion function for normalizing the FieldSelector for the resource +func (r *EndpointSet) FieldLabelConversion() runtime.FieldLabelConversionFunc { + return func(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } + } +} + +func (r *EndpointSet) FieldSelector() func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + return func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + var filter *EndpointSetFilter + + // add the namespace to the list + namespace, ok := genericapirequest.NamespaceFrom(ctx) + if fieldSelector == nil { + if ok { + return &EndpointSetFilter{Namespace: namespace}, nil + } + return filter, nil + } + requirements := fieldSelector.Requirements() + for _, requirement := range requirements { + filter = &EndpointSetFilter{} + switch requirement.Operator { + case selection.Equals, selection.DoesNotExist: + if requirement.Value == "" { + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) + } + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) + } + + switch requirement.Field { + case "metadata.name": + filter.Name = requirement.Value + case "metadata.namespace": + filter.Namespace = requirement.Value + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) + } + } + // add namespace to the filter selector if specified + if ok { + if filter != nil { + filter.Namespace = namespace + } else { + filter = &EndpointSetFilter{Namespace: namespace} + } + return filter, nil + } + + return &EndpointSetFilter{}, nil + } + +} + +type EndpointSetFilter struct { + // Name filters by the name of the objects + Name string `protobuf:"bytes,1,opt,name=name"` + + // Namespace filters by the namespace of the objects + Namespace string `protobuf:"bytes,2,opt,name=namespace"` +} + +func (r *EndpointSetFilter) Filter(ctx context.Context, obj runtime.Object) bool { + f := false // result of the previous filter + o, ok := obj.(*EndpointSet) + if !ok { + return f + } + if r == nil { + return false + } + if r.Name != "" { + if o.GetName() == r.Name { + f = false + } else { + f = true + } + } + if r.Namespace != "" { + if o.GetNamespace() == r.Namespace { + f = false + } else { + f = true + } + } + return f +} + +func (r *EndpointSet) PrepareForCreate(ctx context.Context, obj runtime.Object) { + // status cannot be set upon create -> reset it + newobj := obj.(*EndpointSet) + newobj.Status = EndpointSetStatus{} +} + +// ValidateCreate statically validates +func (r *EndpointSet) ValidateCreate(ctx context.Context, obj runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +func (r *EndpointSet) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { + // ensure the status dont get updated + newobj := obj.(*EndpointSet) + oldObj := old.(*EndpointSet) + newobj.Status = oldObj.Status +} + +func (r *EndpointSet) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} diff --git a/apis/infra/endpointset_types.go b/apis/infra/endpointset_types.go new file mode 100644 index 0000000..35bf4cc --- /dev/null +++ b/apis/infra/endpointset_types.go @@ -0,0 +1,85 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "reflect" + + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/id" + "github.com/kuidio/kuid/apis/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// EndpointSetSpec defines the desired state of EndpointSet +// An EndpointSet can be a LAG (single Homed) or ESI (multiHomed). The EndpointSet +// can only belong to a single NodeGroup +type EndpointSetSpec struct { + // Endpoints defines the Endpoints that are part of the EndpointSet + // Min 1, Max 16 + Endpoints []*id.PartitionEndpointID `json:"endpoints" yaml:"endpoints" protobuf:"bytes,1,opt,name=endpoints"` + // Lacp defines if the lag enabled LACP + // +optional + Lacp *bool `json:"lacp,omitempty" yaml:"lacp,omitempty" protobuf:"bytes,2,opt,name=lacp"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + common.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` +} + +// EndpointSetStatus defines the observed state of EndpointSet +type EndpointSetStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condition.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` + // ESI defines the ethernet segment identifier of the logical link + // if set this is a multi-homed logical endpoint + // the ESI is a global unique identifier within the administrative domain + // +optional + ESI *uint32 `json:"esi,omitempty" yaml:"esi,omitempty" protobuf:"bytes,2,opt,name=esi"` + // LagId defines the lag id for the logical single-homed or multi-homed + // endpoint + // +optional + LagId *uint32 `json:"lagID,omitempty" yaml:"lagID,omitempty" protobuf:"bytes,3,opt,name=lagID"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// A EndpointSet represents a set of endpoints that belong together within a nodeGroup. +// E.g. it can be used to model a logical Link Aggregation group within +// a node or it can be used to represent a logical multi-homing construction +// between a set of nodes belonging to a single nodeGroup. +type EndpointSet struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec EndpointSetSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status EndpointSetStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// EndpointSetList contains a list of EndpointSets +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type EndpointSetList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []EndpointSet `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + EndpointSetKind = reflect.TypeOf(EndpointSet{}).Name() + EndpointSetKindList = reflect.TypeOf(EndpointSetList{}).Name() +) diff --git a/apis/infra/link_helper.go b/apis/infra/link_helper.go new file mode 100644 index 0000000..e4ef0d2 --- /dev/null +++ b/apis/infra/link_helper.go @@ -0,0 +1,32 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "github.com/kform-dev/choreo/apis/condition" +) + +// GetCondition returns the condition based on the condition kind +func (r *Link) GetCondition(t condition.ConditionType) condition.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *Link) SetConditions(c ...condition.Condition) { + r.Status.SetConditions(c...) +} diff --git a/apis/infra/link_resource.go b/apis/infra/link_resource.go new file mode 100644 index 0000000..063aa7a --- /dev/null +++ b/apis/infra/link_resource.go @@ -0,0 +1,312 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "context" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/kform-dev/choreo/apis/condition" + apiequality "k8s.io/apimachinery/pkg/api/equality" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/util/validation/field" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +const ( + LinkPlural = "links" + LinkSingular = "links" +) + +var ( + LinkShortNames = []string{} + LinkCategories = []string{"kuid", "knet"} +) + +// +k8s:deepcopy-gen=false +var _ resource.InternalObject = &Link{} +var _ resource.ObjectList = &LinkList{} +var _ resource.ObjectWithStatusSubResource = &Link{} +var _ resource.StatusSubResource = &LinkStatus{} + +func (Link) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: LinkPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (Link) IsStorageVersion() bool { + return true +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (Link) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *Link) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// GetSingularName returns the singular name of the resource +// GetSingularName implements resource.Object +func (Link) GetSingularName() string { + return LinkSingular +} + +// GetShortNames returns the shortnames for the resource +// GetShortNames implements resource.Object +func (Link) GetShortNames() []string { + return LinkShortNames +} + +// GetCategories return the categories of the resource +// GetCategories implements resource.Object +func (Link) GetCategories() []string { + return LinkCategories +} + +// New return an empty resource +// New implements resource.Object +func (Link) New() runtime.Object { + return &Link{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (Link) NewList() runtime.Object { + return &LinkList{} +} + +// IsEqual returns a bool indicating if the desired state of both resources is equal or not +func (r *Link) IsEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*Link) + oldobj := old.(*Link) + + if !apiequality.Semantic.DeepEqual(oldobj.ObjectMeta, newobj.ObjectMeta) { + return false + } + // if equal we also test the spec + return apiequality.Semantic.DeepEqual(oldobj.Spec, newobj.Spec) +} + +// GetStatus return the resource.StatusSubResource interface +func (r *Link) GetStatus() resource.StatusSubResource { + return r.Status +} + +// IsStatusEqual returns a bool indicating if the status of both resources is equal or not +func (r *Link) IsStatusEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*Link) + oldobj := old.(*Link) + return apiequality.Semantic.DeepEqual(oldobj.Status, newobj.Status) +} + +// PrepareForStatusUpdate prepares the status update +func (r *Link) PrepareForStatusUpdate(ctx context.Context, obj, old runtime.Object) { + newObj := obj.(*Link) + oldObj := old.(*Link) + newObj.Spec = oldObj.Spec + + // Status updates are for only for updating status, not objectmeta. + metav1.ResetObjectMetaForStatus(&newObj.ObjectMeta, &newObj.ObjectMeta) +} + +// ValidateStatusUpdate validates status updates +func (r *Link) ValidateStatusUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +// SubResourceName resturns the name of the subresource +// SubResourceName implements the resource.StatusSubResource +func (LinkStatus) SubResourceName() string { + return fmt.Sprintf("%s/%s", LinkPlural, "status") +} + +// CopyTo copies the content of the status subresource to a parent resource. +// CopyTo implements the resource.StatusSubResource +func (r LinkStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { + parent, ok := obj.(*Link) + if ok { + parent.Status = r + } +} + +// GetListMeta returns the ListMeta +// GetListMeta implements the resource.ObjectList +func (r *LinkList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// TableConvertor return the table format of the resource +func (r *Link) TableConvertor() func(gr schema.GroupResource) rest.TableConvertor { + return func(gr schema.GroupResource) rest.TableConvertor { + return registry.NewTableConverter( + gr, + func(obj runtime.Object) []interface{} { + claim, ok := obj.(*Link) + if !ok { + return nil + } + return []interface{}{ + claim.GetName(), + claim.GetCondition(condition.ConditionTypeReady).Status, + } + }, + []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + {Name: "Ready", Type: "string"}, + }, + ) + } +} + +// FieldLabelConversion is the schema conversion function for normalizing the FieldSelector for the resource +func (r *Link) FieldLabelConversion() runtime.FieldLabelConversionFunc { + return func(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } + } +} + +func (r *Link) FieldSelector() func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + return func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + var filter *LinkFilter + + // add the namespace to the list + namespace, ok := genericapirequest.NamespaceFrom(ctx) + if fieldSelector == nil { + if ok { + return &LinkFilter{Namespace: namespace}, nil + } + return filter, nil + } + requirements := fieldSelector.Requirements() + for _, requirement := range requirements { + filter = &LinkFilter{} + switch requirement.Operator { + case selection.Equals, selection.DoesNotExist: + if requirement.Value == "" { + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) + } + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) + } + + switch requirement.Field { + case "metadata.name": + filter.Name = requirement.Value + case "metadata.namespace": + filter.Namespace = requirement.Value + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) + } + } + // add namespace to the filter selector if specified + if ok { + if filter != nil { + filter.Namespace = namespace + } else { + filter = &LinkFilter{Namespace: namespace} + } + return filter, nil + } + + return &LinkFilter{}, nil + } + +} + +type LinkFilter struct { + // Name filters by the name of the objects + Name string `protobuf:"bytes,1,opt,name=name"` + + // Namespace filters by the namespace of the objects + Namespace string `protobuf:"bytes,2,opt,name=namespace"` +} + +func (r *LinkFilter) Filter(ctx context.Context, obj runtime.Object) bool { + f := false // result of the previous filter + o, ok := obj.(*Link) + if !ok { + return f + } + if r == nil { + return false + } + if r.Name != "" { + if o.GetName() == r.Name { + f = false + } else { + f = true + } + } + if r.Namespace != "" { + if o.GetNamespace() == r.Namespace { + f = false + } else { + f = true + } + } + return f +} + +func (r *Link) PrepareForCreate(ctx context.Context, obj runtime.Object) { + // status cannot be set upon create -> reset it + newobj := obj.(*Link) + newobj.Status = LinkStatus{} +} + +// ValidateCreate statically validates +func (r *Link) ValidateCreate(ctx context.Context, obj runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +func (r *Link) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { + // ensure the status dont get updated + newobj := obj.(*Link) + oldObj := old.(*Link) + newobj.Status = oldObj.Status +} + +func (r *Link) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} diff --git a/apis/infra/link_types.go b/apis/infra/link_types.go new file mode 100644 index 0000000..3bc224e --- /dev/null +++ b/apis/infra/link_types.go @@ -0,0 +1,81 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "reflect" + + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/id" + "github.com/kuidio/kuid/apis/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// LinkSpec defines the desired state of Link +type LinkSpec struct { + // Endpoints define the 2 endpoint identifiers of the link + // Can only have 2 endpoints + Endpoints []*id.PartitionEndpointID `json:"endpoints" yaml:"endpoints" protobuf:"bytes,1,opt,name=endpoints"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + common.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,2,opt,name=userDefinedLabels"` + // BFD defines the BFD specific parameters on the link + // +optional + //BFD *BFDLinkParameters `json:"bfd,omitempty" yaml:"bfd,omitempty" protobuf:"bytes,3,opt,name=bfd"` + // OSPF defines the OSPF specific parameters on the link + // +optional + //OSPF *OSPFLinkParameters `json:"ospf,omitempty" yaml:"ospf,omitempty" protobuf:"bytes,4,opt,name=ospf"` + // ISIS defines the ISIS specific parameters on the link + // +optional + //ISIS *ISISLinkParameters `json:"isis,omitempty" yaml:"isis,omitempty" protobuf:"bytes,5,opt,name=isis"` + // BGP defines the BGP specific parameters on the link + // +optional + //BGP *BGPLinkParameters `json:"bgp,omitempty" yaml:"bgp,omitempty" protobuf:"bytes,6,opt,name=bgp"` +} + +// LinkStatus defines the observed state of Link +type LinkStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condition.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// A link represents a physical/logical connection that enables communication and data transfer +// between 2 endpoints of a node. +type Link struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec LinkSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status LinkStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// LinkList contains a list of Links +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type LinkList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []Link `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + LinkKind = reflect.TypeOf(Link{}).Name() + LinkKindList = reflect.TypeOf(LinkList{}).Name() +) diff --git a/apis/infra/linkset_helper.go b/apis/infra/linkset_helper.go new file mode 100644 index 0000000..64e2ce4 --- /dev/null +++ b/apis/infra/linkset_helper.go @@ -0,0 +1,32 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "github.com/kform-dev/choreo/apis/condition" +) + +// GetCondition returns the condition based on the condition kind +func (r *LinkSet) GetCondition(t condition.ConditionType) condition.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *LinkSet) SetConditions(c ...condition.Condition) { + r.Status.SetConditions(c...) +} diff --git a/apis/infra/linkset_resource.go b/apis/infra/linkset_resource.go new file mode 100644 index 0000000..7093999 --- /dev/null +++ b/apis/infra/linkset_resource.go @@ -0,0 +1,312 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "context" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/kform-dev/choreo/apis/condition" + apiequality "k8s.io/apimachinery/pkg/api/equality" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/util/validation/field" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +const ( + LinkSetPlural = "linksets" + LinkSetSingular = "linkset" +) + +var ( + LinkSetShortNames = []string{} + LinkSetCategories = []string{"kuid", "knet"} +) + +// +k8s:deepcopy-gen=false +var _ resource.InternalObject = &LinkSet{} +var _ resource.ObjectList = &LinkSetList{} +var _ resource.ObjectWithStatusSubResource = &LinkSet{} +var _ resource.StatusSubResource = &LinkSetStatus{} + +func (LinkSet) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: LinkSetPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (LinkSet) IsStorageVersion() bool { + return true +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (LinkSet) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *LinkSet) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// GetSingularName returns the singular name of the resource +// GetSingularName implements resource.Object +func (LinkSet) GetSingularName() string { + return LinkSetSingular +} + +// GetShortNames returns the shortnames for the resource +// GetShortNames implements resource.Object +func (LinkSet) GetShortNames() []string { + return LinkSetShortNames +} + +// GetCategories return the categories of the resource +// GetCategories implements resource.Object +func (LinkSet) GetCategories() []string { + return LinkSetCategories +} + +// New return an empty resource +// New implements resource.Object +func (LinkSet) New() runtime.Object { + return &LinkSet{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (LinkSet) NewList() runtime.Object { + return &LinkSetList{} +} + +// IsEqual returns a bool indicating if the desired state of both resources is equal or not +func (r *LinkSet) IsEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*LinkSet) + oldobj := old.(*LinkSet) + + if !apiequality.Semantic.DeepEqual(oldobj.ObjectMeta, newobj.ObjectMeta) { + return false + } + // if equal we also test the spec + return apiequality.Semantic.DeepEqual(oldobj.Spec, newobj.Spec) +} + +// GetStatus return the resource.StatusSubResource interface +func (r *LinkSet) GetStatus() resource.StatusSubResource { + return r.Status +} + +// IsStatusEqual returns a bool indicating if the status of both resources is equal or not +func (r *LinkSet) IsStatusEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*LinkSet) + oldobj := old.(*LinkSet) + return apiequality.Semantic.DeepEqual(oldobj.Status, newobj.Status) +} + +// PrepareForStatusUpdate prepares the status update +func (r *LinkSet) PrepareForStatusUpdate(ctx context.Context, obj, old runtime.Object) { + newObj := obj.(*LinkSet) + oldObj := old.(*LinkSet) + newObj.Spec = oldObj.Spec + + // Status updates are for only for updating status, not objectmeta. + metav1.ResetObjectMetaForStatus(&newObj.ObjectMeta, &newObj.ObjectMeta) +} + +// ValidateStatusUpdate validates status updates +func (r *LinkSet) ValidateStatusUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +// SubResourceName resturns the name of the subresource +// SubResourceName implements the resource.StatusSubResource +func (LinkSetStatus) SubResourceName() string { + return fmt.Sprintf("%s/%s", LinkSetPlural, "status") +} + +// CopyTo copies the content of the status subresource to a parent resource. +// CopyTo implements the resource.StatusSubResource +func (r LinkSetStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { + parent, ok := obj.(*LinkSet) + if ok { + parent.Status = r + } +} + +// GetListMeta returns the ListMeta +// GetListMeta implements the resource.ObjectList +func (r *LinkSetList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// TableConvertor return the table format of the resource +func (r *LinkSet) TableConvertor() func(gr schema.GroupResource) rest.TableConvertor { + return func(gr schema.GroupResource) rest.TableConvertor { + return registry.NewTableConverter( + gr, + func(obj runtime.Object) []interface{} { + claim, ok := obj.(*LinkSet) + if !ok { + return nil + } + return []interface{}{ + claim.GetName(), + claim.GetCondition(condition.ConditionTypeReady).Status, + } + }, + []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + {Name: "Ready", Type: "string"}, + }, + ) + } +} + +// FieldLabelConversion is the schema conversion function for normalizing the FieldSelector for the resource +func (r *LinkSet) FieldLabelConversion() runtime.FieldLabelConversionFunc { + return func(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } + } +} + +func (r *LinkSet) FieldSelector() func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + return func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + var filter *LinkSetFilter + + // add the namespace to the list + namespace, ok := genericapirequest.NamespaceFrom(ctx) + if fieldSelector == nil { + if ok { + return &LinkSetFilter{Namespace: namespace}, nil + } + return filter, nil + } + requirements := fieldSelector.Requirements() + for _, requirement := range requirements { + filter = &LinkSetFilter{} + switch requirement.Operator { + case selection.Equals, selection.DoesNotExist: + if requirement.Value == "" { + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) + } + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) + } + + switch requirement.Field { + case "metadata.name": + filter.Name = requirement.Value + case "metadata.namespace": + filter.Namespace = requirement.Value + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) + } + } + // add namespace to the filter selector if specified + if ok { + if filter != nil { + filter.Namespace = namespace + } else { + filter = &LinkSetFilter{Namespace: namespace} + } + return filter, nil + } + + return &LinkSetFilter{}, nil + } + +} + +type LinkSetFilter struct { + // Name filters by the name of the objects + Name string `protobuf:"bytes,1,opt,name=name"` + + // Namespace filters by the namespace of the objects + Namespace string `protobuf:"bytes,2,opt,name=namespace"` +} + +func (r *LinkSetFilter) Filter(ctx context.Context, obj runtime.Object) bool { + f := false // result of the previous filter + o, ok := obj.(*LinkSet) + if !ok { + return f + } + if r == nil { + return false + } + if r.Name != "" { + if o.GetName() == r.Name { + f = false + } else { + f = true + } + } + if r.Namespace != "" { + if o.GetNamespace() == r.Namespace { + f = false + } else { + f = true + } + } + return f +} + +func (r *LinkSet) PrepareForCreate(ctx context.Context, obj runtime.Object) { + // status cannot be set upon create -> reset it + newobj := obj.(*LinkSet) + newobj.Status = LinkSetStatus{} +} + +// ValidateCreate statically validates +func (r *LinkSet) ValidateCreate(ctx context.Context, obj runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +func (r *LinkSet) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { + // ensure the status dont get updated + newobj := obj.(*LinkSet) + oldObj := old.(*LinkSet) + newobj.Status = oldObj.Status +} + +func (r *LinkSet) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} diff --git a/apis/infra/linkset_types.go b/apis/infra/linkset_types.go new file mode 100644 index 0000000..147d473 --- /dev/null +++ b/apis/infra/linkset_types.go @@ -0,0 +1,77 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "reflect" + + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/id" + "github.com/kuidio/kuid/apis/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// LinkSetSpec defines the desired state of LinkSet +type LinkSetSpec struct { + // Endpoints define the endpoint identifiers of the LinkSet + Endpoints []*id.PartitionEndpointID `json:"endpoints" yaml:"endpoints" protobuf:"bytes,1,opt,name=endpoints"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + common.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,2,opt,name=userDefinedLabels"` +} + +// LinkSetStatus defines the observed state of LinkSet +type LinkSetStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condition.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` + // ESI defines the ethernet segment identifier of the logical link + // if set this is a multi-homed linkset + // the ESI is a global unique identifier within the administrative domain/topology + ESI *uint32 `json:"esi,omitempty" yaml:"esi,omitempty" protobuf:"varint,2,opt,name=esi"` + // LagId defines the lag id for the logical single-homed or multi-homed + // endpoint + LagId *uint32 `json:"lagId,omitempty" yaml:"lagId,omitempty" protobuf:"varint,3,opt,name=lagId"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// A linkSet represents a set of links that belong together within a node group or accross nodeGroups. +// E.g. it can be used to model a logical Link Aggregation group between 2 nodes or +// it can be used to represent a logical multi-homing construction between a set of nodes +// belonging to 1 or multiple nodeGroups/Topologies. +type LinkSet struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec LinkSetSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status LinkSetStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// LinkSetList contains a list of LinkSets +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type LinkSetList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []LinkSet `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + LinkSetKind = reflect.TypeOf(LinkSet{}).Name() + LinkSetKindList = reflect.TypeOf(LinkSetList{}).Name() +) diff --git a/apis/infra/location.go b/apis/infra/location.go new file mode 100644 index 0000000..5177365 --- /dev/null +++ b/apis/infra/location.go @@ -0,0 +1,22 @@ +/* +Copyright 2024 Nokia. + +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 infra + +type Location struct { + Latitude string `json:"latitude" yaml:"latitude" protobuf:"bytes,1,opt,name=latitude"` + Longitude string `json:"longitude" yaml:"longitude" protobuf:"bytes,2,opt,name=longitude"` +} diff --git a/apis/infra/module_helper.go b/apis/infra/module_helper.go new file mode 100644 index 0000000..52a3c29 --- /dev/null +++ b/apis/infra/module_helper.go @@ -0,0 +1,32 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "github.com/kform-dev/choreo/apis/condition" +) + +// GetCondition returns the condition based on the condition kind +func (r *Module) GetCondition(t condition.ConditionType) condition.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *Module) SetConditions(c ...condition.Condition) { + r.Status.SetConditions(c...) +} diff --git a/apis/infra/module_resource.go b/apis/infra/module_resource.go new file mode 100644 index 0000000..86b8a05 --- /dev/null +++ b/apis/infra/module_resource.go @@ -0,0 +1,312 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "context" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/kform-dev/choreo/apis/condition" + apiequality "k8s.io/apimachinery/pkg/api/equality" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/util/validation/field" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +const ( + ModulePlural = "modules" + ModuleSingular = "module" +) + +var ( + ModuleShortNames = []string{} + ModuleCategories = []string{"kuid", "knet"} +) + +// +k8s:deepcopy-gen=false +var _ resource.InternalObject = &Module{} +var _ resource.ObjectList = &ModuleList{} +var _ resource.ObjectWithStatusSubResource = &Module{} +var _ resource.StatusSubResource = &ModuleStatus{} + +func (Module) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: ModulePlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (Module) IsStorageVersion() bool { + return true +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (Module) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *Module) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// GetSingularName returns the singular name of the resource +// GetSingularName implements resource.Object +func (Module) GetSingularName() string { + return ModuleSingular +} + +// GetShortNames returns the shortnames for the resource +// GetShortNames implements resource.Object +func (Module) GetShortNames() []string { + return ModuleShortNames +} + +// GetCategories return the categories of the resource +// GetCategories implements resource.Object +func (Module) GetCategories() []string { + return ModuleCategories +} + +// New return an empty resource +// New implements resource.Object +func (Module) New() runtime.Object { + return &Module{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (Module) NewList() runtime.Object { + return &ModuleList{} +} + +// IsEqual returns a bool indicating if the desired state of both resources is equal or not +func (r *Module) IsEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*Module) + oldobj := old.(*Module) + + if !apiequality.Semantic.DeepEqual(oldobj.ObjectMeta, newobj.ObjectMeta) { + return false + } + // if equal we also test the spec + return apiequality.Semantic.DeepEqual(oldobj.Spec, newobj.Spec) +} + +// GetStatus return the resource.StatusSubResource interface +func (r *Module) GetStatus() resource.StatusSubResource { + return r.Status +} + +// IsStatusEqual returns a bool indicating if the status of both resources is equal or not +func (r *Module) IsStatusEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*Module) + oldobj := old.(*Module) + return apiequality.Semantic.DeepEqual(oldobj.Status, newobj.Status) +} + +// PrepareForStatusUpdate prepares the status update +func (r *Module) PrepareForStatusUpdate(ctx context.Context, obj, old runtime.Object) { + newObj := obj.(*Module) + oldObj := old.(*Module) + newObj.Spec = oldObj.Spec + + // Status updates are for only for updating status, not objectmeta. + metav1.ResetObjectMetaForStatus(&newObj.ObjectMeta, &newObj.ObjectMeta) +} + +// ValidateStatusUpdate validates status updates +func (r *Module) ValidateStatusUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +// SubResourceName resturns the name of the subresource +// SubResourceName implements the resource.StatusSubResource +func (ModuleStatus) SubResourceName() string { + return fmt.Sprintf("%s/%s", ModulePlural, "status") +} + +// CopyTo copies the content of the status subresource to a parent resource. +// CopyTo implements the resource.StatusSubResource +func (r ModuleStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { + parent, ok := obj.(*Module) + if ok { + parent.Status = r + } +} + +// GetListMeta returns the ListMeta +// GetListMeta implements the resource.ObjectList +func (r *ModuleList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// TableConvertor return the table format of the resource +func (r *Module) TableConvertor() func(gr schema.GroupResource) rest.TableConvertor { + return func(gr schema.GroupResource) rest.TableConvertor { + return registry.NewTableConverter( + gr, + func(obj runtime.Object) []interface{} { + claim, ok := obj.(*Module) + if !ok { + return nil + } + return []interface{}{ + claim.GetName(), + claim.GetCondition(condition.ConditionTypeReady).Status, + } + }, + []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + {Name: "Ready", Type: "string"}, + }, + ) + } +} + +// FieldLabelConversion is the schema conversion function for normalizing the FieldSelector for the resource +func (r *Module) FieldLabelConversion() runtime.FieldLabelConversionFunc { + return func(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } + } +} + +func (r *Module) FieldSelector() func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + return func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + var filter *ModuleFilter + + // add the namespace to the list + namespace, ok := genericapirequest.NamespaceFrom(ctx) + if fieldSelector == nil { + if ok { + return &ModuleFilter{Namespace: namespace}, nil + } + return filter, nil + } + requirements := fieldSelector.Requirements() + for _, requirement := range requirements { + filter = &ModuleFilter{} + switch requirement.Operator { + case selection.Equals, selection.DoesNotExist: + if requirement.Value == "" { + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) + } + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) + } + + switch requirement.Field { + case "metadata.name": + filter.Name = requirement.Value + case "metadata.namespace": + filter.Namespace = requirement.Value + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) + } + } + // add namespace to the filter selector if specified + if ok { + if filter != nil { + filter.Namespace = namespace + } else { + filter = &ModuleFilter{Namespace: namespace} + } + return filter, nil + } + + return &ModuleFilter{}, nil + } + +} + +type ModuleFilter struct { + // Name filters by the name of the objects + Name string `protobuf:"bytes,1,opt,name=name"` + + // Namespace filters by the namespace of the objects + Namespace string `protobuf:"bytes,2,opt,name=namespace"` +} + +func (r *ModuleFilter) Filter(ctx context.Context, obj runtime.Object) bool { + f := false // result of the previous filter + o, ok := obj.(*Module) + if !ok { + return f + } + if r == nil { + return false + } + if r.Name != "" { + if o.GetName() == r.Name { + f = false + } else { + f = true + } + } + if r.Namespace != "" { + if o.GetNamespace() == r.Namespace { + f = false + } else { + f = true + } + } + return f +} + +func (r *Module) PrepareForCreate(ctx context.Context, obj runtime.Object) { + // status cannot be set upon create -> reset it + newobj := obj.(*Module) + newobj.Status = ModuleStatus{} +} + +// ValidateCreate statically validates +func (r *Module) ValidateCreate(ctx context.Context, obj runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +func (r *Module) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { + // ensure the status dont get updated + newobj := obj.(*Module) + oldObj := old.(*Module) + newobj.Status = oldObj.Status +} + +func (r *Module) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} diff --git a/apis/infra/module_types.go b/apis/infra/module_types.go new file mode 100644 index 0000000..cc083ed --- /dev/null +++ b/apis/infra/module_types.go @@ -0,0 +1,71 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "reflect" + + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/id" + "github.com/kuidio/kuid/apis/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// ModuleSpec defines the desired state of Module +type ModuleSpec struct { + // NodeID identifies the node identity this resource belongs to + id.PartitionNodeID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"` + // ModuelBay defines the bay in which the module is deployed + ModuleBay int `json:"moduleBay" yaml:"moduleBay" protobuf:"bytes,2,opt,name=moduleBay"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + common.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` +} + +// ModuleStatus defines the observed state of Module +type ModuleStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condition.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// A module refers to a hardware component or expansion module that can be installed within a ModuleBay of a Node. +// Modules provide additional functionality and capabilities to the infrastructure environment, +// allowing users to enhance and customize their deployments according to specific requirements. +type Module struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec ModuleSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status ModuleStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// ModuleList contains a list of Modules +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type ModuleList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []Module `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + ModuleKind = reflect.TypeOf(Module{}).Name() + ModuleKindList = reflect.TypeOf(ModuleList{}).Name() +) diff --git a/apis/infra/modulebay_helper.go b/apis/infra/modulebay_helper.go new file mode 100644 index 0000000..c60e973 --- /dev/null +++ b/apis/infra/modulebay_helper.go @@ -0,0 +1,32 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "github.com/kform-dev/choreo/apis/condition" +) + +// GetCondition returns the condition based on the condition kind +func (r *ModuleBay) GetCondition(t condition.ConditionType) condition.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *ModuleBay) SetConditions(c ...condition.Condition) { + r.Status.SetConditions(c...) +} diff --git a/apis/infra/modulebay_resource.go b/apis/infra/modulebay_resource.go new file mode 100644 index 0000000..9c654d9 --- /dev/null +++ b/apis/infra/modulebay_resource.go @@ -0,0 +1,312 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "context" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/kform-dev/choreo/apis/condition" + apiequality "k8s.io/apimachinery/pkg/api/equality" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/util/validation/field" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +const ( + ModuleBayPlural = "modulebays" + ModuleBaySingular = "modulebay" +) + +var ( + ModuleBayShortNames = []string{} + ModuleBayCategories = []string{"kuid", "knet"} +) + +// +k8s:deepcopy-gen=false +var _ resource.InternalObject = &ModuleBay{} +var _ resource.ObjectList = &ModuleBayList{} +var _ resource.ObjectWithStatusSubResource = &ModuleBay{} +var _ resource.StatusSubResource = &ModuleBayStatus{} + +func (ModuleBay) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: ModuleBayPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (ModuleBay) IsStorageVersion() bool { + return true +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (ModuleBay) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *ModuleBay) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// GetSingularName returns the singular name of the resource +// GetSingularName implements resource.Object +func (ModuleBay) GetSingularName() string { + return ModuleBaySingular +} + +// GetShortNames returns the shortnames for the resource +// GetShortNames implements resource.Object +func (ModuleBay) GetShortNames() []string { + return ModuleBayShortNames +} + +// GetCategories return the categories of the resource +// GetCategories implements resource.Object +func (ModuleBay) GetCategories() []string { + return ModuleBayCategories +} + +// New return an empty resource +// New implements resource.Object +func (ModuleBay) New() runtime.Object { + return &ModuleBay{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (ModuleBay) NewList() runtime.Object { + return &ModuleBayList{} +} + +// IsEqual returns a bool indicating if the desired state of both resources is equal or not +func (r *ModuleBay) IsEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*ModuleBay) + oldobj := old.(*ModuleBay) + + if !apiequality.Semantic.DeepEqual(oldobj.ObjectMeta, newobj.ObjectMeta) { + return false + } + // if equal we also test the spec + return apiequality.Semantic.DeepEqual(oldobj.Spec, newobj.Spec) +} + +// GetStatus return the resource.StatusSubResource interface +func (r *ModuleBay) GetStatus() resource.StatusSubResource { + return r.Status +} + +// IsStatusEqual returns a bool indicating if the status of both resources is equal or not +func (r *ModuleBay) IsStatusEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*ModuleBay) + oldobj := old.(*ModuleBay) + return apiequality.Semantic.DeepEqual(oldobj.Status, newobj.Status) +} + +// PrepareForStatusUpdate prepares the status update +func (r *ModuleBay) PrepareForStatusUpdate(ctx context.Context, obj, old runtime.Object) { + newObj := obj.(*ModuleBay) + oldObj := old.(*ModuleBay) + newObj.Spec = oldObj.Spec + + // Status updates are for only for updating status, not objectmeta. + metav1.ResetObjectMetaForStatus(&newObj.ObjectMeta, &newObj.ObjectMeta) +} + +// ValidateStatusUpdate validates status updates +func (r *ModuleBay) ValidateStatusUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +// SubResourceName resturns the name of the subresource +// SubResourceName implements the resource.StatusSubResource +func (ModuleBayStatus) SubResourceName() string { + return fmt.Sprintf("%s/%s", ModuleBayPlural, "status") +} + +// CopyTo copies the content of the status subresource to a parent resource. +// CopyTo implements the resource.StatusSubResource +func (r ModuleBayStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { + parent, ok := obj.(*ModuleBay) + if ok { + parent.Status = r + } +} + +// GetListMeta returns the ListMeta +// GetListMeta implements the resource.ObjectList +func (r *ModuleBayList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// TableConvertor return the table format of the resource +func (r *ModuleBay) TableConvertor() func(gr schema.GroupResource) rest.TableConvertor { + return func(gr schema.GroupResource) rest.TableConvertor { + return registry.NewTableConverter( + gr, + func(obj runtime.Object) []interface{} { + claim, ok := obj.(*ModuleBay) + if !ok { + return nil + } + return []interface{}{ + claim.GetName(), + claim.GetCondition(condition.ConditionTypeReady).Status, + } + }, + []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + {Name: "Ready", Type: "string"}, + }, + ) + } +} + +// FieldLabelConversion is the schema conversion function for normalizing the FieldSelector for the resource +func (r *ModuleBay) FieldLabelConversion() runtime.FieldLabelConversionFunc { + return func(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } + } +} + +func (r *ModuleBay) FieldSelector() func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + return func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + var filter *ModuleBayFilter + + // add the namespace to the list + namespace, ok := genericapirequest.NamespaceFrom(ctx) + if fieldSelector == nil { + if ok { + return &ModuleBayFilter{Namespace: namespace}, nil + } + return filter, nil + } + requirements := fieldSelector.Requirements() + for _, requirement := range requirements { + filter = &ModuleBayFilter{} + switch requirement.Operator { + case selection.Equals, selection.DoesNotExist: + if requirement.Value == "" { + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) + } + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) + } + + switch requirement.Field { + case "metadata.name": + filter.Name = requirement.Value + case "metadata.namespace": + filter.Namespace = requirement.Value + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) + } + } + // add namespace to the filter selector if specified + if ok { + if filter != nil { + filter.Namespace = namespace + } else { + filter = &ModuleBayFilter{Namespace: namespace} + } + return filter, nil + } + + return &ModuleBayFilter{}, nil + } + +} + +type ModuleBayFilter struct { + // Name filters by the name of the objects + Name string `protobuf:"bytes,1,opt,name=name"` + + // Namespace filters by the namespace of the objects + Namespace string `protobuf:"bytes,2,opt,name=namespace"` +} + +func (r *ModuleBayFilter) Filter(ctx context.Context, obj runtime.Object) bool { + f := false // result of the previous filter + o, ok := obj.(*ModuleBay) + if !ok { + return f + } + if r == nil { + return false + } + if r.Name != "" { + if o.GetName() == r.Name { + f = false + } else { + f = true + } + } + if r.Namespace != "" { + if o.GetNamespace() == r.Namespace { + f = false + } else { + f = true + } + } + return f +} + +func (r *ModuleBay) PrepareForCreate(ctx context.Context, obj runtime.Object) { + // status cannot be set upon create -> reset it + newobj := obj.(*ModuleBay) + newobj.Status = ModuleBayStatus{} +} + +// ValidateCreate statically validates +func (r *ModuleBay) ValidateCreate(ctx context.Context, obj runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +func (r *ModuleBay) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { + // ensure the status dont get updated + newobj := obj.(*ModuleBay) + oldObj := old.(*ModuleBay) + newobj.Status = oldObj.Status +} + +func (r *ModuleBay) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} diff --git a/apis/infra/modulebay_types.go b/apis/infra/modulebay_types.go new file mode 100644 index 0000000..6db48bd --- /dev/null +++ b/apis/infra/modulebay_types.go @@ -0,0 +1,71 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "reflect" + + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/id" + "github.com/kuidio/kuid/apis/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// ModuleBaySpec defines the desired state of ModuleBay +type ModuleBaySpec struct { + // NodeID identifies the node identity this resource belongs to + id.PartitionNodeID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"` + // Position defines the position in the node the moduleBay is deployed + Position int `json:"psoition" yaml:"psoition" protobuf:"bytes,2,opt,name=psoition"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + common.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` +} + +// ModuleBayStatus defines the observed state of ModuleBay +type ModuleBayStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condition.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// A ModuleBay serves as a modular slot or enclosure within a Node, designed to accommodate additional modules. +// ModuleBays provide a flexible and scalable approach to extending the capabilities of Nodes, +// allowing users to customize and enhance their infrastructure deployments according to specific requirements. +type ModuleBay struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec ModuleBaySpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status ModuleBayStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// ModuleBayList contains a list of ModuleBays +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type ModuleBayList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []ModuleBay `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + ModuleBayKind = reflect.TypeOf(ModuleBay{}).Name() + ModuleBayKindList = reflect.TypeOf(ModuleBayList{}).Name() +) diff --git a/apis/infra/node_helper.go b/apis/infra/node_helper.go new file mode 100644 index 0000000..b05bdc9 --- /dev/null +++ b/apis/infra/node_helper.go @@ -0,0 +1,32 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "github.com/kform-dev/choreo/apis/condition" +) + +// GetCondition returns the condition based on the condition kind +func (r *Node) GetCondition(t condition.ConditionType) condition.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *Node) SetConditions(c ...condition.Condition) { + r.Status.SetConditions(c...) +} diff --git a/apis/infra/node_resource.go b/apis/infra/node_resource.go new file mode 100644 index 0000000..23c5362 --- /dev/null +++ b/apis/infra/node_resource.go @@ -0,0 +1,312 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "context" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/kform-dev/choreo/apis/condition" + apiequality "k8s.io/apimachinery/pkg/api/equality" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/util/validation/field" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +const ( + NodePlural = "nodes" + NodeSingular = "node" +) + +var ( + NodeShortNames = []string{} + NodeCategories = []string{"kuid", "knet"} +) + +// +k8s:deepcopy-gen=false +var _ resource.InternalObject = &Node{} +var _ resource.ObjectList = &NodeList{} +var _ resource.ObjectWithStatusSubResource = &Node{} +var _ resource.StatusSubResource = &NodeStatus{} + +func (Node) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: NodePlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (Node) IsStorageVersion() bool { + return true +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (Node) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *Node) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// GetSingularName returns the singular name of the resource +// GetSingularName implements resource.Object +func (Node) GetSingularName() string { + return NodeSingular +} + +// GetShortNames returns the shortnames for the resource +// GetShortNames implements resource.Object +func (Node) GetShortNames() []string { + return NodeShortNames +} + +// GetCategories return the categories of the resource +// GetCategories implements resource.Object +func (Node) GetCategories() []string { + return NodeCategories +} + +// New return an empty resource +// New implements resource.Object +func (Node) New() runtime.Object { + return &Node{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (Node) NewList() runtime.Object { + return &NodeList{} +} + +// IsEqual returns a bool indicating if the desired state of both resources is equal or not +func (r *Node) IsEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*Node) + oldobj := old.(*Node) + + if !apiequality.Semantic.DeepEqual(oldobj.ObjectMeta, newobj.ObjectMeta) { + return false + } + // if equal we also test the spec + return apiequality.Semantic.DeepEqual(oldobj.Spec, newobj.Spec) +} + +// GetStatus return the resource.StatusSubResource interface +func (r *Node) GetStatus() resource.StatusSubResource { + return r.Status +} + +// IsStatusEqual returns a bool indicating if the status of both resources is equal or not +func (r *Node) IsStatusEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*Node) + oldobj := old.(*Node) + return apiequality.Semantic.DeepEqual(oldobj.Status, newobj.Status) +} + +// PrepareForStatusUpdate prepares the status update +func (r *Node) PrepareForStatusUpdate(ctx context.Context, obj, old runtime.Object) { + newObj := obj.(*Node) + oldObj := old.(*Node) + newObj.Spec = oldObj.Spec + + // Status updates are for only for updating status, not objectmeta. + metav1.ResetObjectMetaForStatus(&newObj.ObjectMeta, &newObj.ObjectMeta) +} + +// ValidateStatusUpdate validates status updates +func (r *Node) ValidateStatusUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +// SubResourceName resturns the name of the subresource +// SubResourceName implements the resource.StatusSubResource +func (NodeStatus) SubResourceName() string { + return fmt.Sprintf("%s/%s", NodePlural, "status") +} + +// CopyTo copies the content of the status subresource to a parent resource. +// CopyTo implements the resource.StatusSubResource +func (r NodeStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { + parent, ok := obj.(*Node) + if ok { + parent.Status = r + } +} + +// GetListMeta returns the ListMeta +// GetListMeta implements the resource.ObjectList +func (r *NodeList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// TableConvertor return the table format of the resource +func (r *Node) TableConvertor() func(gr schema.GroupResource) rest.TableConvertor { + return func(gr schema.GroupResource) rest.TableConvertor { + return registry.NewTableConverter( + gr, + func(obj runtime.Object) []interface{} { + claim, ok := obj.(*Node) + if !ok { + return nil + } + return []interface{}{ + claim.GetName(), + claim.GetCondition(condition.ConditionTypeReady).Status, + } + }, + []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + {Name: "Ready", Type: "string"}, + }, + ) + } +} + +// FieldLabelConversion is the schema conversion function for normalizing the FieldSelector for the resource +func (r *Node) FieldLabelConversion() runtime.FieldLabelConversionFunc { + return func(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } + } +} + +func (r *Node) FieldSelector() func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + return func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + var filter *NodeFilter + + // add the namespace to the list + namespace, ok := genericapirequest.NamespaceFrom(ctx) + if fieldSelector == nil { + if ok { + return &NodeFilter{Namespace: namespace}, nil + } + return filter, nil + } + requirements := fieldSelector.Requirements() + for _, requirement := range requirements { + filter = &NodeFilter{} + switch requirement.Operator { + case selection.Equals, selection.DoesNotExist: + if requirement.Value == "" { + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) + } + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) + } + + switch requirement.Field { + case "metadata.name": + filter.Name = requirement.Value + case "metadata.namespace": + filter.Namespace = requirement.Value + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) + } + } + // add namespace to the filter selector if specified + if ok { + if filter != nil { + filter.Namespace = namespace + } else { + filter = &NodeFilter{Namespace: namespace} + } + return filter, nil + } + + return &NodeFilter{}, nil + } + +} + +type NodeFilter struct { + // Name filters by the name of the objects + Name string `protobuf:"bytes,1,opt,name=name"` + + // Namespace filters by the namespace of the objects + Namespace string `protobuf:"bytes,2,opt,name=namespace"` +} + +func (r *NodeFilter) Filter(ctx context.Context, obj runtime.Object) bool { + f := false // result of the previous filter + o, ok := obj.(*Node) + if !ok { + return f + } + if r == nil { + return false + } + if r.Name != "" { + if o.GetName() == r.Name { + f = false + } else { + f = true + } + } + if r.Namespace != "" { + if o.GetNamespace() == r.Namespace { + f = false + } else { + f = true + } + } + return f +} + +func (r *Node) PrepareForCreate(ctx context.Context, obj runtime.Object) { + // status cannot be set upon create -> reset it + newobj := obj.(*Node) + newobj.Status = NodeStatus{} +} + +// ValidateCreate statically validates +func (r *Node) ValidateCreate(ctx context.Context, obj runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +func (r *Node) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { + // ensure the status dont get updated + newobj := obj.(*Node) + oldObj := old.(*Node) + newobj.Status = oldObj.Status +} + +func (r *Node) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} diff --git a/apis/infra/node_types.go b/apis/infra/node_types.go new file mode 100644 index 0000000..f216c99 --- /dev/null +++ b/apis/infra/node_types.go @@ -0,0 +1,97 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "reflect" + + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/id" + "github.com/kuidio/kuid/apis/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// NodeSpec defines the desired state of Node +type NodeSpec struct { + // NodeGroupNodeID identifies the nodeGroup identity this resource belongs to + id.PartitionNodeID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"` + // Rack defines the rack in which the node is deployed + // +optional + Rack *string `json:"rack,omitempty" yaml:"rack,omitempty" protobuf:"bytes,2,opt,name=rack"` + // relative position in the rack + // +optional + Position *string `json:"position,omitempty" yaml:"position,omitempty" protobuf:"bytes,3,opt,name=position"` + // Location defines the location information where this resource is located + // in lon/lat coordinates + // +optional + Location *Location `json:"location,omitempty" yaml:"location,omitempty" protobuf:"bytes,4,opt,name=location"` + // Provider defines the provider implementing this resource. + Provider string `json:"provider" yaml:"provider" protobuf:"bytes,5,opt,name=provider"` + // PlatformType define the type of platform implementing the nodespec + PlatformType string `json:"platformType" yaml:"platformType" protobuf:"bytes,6,opt,name=platformType"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + common.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,7,opt,name=userDefinedLabels"` + + // TBD + // Serial number + // Node config + // Initial config + // IPAddress: IPv4 or IPv6 + // OOB IPAddress +} + +// NodeStatus defines the observed state of Node +type NodeStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condition.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` + // System ID define the unique system id of the node + // +optional + SystemID *string `json:"systemID,omitempty" yaml:"systemID,omitempty" protobuf:"bytes,2,opt,name=systemID"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// A Node represents a fundamental unit that implements compute, storage, and/or networking within your environment. +// Nodes can embody physical, virtual, or containerized entities, offering versatility in deployment options to suit +// diverse infrastructure requirements. +// Nodes are logically organized within racks and sites/regions, establishing a hierarchical structure for efficient +// resource management and organization. Additionally, Nodes are associated with nodeGroups, facilitating centralized +// management and control within defined administrative boundaries. +// Each Node is assigned a provider, representing the entity responsible for implementing the specifics of the Node. +type Node struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec NodeSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status NodeStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// NodeList contains a list of Nodes +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type NodeList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []Node `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + NodeKind = reflect.TypeOf(Node{}).Name() + NodeKindList = reflect.TypeOf(NodeList{}).Name() +) diff --git a/apis/infra/nodeitem_helper.go b/apis/infra/nodeitem_helper.go new file mode 100644 index 0000000..870b0f5 --- /dev/null +++ b/apis/infra/nodeitem_helper.go @@ -0,0 +1,32 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "github.com/kform-dev/choreo/apis/condition" +) + +// GetCondition returns the condition based on the condition kind +func (r *NodeItem) GetCondition(t condition.ConditionType) condition.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *NodeItem) SetConditions(c ...condition.Condition) { + r.Status.SetConditions(c...) +} diff --git a/apis/infra/nodeitem_resource.go b/apis/infra/nodeitem_resource.go new file mode 100644 index 0000000..8d44dc9 --- /dev/null +++ b/apis/infra/nodeitem_resource.go @@ -0,0 +1,312 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "context" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/kform-dev/choreo/apis/condition" + apiequality "k8s.io/apimachinery/pkg/api/equality" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/util/validation/field" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +const ( + NodeItemPlural = "nodeitems" + NodeItemSingular = "nodeitem" +) + +var ( + NodeItemShortNames = []string{} + NodeItemCategories = []string{"kuid", "knet"} +) + +// +k8s:deepcopy-gen=false +var _ resource.InternalObject = &NodeItem{} +var _ resource.ObjectList = &NodeItemList{} +var _ resource.ObjectWithStatusSubResource = &NodeItem{} +var _ resource.StatusSubResource = &NodeItemStatus{} + +func (NodeItem) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: NodeItemPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (NodeItem) IsStorageVersion() bool { + return true +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (NodeItem) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *NodeItem) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// GetSingularName returns the singular name of the resource +// GetSingularName implements resource.Object +func (NodeItem) GetSingularName() string { + return NodeItemSingular +} + +// GetShortNames returns the shortnames for the resource +// GetShortNames implements resource.Object +func (NodeItem) GetShortNames() []string { + return NodeItemShortNames +} + +// GetCategories return the categories of the resource +// GetCategories implements resource.Object +func (NodeItem) GetCategories() []string { + return NodeItemCategories +} + +// New return an empty resource +// New implements resource.Object +func (NodeItem) New() runtime.Object { + return &NodeItem{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (NodeItem) NewList() runtime.Object { + return &NodeItemList{} +} + +// IsEqual returns a bool indicating if the desired state of both resources is equal or not +func (r *NodeItem) IsEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*NodeItem) + oldobj := old.(*NodeItem) + + if !apiequality.Semantic.DeepEqual(oldobj.ObjectMeta, newobj.ObjectMeta) { + return false + } + // if equal we also test the spec + return apiequality.Semantic.DeepEqual(oldobj.Spec, newobj.Spec) +} + +// GetStatus return the resource.StatusSubResource interface +func (r *NodeItem) GetStatus() resource.StatusSubResource { + return r.Status +} + +// IsStatusEqual returns a bool indicating if the status of both resources is equal or not +func (r *NodeItem) IsStatusEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*NodeItem) + oldobj := old.(*NodeItem) + return apiequality.Semantic.DeepEqual(oldobj.Status, newobj.Status) +} + +// PrepareForStatusUpdate prepares the status update +func (r *NodeItem) PrepareForStatusUpdate(ctx context.Context, obj, old runtime.Object) { + newObj := obj.(*NodeItem) + oldObj := old.(*NodeItem) + newObj.Spec = oldObj.Spec + + // Status updates are for only for updating status, not objectmeta. + metav1.ResetObjectMetaForStatus(&newObj.ObjectMeta, &newObj.ObjectMeta) +} + +// ValidateStatusUpdate validates status updates +func (r *NodeItem) ValidateStatusUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +// SubResourceName resturns the name of the subresource +// SubResourceName implements the resource.StatusSubResource +func (NodeItemStatus) SubResourceName() string { + return fmt.Sprintf("%s/%s", NodeItemPlural, "status") +} + +// CopyTo copies the content of the status subresource to a parent resource. +// CopyTo implements the resource.StatusSubResource +func (r NodeItemStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { + parent, ok := obj.(*NodeItem) + if ok { + parent.Status = r + } +} + +// GetListMeta returns the ListMeta +// GetListMeta implements the resource.ObjectList +func (r *NodeItemList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// TableConvertor return the table format of the resource +func (r *NodeItem) TableConvertor() func(gr schema.GroupResource) rest.TableConvertor { + return func(gr schema.GroupResource) rest.TableConvertor { + return registry.NewTableConverter( + gr, + func(obj runtime.Object) []interface{} { + claim, ok := obj.(*NodeItem) + if !ok { + return nil + } + return []interface{}{ + claim.GetName(), + claim.GetCondition(condition.ConditionTypeReady).Status, + } + }, + []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + {Name: "Ready", Type: "string"}, + }, + ) + } +} + +// FieldLabelConversion is the schema conversion function for normalizing the FieldSelector for the resource +func (r *NodeItem) FieldLabelConversion() runtime.FieldLabelConversionFunc { + return func(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } + } +} + +func (r *NodeItem) FieldSelector() func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + return func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + var filter *NodeItemFilter + + // add the namespace to the list + namespace, ok := genericapirequest.NamespaceFrom(ctx) + if fieldSelector == nil { + if ok { + return &NodeItemFilter{Namespace: namespace}, nil + } + return filter, nil + } + requirements := fieldSelector.Requirements() + for _, requirement := range requirements { + filter = &NodeItemFilter{} + switch requirement.Operator { + case selection.Equals, selection.DoesNotExist: + if requirement.Value == "" { + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) + } + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) + } + + switch requirement.Field { + case "metadata.name": + filter.Name = requirement.Value + case "metadata.namespace": + filter.Namespace = requirement.Value + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) + } + } + // add namespace to the filter selector if specified + if ok { + if filter != nil { + filter.Namespace = namespace + } else { + filter = &NodeItemFilter{Namespace: namespace} + } + return filter, nil + } + + return &NodeItemFilter{}, nil + } + +} + +type NodeItemFilter struct { + // Name filters by the name of the objects + Name string `protobuf:"bytes,1,opt,name=name"` + + // Namespace filters by the namespace of the objects + Namespace string `protobuf:"bytes,2,opt,name=namespace"` +} + +func (r *NodeItemFilter) Filter(ctx context.Context, obj runtime.Object) bool { + f := false // result of the previous filter + o, ok := obj.(*NodeItem) + if !ok { + return f + } + if r == nil { + return false + } + if r.Name != "" { + if o.GetName() == r.Name { + f = false + } else { + f = true + } + } + if r.Namespace != "" { + if o.GetNamespace() == r.Namespace { + f = false + } else { + f = true + } + } + return f +} + +func (r *NodeItem) PrepareForCreate(ctx context.Context, obj runtime.Object) { + // status cannot be set upon create -> reset it + newobj := obj.(*NodeItem) + newobj.Status = NodeItemStatus{} +} + +// ValidateCreate statically validates +func (r *NodeItem) ValidateCreate(ctx context.Context, obj runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +func (r *NodeItem) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { + // ensure the status dont get updated + newobj := obj.(*NodeItem) + oldObj := old.(*NodeItem) + newobj.Status = oldObj.Status +} + +func (r *NodeItem) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} diff --git a/apis/infra/nodeitem_types.go b/apis/infra/nodeitem_types.go new file mode 100644 index 0000000..f517e8d --- /dev/null +++ b/apis/infra/nodeitem_types.go @@ -0,0 +1,70 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "reflect" + + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/id" + "github.com/kuidio/kuid/apis/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// NodeItemSpec defines the desired state of NodeItem +type NodeItemSpec struct { + // NodeID identifies the node identity this resource belongs to + id.PartitionNodeID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + common.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,2,opt,name=userDefinedLabels"` +} + +// NodeItemStatus defines the observed state of NodeItem +type NodeItemStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condition.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// A NodeItem represents a specific hardware component or accessory associated with a Node. +// NodeItems represent a wide range of hardware elements, e.g Fan(s), PowerUnit(s), CPU(s), +// and other peripheral devices essential for the operation of the Node. +// NodeItem is used to represent the modular components of a node. +type NodeItem struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec NodeItemSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status NodeItemStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// NodeItemList contains a list of NodeItems +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type NodeItemList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []NodeItem `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + NodeItemKind = reflect.TypeOf(NodeItem{}).Name() + NodeItemKindList = reflect.TypeOf(NodeItemList{}).Name() +) diff --git a/apis/infra/nodeset_helper.go b/apis/infra/nodeset_helper.go new file mode 100644 index 0000000..fa7e27d --- /dev/null +++ b/apis/infra/nodeset_helper.go @@ -0,0 +1,32 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "github.com/kform-dev/choreo/apis/condition" +) + +// GetCondition returns the condition based on the condition kind +func (r *NodeSet) GetCondition(t condition.ConditionType) condition.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *NodeSet) SetConditions(c ...condition.Condition) { + r.Status.SetConditions(c...) +} diff --git a/apis/infra/nodeset_resource.go b/apis/infra/nodeset_resource.go new file mode 100644 index 0000000..40b6b2c --- /dev/null +++ b/apis/infra/nodeset_resource.go @@ -0,0 +1,312 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "context" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/kform-dev/choreo/apis/condition" + apiequality "k8s.io/apimachinery/pkg/api/equality" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/util/validation/field" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +const ( + NodeSetPlural = "nodesets" + NodeSetSingular = "nodeset" +) + +var ( + NodeSetShortNames = []string{} + NodeSetCategories = []string{"kuid", "knet"} +) + +// +k8s:deepcopy-gen=false +var _ resource.InternalObject = &NodeSet{} +var _ resource.ObjectList = &NodeSetList{} +var _ resource.ObjectWithStatusSubResource = &NodeSet{} +var _ resource.StatusSubResource = &NodeSetStatus{} + +func (NodeSet) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: NodeSetPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (NodeSet) IsStorageVersion() bool { + return true +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (NodeSet) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *NodeSet) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// GetSingularName returns the singular name of the resource +// GetSingularName implements resource.Object +func (NodeSet) GetSingularName() string { + return NodeSetSingular +} + +// GetShortNames returns the shortnames for the resource +// GetShortNames implements resource.Object +func (NodeSet) GetShortNames() []string { + return NodeSetShortNames +} + +// GetCategories return the categories of the resource +// GetCategories implements resource.Object +func (NodeSet) GetCategories() []string { + return NodeSetCategories +} + +// New return an empty resource +// New implements resource.Object +func (NodeSet) New() runtime.Object { + return &NodeSet{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (NodeSet) NewList() runtime.Object { + return &NodeSetList{} +} + +// IsEqual returns a bool indicating if the desired state of both resources is equal or not +func (r *NodeSet) IsEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*NodeSet) + oldobj := old.(*NodeSet) + + if !apiequality.Semantic.DeepEqual(oldobj.ObjectMeta, newobj.ObjectMeta) { + return false + } + // if equal we also test the spec + return apiequality.Semantic.DeepEqual(oldobj.Spec, newobj.Spec) +} + +// GetStatus return the resource.StatusSubResource interface +func (r *NodeSet) GetStatus() resource.StatusSubResource { + return r.Status +} + +// IsStatusEqual returns a bool indicating if the status of both resources is equal or not +func (r *NodeSet) IsStatusEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*NodeSet) + oldobj := old.(*NodeSet) + return apiequality.Semantic.DeepEqual(oldobj.Status, newobj.Status) +} + +// PrepareForStatusUpdate prepares the status update +func (r *NodeSet) PrepareForStatusUpdate(ctx context.Context, obj, old runtime.Object) { + newObj := obj.(*NodeSet) + oldObj := old.(*NodeSet) + newObj.Spec = oldObj.Spec + + // Status updates are for only for updating status, not objectmeta. + metav1.ResetObjectMetaForStatus(&newObj.ObjectMeta, &newObj.ObjectMeta) +} + +// ValidateStatusUpdate validates status updates +func (r *NodeSet) ValidateStatusUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +// SubResourceName resturns the name of the subresource +// SubResourceName implements the resource.StatusSubResource +func (NodeSetStatus) SubResourceName() string { + return fmt.Sprintf("%s/%s", NodeSetPlural, "status") +} + +// CopyTo copies the content of the status subresource to a parent resource. +// CopyTo implements the resource.StatusSubResource +func (r NodeSetStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { + parent, ok := obj.(*NodeSet) + if ok { + parent.Status = r + } +} + +// GetListMeta returns the ListMeta +// GetListMeta implements the resource.ObjectList +func (r *NodeSetList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// TableConvertor return the table format of the resource +func (r *NodeSet) TableConvertor() func(gr schema.GroupResource) rest.TableConvertor { + return func(gr schema.GroupResource) rest.TableConvertor { + return registry.NewTableConverter( + gr, + func(obj runtime.Object) []interface{} { + claim, ok := obj.(*NodeSet) + if !ok { + return nil + } + return []interface{}{ + claim.GetName(), + claim.GetCondition(condition.ConditionTypeReady).Status, + } + }, + []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + {Name: "Ready", Type: "string"}, + }, + ) + } +} + +// FieldLabelConversion is the schema conversion function for normalizing the FieldSelector for the resource +func (r *NodeSet) FieldLabelConversion() runtime.FieldLabelConversionFunc { + return func(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } + } +} + +func (r *NodeSet) FieldSelector() func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + return func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + var filter *NodeSetFilter + + // add the namespace to the list + namespace, ok := genericapirequest.NamespaceFrom(ctx) + if fieldSelector == nil { + if ok { + return &NodeSetFilter{Namespace: namespace}, nil + } + return filter, nil + } + requirements := fieldSelector.Requirements() + for _, requirement := range requirements { + filter = &NodeSetFilter{} + switch requirement.Operator { + case selection.Equals, selection.DoesNotExist: + if requirement.Value == "" { + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) + } + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) + } + + switch requirement.Field { + case "metadata.name": + filter.Name = requirement.Value + case "metadata.namespace": + filter.Namespace = requirement.Value + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) + } + } + // add namespace to the filter selector if specified + if ok { + if filter != nil { + filter.Namespace = namespace + } else { + filter = &NodeSetFilter{Namespace: namespace} + } + return filter, nil + } + + return &NodeSetFilter{}, nil + } + +} + +type NodeSetFilter struct { + // Name filters by the name of the objects + Name string `protobuf:"bytes,1,opt,name=name"` + + // Namespace filters by the namespace of the objects + Namespace string `protobuf:"bytes,2,opt,name=namespace"` +} + +func (r *NodeSetFilter) Filter(ctx context.Context, obj runtime.Object) bool { + f := false // result of the previous filter + o, ok := obj.(*NodeSet) + if !ok { + return f + } + if r == nil { + return false + } + if r.Name != "" { + if o.GetName() == r.Name { + f = false + } else { + f = true + } + } + if r.Namespace != "" { + if o.GetNamespace() == r.Namespace { + f = false + } else { + f = true + } + } + return f +} + +func (r *NodeSet) PrepareForCreate(ctx context.Context, obj runtime.Object) { + // status cannot be set upon create -> reset it + newobj := obj.(*NodeSet) + newobj.Status = NodeSetStatus{} +} + +// ValidateCreate statically validates +func (r *NodeSet) ValidateCreate(ctx context.Context, obj runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +func (r *NodeSet) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { + // ensure the status dont get updated + newobj := obj.(*NodeSet) + oldObj := old.(*NodeSet) + newobj.Status = oldObj.Status +} + +func (r *NodeSet) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} diff --git a/apis/infra/nodeset_types.go b/apis/infra/nodeset_types.go new file mode 100644 index 0000000..c5a79fa --- /dev/null +++ b/apis/infra/nodeset_types.go @@ -0,0 +1,71 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "reflect" + + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/id" + "github.com/kuidio/kuid/apis/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// NodeSetSetSpec defines the desired state of NodeSet +type NodeSetSpec struct { + NodeSet string `json:"nodeSet" yaml:"nodeSet" protobuf:"bytes,1,opt,name=nodeSet"` + // PartitionClusterID defines the cluster partition + id.PartitionClusterID `json:",inline" yaml:",inline" protobuf:"bytes,2,opt,name=nodeID"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + common.ClaimLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` +} + +// NodeSetStatus defines the observed state of NodeSet +type NodeSetStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condition.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// A NodeSet represents a set of nodes. +// E.g. it can be used to model a set of nodes in a NodeSet that share the same +// charecteristics wrt, Numa, interfaces, etc. +// Another usage of NodeSet is the representation of a virtual Node that consists of multiple nodes. +type NodeSet struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec NodeSetSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status NodeSetStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// NodeSetList contains a list of NodeSets +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type NodeSetList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []NodeSet `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + NodeSetKind = reflect.TypeOf(NodeSet{}).Name() + NodeSetKindList = reflect.TypeOf(NodeSetList{}).Name() +) diff --git a/apis/infra/partition_helper.go b/apis/infra/partition_helper.go new file mode 100644 index 0000000..78db4b0 --- /dev/null +++ b/apis/infra/partition_helper.go @@ -0,0 +1,32 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "github.com/kform-dev/choreo/apis/condition" +) + +// GetCondition returns the condition based on the condition kind +func (r *Partition) GetCondition(t condition.ConditionType) condition.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *Partition) SetConditions(c ...condition.Condition) { + r.Status.SetConditions(c...) +} diff --git a/apis/infra/partition_resource.go b/apis/infra/partition_resource.go new file mode 100644 index 0000000..508290c --- /dev/null +++ b/apis/infra/partition_resource.go @@ -0,0 +1,312 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "context" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/kform-dev/choreo/apis/condition" + apiequality "k8s.io/apimachinery/pkg/api/equality" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/util/validation/field" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +const ( + PartitionPlural = "partitions" + PartitionSingular = "partition" +) + +var ( + PartitionShortNames = []string{} + PartitionCategories = []string{"kuid", "knet"} +) + +// +k8s:deepcopy-gen=false +var _ resource.InternalObject = &Partition{} +var _ resource.ObjectList = &PartitionList{} +var _ resource.ObjectWithStatusSubResource = &Partition{} +var _ resource.StatusSubResource = &PartitionStatus{} + +func (Partition) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: PartitionPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (Partition) IsStorageVersion() bool { + return true +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (Partition) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *Partition) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// GetSingularName returns the singular name of the resource +// GetSingularName implements resource.Object +func (Partition) GetSingularName() string { + return PartitionSingular +} + +// GetShortNames returns the shortnames for the resource +// GetShortNames implements resource.Object +func (Partition) GetShortNames() []string { + return PartitionShortNames +} + +// GetCategories return the categories of the resource +// GetCategories implements resource.Object +func (Partition) GetCategories() []string { + return PartitionCategories +} + +// New return an empty resource +// New implements resource.Object +func (Partition) New() runtime.Object { + return &Partition{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (Partition) NewList() runtime.Object { + return &PartitionList{} +} + +// IsEqual returns a bool indicating if the desired state of both resources is equal or not +func (r *Partition) IsEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*Partition) + oldobj := old.(*Partition) + + if !apiequality.Semantic.DeepEqual(oldobj.ObjectMeta, newobj.ObjectMeta) { + return false + } + // if equal we also test the spec + return apiequality.Semantic.DeepEqual(oldobj.Spec, newobj.Spec) +} + +// GetStatus return the resource.StatusSubResource interface +func (r *Partition) GetStatus() resource.StatusSubResource { + return r.Status +} + +// IsStatusEqual returns a bool indicating if the status of both resources is equal or not +func (r *Partition) IsStatusEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*Partition) + oldobj := old.(*Partition) + return apiequality.Semantic.DeepEqual(oldobj.Status, newobj.Status) +} + +// PrepareForStatusUpdate prepares the status update +func (r *Partition) PrepareForStatusUpdate(ctx context.Context, obj, old runtime.Object) { + newObj := obj.(*Partition) + oldObj := old.(*Partition) + newObj.Spec = oldObj.Spec + + // Status updates are for only for updating status, not objectmeta. + metav1.ResetObjectMetaForStatus(&newObj.ObjectMeta, &newObj.ObjectMeta) +} + +// ValidateStatusUpdate validates status updates +func (r *Partition) ValidateStatusUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +// SubResourceName resturns the name of the subresource +// SubResourceName implements the resource.StatusSubResource +func (PartitionStatus) SubResourceName() string { + return fmt.Sprintf("%s/%s", PartitionPlural, "status") +} + +// CopyTo copies the content of the status subresource to a parent resource. +// CopyTo implements the resource.StatusSubResource +func (r PartitionStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { + parent, ok := obj.(*Partition) + if ok { + parent.Status = r + } +} + +// GetListMeta returns the ListMeta +// GetListMeta implements the resource.ObjectList +func (r *PartitionList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// TableConvertor return the table format of the resource +func (r *Partition) TableConvertor() func(gr schema.GroupResource) rest.TableConvertor { + return func(gr schema.GroupResource) rest.TableConvertor { + return registry.NewTableConverter( + gr, + func(obj runtime.Object) []interface{} { + claim, ok := obj.(*Partition) + if !ok { + return nil + } + return []interface{}{ + claim.GetName(), + claim.GetCondition(condition.ConditionTypeReady).Status, + } + }, + []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + {Name: "Ready", Type: "string"}, + }, + ) + } +} + +// FieldLabelConversion is the schema conversion function for normalizing the FieldSelector for the resource +func (r *Partition) FieldLabelConversion() runtime.FieldLabelConversionFunc { + return func(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } + } +} + +func (r *Partition) FieldSelector() func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + return func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + var filter *PartitionFilter + + // add the namespace to the list + namespace, ok := genericapirequest.NamespaceFrom(ctx) + if fieldSelector == nil { + if ok { + return &PartitionFilter{Namespace: namespace}, nil + } + return filter, nil + } + requirements := fieldSelector.Requirements() + for _, requirement := range requirements { + filter = &PartitionFilter{} + switch requirement.Operator { + case selection.Equals, selection.DoesNotExist: + if requirement.Value == "" { + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) + } + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) + } + + switch requirement.Field { + case "metadata.name": + filter.Name = requirement.Value + case "metadata.namespace": + filter.Namespace = requirement.Value + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) + } + } + // add namespace to the filter selector if specified + if ok { + if filter != nil { + filter.Namespace = namespace + } else { + filter = &PartitionFilter{Namespace: namespace} + } + return filter, nil + } + + return &PartitionFilter{}, nil + } + +} + +type PartitionFilter struct { + // Name filters by the name of the objects + Name string `protobuf:"bytes,1,opt,name=name"` + + // Namespace filters by the namespace of the objects + Namespace string `protobuf:"bytes,2,opt,name=namespace"` +} + +func (r *PartitionFilter) Filter(ctx context.Context, obj runtime.Object) bool { + f := false // result of the previous filter + o, ok := obj.(*Partition) + if !ok { + return f + } + if r == nil { + return false + } + if r.Name != "" { + if o.GetName() == r.Name { + f = false + } else { + f = true + } + } + if r.Namespace != "" { + if o.GetNamespace() == r.Namespace { + f = false + } else { + f = true + } + } + return f +} + +func (r *Partition) PrepareForCreate(ctx context.Context, obj runtime.Object) { + // status cannot be set upon create -> reset it + newobj := obj.(*Partition) + newobj.Status = PartitionStatus{} +} + +// ValidateCreate statically validates +func (r *Partition) ValidateCreate(ctx context.Context, obj runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +func (r *Partition) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { + // ensure the status dont get updated + newobj := obj.(*Partition) + oldObj := old.(*Partition) + newobj.Status = oldObj.Status +} + +func (r *Partition) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} diff --git a/apis/infra/partition_types.go b/apis/infra/partition_types.go new file mode 100644 index 0000000..7afabe9 --- /dev/null +++ b/apis/infra/partition_types.go @@ -0,0 +1,62 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "reflect" + + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// PartitionSpec defines the desired state of the partition +type PartitionSpec struct { + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + common.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,7,opt,name=userDefinedLabels"` +} + +// PartitionStatus defines the observed state of Partition +type PartitionStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condition.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type Partition struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec PartitionSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status PartitionStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// PartitionList contains a list of Partitions +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type PartitionList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []Partition `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + PartitionKind = reflect.TypeOf(Partition{}).Name() + PartitionKindList = reflect.TypeOf(PartitionList{}).Name() +) diff --git a/apis/infra/rack_helper.go b/apis/infra/rack_helper.go new file mode 100644 index 0000000..95ce1c5 --- /dev/null +++ b/apis/infra/rack_helper.go @@ -0,0 +1,32 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "github.com/kform-dev/choreo/apis/condition" +) + +// GetCondition returns the condition based on the condition kind +func (r *Rack) GetCondition(t condition.ConditionType) condition.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *Rack) SetConditions(c ...condition.Condition) { + r.Status.SetConditions(c...) +} diff --git a/apis/infra/rack_resource.go b/apis/infra/rack_resource.go new file mode 100644 index 0000000..e345351 --- /dev/null +++ b/apis/infra/rack_resource.go @@ -0,0 +1,312 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "context" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/kform-dev/choreo/apis/condition" + apiequality "k8s.io/apimachinery/pkg/api/equality" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/util/validation/field" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +const ( + RackPlural = "racks" + RackSingular = "rack" +) + +var ( + RackShortNames = []string{} + RackCategories = []string{"kuid", "knet"} +) + +// +k8s:deepcopy-gen=false +var _ resource.InternalObject = &Rack{} +var _ resource.ObjectList = &RackList{} +var _ resource.ObjectWithStatusSubResource = &Rack{} +var _ resource.StatusSubResource = &RackStatus{} + +func (Rack) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: RackPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (Rack) IsStorageVersion() bool { + return true +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (Rack) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *Rack) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// GetSingularName returns the singular name of the resource +// GetSingularName implements resource.Object +func (Rack) GetSingularName() string { + return RackSingular +} + +// GetShortNames returns the shortnames for the resource +// GetShortNames implements resource.Object +func (Rack) GetShortNames() []string { + return RackShortNames +} + +// GetCategories return the categories of the resource +// GetCategories implements resource.Object +func (Rack) GetCategories() []string { + return RackCategories +} + +// New return an empty resource +// New implements resource.Object +func (Rack) New() runtime.Object { + return &Rack{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (Rack) NewList() runtime.Object { + return &RackList{} +} + +// IsEqual returns a bool indicating if the desired state of both resources is equal or not +func (r *Rack) IsEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*Rack) + oldobj := old.(*Rack) + + if !apiequality.Semantic.DeepEqual(oldobj.ObjectMeta, newobj.ObjectMeta) { + return false + } + // if equal we also test the spec + return apiequality.Semantic.DeepEqual(oldobj.Spec, newobj.Spec) +} + +// GetStatus return the resource.StatusSubResource interface +func (r *Rack) GetStatus() resource.StatusSubResource { + return r.Status +} + +// IsStatusEqual returns a bool indicating if the status of both resources is equal or not +func (r *Rack) IsStatusEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*Rack) + oldobj := old.(*Rack) + return apiequality.Semantic.DeepEqual(oldobj.Status, newobj.Status) +} + +// PrepareForStatusUpdate prepares the status update +func (r *Rack) PrepareForStatusUpdate(ctx context.Context, obj, old runtime.Object) { + newObj := obj.(*Rack) + oldObj := old.(*Rack) + newObj.Spec = oldObj.Spec + + // Status updates are for only for updating status, not objectmeta. + metav1.ResetObjectMetaForStatus(&newObj.ObjectMeta, &newObj.ObjectMeta) +} + +// ValidateStatusUpdate validates status updates +func (r *Rack) ValidateStatusUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +// SubResourceName resturns the name of the subresource +// SubResourceName implements the resource.StatusSubResource +func (RackStatus) SubResourceName() string { + return fmt.Sprintf("%s/%s", RackPlural, "status") +} + +// CopyTo copies the content of the status subresource to a parent resource. +// CopyTo implements the resource.StatusSubResource +func (r RackStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { + parent, ok := obj.(*Rack) + if ok { + parent.Status = r + } +} + +// GetListMeta returns the ListMeta +// GetListMeta implements the resource.ObjectList +func (r *RackList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// TableConvertor return the table format of the resource +func (r *Rack) TableConvertor() func(gr schema.GroupResource) rest.TableConvertor { + return func(gr schema.GroupResource) rest.TableConvertor { + return registry.NewTableConverter( + gr, + func(obj runtime.Object) []interface{} { + claim, ok := obj.(*Rack) + if !ok { + return nil + } + return []interface{}{ + claim.GetName(), + claim.GetCondition(condition.ConditionTypeReady).Status, + } + }, + []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + {Name: "Ready", Type: "string"}, + }, + ) + } +} + +// FieldLabelConversion is the schema conversion function for normalizing the FieldSelector for the resource +func (r *Rack) FieldLabelConversion() runtime.FieldLabelConversionFunc { + return func(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } + } +} + +func (r *Rack) FieldSelector() func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + return func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + var filter *RackFilter + + // add the namespace to the list + namespace, ok := genericapirequest.NamespaceFrom(ctx) + if fieldSelector == nil { + if ok { + return &RackFilter{Namespace: namespace}, nil + } + return filter, nil + } + requirements := fieldSelector.Requirements() + for _, requirement := range requirements { + filter = &RackFilter{} + switch requirement.Operator { + case selection.Equals, selection.DoesNotExist: + if requirement.Value == "" { + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) + } + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) + } + + switch requirement.Field { + case "metadata.name": + filter.Name = requirement.Value + case "metadata.namespace": + filter.Namespace = requirement.Value + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) + } + } + // add namespace to the filter selector if specified + if ok { + if filter != nil { + filter.Namespace = namespace + } else { + filter = &RackFilter{Namespace: namespace} + } + return filter, nil + } + + return &RackFilter{}, nil + } + +} + +type RackFilter struct { + // Name filters by the name of the objects + Name string `protobuf:"bytes,1,opt,name=name"` + + // Namespace filters by the namespace of the objects + Namespace string `protobuf:"bytes,2,opt,name=namespace"` +} + +func (r *RackFilter) Filter(ctx context.Context, obj runtime.Object) bool { + f := false // result of the previous filter + o, ok := obj.(*Rack) + if !ok { + return f + } + if r == nil { + return false + } + if r.Name != "" { + if o.GetName() == r.Name { + f = false + } else { + f = true + } + } + if r.Namespace != "" { + if o.GetNamespace() == r.Namespace { + f = false + } else { + f = true + } + } + return f +} + +func (r *Rack) PrepareForCreate(ctx context.Context, obj runtime.Object) { + // status cannot be set upon create -> reset it + newobj := obj.(*Rack) + newobj.Status = RackStatus{} +} + +// ValidateCreate statically validates +func (r *Rack) ValidateCreate(ctx context.Context, obj runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +func (r *Rack) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { + // ensure the status dont get updated + newobj := obj.(*Rack) + oldObj := old.(*Rack) + newobj.Status = oldObj.Status +} + +func (r *Rack) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} diff --git a/apis/infra/rack_types.go b/apis/infra/rack_types.go new file mode 100644 index 0000000..f61544e --- /dev/null +++ b/apis/infra/rack_types.go @@ -0,0 +1,75 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "reflect" + + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/id" + "github.com/kuidio/kuid/apis/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// RackSpec defines the desired state of Rack +type RackSpec struct { + // SiteID identifies the siteID this resource belongs to + id.SiteID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=siteID"` + // Location defines the location information where this resource is located + // in lon/lat coordinates + Location *Location `json:"location,omitempty" yaml:"location,omitempty" protobuf:"bytes,2,opt,name=location"` + // The height of the rack, measured in units. + Height string `json:"height,omitempty" yaml:"height,omitempty" protobuf:"bytes,3,opt,name=height"` + // The canonical distance between the two vertical rails on a face. In inch + Width string `json:"width,omitempty" yaml:"width,omitempty" protobuf:"bytes,4,opt,name=width"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined label + common.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,5,opt,name=userDefinedLabels"` +} + +// RackStatus defines the observed state of Rack +type RackStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condition.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// A rack represents a physical equipment rack within your environment. Each rack is designed to accommodate +// the installation of devices and equipment. +type Rack struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec RackSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status RackStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// RackList contains a list of Racks +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type RackList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []Rack `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + RackKind = reflect.TypeOf(Rack{}).Name() + RackKindList = reflect.TypeOf(RackList{}).Name() +) diff --git a/apis/infra/region_helper.go b/apis/infra/region_helper.go new file mode 100644 index 0000000..d8434db --- /dev/null +++ b/apis/infra/region_helper.go @@ -0,0 +1,32 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "github.com/kform-dev/choreo/apis/condition" +) + +// GetCondition returns the condition based on the condition kind +func (r *Region) GetCondition(t condition.ConditionType) condition.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *Region) SetConditions(c ...condition.Condition) { + r.Status.SetConditions(c...) +} diff --git a/apis/infra/region_resource.go b/apis/infra/region_resource.go new file mode 100644 index 0000000..1aaec46 --- /dev/null +++ b/apis/infra/region_resource.go @@ -0,0 +1,312 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "context" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/kform-dev/choreo/apis/condition" + apiequality "k8s.io/apimachinery/pkg/api/equality" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/util/validation/field" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +const ( + RegionPlural = "regions" + RegionSingular = "region" +) + +var ( + RegionShortNames = []string{} + RegionCategories = []string{"kuid", "knet"} +) + +// +k8s:deepcopy-gen=false +var _ resource.InternalObject = &Region{} +var _ resource.ObjectList = &RegionList{} +var _ resource.ObjectWithStatusSubResource = &Region{} +var _ resource.StatusSubResource = &RegionStatus{} + +func (Region) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: RegionPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (Region) IsStorageVersion() bool { + return true +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (Region) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *Region) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// GetSingularName returns the singular name of the resource +// GetSingularName implements resource.Object +func (Region) GetSingularName() string { + return RegionSingular +} + +// GetShortNames returns the shortnames for the resource +// GetShortNames implements resource.Object +func (Region) GetShortNames() []string { + return RegionShortNames +} + +// GetCategories return the categories of the resource +// GetCategories implements resource.Object +func (Region) GetCategories() []string { + return RegionCategories +} + +// New return an empty resource +// New implements resource.Object +func (Region) New() runtime.Object { + return &Region{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (Region) NewList() runtime.Object { + return &RegionList{} +} + +// IsEqual returns a bool indicating if the desired state of both resources is equal or not +func (r *Region) IsEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*Region) + oldobj := old.(*Region) + + if !apiequality.Semantic.DeepEqual(oldobj.ObjectMeta, newobj.ObjectMeta) { + return false + } + // if equal we also test the spec + return apiequality.Semantic.DeepEqual(oldobj.Spec, newobj.Spec) +} + +// GetStatus return the resource.StatusSubResource interface +func (r *Region) GetStatus() resource.StatusSubResource { + return r.Status +} + +// IsStatusEqual returns a bool indicating if the status of both resources is equal or not +func (r *Region) IsStatusEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*Region) + oldobj := old.(*Region) + return apiequality.Semantic.DeepEqual(oldobj.Status, newobj.Status) +} + +// PrepareForStatusUpdate prepares the status update +func (r *Region) PrepareForStatusUpdate(ctx context.Context, obj, old runtime.Object) { + newObj := obj.(*Region) + oldObj := old.(*Region) + newObj.Spec = oldObj.Spec + + // Status updates are for only for updating status, not objectmeta. + metav1.ResetObjectMetaForStatus(&newObj.ObjectMeta, &newObj.ObjectMeta) +} + +// ValidateStatusUpdate validates status updates +func (r *Region) ValidateStatusUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +// SubResourceName resturns the name of the subresource +// SubResourceName implements the resource.StatusSubResource +func (RegionStatus) SubResourceName() string { + return fmt.Sprintf("%s/%s", RegionPlural, "status") +} + +// CopyTo copies the content of the status subresource to a parent resource. +// CopyTo implements the resource.StatusSubResource +func (r RegionStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { + parent, ok := obj.(*Region) + if ok { + parent.Status = r + } +} + +// GetListMeta returns the ListMeta +// GetListMeta implements the resource.ObjectList +func (r *RegionList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// TableConvertor return the table format of the resource +func (r *Region) TableConvertor() func(gr schema.GroupResource) rest.TableConvertor { + return func(gr schema.GroupResource) rest.TableConvertor { + return registry.NewTableConverter( + gr, + func(obj runtime.Object) []interface{} { + claim, ok := obj.(*Region) + if !ok { + return nil + } + return []interface{}{ + claim.GetName(), + claim.GetCondition(condition.ConditionTypeReady).Status, + } + }, + []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + {Name: "Ready", Type: "string"}, + }, + ) + } +} + +// FieldLabelConversion is the schema conversion function for normalizing the FieldSelector for the resource +func (r *Region) FieldLabelConversion() runtime.FieldLabelConversionFunc { + return func(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } + } +} + +func (r *Region) FieldSelector() func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + return func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + var filter *RegionFilter + + // add the namespace to the list + namespace, ok := genericapirequest.NamespaceFrom(ctx) + if fieldSelector == nil { + if ok { + return &RegionFilter{Namespace: namespace}, nil + } + return filter, nil + } + requirements := fieldSelector.Requirements() + for _, requirement := range requirements { + filter = &RegionFilter{} + switch requirement.Operator { + case selection.Equals, selection.DoesNotExist: + if requirement.Value == "" { + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) + } + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) + } + + switch requirement.Field { + case "metadata.name": + filter.Name = requirement.Value + case "metadata.namespace": + filter.Namespace = requirement.Value + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) + } + } + // add namespace to the filter selector if specified + if ok { + if filter != nil { + filter.Namespace = namespace + } else { + filter = &RegionFilter{Namespace: namespace} + } + return filter, nil + } + + return &RegionFilter{}, nil + } + +} + +type RegionFilter struct { + // Name filters by the name of the objects + Name string `protobuf:"bytes,1,opt,name=name"` + + // Namespace filters by the namespace of the objects + Namespace string `protobuf:"bytes,2,opt,name=namespace"` +} + +func (r *RegionFilter) Filter(ctx context.Context, obj runtime.Object) bool { + f := false // result of the previous filter + o, ok := obj.(*Region) + if !ok { + return f + } + if r == nil { + return false + } + if r.Name != "" { + if o.GetName() == r.Name { + f = false + } else { + f = true + } + } + if r.Namespace != "" { + if o.GetNamespace() == r.Namespace { + f = false + } else { + f = true + } + } + return f +} + +func (r *Region) PrepareForCreate(ctx context.Context, obj runtime.Object) { + // status cannot be set upon create -> reset it + newobj := obj.(*Region) + newobj.Status = RegionStatus{} +} + +// ValidateCreate statically validates +func (r *Region) ValidateCreate(ctx context.Context, obj runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +func (r *Region) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { + // ensure the status dont get updated + newobj := obj.(*Region) + oldObj := old.(*Region) + newobj.Status = oldObj.Status +} + +func (r *Region) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} diff --git a/apis/infra/region_types.go b/apis/infra/region_types.go new file mode 100644 index 0000000..1ad5b84 --- /dev/null +++ b/apis/infra/region_types.go @@ -0,0 +1,65 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "reflect" + + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// RegionSpec defines the desired state of Region +type RegionSpec struct { + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + common.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=userDefinedLabels"` +} + +// RegionStatus defines the observed state of Region +type RegionStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condition.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// A Region represent a geography in which multiple infrastructure resources are grouped +// A Region might represent a continent, country, city, campus, or other area depending on your environment. +type Region struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec RegionSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status RegionStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// RegionList contains a list of Regions +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type RegionList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []Region `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + RegionKind = reflect.TypeOf(Region{}).Name() + RegionKindList = reflect.TypeOf(RegionList{}).Name() +) diff --git a/apis/infra/register.go b/apis/infra/register.go new file mode 100644 index 0000000..e8665ba --- /dev/null +++ b/apis/infra/register.go @@ -0,0 +1,78 @@ +/* +Copyright 2024 Nokia. + +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. +*/ + +// +kubebuilder:object:generate=true +// +groupName=infra.kuid.dev +package infra + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +const ( + GroupName = "infra.kuid.dev" + Version = runtime.APIVersionInternal +) + +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: Version} + +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme +) + +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &Cluster{}, + &ClusterList{}, + &Endpoint{}, + &EndpointList{}, + &EndpointSet{}, + &EndpointSetList{}, + &Link{}, + &LinkList{}, + &LinkSet{}, + &LinkSetList{}, + &Module{}, + &ModuleList{}, + &ModuleBay{}, + &ModuleBayList{}, + &Node{}, + &NodeList{}, + &NodeItem{}, + &NodeItemList{}, + &NodeSet{}, + &NodeSetList{}, + &Partition{}, + &PartitionList{}, + &Rack{}, + &RackList{}, + &Region{}, + &RegionList{}, + &Site{}, + &SiteList{}, + ) + return nil +} diff --git a/apis/infra/register/register.go b/apis/infra/register/register.go new file mode 100644 index 0000000..88ff827 --- /dev/null +++ b/apis/infra/register/register.go @@ -0,0 +1,59 @@ +/* +Copyright 2024 Nokia. + +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 register + +import ( + "context" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-builder/pkg/builder/rest" + "github.com/kuidio/kuid/apis/infra" + infrav1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + bebackend "github.com/kuidio/kuid/pkg/backend" + "github.com/kuidio/kuid/pkg/config" + genericregistry "github.com/kuidio/kuid/pkg/registry/generic" + "github.com/kuidio/kuid/pkg/registry/options" +) + +func init() { + config.Register( + infra.SchemeGroupVersion.Group, + infrav1alpha1.AddToScheme, + nil, + nil, + []*config.ResourceConfig{ + {StorageProviderFn: NewStorageProvider, Internal: &infra.Cluster{}, ResourceVersions: []resource.Object{&infra.Cluster{}, &infrav1alpha1.Cluster{}}}, + {StorageProviderFn: NewStorageProvider, Internal: &infra.Endpoint{}, ResourceVersions: []resource.Object{&infra.Endpoint{}, &infrav1alpha1.Endpoint{}}}, + {StorageProviderFn: NewStorageProvider, Internal: &infra.EndpointSet{}, ResourceVersions: []resource.Object{&infra.EndpointSet{}, &infrav1alpha1.EndpointSet{}}}, + {StorageProviderFn: NewStorageProvider, Internal: &infra.Link{}, ResourceVersions: []resource.Object{&infra.Link{}, &infrav1alpha1.Link{}}}, + {StorageProviderFn: NewStorageProvider, Internal: &infra.LinkSet{}, ResourceVersions: []resource.Object{&infra.LinkSet{}, &infrav1alpha1.LinkSet{}}}, + {StorageProviderFn: NewStorageProvider, Internal: &infra.Module{}, ResourceVersions: []resource.Object{&infra.Module{}, &infrav1alpha1.Module{}}}, + {StorageProviderFn: NewStorageProvider, Internal: &infra.ModuleBay{}, ResourceVersions: []resource.Object{&infra.ModuleBay{}, &infrav1alpha1.ModuleBay{}}}, + {StorageProviderFn: NewStorageProvider, Internal: &infra.Node{}, ResourceVersions: []resource.Object{&infra.Node{}, &infrav1alpha1.Node{}}}, + {StorageProviderFn: NewStorageProvider, Internal: &infra.NodeItem{}, ResourceVersions: []resource.Object{&infra.NodeItem{}, &infrav1alpha1.NodeItem{}}}, + {StorageProviderFn: NewStorageProvider, Internal: &infra.NodeSet{}, ResourceVersions: []resource.Object{&infra.NodeSet{}, &infrav1alpha1.NodeSet{}}}, + {StorageProviderFn: NewStorageProvider, Internal: &infra.Partition{}, ResourceVersions: []resource.Object{&infra.Partition{}, &infrav1alpha1.Partition{}}}, + {StorageProviderFn: NewStorageProvider, Internal: &infra.Rack{}, ResourceVersions: []resource.Object{&infra.Rack{}, &infrav1alpha1.Rack{}}}, + {StorageProviderFn: NewStorageProvider, Internal: &infra.Region{}, ResourceVersions: []resource.Object{&infra.Region{}, &infrav1alpha1.Region{}}}, + {StorageProviderFn: NewStorageProvider, Internal: &infra.Site{}, ResourceVersions: []resource.Object{&infra.Site{}, &infrav1alpha1.Site{}}}, + }, + ) +} + +func NewStorageProvider(ctx context.Context, obj resource.InternalObject, be bebackend.Backend, sync bool, options *options.Options) *rest.StorageProvider { + return genericregistry.NewStorageProvider(ctx, obj, options) +} diff --git a/apis/infra/site_helper.go b/apis/infra/site_helper.go new file mode 100644 index 0000000..6c5bdf3 --- /dev/null +++ b/apis/infra/site_helper.go @@ -0,0 +1,32 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "github.com/kform-dev/choreo/apis/condition" +) + +// GetCondition returns the condition based on the condition kind +func (r *Site) GetCondition(t condition.ConditionType) condition.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *Site) SetConditions(c ...condition.Condition) { + r.Status.SetConditions(c...) +} diff --git a/apis/infra/site_resource.go b/apis/infra/site_resource.go new file mode 100644 index 0000000..e6a349d --- /dev/null +++ b/apis/infra/site_resource.go @@ -0,0 +1,312 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "context" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/kform-dev/choreo/apis/condition" + apiequality "k8s.io/apimachinery/pkg/api/equality" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/util/validation/field" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +const ( + SitePlural = "sites" + SiteSingular = "site" +) + +var ( + SiteShortNames = []string{} + SiteCategories = []string{"kuid", "knet"} +) + +// +k8s:deepcopy-gen=false +var _ resource.InternalObject = &Site{} +var _ resource.ObjectList = &SiteList{} +var _ resource.ObjectWithStatusSubResource = &Site{} +var _ resource.StatusSubResource = &SiteStatus{} + +func (Site) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: SitePlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (Site) IsStorageVersion() bool { + return true +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (Site) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *Site) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// GetSingularName returns the singular name of the resource +// GetSingularName implements resource.Object +func (Site) GetSingularName() string { + return SiteSingular +} + +// GetShortNames returns the shortnames for the resource +// GetShortNames implements resource.Object +func (Site) GetShortNames() []string { + return SiteShortNames +} + +// GetCategories return the categories of the resource +// GetCategories implements resource.Object +func (Site) GetCategories() []string { + return SiteCategories +} + +// New return an empty resource +// New implements resource.Object +func (Site) New() runtime.Object { + return &Site{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (Site) NewList() runtime.Object { + return &SiteList{} +} + +// IsEqual returns a bool indicating if the desired state of both resources is equal or not +func (r *Site) IsEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*Site) + oldobj := old.(*Site) + + if !apiequality.Semantic.DeepEqual(oldobj.ObjectMeta, newobj.ObjectMeta) { + return false + } + // if equal we also test the spec + return apiequality.Semantic.DeepEqual(oldobj.Spec, newobj.Spec) +} + +// GetStatus return the resource.StatusSubResource interface +func (r *Site) GetStatus() resource.StatusSubResource { + return r.Status +} + +// IsStatusEqual returns a bool indicating if the status of both resources is equal or not +func (r *Site) IsStatusEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*Site) + oldobj := old.(*Site) + return apiequality.Semantic.DeepEqual(oldobj.Status, newobj.Status) +} + +// PrepareForStatusUpdate prepares the status update +func (r *Site) PrepareForStatusUpdate(ctx context.Context, obj, old runtime.Object) { + newObj := obj.(*Site) + oldObj := old.(*Site) + newObj.Spec = oldObj.Spec + + // Status updates are for only for updating status, not objectmeta. + metav1.ResetObjectMetaForStatus(&newObj.ObjectMeta, &newObj.ObjectMeta) +} + +// ValidateStatusUpdate validates status updates +func (r *Site) ValidateStatusUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +// SubResourceName resturns the name of the subresource +// SubResourceName implements the resource.StatusSubResource +func (SiteStatus) SubResourceName() string { + return fmt.Sprintf("%s/%s", SitePlural, "status") +} + +// CopyTo copies the content of the status subresource to a parent resource. +// CopyTo implements the resource.StatusSubResource +func (r SiteStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { + parent, ok := obj.(*Site) + if ok { + parent.Status = r + } +} + +// GetListMeta returns the ListMeta +// GetListMeta implements the resource.ObjectList +func (r *SiteList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// TableConvertor return the table format of the resource +func (r *Site) TableConvertor() func(gr schema.GroupResource) rest.TableConvertor { + return func(gr schema.GroupResource) rest.TableConvertor { + return registry.NewTableConverter( + gr, + func(obj runtime.Object) []interface{} { + claim, ok := obj.(*Site) + if !ok { + return nil + } + return []interface{}{ + claim.GetName(), + claim.GetCondition(condition.ConditionTypeReady).Status, + } + }, + []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + {Name: "Ready", Type: "string"}, + }, + ) + } +} + +// FieldLabelConversion is the schema conversion function for normalizing the FieldSelector for the resource +func (r *Site) FieldLabelConversion() runtime.FieldLabelConversionFunc { + return func(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } + } +} + +func (r *Site) FieldSelector() func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + return func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + var filter *SiteFilter + + // add the namespace to the list + namespace, ok := genericapirequest.NamespaceFrom(ctx) + if fieldSelector == nil { + if ok { + return &SiteFilter{Namespace: namespace}, nil + } + return filter, nil + } + requirements := fieldSelector.Requirements() + for _, requirement := range requirements { + filter = &SiteFilter{} + switch requirement.Operator { + case selection.Equals, selection.DoesNotExist: + if requirement.Value == "" { + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) + } + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) + } + + switch requirement.Field { + case "metadata.name": + filter.Name = requirement.Value + case "metadata.namespace": + filter.Namespace = requirement.Value + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) + } + } + // add namespace to the filter selector if specified + if ok { + if filter != nil { + filter.Namespace = namespace + } else { + filter = &SiteFilter{Namespace: namespace} + } + return filter, nil + } + + return &SiteFilter{}, nil + } + +} + +type SiteFilter struct { + // Name filters by the name of the objects + Name string `protobuf:"bytes,1,opt,name=name"` + + // Namespace filters by the namespace of the objects + Namespace string `protobuf:"bytes,2,opt,name=namespace"` +} + +func (r *SiteFilter) Filter(ctx context.Context, obj runtime.Object) bool { + f := false // result of the previous filter + o, ok := obj.(*Site) + if !ok { + return f + } + if r == nil { + return false + } + if r.Name != "" { + if o.GetName() == r.Name { + f = false + } else { + f = true + } + } + if r.Namespace != "" { + if o.GetNamespace() == r.Namespace { + f = false + } else { + f = true + } + } + return f +} + +func (r *Site) PrepareForCreate(ctx context.Context, obj runtime.Object) { + // status cannot be set upon create -> reset it + newobj := obj.(*Site) + newobj.Status = SiteStatus{} +} + +// ValidateCreate statically validates +func (r *Site) ValidateCreate(ctx context.Context, obj runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +func (r *Site) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { + // ensure the status dont get updated + newobj := obj.(*Site) + oldObj := old.(*Site) + newobj.Status = oldObj.Status +} + +func (r *Site) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} diff --git a/apis/infra/site_types.go b/apis/infra/site_types.go new file mode 100644 index 0000000..b8ec265 --- /dev/null +++ b/apis/infra/site_types.go @@ -0,0 +1,73 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + "reflect" + + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/common" + "github.com/kuidio/kuid/apis/id" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// SiteSpec defines the desired state of Site +type SiteSpec struct { + // SiteID defines the siteID + id.SiteID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=siteID"` + // Location defines the location information where this resource is located + // in lon/lat coordinates + Location *Location `json:"location,omitempty" yaml:"location,omitempty" protobuf:"bytes,2,opt,name=location"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + common.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` +} + +// SiteStatus defines the observed state of Site +type SiteStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condition.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// A site serves as a fundamental organizational unit for managing infrastructure resources within your environment. +// The utilization of sites may vary based on the organizational structure and requirements, +// but in essence, each site typically corresponds to a distinct building or campus. +// +k8s:openapi-gen=true +type Site struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec SiteSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status SiteStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// SiteList contains a list of Sites +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type SiteList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []Site `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + SiteKind = reflect.TypeOf(Site{}).Name() + SiteKindList = reflect.TypeOf(SiteList{}).Name() +) diff --git a/apis/infra/v1alpha1/cluster_resource.go b/apis/infra/v1alpha1/cluster_resource.go new file mode 100644 index 0000000..f66e0fe --- /dev/null +++ b/apis/infra/v1alpha1/cluster_resource.go @@ -0,0 +1,80 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/kuidio/kuid/apis/infra" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +k8s:deepcopy-gen=false +var _ resource.Object = &Cluster{} +var _ resource.ObjectList = &ClusterList{} +var _ resource.MultiVersionObject = &Cluster{} + +func (Cluster) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: infra.ClusterPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (Cluster) IsStorageVersion() bool { + return false +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (Cluster) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *Cluster) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// New return an empty resource +// New implements resource.Object +func (Cluster) New() runtime.Object { + return &Cluster{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (Cluster) NewList() runtime.Object { + return &ClusterList{} +} + +// GetListMeta returns the ListMeta +// GetListMeta implements resource.ObjectList +func (r *ClusterList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// RegisterConversions registers the conversions. +// RegisterConversions implements resource.MultiVersionObject +func (Cluster) RegisterConversions() func(s *runtime.Scheme) error { + return RegisterConversions +} diff --git a/apis/infra/v1alpha1/cluster_types.go b/apis/infra/v1alpha1/cluster_types.go new file mode 100644 index 0000000..8fb6e8c --- /dev/null +++ b/apis/infra/v1alpha1/cluster_types.go @@ -0,0 +1,81 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "reflect" + + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + idv1alpha1 "github.com/kuidio/kuid/apis/id/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// ClusterSpec defines the desired state of Cluster +type ClusterSpec struct { + // PartitionClusterID defines the cluster partition + idv1alpha1.PartitionClusterID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"` + // Provider defines the provider implementing this resource. + Provider string `json:"provider" yaml:"provider" protobuf:"bytes,2,opt,name=provider"` + // Location defines the location information where this resource is located + // in lon/lat coordinates + Location *Location `json:"location,omitempty" yaml:"location,omitempty" protobuf:"bytes,3,opt,name=location"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,4,opt,name=userDefinedLabels"` + // ParametersRef points to a provider specific configuration of the resource + // +optional + //ParametersRef *ObjectReference `json:"parametersRef,omitempty" yaml:"parametersRef,omitempty" protobuf:"bytes,5,opt,name=parametersRef"` +} + +// ClusterStatus defines the observed state of Cluster +type ClusterStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} + +// A Cluster represents a kubernetes cluster and is typically used as a nodeGroup identifier. +type Cluster struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec ClusterSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status ClusterStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true + +// ClusterList contains a list of Clusters +type ClusterList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []Cluster `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + ClusterKind = reflect.TypeOf(Cluster{}).Name() + ClusterKindList = reflect.TypeOf(ClusterList{}).Name() +) diff --git a/apis/infra/v1alpha1/conversion.go b/apis/infra/v1alpha1/conversion.go new file mode 100644 index 0000000..3ecb89c --- /dev/null +++ b/apis/infra/v1alpha1/conversion.go @@ -0,0 +1,323 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + unsafe "unsafe" + + id "github.com/kuidio/kuid/apis/id" + idv1alpha1 "github.com/kuidio/kuid/apis/id/v1alpha1" + conversion "k8s.io/apimachinery/pkg/conversion" +) + +// Convert_v1alpha1_AdaptorID_To_id_AdaptorID is an autogenerated conversion function. +func Convert_v1alpha1_AdaptorID_To_id_AdaptorID(in *idv1alpha1.AdaptorID, out *id.AdaptorID, s conversion.Scope) error { + return autoConvert_v1alpha1_AdaptorID_To_id_AdaptorID(in, out, s) +} + +func autoConvert_v1alpha1_AdaptorID_To_id_AdaptorID(in *idv1alpha1.AdaptorID, out *id.AdaptorID, s conversion.Scope) error { + if err := Convert_v1alpha1_NodeID_To_id_NodeID(&in.NodeID, &out.NodeID, s); err != nil { + return err + } + out.ModuleBay = (*int)(unsafe.Pointer(in.ModuleBay)) + out.Module = (*int)(unsafe.Pointer(in.Module)) + out.Port = in.Port + out.Adaptor = in.Adaptor + return nil +} + +// Convert_id_AdaptorID_To_v1alpha1_AdaptorID is an autogenerated conversion function. +func Convert_id_AdaptorID_To_v1alpha1_AdaptorID(in *id.AdaptorID, out *idv1alpha1.AdaptorID, s conversion.Scope) error { + return autoConvert_id_AdaptorID_To_v1alpha1_AdaptorID(in, out, s) +} + +func autoConvert_id_AdaptorID_To_v1alpha1_AdaptorID(in *id.AdaptorID, out *idv1alpha1.AdaptorID, s conversion.Scope) error { + if err := Convert_id_NodeID_To_v1alpha1_NodeID(&in.NodeID, &out.NodeID, s); err != nil { + return err + } + out.ModuleBay = (*int)(unsafe.Pointer(in.ModuleBay)) + out.Module = (*int)(unsafe.Pointer(in.Module)) + out.Port = in.Port + out.Adaptor = in.Adaptor + return nil +} + +// Convert_v1alpha1_ClusterID_To_id_ClusterID is an autogenerated conversion function. +func Convert_v1alpha1_ClusterID_To_id_ClusterID(in *idv1alpha1.ClusterID, out *id.ClusterID, s conversion.Scope) error { + return autoConvert_v1alpha1_ClusterID_To_id_ClusterID(in, out, s) +} + +func autoConvert_v1alpha1_ClusterID_To_id_ClusterID(in *idv1alpha1.ClusterID, out *id.ClusterID, s conversion.Scope) error { + if err := Convert_v1alpha1_SiteID_To_id_SiteID(&in.SiteID, &out.SiteID, s); err != nil { + return err + } + out.Cluster = in.Cluster + return nil +} + +// Convert_id_ClusterID_To_v1alpha1_ClusterID is an autogenerated conversion function. +func Convert_id_ClusterID_To_v1alpha1_ClusterID(in *id.ClusterID, out *idv1alpha1.ClusterID, s conversion.Scope) error { + return autoConvert_id_ClusterID_To_v1alpha1_ClusterID(in, out, s) +} + +func autoConvert_id_ClusterID_To_v1alpha1_ClusterID(in *id.ClusterID, out *idv1alpha1.ClusterID, s conversion.Scope) error { + if err := Convert_id_SiteID_To_v1alpha1_SiteID(&in.SiteID, &out.SiteID, s); err != nil { + return err + } + out.Cluster = in.Cluster + return nil +} + +// Convert_v1alpha1_EndpointID_To_id_EndpointID is an autogenerated conversion function. +func Convert_v1alpha1_EndpointID_To_id_EndpointID(in *idv1alpha1.EndpointID, out *id.EndpointID, s conversion.Scope) error { + return autoConvert_v1alpha1_EndpointID_To_id_EndpointID(in, out, s) +} + +func autoConvert_v1alpha1_EndpointID_To_id_EndpointID(in *idv1alpha1.EndpointID, out *id.EndpointID, s conversion.Scope) error { + if err := Convert_v1alpha1_NodeID_To_id_NodeID(&in.NodeID, &out.NodeID, s); err != nil { + return err + } + out.ModuleBay = (*int)(unsafe.Pointer(in.ModuleBay)) + out.Module = (*int)(unsafe.Pointer(in.Module)) + out.Port = in.Port + out.Adaptor = in.Adaptor + out.Endpoint = in.Endpoint + return nil +} + +// Convert_id_EndpointID_To_v1alpha1_EndpointID is an autogenerated conversion function. +func Convert_id_EndpointID_To_v1alpha1_EndpointID(in *id.EndpointID, out *idv1alpha1.EndpointID, s conversion.Scope) error { + return autoConvert_id_EndpointID_To_v1alpha1_EndpointID(in, out, s) +} + +func autoConvert_id_EndpointID_To_v1alpha1_EndpointID(in *id.EndpointID, out *idv1alpha1.EndpointID, s conversion.Scope) error { + if err := Convert_id_NodeID_To_v1alpha1_NodeID(&in.NodeID, &out.NodeID, s); err != nil { + return err + } + out.ModuleBay = (*int)(unsafe.Pointer(in.ModuleBay)) + out.Module = (*int)(unsafe.Pointer(in.Module)) + out.Port = in.Port + out.Adaptor = in.Adaptor + out.Endpoint = in.Endpoint + return nil +} + +// Convert_v1alpha1_NodeID_To_id_NodeID is an autogenerated conversion function. +func Convert_v1alpha1_NodeID_To_id_NodeID(in *idv1alpha1.NodeID, out *id.NodeID, s conversion.Scope) error { + return autoConvert_v1alpha1_NodeID_To_id_NodeID(in, out, s) +} + +func autoConvert_v1alpha1_NodeID_To_id_NodeID(in *idv1alpha1.NodeID, out *id.NodeID, s conversion.Scope) error { + if err := Convert_v1alpha1_SiteID_To_id_SiteID(&in.SiteID, &out.SiteID, s); err != nil { + return err + } + out.Node = in.Node + return nil +} + +// Convert_id_NodeID_To_v1alpha1_NodeID is an autogenerated conversion function. +func Convert_id_NodeID_To_v1alpha1_NodeID(in *id.NodeID, out *idv1alpha1.NodeID, s conversion.Scope) error { + return autoConvert_id_NodeID_To_v1alpha1_NodeID(in, out, s) +} + +func autoConvert_id_NodeID_To_v1alpha1_NodeID(in *id.NodeID, out *idv1alpha1.NodeID, s conversion.Scope) error { + if err := Convert_id_SiteID_To_v1alpha1_SiteID(&in.SiteID, &out.SiteID, s); err != nil { + return err + } + out.Node = in.Node + return nil +} + +// Convert_v1alpha1_PartitionAttachmentID_To_id_PartitionAttachmentID is an autogenerated conversion function. +func Convert_v1alpha1_PartitionAttachmentID_To_id_PartitionAttachmentID(in *idv1alpha1.PartitionAttachmentID, out *id.PartitionAttachmentID, s conversion.Scope) error { + return autoConvert_v1alpha1_PartitionAttachmentID_To_id_PartitionAttachmentID(in, out, s) +} + +func autoConvert_v1alpha1_PartitionAttachmentID_To_id_PartitionAttachmentID(in *idv1alpha1.PartitionAttachmentID, out *id.PartitionAttachmentID, s conversion.Scope) error { + out.Partition = in.Partition + if err := Convert_v1alpha1_SiteID_To_id_SiteID(&in.SiteID, &out.SiteID, s); err != nil { + return err + } + out.Cluster = (*string)(unsafe.Pointer(in.Cluster)) + out.Node = (*string)(unsafe.Pointer(in.Node)) + out.NodeSet = (*string)(unsafe.Pointer(in.NodeSet)) + out.Interface = in.Interface + return nil +} + +// Convert_id_PartitionAttachmentID_To_v1alpha1_PartitionAttachmentID is an autogenerated conversion function. +func Convert_id_PartitionAttachmentID_To_v1alpha1_PartitionAttachmentID(in *id.PartitionAttachmentID, out *idv1alpha1.PartitionAttachmentID, s conversion.Scope) error { + return autoConvert_id_PartitionAttachmentID_To_v1alpha1_PartitionAttachmentID(in, out, s) +} + +func autoConvert_id_PartitionAttachmentID_To_v1alpha1_PartitionAttachmentID(in *id.PartitionAttachmentID, out *idv1alpha1.PartitionAttachmentID, s conversion.Scope) error { + out.Partition = in.Partition + if err := Convert_id_SiteID_To_v1alpha1_SiteID(&in.SiteID, &out.SiteID, s); err != nil { + return err + } + out.Cluster = (*string)(unsafe.Pointer(in.Cluster)) + out.Node = (*string)(unsafe.Pointer(in.Node)) + out.NodeSet = (*string)(unsafe.Pointer(in.NodeSet)) + out.Interface = in.Interface + return nil +} + +// Convert_v1alpha1_PartitionClusterID_To_id_PartitionClusterID is an autogenerated conversion function. +func Convert_v1alpha1_PartitionClusterID_To_id_PartitionClusterID(in *idv1alpha1.PartitionClusterID, out *id.PartitionClusterID, s conversion.Scope) error { + return autoConvert_v1alpha1_PartitionClusterID_To_id_PartitionClusterID(in, out, s) +} + +func autoConvert_v1alpha1_PartitionClusterID_To_id_PartitionClusterID(in *idv1alpha1.PartitionClusterID, out *id.PartitionClusterID, s conversion.Scope) error { + out.Partition = in.Partition + if err := Convert_v1alpha1_SiteID_To_id_SiteID(&in.SiteID, &out.SiteID, s); err != nil { + return err + } + out.Cluster = in.Cluster + return nil +} + +// Convert_id_PartitionClusterID_To_v1alpha1_PartitionClusterID is an autogenerated conversion function. +func Convert_id_PartitionClusterID_To_v1alpha1_PartitionClusterID(in *id.PartitionClusterID, out *idv1alpha1.PartitionClusterID, s conversion.Scope) error { + return autoConvert_id_PartitionClusterID_To_v1alpha1_PartitionClusterID(in, out, s) +} + +func autoConvert_id_PartitionClusterID_To_v1alpha1_PartitionClusterID(in *id.PartitionClusterID, out *idv1alpha1.PartitionClusterID, s conversion.Scope) error { + out.Partition = in.Partition + if err := Convert_id_SiteID_To_v1alpha1_SiteID(&in.SiteID, &out.SiteID, s); err != nil { + return err + } + out.Cluster = in.Cluster + return nil +} + +// Convert_v1alpha1_PartitionEndpointID_To_id_PartitionEndpointID is an autogenerated conversion function. +func Convert_v1alpha1_PartitionEndpointID_To_id_PartitionEndpointID(in *idv1alpha1.PartitionEndpointID, out *id.PartitionEndpointID, s conversion.Scope) error { + return autoConvert_v1alpha1_PartitionEndpointID_To_id_PartitionEndpointID(in, out, s) +} + +func autoConvert_v1alpha1_PartitionEndpointID_To_id_PartitionEndpointID(in *idv1alpha1.PartitionEndpointID, out *id.PartitionEndpointID, s conversion.Scope) error { + out.Partition = in.Partition + if err := Convert_v1alpha1_NodeID_To_id_NodeID(&in.NodeID, &out.NodeID, s); err != nil { + return err + } + out.ModuleBay = (*int)(unsafe.Pointer(in.ModuleBay)) + out.Module = (*int)(unsafe.Pointer(in.Module)) + out.Port = in.Port + out.Adaptor = (*string)(unsafe.Pointer(in.Adaptor)) + out.Endpoint = in.Endpoint + out.Name = (*string)(unsafe.Pointer(in.Name)) + return nil +} + +// Convert_id_PartitionEndpointID_To_v1alpha1_PartitionEndpointID is an autogenerated conversion function. +func Convert_id_PartitionEndpointID_To_v1alpha1_PartitionEndpointID(in *id.PartitionEndpointID, out *idv1alpha1.PartitionEndpointID, s conversion.Scope) error { + return autoConvert_id_PartitionEndpointID_To_v1alpha1_PartitionEndpointID(in, out, s) +} + +func autoConvert_id_PartitionEndpointID_To_v1alpha1_PartitionEndpointID(in *id.PartitionEndpointID, out *idv1alpha1.PartitionEndpointID, s conversion.Scope) error { + out.Partition = in.Partition + if err := Convert_id_NodeID_To_v1alpha1_NodeID(&in.NodeID, &out.NodeID, s); err != nil { + return err + } + out.ModuleBay = (*int)(unsafe.Pointer(in.ModuleBay)) + out.Module = (*int)(unsafe.Pointer(in.Module)) + out.Port = in.Port + out.Adaptor = (*string)(unsafe.Pointer(in.Adaptor)) + out.Endpoint = in.Endpoint + out.Name = (*string)(unsafe.Pointer(in.Name)) + return nil +} + +// Convert_v1alpha1_PartitionNodeID_To_id_PartitionNodeID is an autogenerated conversion function. +func Convert_v1alpha1_PartitionNodeID_To_id_PartitionNodeID(in *idv1alpha1.PartitionNodeID, out *id.PartitionNodeID, s conversion.Scope) error { + return autoConvert_v1alpha1_PartitionNodeID_To_id_PartitionNodeID(in, out, s) +} + +func autoConvert_v1alpha1_PartitionNodeID_To_id_PartitionNodeID(in *idv1alpha1.PartitionNodeID, out *id.PartitionNodeID, s conversion.Scope) error { + out.Partition = in.Partition + if err := Convert_v1alpha1_SiteID_To_id_SiteID(&in.SiteID, &out.SiteID, s); err != nil { + return err + } + out.Node = in.Node + return nil +} + +// Convert_id_PartitionNodeID_To_v1alpha1_PartitionNodeID is an autogenerated conversion function. +func Convert_id_PartitionNodeID_To_v1alpha1_PartitionNodeID(in *id.PartitionNodeID, out *idv1alpha1.PartitionNodeID, s conversion.Scope) error { + return autoConvert_id_PartitionNodeID_To_v1alpha1_PartitionNodeID(in, out, s) +} + +func autoConvert_id_PartitionNodeID_To_v1alpha1_PartitionNodeID(in *id.PartitionNodeID, out *idv1alpha1.PartitionNodeID, s conversion.Scope) error { + out.Partition = in.Partition + if err := Convert_id_SiteID_To_v1alpha1_SiteID(&in.SiteID, &out.SiteID, s); err != nil { + return err + } + out.Node = in.Node + return nil +} + +// Convert_v1alpha1_PortID_To_id_PortID is an autogenerated conversion function. +func Convert_v1alpha1_PortID_To_id_PortID(in *idv1alpha1.PortID, out *id.PortID, s conversion.Scope) error { + return autoConvert_v1alpha1_PortID_To_id_PortID(in, out, s) +} + +func autoConvert_v1alpha1_PortID_To_id_PortID(in *idv1alpha1.PortID, out *id.PortID, s conversion.Scope) error { + if err := Convert_v1alpha1_NodeID_To_id_NodeID(&in.NodeID, &out.NodeID, s); err != nil { + return err + } + out.ModuleBay = (*int)(unsafe.Pointer(in.ModuleBay)) + out.Module = (*int)(unsafe.Pointer(in.Module)) + out.Port = in.Port + return nil +} + +// Convert_id_PortID_To_v1alpha1_PortID is an autogenerated conversion function. +func Convert_id_PortID_To_v1alpha1_PortID(in *id.PortID, out *idv1alpha1.PortID, s conversion.Scope) error { + return autoConvert_id_PortID_To_v1alpha1_PortID(in, out, s) +} + +func autoConvert_id_PortID_To_v1alpha1_PortID(in *id.PortID, out *idv1alpha1.PortID, s conversion.Scope) error { + if err := Convert_id_NodeID_To_v1alpha1_NodeID(&in.NodeID, &out.NodeID, s); err != nil { + return err + } + out.ModuleBay = (*int)(unsafe.Pointer(in.ModuleBay)) + out.Module = (*int)(unsafe.Pointer(in.Module)) + out.Port = in.Port + return nil +} + +// Convert_v1alpha1_SiteID_To_id_SiteID is an autogenerated conversion function. +func Convert_v1alpha1_SiteID_To_id_SiteID(in *idv1alpha1.SiteID, out *id.SiteID, s conversion.Scope) error { + return autoConvert_v1alpha1_SiteID_To_id_SiteID(in, out, s) +} + +func autoConvert_v1alpha1_SiteID_To_id_SiteID(in *idv1alpha1.SiteID, out *id.SiteID, _ conversion.Scope) error { + out.Region = in.Region + out.Site = in.Site + return nil +} + +// Convert_id_SiteID_To_v1alpha1_SiteID is an autogenerated conversion function. +func Convert_id_SiteID_To_v1alpha1_SiteID(in *id.SiteID, out *idv1alpha1.SiteID, s conversion.Scope) error { + return autoConvert_id_SiteID_To_v1alpha1_SiteID(in, out, s) +} + +func autoConvert_id_SiteID_To_v1alpha1_SiteID(in *id.SiteID, out *idv1alpha1.SiteID, _ conversion.Scope) error { + out.Region = in.Region + out.Site = in.Site + return nil +} diff --git a/apis/infra/v1alpha1/doc.go b/apis/infra/v1alpha1/doc.go new file mode 100644 index 0000000..10b1fba --- /dev/null +++ b/apis/infra/v1alpha1/doc.go @@ -0,0 +1,29 @@ +/* +Copyright 2024 Nokia. + +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. +*/ + +//go:generate deepcopy-gen -O zz_generated.deepcopy -i . -h ../../../../boilerplate.go.txt +//go:generate defaulter-gen -O zz_generated.defaults -i . -h ../../../../boilerplate.go.txt +//go:generate conversion-gen -O zz_generated.conversion -i . -h ../../../../boilerplate.go.txt + +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen=package,register +// +k8s:conversion-gen=github.com/kuidio/kuid/apis/infra +// +k8s:defaulter-gen=TypeMeta +// +groupName=infra.kuid.dev + +// v1alpha1 is the v1alpha1 version of the API. +package v1alpha1 + diff --git a/apis/infra/v1alpha1/endpoint_resource.go b/apis/infra/v1alpha1/endpoint_resource.go new file mode 100644 index 0000000..0d15823 --- /dev/null +++ b/apis/infra/v1alpha1/endpoint_resource.go @@ -0,0 +1,80 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/kuidio/kuid/apis/infra" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +k8s:deepcopy-gen=false +var _ resource.Object = &Endpoint{} +var _ resource.ObjectList = &EndpointList{} +var _ resource.MultiVersionObject = &Endpoint{} + +func (Endpoint) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: infra.EndpointPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (Endpoint) IsStorageVersion() bool { + return false +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (Endpoint) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *Endpoint) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// New return an empty resource +// New implements resource.Object +func (Endpoint) New() runtime.Object { + return &Endpoint{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (Endpoint) NewList() runtime.Object { + return &EndpointList{} +} + +// GetListMeta returns the ListMeta +// GetListMeta implements resource.ObjectList +func (r *EndpointList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// RegisterConversions registers the conversions. +// RegisterConversions implements resource.MultiVersionObject +func (Endpoint) RegisterConversions() func(s *runtime.Scheme) error { + return RegisterConversions +} diff --git a/apis/infra/v1alpha1/endpoint_types.go b/apis/infra/v1alpha1/endpoint_types.go new file mode 100644 index 0000000..de43b72 --- /dev/null +++ b/apis/infra/v1alpha1/endpoint_types.go @@ -0,0 +1,78 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "reflect" + + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + idv1alpha1 "github.com/kuidio/kuid/apis/id/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// Claims can be expressed in 3 ways +// OnwerReference, Finalizer or Status with reference to the claim onwer -> finalizer seem the best option for this + +// EndpointSpec defines the desired state of Endpoint +type EndpointSpec struct { + // NodeGroupEndpointID identifies the endpoint identity this resource belongs to + idv1alpha1.PartitionEndpointID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeGroupEndpointID"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` + // (Gbps) + Speed *string `json:"speed,omitempty" yaml:"speed,omitempty" protobuf:"bytes,4,opt,name=speed"` + // VLANTagging defines if VLAN tagging is enabled or disabled on the interface + VLANTagging bool `json:"vlanTagging,omitempty" yaml:"vlanTagging,omitempty" protobuf:"bytes,5,opt,name=vlanTagging"` +} + +// EndpointStatus defines the observed state of Endpoint +type EndpointStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// An Endpoint represents a communication interface or connection point within a Node, +// facilitating network communication and data transfer between different components +// or systems within the environment. `Endpoints` serve as gateways for transmitting and +// receiving data, enabling seamless communication between Nodes. +// +k8s:openapi-gen=true +type Endpoint struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec EndpointSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status EndpointStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// EndpointList contains a list of Endpoints +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type EndpointList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []Endpoint `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + EndpointKind = reflect.TypeOf(Endpoint{}).Name() + EndpointKindList = reflect.TypeOf(EndpointList{}).Name() +) diff --git a/apis/infra/v1alpha1/endpointset_resource.go b/apis/infra/v1alpha1/endpointset_resource.go new file mode 100644 index 0000000..00af73d --- /dev/null +++ b/apis/infra/v1alpha1/endpointset_resource.go @@ -0,0 +1,80 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/kuidio/kuid/apis/infra" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +k8s:deepcopy-gen=false +var _ resource.Object = &EndpointSet{} +var _ resource.ObjectList = &EndpointSetList{} +var _ resource.MultiVersionObject = &EndpointSet{} + +func (EndpointSet) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: infra.EndpointSetPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (EndpointSet) IsStorageVersion() bool { + return false +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (EndpointSet) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *EndpointSet) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// New return an empty resource +// New implements resource.Object +func (EndpointSet) New() runtime.Object { + return &EndpointSet{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (EndpointSet) NewList() runtime.Object { + return &EndpointSetList{} +} + +// GetListMeta returns the ListMeta +// GetListMeta implements resource.ObjectList +func (r *EndpointSetList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// RegisterConversions registers the conversions. +// RegisterConversions implements resource.MultiVersionObject +func (EndpointSet) RegisterConversions() func(s *runtime.Scheme) error { + return RegisterConversions +} diff --git a/apis/infra/v1alpha1/endpointset_types.go b/apis/infra/v1alpha1/endpointset_types.go new file mode 100644 index 0000000..1c99929 --- /dev/null +++ b/apis/infra/v1alpha1/endpointset_types.go @@ -0,0 +1,86 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "reflect" + + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + idv1alpha1 "github.com/kuidio/kuid/apis/id/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// EndpointSetSpec defines the desired state of EndpointSet +// An EndpointSet can be a LAG (single Homed) or ESI (multiHomed). The EndpointSet +// can only belong to a single NodeGroup +type EndpointSetSpec struct { + // Endpoints defines the Endpoints that are part of the EndpointSet + // Min 1, Max 16 + Endpoints []*idv1alpha1.PartitionEndpointID `json:"endpoints" yaml:"endpoints" protobuf:"bytes,1,opt,name=endpoints"` + // Lacp defines if the lag enabled LACP + // +optional + Lacp *bool `json:"lacp,omitempty" yaml:"lacp,omitempty" protobuf:"bytes,2,opt,name=lacp"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` +} + +// EndpointSetStatus defines the observed state of EndpointSet +type EndpointSetStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` + // ESI defines the ethernet segment identifier of the logical link + // if set this is a multi-homed logical endpoint + // the ESI is a global unique identifier within the administrative domain + // +optional + ESI *uint32 `json:"esi,omitempty" yaml:"esi,omitempty" protobuf:"bytes,2,opt,name=esi"` + // LagId defines the lag id for the logical single-homed or multi-homed + // endpoint + // +optional + LagId *uint32 `json:"lagID,omitempty" yaml:"lagID,omitempty" protobuf:"bytes,3,opt,name=lagID"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// A EndpointSet represents a set of endpoints that belong together within a nodeGroup. +// E.g. it can be used to model a logical Link Aggregation group within +// a node or it can be used to represent a logical multi-homing construction +// between a set of nodes belonging to a single nodeGroup. +// +k8s:openapi-gen=true +type EndpointSet struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec EndpointSetSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status EndpointSetStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// EndpointSetList contains a list of EndpointSets +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type EndpointSetList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []EndpointSet `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + EndpointSetKind = reflect.TypeOf(EndpointSet{}).Name() + EndpointSetKindList = reflect.TypeOf(EndpointSetList{}).Name() +) diff --git a/apis/infra/v1alpha1/link_resource.go b/apis/infra/v1alpha1/link_resource.go new file mode 100644 index 0000000..fbffdb6 --- /dev/null +++ b/apis/infra/v1alpha1/link_resource.go @@ -0,0 +1,80 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/kuidio/kuid/apis/infra" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +k8s:deepcopy-gen=false +var _ resource.Object = &Link{} +var _ resource.ObjectList = &LinkList{} +var _ resource.MultiVersionObject = &Link{} + +func (Link) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: infra.LinkPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (Link) IsStorageVersion() bool { + return false +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (Link) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *Link) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// New return an empty resource +// New implements resource.Object +func (Link) New() runtime.Object { + return &Link{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (Link) NewList() runtime.Object { + return &LinkList{} +} + +// GetListMeta returns the ListMeta +// GetListMeta implements resource.ObjectList +func (r *LinkList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// RegisterConversions registers the conversions. +// RegisterConversions implements resource.MultiVersionObject +func (Link) RegisterConversions() func(s *runtime.Scheme) error { + return RegisterConversions +} diff --git a/apis/infra/v1alpha1/link_types.go b/apis/infra/v1alpha1/link_types.go new file mode 100644 index 0000000..c3e875e --- /dev/null +++ b/apis/infra/v1alpha1/link_types.go @@ -0,0 +1,82 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "reflect" + + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + idv1alpha1 "github.com/kuidio/kuid/apis/id/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// LinkSpec defines the desired state of Link +type LinkSpec struct { + // Endpoints define the 2 endpoint identifiers of the link + // Can only have 2 endpoints + Endpoints []*idv1alpha1.PartitionEndpointID `json:"endpoints" yaml:"endpoints" protobuf:"bytes,1,opt,name=endpoints"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,2,opt,name=userDefinedLabels"` + // BFD defines the BFD specific parameters on the link + // +optional + //BFD *BFDLinkParameters `json:"bfd,omitempty" yaml:"bfd,omitempty" protobuf:"bytes,3,opt,name=bfd"` + // OSPF defines the OSPF specific parameters on the link + // +optional + //OSPF *OSPFLinkParameters `json:"ospf,omitempty" yaml:"ospf,omitempty" protobuf:"bytes,4,opt,name=ospf"` + // ISIS defines the ISIS specific parameters on the link + // +optional + //ISIS *ISISLinkParameters `json:"isis,omitempty" yaml:"isis,omitempty" protobuf:"bytes,5,opt,name=isis"` + // BGP defines the BGP specific parameters on the link + // +optional + //BGP *BGPLinkParameters `json:"bgp,omitempty" yaml:"bgp,omitempty" protobuf:"bytes,6,opt,name=bgp"` +} + +// LinkStatus defines the observed state of Link +type LinkStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// A link represents a physical/logical connection that enables communication and data transfer +// between 2 endpoints of a node. +// +k8s:openapi-gen=true +type Link struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec LinkSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status LinkStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// LinkList contains a list of Links +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type LinkList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []Link `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + LinkKind = reflect.TypeOf(Link{}).Name() + LinkKindList = reflect.TypeOf(LinkList{}).Name() +) diff --git a/apis/infra/v1alpha1/linkset_resource.go b/apis/infra/v1alpha1/linkset_resource.go new file mode 100644 index 0000000..c032fa4 --- /dev/null +++ b/apis/infra/v1alpha1/linkset_resource.go @@ -0,0 +1,80 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/kuidio/kuid/apis/infra" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +k8s:deepcopy-gen=false +var _ resource.Object = &LinkSet{} +var _ resource.ObjectList = &LinkSetList{} +var _ resource.MultiVersionObject = &LinkSet{} + +func (LinkSet) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: infra.LinkSetPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (LinkSet) IsStorageVersion() bool { + return false +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (LinkSet) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *LinkSet) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// New return an empty resource +// New implements resource.Object +func (LinkSet) New() runtime.Object { + return &LinkSet{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (LinkSet) NewList() runtime.Object { + return &LinkSetList{} +} + +// GetListMeta returns the ListMeta +// GetListMeta implements resource.ObjectList +func (r *LinkSetList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// RegisterConversions registers the conversions. +// RegisterConversions implements resource.MultiVersionObject +func (LinkSet) RegisterConversions() func(s *runtime.Scheme) error { + return RegisterConversions +} diff --git a/apis/infra/v1alpha1/linkset_types.go b/apis/infra/v1alpha1/linkset_types.go new file mode 100644 index 0000000..2b7683d --- /dev/null +++ b/apis/infra/v1alpha1/linkset_types.go @@ -0,0 +1,78 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "reflect" + + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + idv1alpha1 "github.com/kuidio/kuid/apis/id/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// LinkSetSpec defines the desired state of LinkSet +type LinkSetSpec struct { + // Endpoints define the endpoint identifiers of the LinkSet + Endpoints []*idv1alpha1.PartitionEndpointID `json:"endpoints" yaml:"endpoints" protobuf:"bytes,1,opt,name=endpoints"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,2,opt,name=userDefinedLabels"` +} + +// LinkSetStatus defines the observed state of LinkSet +type LinkSetStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` + // ESI defines the ethernet segment identifier of the logical link + // if set this is a multi-homed linkset + // the ESI is a global unique identifier within the administrative domain/topology + ESI *uint32 `json:"esi,omitempty" yaml:"esi,omitempty" protobuf:"varint,2,opt,name=esi"` + // LagId defines the lag id for the logical single-homed or multi-homed + // endpoint + LagId *uint32 `json:"lagId,omitempty" yaml:"lagId,omitempty" protobuf:"varint,3,opt,name=lagId"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// A linkSet represents a set of links that belong together within a node group or accross nodeGroups. +// E.g. it can be used to model a logical Link Aggregation group between 2 nodes or +// it can be used to represent a logical multi-homing construction between a set of nodes +// belonging to 1 or multiple nodeGroups/Topologies. +// +k8s:openapi-gen=true +type LinkSet struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec LinkSetSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status LinkSetStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// LinkSetList contains a list of LinkSets +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type LinkSetList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []LinkSet `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + LinkSetKind = reflect.TypeOf(LinkSet{}).Name() + LinkSetKindList = reflect.TypeOf(LinkSetList{}).Name() +) diff --git a/apis/infra/v1alpha1/location.go b/apis/infra/v1alpha1/location.go new file mode 100644 index 0000000..c1790ca --- /dev/null +++ b/apis/infra/v1alpha1/location.go @@ -0,0 +1,22 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +type Location struct { + Latitude string `json:"latitude" yaml:"latitude" protobuf:"bytes,1,opt,name=latitude"` + Longitude string `json:"longitude" yaml:"longitude" protobuf:"bytes,2,opt,name=longitude"` +} diff --git a/apis/infra/v1alpha1/module_resource.go b/apis/infra/v1alpha1/module_resource.go new file mode 100644 index 0000000..ec8e1a4 --- /dev/null +++ b/apis/infra/v1alpha1/module_resource.go @@ -0,0 +1,80 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/kuidio/kuid/apis/infra" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +k8s:deepcopy-gen=false +var _ resource.Object = &Module{} +var _ resource.ObjectList = &ModuleList{} +var _ resource.MultiVersionObject = &Module{} + +func (Module) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: infra.ModulePlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (Module) IsStorageVersion() bool { + return false +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (Module) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *Module) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// New return an empty resource +// New implements resource.Object +func (Module) New() runtime.Object { + return &Module{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (Module) NewList() runtime.Object { + return &ModuleList{} +} + +// GetListMeta returns the ListMeta +// GetListMeta implements resource.ObjectList +func (r *ModuleList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// RegisterConversions registers the conversions. +// RegisterConversions implements resource.MultiVersionObject +func (Module) RegisterConversions() func(s *runtime.Scheme) error { + return RegisterConversions +} diff --git a/apis/infra/v1alpha1/module_types.go b/apis/infra/v1alpha1/module_types.go new file mode 100644 index 0000000..4820a94 --- /dev/null +++ b/apis/infra/v1alpha1/module_types.go @@ -0,0 +1,72 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "reflect" + + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + idv1alpha1 "github.com/kuidio/kuid/apis/id/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// ModuleSpec defines the desired state of Module +type ModuleSpec struct { + // NodeID identifies the node identity this resource belongs to + idv1alpha1.PartitionNodeID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"` + // ModuelBay defines the bay in which the module is deployed + ModuleBay int `json:"moduleBay" yaml:"moduleBay" protobuf:"bytes,2,opt,name=moduleBay"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` +} + +// ModuleStatus defines the observed state of Module +type ModuleStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// A module refers to a hardware component or expansion module that can be installed within a ModuleBay of a Node. +// Modules provide additional functionality and capabilities to the infrastructure environment, +// allowing users to enhance and customize their deployments according to specific requirements. +// +k8s:openapi-gen=true +type Module struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec ModuleSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status ModuleStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// ModuleList contains a list of Modules +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type ModuleList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []Module `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + ModuleKind = reflect.TypeOf(Module{}).Name() + ModuleKindList = reflect.TypeOf(ModuleList{}).Name() +) diff --git a/apis/infra/v1alpha1/modulebay_resource.go b/apis/infra/v1alpha1/modulebay_resource.go new file mode 100644 index 0000000..99f9dac --- /dev/null +++ b/apis/infra/v1alpha1/modulebay_resource.go @@ -0,0 +1,80 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/kuidio/kuid/apis/infra" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +k8s:deepcopy-gen=false +var _ resource.Object = &ModuleBay{} +var _ resource.ObjectList = &ModuleBayList{} +var _ resource.MultiVersionObject = &ModuleBay{} + +func (ModuleBay) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: infra.ModuleBayPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (ModuleBay) IsStorageVersion() bool { + return false +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (ModuleBay) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *ModuleBay) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// New return an empty resource +// New implements resource.Object +func (ModuleBay) New() runtime.Object { + return &ModuleBay{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (ModuleBay) NewList() runtime.Object { + return &ModuleBayList{} +} + +// GetListMeta returns the ListMeta +// GetListMeta implements resource.ObjectList +func (r *ModuleBayList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// RegisterConversions registers the conversions. +// RegisterConversions implements resource.MultiVersionObject +func (ModuleBay) RegisterConversions() func(s *runtime.Scheme) error { + return RegisterConversions +} diff --git a/apis/infra/v1alpha1/modulebay_types.go b/apis/infra/v1alpha1/modulebay_types.go new file mode 100644 index 0000000..41b57aa --- /dev/null +++ b/apis/infra/v1alpha1/modulebay_types.go @@ -0,0 +1,72 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "reflect" + + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + idv1alpha1 "github.com/kuidio/kuid/apis/id/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// ModuleBaySpec defines the desired state of ModuleBay +type ModuleBaySpec struct { + // NodeID identifies the node identity this resource belongs to + idv1alpha1.PartitionNodeID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"` + // Position defines the position in the node the moduleBay is deployed + Position int `json:"psoition" yaml:"psoition" protobuf:"bytes,2,opt,name=psoition"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` +} + +// ModuleBayStatus defines the observed state of ModuleBay +type ModuleBayStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// A ModuleBay serves as a modular slot or enclosure within a Node, designed to accommodate additional modules. +// ModuleBays provide a flexible and scalable approach to extending the capabilities of Nodes, +// allowing users to customize and enhance their infrastructure deployments according to specific requirements. +// +k8s:openapi-gen=true +type ModuleBay struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec ModuleBaySpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status ModuleBayStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// ModuleBayList contains a list of ModuleBays +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type ModuleBayList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []ModuleBay `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + ModuleBayKind = reflect.TypeOf(ModuleBay{}).Name() + ModuleBayKindList = reflect.TypeOf(ModuleBayList{}).Name() +) diff --git a/apis/infra/v1alpha1/node_resource.go b/apis/infra/v1alpha1/node_resource.go new file mode 100644 index 0000000..50384e6 --- /dev/null +++ b/apis/infra/v1alpha1/node_resource.go @@ -0,0 +1,80 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/kuidio/kuid/apis/infra" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +k8s:deepcopy-gen=false +var _ resource.Object = &Node{} +var _ resource.ObjectList = &NodeList{} +var _ resource.MultiVersionObject = &Node{} + +func (Node) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: infra.NodePlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (Node) IsStorageVersion() bool { + return false +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (Node) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *Node) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// New return an empty resource +// New implements resource.Object +func (Node) New() runtime.Object { + return &Node{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (Node) NewList() runtime.Object { + return &NodeList{} +} + +// GetListMeta returns the ListMeta +// GetListMeta implements resource.ObjectList +func (r *NodeList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// RegisterConversions registers the conversions. +// RegisterConversions implements resource.MultiVersionObject +func (Node) RegisterConversions() func(s *runtime.Scheme) error { + return RegisterConversions +} diff --git a/apis/infra/v1alpha1/node_types.go b/apis/infra/v1alpha1/node_types.go new file mode 100644 index 0000000..8a2fe1f --- /dev/null +++ b/apis/infra/v1alpha1/node_types.go @@ -0,0 +1,98 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "reflect" + + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + idv1alpha1 "github.com/kuidio/kuid/apis/id/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// NodeSpec defines the desired state of Node +type NodeSpec struct { + // NodeGroupNodeID identifies the nodeGroup identity this resource belongs to + idv1alpha1.PartitionNodeID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"` + // Rack defines the rack in which the node is deployed + // +optional + Rack *string `json:"rack,omitempty" yaml:"rack,omitempty" protobuf:"bytes,2,opt,name=rack"` + // relative position in the rack + // +optional + Position *string `json:"position,omitempty" yaml:"position,omitempty" protobuf:"bytes,3,opt,name=position"` + // Location defines the location information where this resource is located + // in lon/lat coordinates + // +optional + Location *Location `json:"location,omitempty" yaml:"location,omitempty" protobuf:"bytes,4,opt,name=location"` + // Provider defines the provider implementing this resource. + Provider string `json:"provider" yaml:"provider" protobuf:"bytes,5,opt,name=provider"` + // PlatformType define the type of platform implementing the nodespec + PlatformType string `json:"platformType" yaml:"platformType" protobuf:"bytes,6,opt,name=platformType"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,7,opt,name=userDefinedLabels"` + + // TBD + // Serial number + // Node config + // Initial config + // IPAddress: IPv4 or IPv6 + // OOB IPAddress +} + +// NodeStatus defines the observed state of Node +type NodeStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` + // System ID define the unique system id of the node + // +optional + SystemID *string `json:"systemID,omitempty" yaml:"systemID,omitempty" protobuf:"bytes,2,opt,name=systemID"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// A Node represents a fundamental unit that implements compute, storage, and/or networking within your environment. +// Nodes can embody physical, virtual, or containerized entities, offering versatility in deployment options to suit +// diverse infrastructure requirements. +// Nodes are logically organized within racks and sites/regions, establishing a hierarchical structure for efficient +// resource management and organization. Additionally, Nodes are associated with nodeGroups, facilitating centralized +// management and control within defined administrative boundaries. +// Each Node is assigned a provider, representing the entity responsible for implementing the specifics of the Node. +// +k8s:openapi-gen=true +type Node struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec NodeSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status NodeStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// NodeList contains a list of Nodes +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type NodeList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []Node `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + NodeKind = reflect.TypeOf(Node{}).Name() + NodeKindList = reflect.TypeOf(NodeList{}).Name() +) diff --git a/apis/infra/v1alpha1/nodeitem_resource.go b/apis/infra/v1alpha1/nodeitem_resource.go new file mode 100644 index 0000000..09256ff --- /dev/null +++ b/apis/infra/v1alpha1/nodeitem_resource.go @@ -0,0 +1,80 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/kuidio/kuid/apis/infra" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +k8s:deepcopy-gen=false +var _ resource.Object = &NodeItem{} +var _ resource.ObjectList = &NodeItemList{} +var _ resource.MultiVersionObject = &NodeItem{} + +func (NodeItem) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: infra.NodeItemPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (NodeItem) IsStorageVersion() bool { + return false +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (NodeItem) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *NodeItem) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// New return an empty resource +// New implements resource.Object +func (NodeItem) New() runtime.Object { + return &NodeItem{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (NodeItem) NewList() runtime.Object { + return &NodeItemList{} +} + +// GetListMeta returns the ListMeta +// GetListMeta implements resource.ObjectList +func (r *NodeItemList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// RegisterConversions registers the conversions. +// RegisterConversions implements resource.MultiVersionObject +func (NodeItem) RegisterConversions() func(s *runtime.Scheme) error { + return RegisterConversions +} diff --git a/apis/infra/v1alpha1/nodeitem_types.go b/apis/infra/v1alpha1/nodeitem_types.go new file mode 100644 index 0000000..f9ea7af --- /dev/null +++ b/apis/infra/v1alpha1/nodeitem_types.go @@ -0,0 +1,71 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "reflect" + + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + idv1alpha1 "github.com/kuidio/kuid/apis/id/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// NodeItemSpec defines the desired state of NodeItem +type NodeItemSpec struct { + // NodeID identifies the node identity this resource belongs to + idv1alpha1.PartitionNodeID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,2,opt,name=userDefinedLabels"` +} + +// NodeItemStatus defines the observed state of NodeItem +type NodeItemStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// A NodeItem represents a specific hardware component or accessory associated with a Node. +// NodeItems represent a wide range of hardware elements, e.g Fan(s), PowerUnit(s), CPU(s), +// and other peripheral devices essential for the operation of the Node. +// NodeItem is used to represent the modular components of a node. +// +k8s:openapi-gen=true +type NodeItem struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec NodeItemSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status NodeItemStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// NodeItemList contains a list of NodeItems +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type NodeItemList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []NodeItem `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + NodeItemKind = reflect.TypeOf(NodeItem{}).Name() + NodeItemKindList = reflect.TypeOf(NodeItemList{}).Name() +) diff --git a/apis/infra/v1alpha1/nodeset_resource.go b/apis/infra/v1alpha1/nodeset_resource.go new file mode 100644 index 0000000..2f79d75 --- /dev/null +++ b/apis/infra/v1alpha1/nodeset_resource.go @@ -0,0 +1,80 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/kuidio/kuid/apis/infra" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +k8s:deepcopy-gen=false +var _ resource.Object = &NodeSet{} +var _ resource.ObjectList = &NodeSetList{} +var _ resource.MultiVersionObject = &NodeSet{} + +func (NodeSet) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: infra.NodeSetPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (NodeSet) IsStorageVersion() bool { + return false +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (NodeSet) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *NodeSet) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// New return an empty resource +// New implements resource.Object +func (NodeSet) New() runtime.Object { + return &NodeSet{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (NodeSet) NewList() runtime.Object { + return &NodeSetList{} +} + +// GetListMeta returns the ListMeta +// GetListMeta implements resource.ObjectList +func (r *NodeSetList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// RegisterConversions registers the conversions. +// RegisterConversions implements resource.MultiVersionObject +func (NodeSet) RegisterConversions() func(s *runtime.Scheme) error { + return RegisterConversions +} diff --git a/apis/infra/v1alpha1/nodeset_types.go b/apis/infra/v1alpha1/nodeset_types.go new file mode 100644 index 0000000..b3cd949 --- /dev/null +++ b/apis/infra/v1alpha1/nodeset_types.go @@ -0,0 +1,72 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "reflect" + + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + idv1alpha1 "github.com/kuidio/kuid/apis/id/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// NodeSetSetSpec defines the desired state of NodeSet +type NodeSetSpec struct { + NodeSet string `json:"nodeSet" yaml:"nodeSet" protobuf:"bytes,1,opt,name=nodeSet"` + // PartitionClusterID defines the cluster partition + idv1alpha1.PartitionClusterID `json:",inline" yaml:",inline" protobuf:"bytes,2,opt,name=nodeID"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + commonv1alpha1.ClaimLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` +} + +// NodeSetStatus defines the observed state of NodeSet +type NodeSetStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// A NodeSet represents a set of nodes. +// E.g. it can be used to model a set of nodes in a NodeSet that share the same +// charecteristics wrt, Numa, interfaces, etc. +// Another usage of NodeSet is the representation of a virtual Node that consists of multiple nodes. +// +k8s:openapi-gen=true +type NodeSet struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec NodeSetSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status NodeSetStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// NodeSetList contains a list of NodeSets +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type NodeSetList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []NodeSet `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + NodeSetKind = reflect.TypeOf(NodeSet{}).Name() + NodeSetKindList = reflect.TypeOf(NodeSetList{}).Name() +) diff --git a/apis/infra/v1alpha1/partition_resource.go b/apis/infra/v1alpha1/partition_resource.go new file mode 100644 index 0000000..3d0c7cf --- /dev/null +++ b/apis/infra/v1alpha1/partition_resource.go @@ -0,0 +1,80 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/kuidio/kuid/apis/infra" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +k8s:deepcopy-gen=false +var _ resource.Object = &Partition{} +var _ resource.ObjectList = &PartitionList{} +var _ resource.MultiVersionObject = &Partition{} + +func (Partition) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: infra.PartitionPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (Partition) IsStorageVersion() bool { + return false +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (Partition) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *Partition) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// New return an empty resource +// New implements resource.Object +func (Partition) New() runtime.Object { + return &Partition{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (Partition) NewList() runtime.Object { + return &PartitionList{} +} + +// GetListMeta returns the ListMeta +// GetListMeta implements resource.ObjectList +func (r *PartitionList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// RegisterConversions registers the conversions. +// RegisterConversions implements resource.MultiVersionObject +func (Partition) RegisterConversions() func(s *runtime.Scheme) error { + return RegisterConversions +} diff --git a/apis/infra/v1alpha1/partition_types.go b/apis/infra/v1alpha1/partition_types.go new file mode 100644 index 0000000..8ea4fec --- /dev/null +++ b/apis/infra/v1alpha1/partition_types.go @@ -0,0 +1,64 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "reflect" + + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// PartitionSpec defines the desired state of the partition +type PartitionSpec struct { + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,7,opt,name=userDefinedLabels"` +} + +// PartitionStatus defines the observed state of Partition +type PartitionStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// +k8s:openapi-gen=true +type Partition struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec PartitionSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status PartitionStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// PartitionList contains a list of Partitions +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type PartitionList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []Partition `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + PartitionKind = reflect.TypeOf(Partition{}).Name() + PartitionKindList = reflect.TypeOf(PartitionList{}).Name() +) diff --git a/apis/infra/v1alpha1/rack_resource.go b/apis/infra/v1alpha1/rack_resource.go new file mode 100644 index 0000000..071579e --- /dev/null +++ b/apis/infra/v1alpha1/rack_resource.go @@ -0,0 +1,80 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/kuidio/kuid/apis/infra" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +k8s:deepcopy-gen=false +var _ resource.Object = &Rack{} +var _ resource.ObjectList = &RackList{} +var _ resource.MultiVersionObject = &Rack{} + +func (Rack) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: infra.RackPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (Rack) IsStorageVersion() bool { + return false +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (Rack) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *Rack) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// New return an empty resource +// New implements resource.Object +func (Rack) New() runtime.Object { + return &Rack{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (Rack) NewList() runtime.Object { + return &RackList{} +} + +// GetListMeta returns the ListMeta +// GetListMeta implements resource.ObjectList +func (r *RackList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// RegisterConversions registers the conversions. +// RegisterConversions implements resource.MultiVersionObject +func (Rack) RegisterConversions() func(s *runtime.Scheme) error { + return RegisterConversions +} diff --git a/apis/infra/v1alpha1/rack_types.go b/apis/infra/v1alpha1/rack_types.go new file mode 100644 index 0000000..8b9dd60 --- /dev/null +++ b/apis/infra/v1alpha1/rack_types.go @@ -0,0 +1,76 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "reflect" + + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + idv1alpha1 "github.com/kuidio/kuid/apis/id/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// RackSpec defines the desired state of Rack +type RackSpec struct { + // SiteID identifies the siteID this resource belongs to + idv1alpha1.SiteID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=siteID"` + // Location defines the location information where this resource is located + // in lon/lat coordinates + Location *Location `json:"location,omitempty" yaml:"location,omitempty" protobuf:"bytes,2,opt,name=location"` + // The height of the rack, measured in units. + Height string `json:"height,omitempty" yaml:"height,omitempty" protobuf:"bytes,3,opt,name=height"` + // The canonical distance between the two vertical rails on a face. In inch + Width string `json:"width,omitempty" yaml:"width,omitempty" protobuf:"bytes,4,opt,name=width"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined label + commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,5,opt,name=userDefinedLabels"` +} + +// RackStatus defines the observed state of Rack +type RackStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// A rack represents a physical equipment rack within your environment. Each rack is designed to accommodate +// the installation of devices and equipment. +// +k8s:openapi-gen=true +type Rack struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec RackSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status RackStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// RackList contains a list of Racks +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type RackList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []Rack `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + RackKind = reflect.TypeOf(Rack{}).Name() + RackKindList = reflect.TypeOf(RackList{}).Name() +) diff --git a/apis/infra/v1alpha1/region_resource.go b/apis/infra/v1alpha1/region_resource.go new file mode 100644 index 0000000..aab8477 --- /dev/null +++ b/apis/infra/v1alpha1/region_resource.go @@ -0,0 +1,80 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/kuidio/kuid/apis/infra" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +k8s:deepcopy-gen=false +var _ resource.Object = &Region{} +var _ resource.ObjectList = &RegionList{} +var _ resource.MultiVersionObject = &Region{} + +func (Region) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: infra.RegionPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (Region) IsStorageVersion() bool { + return false +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (Region) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *Region) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// New return an empty resource +// New implements resource.Object +func (Region) New() runtime.Object { + return &Region{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (Region) NewList() runtime.Object { + return &RegionList{} +} + +// GetListMeta returns the ListMeta +// GetListMeta implements resource.ObjectList +func (r *RegionList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// RegisterConversions registers the conversions. +// RegisterConversions implements resource.MultiVersionObject +func (Region) RegisterConversions() func(s *runtime.Scheme) error { + return RegisterConversions +} diff --git a/apis/infra/v1alpha1/region_types.go b/apis/infra/v1alpha1/region_types.go new file mode 100644 index 0000000..7fe6798 --- /dev/null +++ b/apis/infra/v1alpha1/region_types.go @@ -0,0 +1,66 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "reflect" + + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// RegionSpec defines the desired state of Region +type RegionSpec struct { + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=userDefinedLabels"` +} + +// RegionStatus defines the observed state of Region +type RegionStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// A region represent a geography in which multiple infrastructure resources are grouped +// A region might represent a continent, country, city, campus, or other area depending on your environment. +// +k8s:openapi-gen=true +type Region struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec RegionSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status RegionStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// RegionList contains a list of Regions +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type RegionList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []Region `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + RegionKind = reflect.TypeOf(Region{}).Name() + RegionKindList = reflect.TypeOf(RegionList{}).Name() +) diff --git a/apis/infra/v1alpha1/register.go b/apis/infra/v1alpha1/register.go new file mode 100644 index 0000000..4c50a51 --- /dev/null +++ b/apis/infra/v1alpha1/register.go @@ -0,0 +1,89 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +const ( + Group = "infra.kuid.dev" + Version = "v1alpha1" +) + +var ( + // SchemeGroupVersion contains the API group and version information for the types in this package. + SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version} + // AddToScheme applies all the stored functions to the scheme. A non-nil error + // indicates that one function failed and the attempt was abandoned. + //AddToScheme = (&runtime.SchemeBuilder{}).AddToScheme + AddToScheme = localSchemeBuilder.AddToScheme + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + schemeBuilder runtime.SchemeBuilder + localSchemeBuilder = &schemeBuilder +) + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +func init() { + localSchemeBuilder.Register(addKnownTypes) +} + +// Adds the list of known types to the given scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + // +kubebuilder:scaffold:install + + scheme.AddKnownTypes(SchemeGroupVersion, + &Cluster{}, + &ClusterList{}, + &Endpoint{}, + &EndpointList{}, + &EndpointSet{}, + &EndpointSetList{}, + &Link{}, + &LinkList{}, + &LinkSet{}, + &LinkSetList{}, + &Module{}, + &ModuleList{}, + &ModuleBay{}, + &ModuleBayList{}, + &Node{}, + &NodeList{}, + &NodeItem{}, + &NodeItemList{}, + &NodeSet{}, + &NodeSetList{}, + &Partition{}, + &PartitionList{}, + &Rack{}, + &RackList{}, + &Region{}, + &RegionList{}, + &Site{}, + &SiteList{}, + ) + + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/apis/infra/v1alpha1/site_resource.go b/apis/infra/v1alpha1/site_resource.go new file mode 100644 index 0000000..f85efaf --- /dev/null +++ b/apis/infra/v1alpha1/site_resource.go @@ -0,0 +1,80 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/kuidio/kuid/apis/infra" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +k8s:deepcopy-gen=false +var _ resource.Object = &Site{} +var _ resource.ObjectList = &SiteList{} +var _ resource.MultiVersionObject = &Site{} + +func (Site) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: infra.SitePlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (Site) IsStorageVersion() bool { + return false +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (Site) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *Site) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// New return an empty resource +// New implements resource.Object +func (Site) New() runtime.Object { + return &Site{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (Site) NewList() runtime.Object { + return &SiteList{} +} + +// GetListMeta returns the ListMeta +// GetListMeta implements resource.ObjectList +func (r *SiteList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// RegisterConversions registers the conversions. +// RegisterConversions implements resource.MultiVersionObject +func (Site) RegisterConversions() func(s *runtime.Scheme) error { + return RegisterConversions +} diff --git a/apis/infra/v1alpha1/site_types.go b/apis/infra/v1alpha1/site_types.go new file mode 100644 index 0000000..8de0528 --- /dev/null +++ b/apis/infra/v1alpha1/site_types.go @@ -0,0 +1,73 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "reflect" + + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + idv1alpha1 "github.com/kuidio/kuid/apis/id/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// SiteSpec defines the desired state of Site +type SiteSpec struct { + // SiteID defines the siteID + idv1alpha1.SiteID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=siteID"` + // Location defines the location information where this resource is located + // in lon/lat coordinates + Location *Location `json:"location,omitempty" yaml:"location,omitempty" protobuf:"bytes,2,opt,name=location"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` +} + +// SiteStatus defines the observed state of Site +type SiteStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// A site serves as a fundamental organizational unit for managing infrastructure resources within your environment. +// The utilization of sites may vary based on the organizational structure and requirements, +// but in essence, each site typically corresponds to a distinct building or campus. +// +k8s:openapi-gen=true +type Site struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec SiteSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status SiteStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// SiteList contains a list of Sites +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type SiteList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []Site `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + SiteKind = reflect.TypeOf(Site{}).Name() + SiteKindList = reflect.TypeOf(SiteList{}).Name() +) diff --git a/apis/infra/v1alpha1/zz_generated.conversion.go b/apis/infra/v1alpha1/zz_generated.conversion.go new file mode 100644 index 0000000..d694766 --- /dev/null +++ b/apis/infra/v1alpha1/zz_generated.conversion.go @@ -0,0 +1,2580 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2024 Nokia. + +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 conversion-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + unsafe "unsafe" + + asv1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" + id "github.com/kuidio/kuid/apis/id" + idv1alpha1 "github.com/kuidio/kuid/apis/id/v1alpha1" + infra "github.com/kuidio/kuid/apis/infra" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +func init() { + localSchemeBuilder.Register(RegisterConversions) +} + +// RegisterConversions adds conversion functions to the given scheme. +// Public to allow building arbitrary schemes. +func RegisterConversions(s *runtime.Scheme) error { + if err := s.AddGeneratedConversionFunc((*Cluster)(nil), (*infra.Cluster)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Cluster_To_infra_Cluster(a.(*Cluster), b.(*infra.Cluster), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.Cluster)(nil), (*Cluster)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_Cluster_To_v1alpha1_Cluster(a.(*infra.Cluster), b.(*Cluster), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ClusterList)(nil), (*infra.ClusterList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ClusterList_To_infra_ClusterList(a.(*ClusterList), b.(*infra.ClusterList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.ClusterList)(nil), (*ClusterList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_ClusterList_To_v1alpha1_ClusterList(a.(*infra.ClusterList), b.(*ClusterList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ClusterSpec)(nil), (*infra.ClusterSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ClusterSpec_To_infra_ClusterSpec(a.(*ClusterSpec), b.(*infra.ClusterSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.ClusterSpec)(nil), (*ClusterSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_ClusterSpec_To_v1alpha1_ClusterSpec(a.(*infra.ClusterSpec), b.(*ClusterSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ClusterStatus)(nil), (*infra.ClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ClusterStatus_To_infra_ClusterStatus(a.(*ClusterStatus), b.(*infra.ClusterStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.ClusterStatus)(nil), (*ClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_ClusterStatus_To_v1alpha1_ClusterStatus(a.(*infra.ClusterStatus), b.(*ClusterStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Endpoint)(nil), (*infra.Endpoint)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Endpoint_To_infra_Endpoint(a.(*Endpoint), b.(*infra.Endpoint), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.Endpoint)(nil), (*Endpoint)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_Endpoint_To_v1alpha1_Endpoint(a.(*infra.Endpoint), b.(*Endpoint), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*EndpointList)(nil), (*infra.EndpointList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_EndpointList_To_infra_EndpointList(a.(*EndpointList), b.(*infra.EndpointList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.EndpointList)(nil), (*EndpointList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_EndpointList_To_v1alpha1_EndpointList(a.(*infra.EndpointList), b.(*EndpointList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*EndpointSet)(nil), (*infra.EndpointSet)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_EndpointSet_To_infra_EndpointSet(a.(*EndpointSet), b.(*infra.EndpointSet), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.EndpointSet)(nil), (*EndpointSet)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_EndpointSet_To_v1alpha1_EndpointSet(a.(*infra.EndpointSet), b.(*EndpointSet), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*EndpointSetList)(nil), (*infra.EndpointSetList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_EndpointSetList_To_infra_EndpointSetList(a.(*EndpointSetList), b.(*infra.EndpointSetList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.EndpointSetList)(nil), (*EndpointSetList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_EndpointSetList_To_v1alpha1_EndpointSetList(a.(*infra.EndpointSetList), b.(*EndpointSetList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*EndpointSetSpec)(nil), (*infra.EndpointSetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_EndpointSetSpec_To_infra_EndpointSetSpec(a.(*EndpointSetSpec), b.(*infra.EndpointSetSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.EndpointSetSpec)(nil), (*EndpointSetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_EndpointSetSpec_To_v1alpha1_EndpointSetSpec(a.(*infra.EndpointSetSpec), b.(*EndpointSetSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*EndpointSetStatus)(nil), (*infra.EndpointSetStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_EndpointSetStatus_To_infra_EndpointSetStatus(a.(*EndpointSetStatus), b.(*infra.EndpointSetStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.EndpointSetStatus)(nil), (*EndpointSetStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_EndpointSetStatus_To_v1alpha1_EndpointSetStatus(a.(*infra.EndpointSetStatus), b.(*EndpointSetStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*EndpointSpec)(nil), (*infra.EndpointSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_EndpointSpec_To_infra_EndpointSpec(a.(*EndpointSpec), b.(*infra.EndpointSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.EndpointSpec)(nil), (*EndpointSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_EndpointSpec_To_v1alpha1_EndpointSpec(a.(*infra.EndpointSpec), b.(*EndpointSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*EndpointStatus)(nil), (*infra.EndpointStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_EndpointStatus_To_infra_EndpointStatus(a.(*EndpointStatus), b.(*infra.EndpointStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.EndpointStatus)(nil), (*EndpointStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_EndpointStatus_To_v1alpha1_EndpointStatus(a.(*infra.EndpointStatus), b.(*EndpointStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Link)(nil), (*infra.Link)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Link_To_infra_Link(a.(*Link), b.(*infra.Link), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.Link)(nil), (*Link)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_Link_To_v1alpha1_Link(a.(*infra.Link), b.(*Link), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LinkList)(nil), (*infra.LinkList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LinkList_To_infra_LinkList(a.(*LinkList), b.(*infra.LinkList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.LinkList)(nil), (*LinkList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_LinkList_To_v1alpha1_LinkList(a.(*infra.LinkList), b.(*LinkList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LinkSet)(nil), (*infra.LinkSet)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LinkSet_To_infra_LinkSet(a.(*LinkSet), b.(*infra.LinkSet), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.LinkSet)(nil), (*LinkSet)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_LinkSet_To_v1alpha1_LinkSet(a.(*infra.LinkSet), b.(*LinkSet), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LinkSetList)(nil), (*infra.LinkSetList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LinkSetList_To_infra_LinkSetList(a.(*LinkSetList), b.(*infra.LinkSetList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.LinkSetList)(nil), (*LinkSetList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_LinkSetList_To_v1alpha1_LinkSetList(a.(*infra.LinkSetList), b.(*LinkSetList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LinkSetSpec)(nil), (*infra.LinkSetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LinkSetSpec_To_infra_LinkSetSpec(a.(*LinkSetSpec), b.(*infra.LinkSetSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.LinkSetSpec)(nil), (*LinkSetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_LinkSetSpec_To_v1alpha1_LinkSetSpec(a.(*infra.LinkSetSpec), b.(*LinkSetSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LinkSetStatus)(nil), (*infra.LinkSetStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LinkSetStatus_To_infra_LinkSetStatus(a.(*LinkSetStatus), b.(*infra.LinkSetStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.LinkSetStatus)(nil), (*LinkSetStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_LinkSetStatus_To_v1alpha1_LinkSetStatus(a.(*infra.LinkSetStatus), b.(*LinkSetStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LinkSpec)(nil), (*infra.LinkSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LinkSpec_To_infra_LinkSpec(a.(*LinkSpec), b.(*infra.LinkSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.LinkSpec)(nil), (*LinkSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_LinkSpec_To_v1alpha1_LinkSpec(a.(*infra.LinkSpec), b.(*LinkSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*LinkStatus)(nil), (*infra.LinkStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LinkStatus_To_infra_LinkStatus(a.(*LinkStatus), b.(*infra.LinkStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.LinkStatus)(nil), (*LinkStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_LinkStatus_To_v1alpha1_LinkStatus(a.(*infra.LinkStatus), b.(*LinkStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Module)(nil), (*infra.Module)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Module_To_infra_Module(a.(*Module), b.(*infra.Module), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.Module)(nil), (*Module)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_Module_To_v1alpha1_Module(a.(*infra.Module), b.(*Module), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ModuleBay)(nil), (*infra.ModuleBay)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ModuleBay_To_infra_ModuleBay(a.(*ModuleBay), b.(*infra.ModuleBay), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.ModuleBay)(nil), (*ModuleBay)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_ModuleBay_To_v1alpha1_ModuleBay(a.(*infra.ModuleBay), b.(*ModuleBay), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ModuleBayList)(nil), (*infra.ModuleBayList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ModuleBayList_To_infra_ModuleBayList(a.(*ModuleBayList), b.(*infra.ModuleBayList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.ModuleBayList)(nil), (*ModuleBayList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_ModuleBayList_To_v1alpha1_ModuleBayList(a.(*infra.ModuleBayList), b.(*ModuleBayList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ModuleBaySpec)(nil), (*infra.ModuleBaySpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ModuleBaySpec_To_infra_ModuleBaySpec(a.(*ModuleBaySpec), b.(*infra.ModuleBaySpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.ModuleBaySpec)(nil), (*ModuleBaySpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_ModuleBaySpec_To_v1alpha1_ModuleBaySpec(a.(*infra.ModuleBaySpec), b.(*ModuleBaySpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ModuleBayStatus)(nil), (*infra.ModuleBayStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ModuleBayStatus_To_infra_ModuleBayStatus(a.(*ModuleBayStatus), b.(*infra.ModuleBayStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.ModuleBayStatus)(nil), (*ModuleBayStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_ModuleBayStatus_To_v1alpha1_ModuleBayStatus(a.(*infra.ModuleBayStatus), b.(*ModuleBayStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ModuleList)(nil), (*infra.ModuleList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ModuleList_To_infra_ModuleList(a.(*ModuleList), b.(*infra.ModuleList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.ModuleList)(nil), (*ModuleList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_ModuleList_To_v1alpha1_ModuleList(a.(*infra.ModuleList), b.(*ModuleList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ModuleSpec)(nil), (*infra.ModuleSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ModuleSpec_To_infra_ModuleSpec(a.(*ModuleSpec), b.(*infra.ModuleSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.ModuleSpec)(nil), (*ModuleSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_ModuleSpec_To_v1alpha1_ModuleSpec(a.(*infra.ModuleSpec), b.(*ModuleSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ModuleStatus)(nil), (*infra.ModuleStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ModuleStatus_To_infra_ModuleStatus(a.(*ModuleStatus), b.(*infra.ModuleStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.ModuleStatus)(nil), (*ModuleStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_ModuleStatus_To_v1alpha1_ModuleStatus(a.(*infra.ModuleStatus), b.(*ModuleStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Node)(nil), (*infra.Node)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Node_To_infra_Node(a.(*Node), b.(*infra.Node), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.Node)(nil), (*Node)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_Node_To_v1alpha1_Node(a.(*infra.Node), b.(*Node), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NodeItem)(nil), (*infra.NodeItem)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_NodeItem_To_infra_NodeItem(a.(*NodeItem), b.(*infra.NodeItem), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.NodeItem)(nil), (*NodeItem)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_NodeItem_To_v1alpha1_NodeItem(a.(*infra.NodeItem), b.(*NodeItem), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NodeItemList)(nil), (*infra.NodeItemList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_NodeItemList_To_infra_NodeItemList(a.(*NodeItemList), b.(*infra.NodeItemList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.NodeItemList)(nil), (*NodeItemList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_NodeItemList_To_v1alpha1_NodeItemList(a.(*infra.NodeItemList), b.(*NodeItemList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NodeItemSpec)(nil), (*infra.NodeItemSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_NodeItemSpec_To_infra_NodeItemSpec(a.(*NodeItemSpec), b.(*infra.NodeItemSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.NodeItemSpec)(nil), (*NodeItemSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_NodeItemSpec_To_v1alpha1_NodeItemSpec(a.(*infra.NodeItemSpec), b.(*NodeItemSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NodeItemStatus)(nil), (*infra.NodeItemStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_NodeItemStatus_To_infra_NodeItemStatus(a.(*NodeItemStatus), b.(*infra.NodeItemStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.NodeItemStatus)(nil), (*NodeItemStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_NodeItemStatus_To_v1alpha1_NodeItemStatus(a.(*infra.NodeItemStatus), b.(*NodeItemStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NodeList)(nil), (*infra.NodeList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_NodeList_To_infra_NodeList(a.(*NodeList), b.(*infra.NodeList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.NodeList)(nil), (*NodeList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_NodeList_To_v1alpha1_NodeList(a.(*infra.NodeList), b.(*NodeList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NodeSet)(nil), (*infra.NodeSet)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_NodeSet_To_infra_NodeSet(a.(*NodeSet), b.(*infra.NodeSet), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.NodeSet)(nil), (*NodeSet)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_NodeSet_To_v1alpha1_NodeSet(a.(*infra.NodeSet), b.(*NodeSet), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NodeSetList)(nil), (*infra.NodeSetList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_NodeSetList_To_infra_NodeSetList(a.(*NodeSetList), b.(*infra.NodeSetList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.NodeSetList)(nil), (*NodeSetList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_NodeSetList_To_v1alpha1_NodeSetList(a.(*infra.NodeSetList), b.(*NodeSetList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NodeSetSpec)(nil), (*infra.NodeSetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_NodeSetSpec_To_infra_NodeSetSpec(a.(*NodeSetSpec), b.(*infra.NodeSetSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.NodeSetSpec)(nil), (*NodeSetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_NodeSetSpec_To_v1alpha1_NodeSetSpec(a.(*infra.NodeSetSpec), b.(*NodeSetSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NodeSetStatus)(nil), (*infra.NodeSetStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_NodeSetStatus_To_infra_NodeSetStatus(a.(*NodeSetStatus), b.(*infra.NodeSetStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.NodeSetStatus)(nil), (*NodeSetStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_NodeSetStatus_To_v1alpha1_NodeSetStatus(a.(*infra.NodeSetStatus), b.(*NodeSetStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NodeSpec)(nil), (*infra.NodeSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_NodeSpec_To_infra_NodeSpec(a.(*NodeSpec), b.(*infra.NodeSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.NodeSpec)(nil), (*NodeSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_NodeSpec_To_v1alpha1_NodeSpec(a.(*infra.NodeSpec), b.(*NodeSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NodeStatus)(nil), (*infra.NodeStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_NodeStatus_To_infra_NodeStatus(a.(*NodeStatus), b.(*infra.NodeStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.NodeStatus)(nil), (*NodeStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_NodeStatus_To_v1alpha1_NodeStatus(a.(*infra.NodeStatus), b.(*NodeStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Partition)(nil), (*infra.Partition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Partition_To_infra_Partition(a.(*Partition), b.(*infra.Partition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.Partition)(nil), (*Partition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_Partition_To_v1alpha1_Partition(a.(*infra.Partition), b.(*Partition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*PartitionList)(nil), (*infra.PartitionList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_PartitionList_To_infra_PartitionList(a.(*PartitionList), b.(*infra.PartitionList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.PartitionList)(nil), (*PartitionList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_PartitionList_To_v1alpha1_PartitionList(a.(*infra.PartitionList), b.(*PartitionList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*PartitionSpec)(nil), (*infra.PartitionSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_PartitionSpec_To_infra_PartitionSpec(a.(*PartitionSpec), b.(*infra.PartitionSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.PartitionSpec)(nil), (*PartitionSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_PartitionSpec_To_v1alpha1_PartitionSpec(a.(*infra.PartitionSpec), b.(*PartitionSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*PartitionStatus)(nil), (*infra.PartitionStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_PartitionStatus_To_infra_PartitionStatus(a.(*PartitionStatus), b.(*infra.PartitionStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.PartitionStatus)(nil), (*PartitionStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_PartitionStatus_To_v1alpha1_PartitionStatus(a.(*infra.PartitionStatus), b.(*PartitionStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Rack)(nil), (*infra.Rack)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Rack_To_infra_Rack(a.(*Rack), b.(*infra.Rack), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.Rack)(nil), (*Rack)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_Rack_To_v1alpha1_Rack(a.(*infra.Rack), b.(*Rack), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*RackList)(nil), (*infra.RackList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_RackList_To_infra_RackList(a.(*RackList), b.(*infra.RackList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.RackList)(nil), (*RackList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_RackList_To_v1alpha1_RackList(a.(*infra.RackList), b.(*RackList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*RackSpec)(nil), (*infra.RackSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_RackSpec_To_infra_RackSpec(a.(*RackSpec), b.(*infra.RackSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.RackSpec)(nil), (*RackSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_RackSpec_To_v1alpha1_RackSpec(a.(*infra.RackSpec), b.(*RackSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*RackStatus)(nil), (*infra.RackStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_RackStatus_To_infra_RackStatus(a.(*RackStatus), b.(*infra.RackStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.RackStatus)(nil), (*RackStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_RackStatus_To_v1alpha1_RackStatus(a.(*infra.RackStatus), b.(*RackStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Region)(nil), (*infra.Region)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Region_To_infra_Region(a.(*Region), b.(*infra.Region), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.Region)(nil), (*Region)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_Region_To_v1alpha1_Region(a.(*infra.Region), b.(*Region), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*RegionList)(nil), (*infra.RegionList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_RegionList_To_infra_RegionList(a.(*RegionList), b.(*infra.RegionList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.RegionList)(nil), (*RegionList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_RegionList_To_v1alpha1_RegionList(a.(*infra.RegionList), b.(*RegionList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*RegionSpec)(nil), (*infra.RegionSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_RegionSpec_To_infra_RegionSpec(a.(*RegionSpec), b.(*infra.RegionSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.RegionSpec)(nil), (*RegionSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_RegionSpec_To_v1alpha1_RegionSpec(a.(*infra.RegionSpec), b.(*RegionSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*RegionStatus)(nil), (*infra.RegionStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_RegionStatus_To_infra_RegionStatus(a.(*RegionStatus), b.(*infra.RegionStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.RegionStatus)(nil), (*RegionStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_RegionStatus_To_v1alpha1_RegionStatus(a.(*infra.RegionStatus), b.(*RegionStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Site)(nil), (*infra.Site)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Site_To_infra_Site(a.(*Site), b.(*infra.Site), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.Site)(nil), (*Site)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_Site_To_v1alpha1_Site(a.(*infra.Site), b.(*Site), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*SiteList)(nil), (*infra.SiteList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_SiteList_To_infra_SiteList(a.(*SiteList), b.(*infra.SiteList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.SiteList)(nil), (*SiteList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_SiteList_To_v1alpha1_SiteList(a.(*infra.SiteList), b.(*SiteList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*SiteSpec)(nil), (*infra.SiteSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_SiteSpec_To_infra_SiteSpec(a.(*SiteSpec), b.(*infra.SiteSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.SiteSpec)(nil), (*SiteSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_SiteSpec_To_v1alpha1_SiteSpec(a.(*infra.SiteSpec), b.(*SiteSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*SiteStatus)(nil), (*infra.SiteStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_SiteStatus_To_infra_SiteStatus(a.(*SiteStatus), b.(*infra.SiteStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.SiteStatus)(nil), (*SiteStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_SiteStatus_To_v1alpha1_SiteStatus(a.(*infra.SiteStatus), b.(*SiteStatus), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*id.AdaptorID)(nil), (*idv1alpha1.AdaptorID)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_id_AdaptorID_To_v1alpha1_AdaptorID(a.(*id.AdaptorID), b.(*idv1alpha1.AdaptorID), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*id.ClusterID)(nil), (*idv1alpha1.ClusterID)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_id_ClusterID_To_v1alpha1_ClusterID(a.(*id.ClusterID), b.(*idv1alpha1.ClusterID), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*id.EndpointID)(nil), (*idv1alpha1.EndpointID)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_id_EndpointID_To_v1alpha1_EndpointID(a.(*id.EndpointID), b.(*idv1alpha1.EndpointID), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*id.NodeID)(nil), (*idv1alpha1.NodeID)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_id_NodeID_To_v1alpha1_NodeID(a.(*id.NodeID), b.(*idv1alpha1.NodeID), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*id.PartitionAttachmentID)(nil), (*idv1alpha1.PartitionAttachmentID)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_id_PartitionAttachmentID_To_v1alpha1_PartitionAttachmentID(a.(*id.PartitionAttachmentID), b.(*idv1alpha1.PartitionAttachmentID), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*id.PartitionClusterID)(nil), (*idv1alpha1.PartitionClusterID)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_id_PartitionClusterID_To_v1alpha1_PartitionClusterID(a.(*id.PartitionClusterID), b.(*idv1alpha1.PartitionClusterID), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*id.PartitionEndpointID)(nil), (*idv1alpha1.PartitionEndpointID)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_id_PartitionEndpointID_To_v1alpha1_PartitionEndpointID(a.(*id.PartitionEndpointID), b.(*idv1alpha1.PartitionEndpointID), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*id.PartitionNodeID)(nil), (*idv1alpha1.PartitionNodeID)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_id_PartitionNodeID_To_v1alpha1_PartitionNodeID(a.(*id.PartitionNodeID), b.(*idv1alpha1.PartitionNodeID), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*id.PortID)(nil), (*idv1alpha1.PortID)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_id_PortID_To_v1alpha1_PortID(a.(*id.PortID), b.(*idv1alpha1.PortID), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*id.SiteID)(nil), (*idv1alpha1.SiteID)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_id_SiteID_To_v1alpha1_SiteID(a.(*id.SiteID), b.(*idv1alpha1.SiteID), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*idv1alpha1.AdaptorID)(nil), (*id.AdaptorID)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_AdaptorID_To_id_AdaptorID(a.(*idv1alpha1.AdaptorID), b.(*id.AdaptorID), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*idv1alpha1.ClusterID)(nil), (*id.ClusterID)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ClusterID_To_id_ClusterID(a.(*idv1alpha1.ClusterID), b.(*id.ClusterID), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*idv1alpha1.EndpointID)(nil), (*id.EndpointID)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_EndpointID_To_id_EndpointID(a.(*idv1alpha1.EndpointID), b.(*id.EndpointID), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*idv1alpha1.NodeID)(nil), (*id.NodeID)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_NodeID_To_id_NodeID(a.(*idv1alpha1.NodeID), b.(*id.NodeID), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*idv1alpha1.PartitionAttachmentID)(nil), (*id.PartitionAttachmentID)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_PartitionAttachmentID_To_id_PartitionAttachmentID(a.(*idv1alpha1.PartitionAttachmentID), b.(*id.PartitionAttachmentID), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*idv1alpha1.PartitionClusterID)(nil), (*id.PartitionClusterID)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_PartitionClusterID_To_id_PartitionClusterID(a.(*idv1alpha1.PartitionClusterID), b.(*id.PartitionClusterID), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*idv1alpha1.PartitionEndpointID)(nil), (*id.PartitionEndpointID)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_PartitionEndpointID_To_id_PartitionEndpointID(a.(*idv1alpha1.PartitionEndpointID), b.(*id.PartitionEndpointID), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*idv1alpha1.PartitionNodeID)(nil), (*id.PartitionNodeID)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_PartitionNodeID_To_id_PartitionNodeID(a.(*idv1alpha1.PartitionNodeID), b.(*id.PartitionNodeID), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*idv1alpha1.PortID)(nil), (*id.PortID)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_PortID_To_id_PortID(a.(*idv1alpha1.PortID), b.(*id.PortID), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*idv1alpha1.SiteID)(nil), (*id.SiteID)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_SiteID_To_id_SiteID(a.(*idv1alpha1.SiteID), b.(*id.SiteID), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1alpha1_Cluster_To_infra_Cluster(in *Cluster, out *infra.Cluster, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_ClusterSpec_To_infra_ClusterSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_ClusterStatus_To_infra_ClusterStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_Cluster_To_infra_Cluster is an autogenerated conversion function. +func Convert_v1alpha1_Cluster_To_infra_Cluster(in *Cluster, out *infra.Cluster, s conversion.Scope) error { + return autoConvert_v1alpha1_Cluster_To_infra_Cluster(in, out, s) +} + +func autoConvert_infra_Cluster_To_v1alpha1_Cluster(in *infra.Cluster, out *Cluster, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_infra_ClusterSpec_To_v1alpha1_ClusterSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_infra_ClusterStatus_To_v1alpha1_ClusterStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_infra_Cluster_To_v1alpha1_Cluster is an autogenerated conversion function. +func Convert_infra_Cluster_To_v1alpha1_Cluster(in *infra.Cluster, out *Cluster, s conversion.Scope) error { + return autoConvert_infra_Cluster_To_v1alpha1_Cluster(in, out, s) +} + +func autoConvert_v1alpha1_ClusterList_To_infra_ClusterList(in *ClusterList, out *infra.ClusterList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]infra.Cluster, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_Cluster_To_infra_Cluster(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_ClusterList_To_infra_ClusterList is an autogenerated conversion function. +func Convert_v1alpha1_ClusterList_To_infra_ClusterList(in *ClusterList, out *infra.ClusterList, s conversion.Scope) error { + return autoConvert_v1alpha1_ClusterList_To_infra_ClusterList(in, out, s) +} + +func autoConvert_infra_ClusterList_To_v1alpha1_ClusterList(in *infra.ClusterList, out *ClusterList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Cluster, len(*in)) + for i := range *in { + if err := Convert_infra_Cluster_To_v1alpha1_Cluster(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_infra_ClusterList_To_v1alpha1_ClusterList is an autogenerated conversion function. +func Convert_infra_ClusterList_To_v1alpha1_ClusterList(in *infra.ClusterList, out *ClusterList, s conversion.Scope) error { + return autoConvert_infra_ClusterList_To_v1alpha1_ClusterList(in, out, s) +} + +func autoConvert_v1alpha1_ClusterSpec_To_infra_ClusterSpec(in *ClusterSpec, out *infra.ClusterSpec, s conversion.Scope) error { + if err := Convert_v1alpha1_PartitionClusterID_To_id_PartitionClusterID(&in.PartitionClusterID, &out.PartitionClusterID, s); err != nil { + return err + } + out.Provider = in.Provider + out.Location = (*infra.Location)(unsafe.Pointer(in.Location)) + if err := asv1alpha1.Convert_v1alpha1_UserDefinedLabels_To_common_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_ClusterSpec_To_infra_ClusterSpec is an autogenerated conversion function. +func Convert_v1alpha1_ClusterSpec_To_infra_ClusterSpec(in *ClusterSpec, out *infra.ClusterSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_ClusterSpec_To_infra_ClusterSpec(in, out, s) +} + +func autoConvert_infra_ClusterSpec_To_v1alpha1_ClusterSpec(in *infra.ClusterSpec, out *ClusterSpec, s conversion.Scope) error { + if err := Convert_id_PartitionClusterID_To_v1alpha1_PartitionClusterID(&in.PartitionClusterID, &out.PartitionClusterID, s); err != nil { + return err + } + out.Provider = in.Provider + out.Location = (*Location)(unsafe.Pointer(in.Location)) + if err := asv1alpha1.Convert_common_UserDefinedLabels_To_v1alpha1_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_infra_ClusterSpec_To_v1alpha1_ClusterSpec is an autogenerated conversion function. +func Convert_infra_ClusterSpec_To_v1alpha1_ClusterSpec(in *infra.ClusterSpec, out *ClusterSpec, s conversion.Scope) error { + return autoConvert_infra_ClusterSpec_To_v1alpha1_ClusterSpec(in, out, s) +} + +func autoConvert_v1alpha1_ClusterStatus_To_infra_ClusterStatus(in *ClusterStatus, out *infra.ClusterStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_ClusterStatus_To_infra_ClusterStatus is an autogenerated conversion function. +func Convert_v1alpha1_ClusterStatus_To_infra_ClusterStatus(in *ClusterStatus, out *infra.ClusterStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_ClusterStatus_To_infra_ClusterStatus(in, out, s) +} + +func autoConvert_infra_ClusterStatus_To_v1alpha1_ClusterStatus(in *infra.ClusterStatus, out *ClusterStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_infra_ClusterStatus_To_v1alpha1_ClusterStatus is an autogenerated conversion function. +func Convert_infra_ClusterStatus_To_v1alpha1_ClusterStatus(in *infra.ClusterStatus, out *ClusterStatus, s conversion.Scope) error { + return autoConvert_infra_ClusterStatus_To_v1alpha1_ClusterStatus(in, out, s) +} + +func autoConvert_v1alpha1_Endpoint_To_infra_Endpoint(in *Endpoint, out *infra.Endpoint, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_EndpointSpec_To_infra_EndpointSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_EndpointStatus_To_infra_EndpointStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_Endpoint_To_infra_Endpoint is an autogenerated conversion function. +func Convert_v1alpha1_Endpoint_To_infra_Endpoint(in *Endpoint, out *infra.Endpoint, s conversion.Scope) error { + return autoConvert_v1alpha1_Endpoint_To_infra_Endpoint(in, out, s) +} + +func autoConvert_infra_Endpoint_To_v1alpha1_Endpoint(in *infra.Endpoint, out *Endpoint, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_infra_EndpointSpec_To_v1alpha1_EndpointSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_infra_EndpointStatus_To_v1alpha1_EndpointStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_infra_Endpoint_To_v1alpha1_Endpoint is an autogenerated conversion function. +func Convert_infra_Endpoint_To_v1alpha1_Endpoint(in *infra.Endpoint, out *Endpoint, s conversion.Scope) error { + return autoConvert_infra_Endpoint_To_v1alpha1_Endpoint(in, out, s) +} + +func autoConvert_v1alpha1_EndpointList_To_infra_EndpointList(in *EndpointList, out *infra.EndpointList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]infra.Endpoint, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_Endpoint_To_infra_Endpoint(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_EndpointList_To_infra_EndpointList is an autogenerated conversion function. +func Convert_v1alpha1_EndpointList_To_infra_EndpointList(in *EndpointList, out *infra.EndpointList, s conversion.Scope) error { + return autoConvert_v1alpha1_EndpointList_To_infra_EndpointList(in, out, s) +} + +func autoConvert_infra_EndpointList_To_v1alpha1_EndpointList(in *infra.EndpointList, out *EndpointList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Endpoint, len(*in)) + for i := range *in { + if err := Convert_infra_Endpoint_To_v1alpha1_Endpoint(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_infra_EndpointList_To_v1alpha1_EndpointList is an autogenerated conversion function. +func Convert_infra_EndpointList_To_v1alpha1_EndpointList(in *infra.EndpointList, out *EndpointList, s conversion.Scope) error { + return autoConvert_infra_EndpointList_To_v1alpha1_EndpointList(in, out, s) +} + +func autoConvert_v1alpha1_EndpointSet_To_infra_EndpointSet(in *EndpointSet, out *infra.EndpointSet, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_EndpointSetSpec_To_infra_EndpointSetSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_EndpointSetStatus_To_infra_EndpointSetStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_EndpointSet_To_infra_EndpointSet is an autogenerated conversion function. +func Convert_v1alpha1_EndpointSet_To_infra_EndpointSet(in *EndpointSet, out *infra.EndpointSet, s conversion.Scope) error { + return autoConvert_v1alpha1_EndpointSet_To_infra_EndpointSet(in, out, s) +} + +func autoConvert_infra_EndpointSet_To_v1alpha1_EndpointSet(in *infra.EndpointSet, out *EndpointSet, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_infra_EndpointSetSpec_To_v1alpha1_EndpointSetSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_infra_EndpointSetStatus_To_v1alpha1_EndpointSetStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_infra_EndpointSet_To_v1alpha1_EndpointSet is an autogenerated conversion function. +func Convert_infra_EndpointSet_To_v1alpha1_EndpointSet(in *infra.EndpointSet, out *EndpointSet, s conversion.Scope) error { + return autoConvert_infra_EndpointSet_To_v1alpha1_EndpointSet(in, out, s) +} + +func autoConvert_v1alpha1_EndpointSetList_To_infra_EndpointSetList(in *EndpointSetList, out *infra.EndpointSetList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]infra.EndpointSet, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_EndpointSet_To_infra_EndpointSet(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_EndpointSetList_To_infra_EndpointSetList is an autogenerated conversion function. +func Convert_v1alpha1_EndpointSetList_To_infra_EndpointSetList(in *EndpointSetList, out *infra.EndpointSetList, s conversion.Scope) error { + return autoConvert_v1alpha1_EndpointSetList_To_infra_EndpointSetList(in, out, s) +} + +func autoConvert_infra_EndpointSetList_To_v1alpha1_EndpointSetList(in *infra.EndpointSetList, out *EndpointSetList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]EndpointSet, len(*in)) + for i := range *in { + if err := Convert_infra_EndpointSet_To_v1alpha1_EndpointSet(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_infra_EndpointSetList_To_v1alpha1_EndpointSetList is an autogenerated conversion function. +func Convert_infra_EndpointSetList_To_v1alpha1_EndpointSetList(in *infra.EndpointSetList, out *EndpointSetList, s conversion.Scope) error { + return autoConvert_infra_EndpointSetList_To_v1alpha1_EndpointSetList(in, out, s) +} + +func autoConvert_v1alpha1_EndpointSetSpec_To_infra_EndpointSetSpec(in *EndpointSetSpec, out *infra.EndpointSetSpec, s conversion.Scope) error { + if in.Endpoints != nil { + in, out := &in.Endpoints, &out.Endpoints + *out = make([]*id.PartitionEndpointID, len(*in)) + for i := range *in { + // FIXME: Provide conversion function to convert *idv1alpha1.PartitionEndpointID to *id.PartitionEndpointID + if err := Convert_v1alpha1_PartitionEndpointID_To_id_PartitionEndpointID((*in)[i], (*out)[i], s); err != nil { + return err + } + } + } else { + out.Endpoints = nil + } + out.Lacp = (*bool)(unsafe.Pointer(in.Lacp)) + if err := asv1alpha1.Convert_v1alpha1_UserDefinedLabels_To_common_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_EndpointSetSpec_To_infra_EndpointSetSpec is an autogenerated conversion function. +func Convert_v1alpha1_EndpointSetSpec_To_infra_EndpointSetSpec(in *EndpointSetSpec, out *infra.EndpointSetSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_EndpointSetSpec_To_infra_EndpointSetSpec(in, out, s) +} + +func autoConvert_infra_EndpointSetSpec_To_v1alpha1_EndpointSetSpec(in *infra.EndpointSetSpec, out *EndpointSetSpec, s conversion.Scope) error { + if in.Endpoints != nil { + in, out := &in.Endpoints, &out.Endpoints + *out = make([]*idv1alpha1.PartitionEndpointID, len(*in)) + for i := range *in { + // FIXME: Provide conversion function to convert *id.PartitionEndpointID to *idv1alpha1.PartitionEndpointID + if err := Convert_id_PartitionEndpointID_To_v1alpha1_PartitionEndpointID((*in)[i], (*out)[i], s); err != nil { + return err + } + } + } else { + out.Endpoints = nil + } + out.Lacp = (*bool)(unsafe.Pointer(in.Lacp)) + if err := asv1alpha1.Convert_common_UserDefinedLabels_To_v1alpha1_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_infra_EndpointSetSpec_To_v1alpha1_EndpointSetSpec is an autogenerated conversion function. +func Convert_infra_EndpointSetSpec_To_v1alpha1_EndpointSetSpec(in *infra.EndpointSetSpec, out *EndpointSetSpec, s conversion.Scope) error { + return autoConvert_infra_EndpointSetSpec_To_v1alpha1_EndpointSetSpec(in, out, s) +} + +func autoConvert_v1alpha1_EndpointSetStatus_To_infra_EndpointSetStatus(in *EndpointSetStatus, out *infra.EndpointSetStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + out.ESI = (*uint32)(unsafe.Pointer(in.ESI)) + out.LagId = (*uint32)(unsafe.Pointer(in.LagId)) + return nil +} + +// Convert_v1alpha1_EndpointSetStatus_To_infra_EndpointSetStatus is an autogenerated conversion function. +func Convert_v1alpha1_EndpointSetStatus_To_infra_EndpointSetStatus(in *EndpointSetStatus, out *infra.EndpointSetStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_EndpointSetStatus_To_infra_EndpointSetStatus(in, out, s) +} + +func autoConvert_infra_EndpointSetStatus_To_v1alpha1_EndpointSetStatus(in *infra.EndpointSetStatus, out *EndpointSetStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + out.ESI = (*uint32)(unsafe.Pointer(in.ESI)) + out.LagId = (*uint32)(unsafe.Pointer(in.LagId)) + return nil +} + +// Convert_infra_EndpointSetStatus_To_v1alpha1_EndpointSetStatus is an autogenerated conversion function. +func Convert_infra_EndpointSetStatus_To_v1alpha1_EndpointSetStatus(in *infra.EndpointSetStatus, out *EndpointSetStatus, s conversion.Scope) error { + return autoConvert_infra_EndpointSetStatus_To_v1alpha1_EndpointSetStatus(in, out, s) +} + +func autoConvert_v1alpha1_EndpointSpec_To_infra_EndpointSpec(in *EndpointSpec, out *infra.EndpointSpec, s conversion.Scope) error { + if err := Convert_v1alpha1_PartitionEndpointID_To_id_PartitionEndpointID(&in.PartitionEndpointID, &out.PartitionEndpointID, s); err != nil { + return err + } + if err := asv1alpha1.Convert_v1alpha1_UserDefinedLabels_To_common_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + out.Speed = (*string)(unsafe.Pointer(in.Speed)) + out.VLANTagging = in.VLANTagging + return nil +} + +// Convert_v1alpha1_EndpointSpec_To_infra_EndpointSpec is an autogenerated conversion function. +func Convert_v1alpha1_EndpointSpec_To_infra_EndpointSpec(in *EndpointSpec, out *infra.EndpointSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_EndpointSpec_To_infra_EndpointSpec(in, out, s) +} + +func autoConvert_infra_EndpointSpec_To_v1alpha1_EndpointSpec(in *infra.EndpointSpec, out *EndpointSpec, s conversion.Scope) error { + if err := Convert_id_PartitionEndpointID_To_v1alpha1_PartitionEndpointID(&in.PartitionEndpointID, &out.PartitionEndpointID, s); err != nil { + return err + } + if err := asv1alpha1.Convert_common_UserDefinedLabels_To_v1alpha1_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + out.Speed = (*string)(unsafe.Pointer(in.Speed)) + out.VLANTagging = in.VLANTagging + return nil +} + +// Convert_infra_EndpointSpec_To_v1alpha1_EndpointSpec is an autogenerated conversion function. +func Convert_infra_EndpointSpec_To_v1alpha1_EndpointSpec(in *infra.EndpointSpec, out *EndpointSpec, s conversion.Scope) error { + return autoConvert_infra_EndpointSpec_To_v1alpha1_EndpointSpec(in, out, s) +} + +func autoConvert_v1alpha1_EndpointStatus_To_infra_EndpointStatus(in *EndpointStatus, out *infra.EndpointStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_EndpointStatus_To_infra_EndpointStatus is an autogenerated conversion function. +func Convert_v1alpha1_EndpointStatus_To_infra_EndpointStatus(in *EndpointStatus, out *infra.EndpointStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_EndpointStatus_To_infra_EndpointStatus(in, out, s) +} + +func autoConvert_infra_EndpointStatus_To_v1alpha1_EndpointStatus(in *infra.EndpointStatus, out *EndpointStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_infra_EndpointStatus_To_v1alpha1_EndpointStatus is an autogenerated conversion function. +func Convert_infra_EndpointStatus_To_v1alpha1_EndpointStatus(in *infra.EndpointStatus, out *EndpointStatus, s conversion.Scope) error { + return autoConvert_infra_EndpointStatus_To_v1alpha1_EndpointStatus(in, out, s) +} + +func autoConvert_v1alpha1_Link_To_infra_Link(in *Link, out *infra.Link, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_LinkSpec_To_infra_LinkSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_LinkStatus_To_infra_LinkStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_Link_To_infra_Link is an autogenerated conversion function. +func Convert_v1alpha1_Link_To_infra_Link(in *Link, out *infra.Link, s conversion.Scope) error { + return autoConvert_v1alpha1_Link_To_infra_Link(in, out, s) +} + +func autoConvert_infra_Link_To_v1alpha1_Link(in *infra.Link, out *Link, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_infra_LinkSpec_To_v1alpha1_LinkSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_infra_LinkStatus_To_v1alpha1_LinkStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_infra_Link_To_v1alpha1_Link is an autogenerated conversion function. +func Convert_infra_Link_To_v1alpha1_Link(in *infra.Link, out *Link, s conversion.Scope) error { + return autoConvert_infra_Link_To_v1alpha1_Link(in, out, s) +} + +func autoConvert_v1alpha1_LinkList_To_infra_LinkList(in *LinkList, out *infra.LinkList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]infra.Link, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_Link_To_infra_Link(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_LinkList_To_infra_LinkList is an autogenerated conversion function. +func Convert_v1alpha1_LinkList_To_infra_LinkList(in *LinkList, out *infra.LinkList, s conversion.Scope) error { + return autoConvert_v1alpha1_LinkList_To_infra_LinkList(in, out, s) +} + +func autoConvert_infra_LinkList_To_v1alpha1_LinkList(in *infra.LinkList, out *LinkList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Link, len(*in)) + for i := range *in { + if err := Convert_infra_Link_To_v1alpha1_Link(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_infra_LinkList_To_v1alpha1_LinkList is an autogenerated conversion function. +func Convert_infra_LinkList_To_v1alpha1_LinkList(in *infra.LinkList, out *LinkList, s conversion.Scope) error { + return autoConvert_infra_LinkList_To_v1alpha1_LinkList(in, out, s) +} + +func autoConvert_v1alpha1_LinkSet_To_infra_LinkSet(in *LinkSet, out *infra.LinkSet, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_LinkSetSpec_To_infra_LinkSetSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_LinkSetStatus_To_infra_LinkSetStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_LinkSet_To_infra_LinkSet is an autogenerated conversion function. +func Convert_v1alpha1_LinkSet_To_infra_LinkSet(in *LinkSet, out *infra.LinkSet, s conversion.Scope) error { + return autoConvert_v1alpha1_LinkSet_To_infra_LinkSet(in, out, s) +} + +func autoConvert_infra_LinkSet_To_v1alpha1_LinkSet(in *infra.LinkSet, out *LinkSet, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_infra_LinkSetSpec_To_v1alpha1_LinkSetSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_infra_LinkSetStatus_To_v1alpha1_LinkSetStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_infra_LinkSet_To_v1alpha1_LinkSet is an autogenerated conversion function. +func Convert_infra_LinkSet_To_v1alpha1_LinkSet(in *infra.LinkSet, out *LinkSet, s conversion.Scope) error { + return autoConvert_infra_LinkSet_To_v1alpha1_LinkSet(in, out, s) +} + +func autoConvert_v1alpha1_LinkSetList_To_infra_LinkSetList(in *LinkSetList, out *infra.LinkSetList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]infra.LinkSet, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_LinkSet_To_infra_LinkSet(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_LinkSetList_To_infra_LinkSetList is an autogenerated conversion function. +func Convert_v1alpha1_LinkSetList_To_infra_LinkSetList(in *LinkSetList, out *infra.LinkSetList, s conversion.Scope) error { + return autoConvert_v1alpha1_LinkSetList_To_infra_LinkSetList(in, out, s) +} + +func autoConvert_infra_LinkSetList_To_v1alpha1_LinkSetList(in *infra.LinkSetList, out *LinkSetList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]LinkSet, len(*in)) + for i := range *in { + if err := Convert_infra_LinkSet_To_v1alpha1_LinkSet(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_infra_LinkSetList_To_v1alpha1_LinkSetList is an autogenerated conversion function. +func Convert_infra_LinkSetList_To_v1alpha1_LinkSetList(in *infra.LinkSetList, out *LinkSetList, s conversion.Scope) error { + return autoConvert_infra_LinkSetList_To_v1alpha1_LinkSetList(in, out, s) +} + +func autoConvert_v1alpha1_LinkSetSpec_To_infra_LinkSetSpec(in *LinkSetSpec, out *infra.LinkSetSpec, s conversion.Scope) error { + if in.Endpoints != nil { + in, out := &in.Endpoints, &out.Endpoints + *out = make([]*id.PartitionEndpointID, len(*in)) + for i := range *in { + // FIXME: Provide conversion function to convert *idv1alpha1.PartitionEndpointID to *id.PartitionEndpointID + if err := Convert_v1alpha1_PartitionEndpointID_To_id_PartitionEndpointID((*in)[i], (*out)[i], s); err != nil { + return err + } + } + } else { + out.Endpoints = nil + } + if err := asv1alpha1.Convert_v1alpha1_UserDefinedLabels_To_common_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_LinkSetSpec_To_infra_LinkSetSpec is an autogenerated conversion function. +func Convert_v1alpha1_LinkSetSpec_To_infra_LinkSetSpec(in *LinkSetSpec, out *infra.LinkSetSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_LinkSetSpec_To_infra_LinkSetSpec(in, out, s) +} + +func autoConvert_infra_LinkSetSpec_To_v1alpha1_LinkSetSpec(in *infra.LinkSetSpec, out *LinkSetSpec, s conversion.Scope) error { + if in.Endpoints != nil { + in, out := &in.Endpoints, &out.Endpoints + *out = make([]*idv1alpha1.PartitionEndpointID, len(*in)) + for i := range *in { + // FIXME: Provide conversion function to convert *id.PartitionEndpointID to *idv1alpha1.PartitionEndpointID + if err := Convert_id_PartitionEndpointID_To_v1alpha1_PartitionEndpointID((*in)[i], (*out)[i], s); err != nil { + return err + } + } + } else { + out.Endpoints = nil + } + if err := asv1alpha1.Convert_common_UserDefinedLabels_To_v1alpha1_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_infra_LinkSetSpec_To_v1alpha1_LinkSetSpec is an autogenerated conversion function. +func Convert_infra_LinkSetSpec_To_v1alpha1_LinkSetSpec(in *infra.LinkSetSpec, out *LinkSetSpec, s conversion.Scope) error { + return autoConvert_infra_LinkSetSpec_To_v1alpha1_LinkSetSpec(in, out, s) +} + +func autoConvert_v1alpha1_LinkSetStatus_To_infra_LinkSetStatus(in *LinkSetStatus, out *infra.LinkSetStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + out.ESI = (*uint32)(unsafe.Pointer(in.ESI)) + out.LagId = (*uint32)(unsafe.Pointer(in.LagId)) + return nil +} + +// Convert_v1alpha1_LinkSetStatus_To_infra_LinkSetStatus is an autogenerated conversion function. +func Convert_v1alpha1_LinkSetStatus_To_infra_LinkSetStatus(in *LinkSetStatus, out *infra.LinkSetStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_LinkSetStatus_To_infra_LinkSetStatus(in, out, s) +} + +func autoConvert_infra_LinkSetStatus_To_v1alpha1_LinkSetStatus(in *infra.LinkSetStatus, out *LinkSetStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + out.ESI = (*uint32)(unsafe.Pointer(in.ESI)) + out.LagId = (*uint32)(unsafe.Pointer(in.LagId)) + return nil +} + +// Convert_infra_LinkSetStatus_To_v1alpha1_LinkSetStatus is an autogenerated conversion function. +func Convert_infra_LinkSetStatus_To_v1alpha1_LinkSetStatus(in *infra.LinkSetStatus, out *LinkSetStatus, s conversion.Scope) error { + return autoConvert_infra_LinkSetStatus_To_v1alpha1_LinkSetStatus(in, out, s) +} + +func autoConvert_v1alpha1_LinkSpec_To_infra_LinkSpec(in *LinkSpec, out *infra.LinkSpec, s conversion.Scope) error { + if in.Endpoints != nil { + in, out := &in.Endpoints, &out.Endpoints + *out = make([]*id.PartitionEndpointID, len(*in)) + for i := range *in { + // FIXME: Provide conversion function to convert *idv1alpha1.PartitionEndpointID to *id.PartitionEndpointID + if err := Convert_v1alpha1_PartitionEndpointID_To_id_PartitionEndpointID((*in)[i], (*out)[i], s); err != nil { + return err + } + } + } else { + out.Endpoints = nil + } + if err := asv1alpha1.Convert_v1alpha1_UserDefinedLabels_To_common_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_LinkSpec_To_infra_LinkSpec is an autogenerated conversion function. +func Convert_v1alpha1_LinkSpec_To_infra_LinkSpec(in *LinkSpec, out *infra.LinkSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_LinkSpec_To_infra_LinkSpec(in, out, s) +} + +func autoConvert_infra_LinkSpec_To_v1alpha1_LinkSpec(in *infra.LinkSpec, out *LinkSpec, s conversion.Scope) error { + if in.Endpoints != nil { + in, out := &in.Endpoints, &out.Endpoints + *out = make([]*idv1alpha1.PartitionEndpointID, len(*in)) + for i := range *in { + // FIXME: Provide conversion function to convert *id.PartitionEndpointID to *idv1alpha1.PartitionEndpointID + if err := Convert_id_PartitionEndpointID_To_v1alpha1_PartitionEndpointID((*in)[i], (*out)[i], s); err != nil { + return err + } + } + } else { + out.Endpoints = nil + } + if err := asv1alpha1.Convert_common_UserDefinedLabels_To_v1alpha1_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_infra_LinkSpec_To_v1alpha1_LinkSpec is an autogenerated conversion function. +func Convert_infra_LinkSpec_To_v1alpha1_LinkSpec(in *infra.LinkSpec, out *LinkSpec, s conversion.Scope) error { + return autoConvert_infra_LinkSpec_To_v1alpha1_LinkSpec(in, out, s) +} + +func autoConvert_v1alpha1_LinkStatus_To_infra_LinkStatus(in *LinkStatus, out *infra.LinkStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_LinkStatus_To_infra_LinkStatus is an autogenerated conversion function. +func Convert_v1alpha1_LinkStatus_To_infra_LinkStatus(in *LinkStatus, out *infra.LinkStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_LinkStatus_To_infra_LinkStatus(in, out, s) +} + +func autoConvert_infra_LinkStatus_To_v1alpha1_LinkStatus(in *infra.LinkStatus, out *LinkStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_infra_LinkStatus_To_v1alpha1_LinkStatus is an autogenerated conversion function. +func Convert_infra_LinkStatus_To_v1alpha1_LinkStatus(in *infra.LinkStatus, out *LinkStatus, s conversion.Scope) error { + return autoConvert_infra_LinkStatus_To_v1alpha1_LinkStatus(in, out, s) +} + +func autoConvert_v1alpha1_Module_To_infra_Module(in *Module, out *infra.Module, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_ModuleSpec_To_infra_ModuleSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_ModuleStatus_To_infra_ModuleStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_Module_To_infra_Module is an autogenerated conversion function. +func Convert_v1alpha1_Module_To_infra_Module(in *Module, out *infra.Module, s conversion.Scope) error { + return autoConvert_v1alpha1_Module_To_infra_Module(in, out, s) +} + +func autoConvert_infra_Module_To_v1alpha1_Module(in *infra.Module, out *Module, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_infra_ModuleSpec_To_v1alpha1_ModuleSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_infra_ModuleStatus_To_v1alpha1_ModuleStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_infra_Module_To_v1alpha1_Module is an autogenerated conversion function. +func Convert_infra_Module_To_v1alpha1_Module(in *infra.Module, out *Module, s conversion.Scope) error { + return autoConvert_infra_Module_To_v1alpha1_Module(in, out, s) +} + +func autoConvert_v1alpha1_ModuleBay_To_infra_ModuleBay(in *ModuleBay, out *infra.ModuleBay, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_ModuleBaySpec_To_infra_ModuleBaySpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_ModuleBayStatus_To_infra_ModuleBayStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_ModuleBay_To_infra_ModuleBay is an autogenerated conversion function. +func Convert_v1alpha1_ModuleBay_To_infra_ModuleBay(in *ModuleBay, out *infra.ModuleBay, s conversion.Scope) error { + return autoConvert_v1alpha1_ModuleBay_To_infra_ModuleBay(in, out, s) +} + +func autoConvert_infra_ModuleBay_To_v1alpha1_ModuleBay(in *infra.ModuleBay, out *ModuleBay, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_infra_ModuleBaySpec_To_v1alpha1_ModuleBaySpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_infra_ModuleBayStatus_To_v1alpha1_ModuleBayStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_infra_ModuleBay_To_v1alpha1_ModuleBay is an autogenerated conversion function. +func Convert_infra_ModuleBay_To_v1alpha1_ModuleBay(in *infra.ModuleBay, out *ModuleBay, s conversion.Scope) error { + return autoConvert_infra_ModuleBay_To_v1alpha1_ModuleBay(in, out, s) +} + +func autoConvert_v1alpha1_ModuleBayList_To_infra_ModuleBayList(in *ModuleBayList, out *infra.ModuleBayList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]infra.ModuleBay, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_ModuleBay_To_infra_ModuleBay(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_ModuleBayList_To_infra_ModuleBayList is an autogenerated conversion function. +func Convert_v1alpha1_ModuleBayList_To_infra_ModuleBayList(in *ModuleBayList, out *infra.ModuleBayList, s conversion.Scope) error { + return autoConvert_v1alpha1_ModuleBayList_To_infra_ModuleBayList(in, out, s) +} + +func autoConvert_infra_ModuleBayList_To_v1alpha1_ModuleBayList(in *infra.ModuleBayList, out *ModuleBayList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ModuleBay, len(*in)) + for i := range *in { + if err := Convert_infra_ModuleBay_To_v1alpha1_ModuleBay(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_infra_ModuleBayList_To_v1alpha1_ModuleBayList is an autogenerated conversion function. +func Convert_infra_ModuleBayList_To_v1alpha1_ModuleBayList(in *infra.ModuleBayList, out *ModuleBayList, s conversion.Scope) error { + return autoConvert_infra_ModuleBayList_To_v1alpha1_ModuleBayList(in, out, s) +} + +func autoConvert_v1alpha1_ModuleBaySpec_To_infra_ModuleBaySpec(in *ModuleBaySpec, out *infra.ModuleBaySpec, s conversion.Scope) error { + if err := Convert_v1alpha1_PartitionNodeID_To_id_PartitionNodeID(&in.PartitionNodeID, &out.PartitionNodeID, s); err != nil { + return err + } + out.Position = in.Position + if err := asv1alpha1.Convert_v1alpha1_UserDefinedLabels_To_common_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_ModuleBaySpec_To_infra_ModuleBaySpec is an autogenerated conversion function. +func Convert_v1alpha1_ModuleBaySpec_To_infra_ModuleBaySpec(in *ModuleBaySpec, out *infra.ModuleBaySpec, s conversion.Scope) error { + return autoConvert_v1alpha1_ModuleBaySpec_To_infra_ModuleBaySpec(in, out, s) +} + +func autoConvert_infra_ModuleBaySpec_To_v1alpha1_ModuleBaySpec(in *infra.ModuleBaySpec, out *ModuleBaySpec, s conversion.Scope) error { + if err := Convert_id_PartitionNodeID_To_v1alpha1_PartitionNodeID(&in.PartitionNodeID, &out.PartitionNodeID, s); err != nil { + return err + } + out.Position = in.Position + if err := asv1alpha1.Convert_common_UserDefinedLabels_To_v1alpha1_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_infra_ModuleBaySpec_To_v1alpha1_ModuleBaySpec is an autogenerated conversion function. +func Convert_infra_ModuleBaySpec_To_v1alpha1_ModuleBaySpec(in *infra.ModuleBaySpec, out *ModuleBaySpec, s conversion.Scope) error { + return autoConvert_infra_ModuleBaySpec_To_v1alpha1_ModuleBaySpec(in, out, s) +} + +func autoConvert_v1alpha1_ModuleBayStatus_To_infra_ModuleBayStatus(in *ModuleBayStatus, out *infra.ModuleBayStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_ModuleBayStatus_To_infra_ModuleBayStatus is an autogenerated conversion function. +func Convert_v1alpha1_ModuleBayStatus_To_infra_ModuleBayStatus(in *ModuleBayStatus, out *infra.ModuleBayStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_ModuleBayStatus_To_infra_ModuleBayStatus(in, out, s) +} + +func autoConvert_infra_ModuleBayStatus_To_v1alpha1_ModuleBayStatus(in *infra.ModuleBayStatus, out *ModuleBayStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_infra_ModuleBayStatus_To_v1alpha1_ModuleBayStatus is an autogenerated conversion function. +func Convert_infra_ModuleBayStatus_To_v1alpha1_ModuleBayStatus(in *infra.ModuleBayStatus, out *ModuleBayStatus, s conversion.Scope) error { + return autoConvert_infra_ModuleBayStatus_To_v1alpha1_ModuleBayStatus(in, out, s) +} + +func autoConvert_v1alpha1_ModuleList_To_infra_ModuleList(in *ModuleList, out *infra.ModuleList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]infra.Module, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_Module_To_infra_Module(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_ModuleList_To_infra_ModuleList is an autogenerated conversion function. +func Convert_v1alpha1_ModuleList_To_infra_ModuleList(in *ModuleList, out *infra.ModuleList, s conversion.Scope) error { + return autoConvert_v1alpha1_ModuleList_To_infra_ModuleList(in, out, s) +} + +func autoConvert_infra_ModuleList_To_v1alpha1_ModuleList(in *infra.ModuleList, out *ModuleList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Module, len(*in)) + for i := range *in { + if err := Convert_infra_Module_To_v1alpha1_Module(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_infra_ModuleList_To_v1alpha1_ModuleList is an autogenerated conversion function. +func Convert_infra_ModuleList_To_v1alpha1_ModuleList(in *infra.ModuleList, out *ModuleList, s conversion.Scope) error { + return autoConvert_infra_ModuleList_To_v1alpha1_ModuleList(in, out, s) +} + +func autoConvert_v1alpha1_ModuleSpec_To_infra_ModuleSpec(in *ModuleSpec, out *infra.ModuleSpec, s conversion.Scope) error { + if err := Convert_v1alpha1_PartitionNodeID_To_id_PartitionNodeID(&in.PartitionNodeID, &out.PartitionNodeID, s); err != nil { + return err + } + out.ModuleBay = in.ModuleBay + if err := asv1alpha1.Convert_v1alpha1_UserDefinedLabels_To_common_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_ModuleSpec_To_infra_ModuleSpec is an autogenerated conversion function. +func Convert_v1alpha1_ModuleSpec_To_infra_ModuleSpec(in *ModuleSpec, out *infra.ModuleSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_ModuleSpec_To_infra_ModuleSpec(in, out, s) +} + +func autoConvert_infra_ModuleSpec_To_v1alpha1_ModuleSpec(in *infra.ModuleSpec, out *ModuleSpec, s conversion.Scope) error { + if err := Convert_id_PartitionNodeID_To_v1alpha1_PartitionNodeID(&in.PartitionNodeID, &out.PartitionNodeID, s); err != nil { + return err + } + out.ModuleBay = in.ModuleBay + if err := asv1alpha1.Convert_common_UserDefinedLabels_To_v1alpha1_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_infra_ModuleSpec_To_v1alpha1_ModuleSpec is an autogenerated conversion function. +func Convert_infra_ModuleSpec_To_v1alpha1_ModuleSpec(in *infra.ModuleSpec, out *ModuleSpec, s conversion.Scope) error { + return autoConvert_infra_ModuleSpec_To_v1alpha1_ModuleSpec(in, out, s) +} + +func autoConvert_v1alpha1_ModuleStatus_To_infra_ModuleStatus(in *ModuleStatus, out *infra.ModuleStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_ModuleStatus_To_infra_ModuleStatus is an autogenerated conversion function. +func Convert_v1alpha1_ModuleStatus_To_infra_ModuleStatus(in *ModuleStatus, out *infra.ModuleStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_ModuleStatus_To_infra_ModuleStatus(in, out, s) +} + +func autoConvert_infra_ModuleStatus_To_v1alpha1_ModuleStatus(in *infra.ModuleStatus, out *ModuleStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_infra_ModuleStatus_To_v1alpha1_ModuleStatus is an autogenerated conversion function. +func Convert_infra_ModuleStatus_To_v1alpha1_ModuleStatus(in *infra.ModuleStatus, out *ModuleStatus, s conversion.Scope) error { + return autoConvert_infra_ModuleStatus_To_v1alpha1_ModuleStatus(in, out, s) +} + +func autoConvert_v1alpha1_Node_To_infra_Node(in *Node, out *infra.Node, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_NodeSpec_To_infra_NodeSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_NodeStatus_To_infra_NodeStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_Node_To_infra_Node is an autogenerated conversion function. +func Convert_v1alpha1_Node_To_infra_Node(in *Node, out *infra.Node, s conversion.Scope) error { + return autoConvert_v1alpha1_Node_To_infra_Node(in, out, s) +} + +func autoConvert_infra_Node_To_v1alpha1_Node(in *infra.Node, out *Node, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_infra_NodeSpec_To_v1alpha1_NodeSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_infra_NodeStatus_To_v1alpha1_NodeStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_infra_Node_To_v1alpha1_Node is an autogenerated conversion function. +func Convert_infra_Node_To_v1alpha1_Node(in *infra.Node, out *Node, s conversion.Scope) error { + return autoConvert_infra_Node_To_v1alpha1_Node(in, out, s) +} + +func autoConvert_v1alpha1_NodeItem_To_infra_NodeItem(in *NodeItem, out *infra.NodeItem, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_NodeItemSpec_To_infra_NodeItemSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_NodeItemStatus_To_infra_NodeItemStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_NodeItem_To_infra_NodeItem is an autogenerated conversion function. +func Convert_v1alpha1_NodeItem_To_infra_NodeItem(in *NodeItem, out *infra.NodeItem, s conversion.Scope) error { + return autoConvert_v1alpha1_NodeItem_To_infra_NodeItem(in, out, s) +} + +func autoConvert_infra_NodeItem_To_v1alpha1_NodeItem(in *infra.NodeItem, out *NodeItem, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_infra_NodeItemSpec_To_v1alpha1_NodeItemSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_infra_NodeItemStatus_To_v1alpha1_NodeItemStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_infra_NodeItem_To_v1alpha1_NodeItem is an autogenerated conversion function. +func Convert_infra_NodeItem_To_v1alpha1_NodeItem(in *infra.NodeItem, out *NodeItem, s conversion.Scope) error { + return autoConvert_infra_NodeItem_To_v1alpha1_NodeItem(in, out, s) +} + +func autoConvert_v1alpha1_NodeItemList_To_infra_NodeItemList(in *NodeItemList, out *infra.NodeItemList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]infra.NodeItem, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_NodeItem_To_infra_NodeItem(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_NodeItemList_To_infra_NodeItemList is an autogenerated conversion function. +func Convert_v1alpha1_NodeItemList_To_infra_NodeItemList(in *NodeItemList, out *infra.NodeItemList, s conversion.Scope) error { + return autoConvert_v1alpha1_NodeItemList_To_infra_NodeItemList(in, out, s) +} + +func autoConvert_infra_NodeItemList_To_v1alpha1_NodeItemList(in *infra.NodeItemList, out *NodeItemList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]NodeItem, len(*in)) + for i := range *in { + if err := Convert_infra_NodeItem_To_v1alpha1_NodeItem(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_infra_NodeItemList_To_v1alpha1_NodeItemList is an autogenerated conversion function. +func Convert_infra_NodeItemList_To_v1alpha1_NodeItemList(in *infra.NodeItemList, out *NodeItemList, s conversion.Scope) error { + return autoConvert_infra_NodeItemList_To_v1alpha1_NodeItemList(in, out, s) +} + +func autoConvert_v1alpha1_NodeItemSpec_To_infra_NodeItemSpec(in *NodeItemSpec, out *infra.NodeItemSpec, s conversion.Scope) error { + if err := Convert_v1alpha1_PartitionNodeID_To_id_PartitionNodeID(&in.PartitionNodeID, &out.PartitionNodeID, s); err != nil { + return err + } + if err := asv1alpha1.Convert_v1alpha1_UserDefinedLabels_To_common_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_NodeItemSpec_To_infra_NodeItemSpec is an autogenerated conversion function. +func Convert_v1alpha1_NodeItemSpec_To_infra_NodeItemSpec(in *NodeItemSpec, out *infra.NodeItemSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_NodeItemSpec_To_infra_NodeItemSpec(in, out, s) +} + +func autoConvert_infra_NodeItemSpec_To_v1alpha1_NodeItemSpec(in *infra.NodeItemSpec, out *NodeItemSpec, s conversion.Scope) error { + if err := Convert_id_PartitionNodeID_To_v1alpha1_PartitionNodeID(&in.PartitionNodeID, &out.PartitionNodeID, s); err != nil { + return err + } + if err := asv1alpha1.Convert_common_UserDefinedLabels_To_v1alpha1_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_infra_NodeItemSpec_To_v1alpha1_NodeItemSpec is an autogenerated conversion function. +func Convert_infra_NodeItemSpec_To_v1alpha1_NodeItemSpec(in *infra.NodeItemSpec, out *NodeItemSpec, s conversion.Scope) error { + return autoConvert_infra_NodeItemSpec_To_v1alpha1_NodeItemSpec(in, out, s) +} + +func autoConvert_v1alpha1_NodeItemStatus_To_infra_NodeItemStatus(in *NodeItemStatus, out *infra.NodeItemStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_NodeItemStatus_To_infra_NodeItemStatus is an autogenerated conversion function. +func Convert_v1alpha1_NodeItemStatus_To_infra_NodeItemStatus(in *NodeItemStatus, out *infra.NodeItemStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_NodeItemStatus_To_infra_NodeItemStatus(in, out, s) +} + +func autoConvert_infra_NodeItemStatus_To_v1alpha1_NodeItemStatus(in *infra.NodeItemStatus, out *NodeItemStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_infra_NodeItemStatus_To_v1alpha1_NodeItemStatus is an autogenerated conversion function. +func Convert_infra_NodeItemStatus_To_v1alpha1_NodeItemStatus(in *infra.NodeItemStatus, out *NodeItemStatus, s conversion.Scope) error { + return autoConvert_infra_NodeItemStatus_To_v1alpha1_NodeItemStatus(in, out, s) +} + +func autoConvert_v1alpha1_NodeList_To_infra_NodeList(in *NodeList, out *infra.NodeList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]infra.Node, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_Node_To_infra_Node(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_NodeList_To_infra_NodeList is an autogenerated conversion function. +func Convert_v1alpha1_NodeList_To_infra_NodeList(in *NodeList, out *infra.NodeList, s conversion.Scope) error { + return autoConvert_v1alpha1_NodeList_To_infra_NodeList(in, out, s) +} + +func autoConvert_infra_NodeList_To_v1alpha1_NodeList(in *infra.NodeList, out *NodeList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Node, len(*in)) + for i := range *in { + if err := Convert_infra_Node_To_v1alpha1_Node(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_infra_NodeList_To_v1alpha1_NodeList is an autogenerated conversion function. +func Convert_infra_NodeList_To_v1alpha1_NodeList(in *infra.NodeList, out *NodeList, s conversion.Scope) error { + return autoConvert_infra_NodeList_To_v1alpha1_NodeList(in, out, s) +} + +func autoConvert_v1alpha1_NodeSet_To_infra_NodeSet(in *NodeSet, out *infra.NodeSet, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_NodeSetSpec_To_infra_NodeSetSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_NodeSetStatus_To_infra_NodeSetStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_NodeSet_To_infra_NodeSet is an autogenerated conversion function. +func Convert_v1alpha1_NodeSet_To_infra_NodeSet(in *NodeSet, out *infra.NodeSet, s conversion.Scope) error { + return autoConvert_v1alpha1_NodeSet_To_infra_NodeSet(in, out, s) +} + +func autoConvert_infra_NodeSet_To_v1alpha1_NodeSet(in *infra.NodeSet, out *NodeSet, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_infra_NodeSetSpec_To_v1alpha1_NodeSetSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_infra_NodeSetStatus_To_v1alpha1_NodeSetStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_infra_NodeSet_To_v1alpha1_NodeSet is an autogenerated conversion function. +func Convert_infra_NodeSet_To_v1alpha1_NodeSet(in *infra.NodeSet, out *NodeSet, s conversion.Scope) error { + return autoConvert_infra_NodeSet_To_v1alpha1_NodeSet(in, out, s) +} + +func autoConvert_v1alpha1_NodeSetList_To_infra_NodeSetList(in *NodeSetList, out *infra.NodeSetList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]infra.NodeSet, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_NodeSet_To_infra_NodeSet(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_NodeSetList_To_infra_NodeSetList is an autogenerated conversion function. +func Convert_v1alpha1_NodeSetList_To_infra_NodeSetList(in *NodeSetList, out *infra.NodeSetList, s conversion.Scope) error { + return autoConvert_v1alpha1_NodeSetList_To_infra_NodeSetList(in, out, s) +} + +func autoConvert_infra_NodeSetList_To_v1alpha1_NodeSetList(in *infra.NodeSetList, out *NodeSetList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]NodeSet, len(*in)) + for i := range *in { + if err := Convert_infra_NodeSet_To_v1alpha1_NodeSet(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_infra_NodeSetList_To_v1alpha1_NodeSetList is an autogenerated conversion function. +func Convert_infra_NodeSetList_To_v1alpha1_NodeSetList(in *infra.NodeSetList, out *NodeSetList, s conversion.Scope) error { + return autoConvert_infra_NodeSetList_To_v1alpha1_NodeSetList(in, out, s) +} + +func autoConvert_v1alpha1_NodeSetSpec_To_infra_NodeSetSpec(in *NodeSetSpec, out *infra.NodeSetSpec, s conversion.Scope) error { + out.NodeSet = in.NodeSet + if err := Convert_v1alpha1_PartitionClusterID_To_id_PartitionClusterID(&in.PartitionClusterID, &out.PartitionClusterID, s); err != nil { + return err + } + if err := asv1alpha1.Convert_v1alpha1_ClaimLabels_To_common_ClaimLabels(&in.ClaimLabels, &out.ClaimLabels, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_NodeSetSpec_To_infra_NodeSetSpec is an autogenerated conversion function. +func Convert_v1alpha1_NodeSetSpec_To_infra_NodeSetSpec(in *NodeSetSpec, out *infra.NodeSetSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_NodeSetSpec_To_infra_NodeSetSpec(in, out, s) +} + +func autoConvert_infra_NodeSetSpec_To_v1alpha1_NodeSetSpec(in *infra.NodeSetSpec, out *NodeSetSpec, s conversion.Scope) error { + out.NodeSet = in.NodeSet + if err := Convert_id_PartitionClusterID_To_v1alpha1_PartitionClusterID(&in.PartitionClusterID, &out.PartitionClusterID, s); err != nil { + return err + } + if err := asv1alpha1.Convert_common_ClaimLabels_To_v1alpha1_ClaimLabels(&in.ClaimLabels, &out.ClaimLabels, s); err != nil { + return err + } + return nil +} + +// Convert_infra_NodeSetSpec_To_v1alpha1_NodeSetSpec is an autogenerated conversion function. +func Convert_infra_NodeSetSpec_To_v1alpha1_NodeSetSpec(in *infra.NodeSetSpec, out *NodeSetSpec, s conversion.Scope) error { + return autoConvert_infra_NodeSetSpec_To_v1alpha1_NodeSetSpec(in, out, s) +} + +func autoConvert_v1alpha1_NodeSetStatus_To_infra_NodeSetStatus(in *NodeSetStatus, out *infra.NodeSetStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_NodeSetStatus_To_infra_NodeSetStatus is an autogenerated conversion function. +func Convert_v1alpha1_NodeSetStatus_To_infra_NodeSetStatus(in *NodeSetStatus, out *infra.NodeSetStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_NodeSetStatus_To_infra_NodeSetStatus(in, out, s) +} + +func autoConvert_infra_NodeSetStatus_To_v1alpha1_NodeSetStatus(in *infra.NodeSetStatus, out *NodeSetStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_infra_NodeSetStatus_To_v1alpha1_NodeSetStatus is an autogenerated conversion function. +func Convert_infra_NodeSetStatus_To_v1alpha1_NodeSetStatus(in *infra.NodeSetStatus, out *NodeSetStatus, s conversion.Scope) error { + return autoConvert_infra_NodeSetStatus_To_v1alpha1_NodeSetStatus(in, out, s) +} + +func autoConvert_v1alpha1_NodeSpec_To_infra_NodeSpec(in *NodeSpec, out *infra.NodeSpec, s conversion.Scope) error { + if err := Convert_v1alpha1_PartitionNodeID_To_id_PartitionNodeID(&in.PartitionNodeID, &out.PartitionNodeID, s); err != nil { + return err + } + out.Rack = (*string)(unsafe.Pointer(in.Rack)) + out.Position = (*string)(unsafe.Pointer(in.Position)) + out.Location = (*infra.Location)(unsafe.Pointer(in.Location)) + out.Provider = in.Provider + out.PlatformType = in.PlatformType + if err := asv1alpha1.Convert_v1alpha1_UserDefinedLabels_To_common_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_NodeSpec_To_infra_NodeSpec is an autogenerated conversion function. +func Convert_v1alpha1_NodeSpec_To_infra_NodeSpec(in *NodeSpec, out *infra.NodeSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_NodeSpec_To_infra_NodeSpec(in, out, s) +} + +func autoConvert_infra_NodeSpec_To_v1alpha1_NodeSpec(in *infra.NodeSpec, out *NodeSpec, s conversion.Scope) error { + if err := Convert_id_PartitionNodeID_To_v1alpha1_PartitionNodeID(&in.PartitionNodeID, &out.PartitionNodeID, s); err != nil { + return err + } + out.Rack = (*string)(unsafe.Pointer(in.Rack)) + out.Position = (*string)(unsafe.Pointer(in.Position)) + out.Location = (*Location)(unsafe.Pointer(in.Location)) + out.Provider = in.Provider + out.PlatformType = in.PlatformType + if err := asv1alpha1.Convert_common_UserDefinedLabels_To_v1alpha1_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_infra_NodeSpec_To_v1alpha1_NodeSpec is an autogenerated conversion function. +func Convert_infra_NodeSpec_To_v1alpha1_NodeSpec(in *infra.NodeSpec, out *NodeSpec, s conversion.Scope) error { + return autoConvert_infra_NodeSpec_To_v1alpha1_NodeSpec(in, out, s) +} + +func autoConvert_v1alpha1_NodeStatus_To_infra_NodeStatus(in *NodeStatus, out *infra.NodeStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + out.SystemID = (*string)(unsafe.Pointer(in.SystemID)) + return nil +} + +// Convert_v1alpha1_NodeStatus_To_infra_NodeStatus is an autogenerated conversion function. +func Convert_v1alpha1_NodeStatus_To_infra_NodeStatus(in *NodeStatus, out *infra.NodeStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_NodeStatus_To_infra_NodeStatus(in, out, s) +} + +func autoConvert_infra_NodeStatus_To_v1alpha1_NodeStatus(in *infra.NodeStatus, out *NodeStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + out.SystemID = (*string)(unsafe.Pointer(in.SystemID)) + return nil +} + +// Convert_infra_NodeStatus_To_v1alpha1_NodeStatus is an autogenerated conversion function. +func Convert_infra_NodeStatus_To_v1alpha1_NodeStatus(in *infra.NodeStatus, out *NodeStatus, s conversion.Scope) error { + return autoConvert_infra_NodeStatus_To_v1alpha1_NodeStatus(in, out, s) +} + +func autoConvert_v1alpha1_Partition_To_infra_Partition(in *Partition, out *infra.Partition, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_PartitionSpec_To_infra_PartitionSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_PartitionStatus_To_infra_PartitionStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_Partition_To_infra_Partition is an autogenerated conversion function. +func Convert_v1alpha1_Partition_To_infra_Partition(in *Partition, out *infra.Partition, s conversion.Scope) error { + return autoConvert_v1alpha1_Partition_To_infra_Partition(in, out, s) +} + +func autoConvert_infra_Partition_To_v1alpha1_Partition(in *infra.Partition, out *Partition, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_infra_PartitionSpec_To_v1alpha1_PartitionSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_infra_PartitionStatus_To_v1alpha1_PartitionStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_infra_Partition_To_v1alpha1_Partition is an autogenerated conversion function. +func Convert_infra_Partition_To_v1alpha1_Partition(in *infra.Partition, out *Partition, s conversion.Scope) error { + return autoConvert_infra_Partition_To_v1alpha1_Partition(in, out, s) +} + +func autoConvert_v1alpha1_PartitionList_To_infra_PartitionList(in *PartitionList, out *infra.PartitionList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]infra.Partition, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_Partition_To_infra_Partition(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_PartitionList_To_infra_PartitionList is an autogenerated conversion function. +func Convert_v1alpha1_PartitionList_To_infra_PartitionList(in *PartitionList, out *infra.PartitionList, s conversion.Scope) error { + return autoConvert_v1alpha1_PartitionList_To_infra_PartitionList(in, out, s) +} + +func autoConvert_infra_PartitionList_To_v1alpha1_PartitionList(in *infra.PartitionList, out *PartitionList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Partition, len(*in)) + for i := range *in { + if err := Convert_infra_Partition_To_v1alpha1_Partition(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_infra_PartitionList_To_v1alpha1_PartitionList is an autogenerated conversion function. +func Convert_infra_PartitionList_To_v1alpha1_PartitionList(in *infra.PartitionList, out *PartitionList, s conversion.Scope) error { + return autoConvert_infra_PartitionList_To_v1alpha1_PartitionList(in, out, s) +} + +func autoConvert_v1alpha1_PartitionSpec_To_infra_PartitionSpec(in *PartitionSpec, out *infra.PartitionSpec, s conversion.Scope) error { + if err := asv1alpha1.Convert_v1alpha1_UserDefinedLabels_To_common_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_PartitionSpec_To_infra_PartitionSpec is an autogenerated conversion function. +func Convert_v1alpha1_PartitionSpec_To_infra_PartitionSpec(in *PartitionSpec, out *infra.PartitionSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_PartitionSpec_To_infra_PartitionSpec(in, out, s) +} + +func autoConvert_infra_PartitionSpec_To_v1alpha1_PartitionSpec(in *infra.PartitionSpec, out *PartitionSpec, s conversion.Scope) error { + if err := asv1alpha1.Convert_common_UserDefinedLabels_To_v1alpha1_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_infra_PartitionSpec_To_v1alpha1_PartitionSpec is an autogenerated conversion function. +func Convert_infra_PartitionSpec_To_v1alpha1_PartitionSpec(in *infra.PartitionSpec, out *PartitionSpec, s conversion.Scope) error { + return autoConvert_infra_PartitionSpec_To_v1alpha1_PartitionSpec(in, out, s) +} + +func autoConvert_v1alpha1_PartitionStatus_To_infra_PartitionStatus(in *PartitionStatus, out *infra.PartitionStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_PartitionStatus_To_infra_PartitionStatus is an autogenerated conversion function. +func Convert_v1alpha1_PartitionStatus_To_infra_PartitionStatus(in *PartitionStatus, out *infra.PartitionStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_PartitionStatus_To_infra_PartitionStatus(in, out, s) +} + +func autoConvert_infra_PartitionStatus_To_v1alpha1_PartitionStatus(in *infra.PartitionStatus, out *PartitionStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_infra_PartitionStatus_To_v1alpha1_PartitionStatus is an autogenerated conversion function. +func Convert_infra_PartitionStatus_To_v1alpha1_PartitionStatus(in *infra.PartitionStatus, out *PartitionStatus, s conversion.Scope) error { + return autoConvert_infra_PartitionStatus_To_v1alpha1_PartitionStatus(in, out, s) +} + +func autoConvert_v1alpha1_Rack_To_infra_Rack(in *Rack, out *infra.Rack, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_RackSpec_To_infra_RackSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_RackStatus_To_infra_RackStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_Rack_To_infra_Rack is an autogenerated conversion function. +func Convert_v1alpha1_Rack_To_infra_Rack(in *Rack, out *infra.Rack, s conversion.Scope) error { + return autoConvert_v1alpha1_Rack_To_infra_Rack(in, out, s) +} + +func autoConvert_infra_Rack_To_v1alpha1_Rack(in *infra.Rack, out *Rack, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_infra_RackSpec_To_v1alpha1_RackSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_infra_RackStatus_To_v1alpha1_RackStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_infra_Rack_To_v1alpha1_Rack is an autogenerated conversion function. +func Convert_infra_Rack_To_v1alpha1_Rack(in *infra.Rack, out *Rack, s conversion.Scope) error { + return autoConvert_infra_Rack_To_v1alpha1_Rack(in, out, s) +} + +func autoConvert_v1alpha1_RackList_To_infra_RackList(in *RackList, out *infra.RackList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]infra.Rack, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_Rack_To_infra_Rack(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_RackList_To_infra_RackList is an autogenerated conversion function. +func Convert_v1alpha1_RackList_To_infra_RackList(in *RackList, out *infra.RackList, s conversion.Scope) error { + return autoConvert_v1alpha1_RackList_To_infra_RackList(in, out, s) +} + +func autoConvert_infra_RackList_To_v1alpha1_RackList(in *infra.RackList, out *RackList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Rack, len(*in)) + for i := range *in { + if err := Convert_infra_Rack_To_v1alpha1_Rack(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_infra_RackList_To_v1alpha1_RackList is an autogenerated conversion function. +func Convert_infra_RackList_To_v1alpha1_RackList(in *infra.RackList, out *RackList, s conversion.Scope) error { + return autoConvert_infra_RackList_To_v1alpha1_RackList(in, out, s) +} + +func autoConvert_v1alpha1_RackSpec_To_infra_RackSpec(in *RackSpec, out *infra.RackSpec, s conversion.Scope) error { + if err := Convert_v1alpha1_SiteID_To_id_SiteID(&in.SiteID, &out.SiteID, s); err != nil { + return err + } + out.Location = (*infra.Location)(unsafe.Pointer(in.Location)) + out.Height = in.Height + out.Width = in.Width + if err := asv1alpha1.Convert_v1alpha1_UserDefinedLabels_To_common_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_RackSpec_To_infra_RackSpec is an autogenerated conversion function. +func Convert_v1alpha1_RackSpec_To_infra_RackSpec(in *RackSpec, out *infra.RackSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_RackSpec_To_infra_RackSpec(in, out, s) +} + +func autoConvert_infra_RackSpec_To_v1alpha1_RackSpec(in *infra.RackSpec, out *RackSpec, s conversion.Scope) error { + if err := Convert_id_SiteID_To_v1alpha1_SiteID(&in.SiteID, &out.SiteID, s); err != nil { + return err + } + out.Location = (*Location)(unsafe.Pointer(in.Location)) + out.Height = in.Height + out.Width = in.Width + if err := asv1alpha1.Convert_common_UserDefinedLabels_To_v1alpha1_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_infra_RackSpec_To_v1alpha1_RackSpec is an autogenerated conversion function. +func Convert_infra_RackSpec_To_v1alpha1_RackSpec(in *infra.RackSpec, out *RackSpec, s conversion.Scope) error { + return autoConvert_infra_RackSpec_To_v1alpha1_RackSpec(in, out, s) +} + +func autoConvert_v1alpha1_RackStatus_To_infra_RackStatus(in *RackStatus, out *infra.RackStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_RackStatus_To_infra_RackStatus is an autogenerated conversion function. +func Convert_v1alpha1_RackStatus_To_infra_RackStatus(in *RackStatus, out *infra.RackStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_RackStatus_To_infra_RackStatus(in, out, s) +} + +func autoConvert_infra_RackStatus_To_v1alpha1_RackStatus(in *infra.RackStatus, out *RackStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_infra_RackStatus_To_v1alpha1_RackStatus is an autogenerated conversion function. +func Convert_infra_RackStatus_To_v1alpha1_RackStatus(in *infra.RackStatus, out *RackStatus, s conversion.Scope) error { + return autoConvert_infra_RackStatus_To_v1alpha1_RackStatus(in, out, s) +} + +func autoConvert_v1alpha1_Region_To_infra_Region(in *Region, out *infra.Region, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_RegionSpec_To_infra_RegionSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_RegionStatus_To_infra_RegionStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_Region_To_infra_Region is an autogenerated conversion function. +func Convert_v1alpha1_Region_To_infra_Region(in *Region, out *infra.Region, s conversion.Scope) error { + return autoConvert_v1alpha1_Region_To_infra_Region(in, out, s) +} + +func autoConvert_infra_Region_To_v1alpha1_Region(in *infra.Region, out *Region, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_infra_RegionSpec_To_v1alpha1_RegionSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_infra_RegionStatus_To_v1alpha1_RegionStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_infra_Region_To_v1alpha1_Region is an autogenerated conversion function. +func Convert_infra_Region_To_v1alpha1_Region(in *infra.Region, out *Region, s conversion.Scope) error { + return autoConvert_infra_Region_To_v1alpha1_Region(in, out, s) +} + +func autoConvert_v1alpha1_RegionList_To_infra_RegionList(in *RegionList, out *infra.RegionList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]infra.Region, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_Region_To_infra_Region(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_RegionList_To_infra_RegionList is an autogenerated conversion function. +func Convert_v1alpha1_RegionList_To_infra_RegionList(in *RegionList, out *infra.RegionList, s conversion.Scope) error { + return autoConvert_v1alpha1_RegionList_To_infra_RegionList(in, out, s) +} + +func autoConvert_infra_RegionList_To_v1alpha1_RegionList(in *infra.RegionList, out *RegionList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Region, len(*in)) + for i := range *in { + if err := Convert_infra_Region_To_v1alpha1_Region(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_infra_RegionList_To_v1alpha1_RegionList is an autogenerated conversion function. +func Convert_infra_RegionList_To_v1alpha1_RegionList(in *infra.RegionList, out *RegionList, s conversion.Scope) error { + return autoConvert_infra_RegionList_To_v1alpha1_RegionList(in, out, s) +} + +func autoConvert_v1alpha1_RegionSpec_To_infra_RegionSpec(in *RegionSpec, out *infra.RegionSpec, s conversion.Scope) error { + if err := asv1alpha1.Convert_v1alpha1_UserDefinedLabels_To_common_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_RegionSpec_To_infra_RegionSpec is an autogenerated conversion function. +func Convert_v1alpha1_RegionSpec_To_infra_RegionSpec(in *RegionSpec, out *infra.RegionSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_RegionSpec_To_infra_RegionSpec(in, out, s) +} + +func autoConvert_infra_RegionSpec_To_v1alpha1_RegionSpec(in *infra.RegionSpec, out *RegionSpec, s conversion.Scope) error { + if err := asv1alpha1.Convert_common_UserDefinedLabels_To_v1alpha1_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_infra_RegionSpec_To_v1alpha1_RegionSpec is an autogenerated conversion function. +func Convert_infra_RegionSpec_To_v1alpha1_RegionSpec(in *infra.RegionSpec, out *RegionSpec, s conversion.Scope) error { + return autoConvert_infra_RegionSpec_To_v1alpha1_RegionSpec(in, out, s) +} + +func autoConvert_v1alpha1_RegionStatus_To_infra_RegionStatus(in *RegionStatus, out *infra.RegionStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_RegionStatus_To_infra_RegionStatus is an autogenerated conversion function. +func Convert_v1alpha1_RegionStatus_To_infra_RegionStatus(in *RegionStatus, out *infra.RegionStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_RegionStatus_To_infra_RegionStatus(in, out, s) +} + +func autoConvert_infra_RegionStatus_To_v1alpha1_RegionStatus(in *infra.RegionStatus, out *RegionStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_infra_RegionStatus_To_v1alpha1_RegionStatus is an autogenerated conversion function. +func Convert_infra_RegionStatus_To_v1alpha1_RegionStatus(in *infra.RegionStatus, out *RegionStatus, s conversion.Scope) error { + return autoConvert_infra_RegionStatus_To_v1alpha1_RegionStatus(in, out, s) +} + +func autoConvert_v1alpha1_Site_To_infra_Site(in *Site, out *infra.Site, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_SiteSpec_To_infra_SiteSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_SiteStatus_To_infra_SiteStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_Site_To_infra_Site is an autogenerated conversion function. +func Convert_v1alpha1_Site_To_infra_Site(in *Site, out *infra.Site, s conversion.Scope) error { + return autoConvert_v1alpha1_Site_To_infra_Site(in, out, s) +} + +func autoConvert_infra_Site_To_v1alpha1_Site(in *infra.Site, out *Site, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_infra_SiteSpec_To_v1alpha1_SiteSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_infra_SiteStatus_To_v1alpha1_SiteStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_infra_Site_To_v1alpha1_Site is an autogenerated conversion function. +func Convert_infra_Site_To_v1alpha1_Site(in *infra.Site, out *Site, s conversion.Scope) error { + return autoConvert_infra_Site_To_v1alpha1_Site(in, out, s) +} + +func autoConvert_v1alpha1_SiteList_To_infra_SiteList(in *SiteList, out *infra.SiteList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]infra.Site, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_Site_To_infra_Site(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_SiteList_To_infra_SiteList is an autogenerated conversion function. +func Convert_v1alpha1_SiteList_To_infra_SiteList(in *SiteList, out *infra.SiteList, s conversion.Scope) error { + return autoConvert_v1alpha1_SiteList_To_infra_SiteList(in, out, s) +} + +func autoConvert_infra_SiteList_To_v1alpha1_SiteList(in *infra.SiteList, out *SiteList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Site, len(*in)) + for i := range *in { + if err := Convert_infra_Site_To_v1alpha1_Site(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_infra_SiteList_To_v1alpha1_SiteList is an autogenerated conversion function. +func Convert_infra_SiteList_To_v1alpha1_SiteList(in *infra.SiteList, out *SiteList, s conversion.Scope) error { + return autoConvert_infra_SiteList_To_v1alpha1_SiteList(in, out, s) +} + +func autoConvert_v1alpha1_SiteSpec_To_infra_SiteSpec(in *SiteSpec, out *infra.SiteSpec, s conversion.Scope) error { + if err := Convert_v1alpha1_SiteID_To_id_SiteID(&in.SiteID, &out.SiteID, s); err != nil { + return err + } + out.Location = (*infra.Location)(unsafe.Pointer(in.Location)) + if err := asv1alpha1.Convert_v1alpha1_UserDefinedLabels_To_common_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_SiteSpec_To_infra_SiteSpec is an autogenerated conversion function. +func Convert_v1alpha1_SiteSpec_To_infra_SiteSpec(in *SiteSpec, out *infra.SiteSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_SiteSpec_To_infra_SiteSpec(in, out, s) +} + +func autoConvert_infra_SiteSpec_To_v1alpha1_SiteSpec(in *infra.SiteSpec, out *SiteSpec, s conversion.Scope) error { + if err := Convert_id_SiteID_To_v1alpha1_SiteID(&in.SiteID, &out.SiteID, s); err != nil { + return err + } + out.Location = (*Location)(unsafe.Pointer(in.Location)) + if err := asv1alpha1.Convert_common_UserDefinedLabels_To_v1alpha1_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_infra_SiteSpec_To_v1alpha1_SiteSpec is an autogenerated conversion function. +func Convert_infra_SiteSpec_To_v1alpha1_SiteSpec(in *infra.SiteSpec, out *SiteSpec, s conversion.Scope) error { + return autoConvert_infra_SiteSpec_To_v1alpha1_SiteSpec(in, out, s) +} + +func autoConvert_v1alpha1_SiteStatus_To_infra_SiteStatus(in *SiteStatus, out *infra.SiteStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_SiteStatus_To_infra_SiteStatus is an autogenerated conversion function. +func Convert_v1alpha1_SiteStatus_To_infra_SiteStatus(in *SiteStatus, out *infra.SiteStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_SiteStatus_To_infra_SiteStatus(in, out, s) +} + +func autoConvert_infra_SiteStatus_To_v1alpha1_SiteStatus(in *infra.SiteStatus, out *SiteStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_infra_SiteStatus_To_v1alpha1_SiteStatus is an autogenerated conversion function. +func Convert_infra_SiteStatus_To_v1alpha1_SiteStatus(in *infra.SiteStatus, out *SiteStatus, s conversion.Scope) error { + return autoConvert_infra_SiteStatus_To_v1alpha1_SiteStatus(in, out, s) +} diff --git a/apis/infra/v1alpha1/zz_generated.deepcopy.go b/apis/infra/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 0000000..3310390 --- /dev/null +++ b/apis/infra/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,1479 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + idv1alpha1 "github.com/kuidio/kuid/apis/id/v1alpha1" + 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 *Cluster) DeepCopyInto(out *Cluster) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Cluster. +func (in *Cluster) DeepCopy() *Cluster { + if in == nil { + return nil + } + out := new(Cluster) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Cluster) 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 *ClusterList) DeepCopyInto(out *ClusterList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Cluster, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterList. +func (in *ClusterList) DeepCopy() *ClusterList { + if in == nil { + return nil + } + out := new(ClusterList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterList) 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 *ClusterSpec) DeepCopyInto(out *ClusterSpec) { + *out = *in + out.PartitionClusterID = in.PartitionClusterID + if in.Location != nil { + in, out := &in.Location, &out.Location + *out = new(Location) + **out = **in + } + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterSpec. +func (in *ClusterSpec) DeepCopy() *ClusterSpec { + if in == nil { + return nil + } + out := new(ClusterSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterStatus) DeepCopyInto(out *ClusterStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterStatus. +func (in *ClusterStatus) DeepCopy() *ClusterStatus { + if in == nil { + return nil + } + out := new(ClusterStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Endpoint) DeepCopyInto(out *Endpoint) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Endpoint. +func (in *Endpoint) DeepCopy() *Endpoint { + if in == nil { + return nil + } + out := new(Endpoint) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Endpoint) 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 *EndpointList) DeepCopyInto(out *EndpointList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Endpoint, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointList. +func (in *EndpointList) DeepCopy() *EndpointList { + if in == nil { + return nil + } + out := new(EndpointList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EndpointList) 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 *EndpointSet) DeepCopyInto(out *EndpointSet) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointSet. +func (in *EndpointSet) DeepCopy() *EndpointSet { + if in == nil { + return nil + } + out := new(EndpointSet) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EndpointSet) 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 *EndpointSetList) DeepCopyInto(out *EndpointSetList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]EndpointSet, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointSetList. +func (in *EndpointSetList) DeepCopy() *EndpointSetList { + if in == nil { + return nil + } + out := new(EndpointSetList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EndpointSetList) 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 *EndpointSetSpec) DeepCopyInto(out *EndpointSetSpec) { + *out = *in + if in.Endpoints != nil { + in, out := &in.Endpoints, &out.Endpoints + *out = make([]*idv1alpha1.PartitionEndpointID, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(idv1alpha1.PartitionEndpointID) + (*in).DeepCopyInto(*out) + } + } + } + if in.Lacp != nil { + in, out := &in.Lacp, &out.Lacp + *out = new(bool) + **out = **in + } + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointSetSpec. +func (in *EndpointSetSpec) DeepCopy() *EndpointSetSpec { + if in == nil { + return nil + } + out := new(EndpointSetSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EndpointSetStatus) DeepCopyInto(out *EndpointSetStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + if in.ESI != nil { + in, out := &in.ESI, &out.ESI + *out = new(uint32) + **out = **in + } + if in.LagId != nil { + in, out := &in.LagId, &out.LagId + *out = new(uint32) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointSetStatus. +func (in *EndpointSetStatus) DeepCopy() *EndpointSetStatus { + if in == nil { + return nil + } + out := new(EndpointSetStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EndpointSpec) DeepCopyInto(out *EndpointSpec) { + *out = *in + in.PartitionEndpointID.DeepCopyInto(&out.PartitionEndpointID) + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + if in.Speed != nil { + in, out := &in.Speed, &out.Speed + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointSpec. +func (in *EndpointSpec) DeepCopy() *EndpointSpec { + if in == nil { + return nil + } + out := new(EndpointSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EndpointStatus) DeepCopyInto(out *EndpointStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointStatus. +func (in *EndpointStatus) DeepCopy() *EndpointStatus { + if in == nil { + return nil + } + out := new(EndpointStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Link) DeepCopyInto(out *Link) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Link. +func (in *Link) DeepCopy() *Link { + if in == nil { + return nil + } + out := new(Link) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Link) 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 *LinkList) DeepCopyInto(out *LinkList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Link, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinkList. +func (in *LinkList) DeepCopy() *LinkList { + if in == nil { + return nil + } + out := new(LinkList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *LinkList) 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 *LinkSet) DeepCopyInto(out *LinkSet) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinkSet. +func (in *LinkSet) DeepCopy() *LinkSet { + if in == nil { + return nil + } + out := new(LinkSet) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *LinkSet) 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 *LinkSetList) DeepCopyInto(out *LinkSetList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]LinkSet, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinkSetList. +func (in *LinkSetList) DeepCopy() *LinkSetList { + if in == nil { + return nil + } + out := new(LinkSetList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *LinkSetList) 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 *LinkSetSpec) DeepCopyInto(out *LinkSetSpec) { + *out = *in + if in.Endpoints != nil { + in, out := &in.Endpoints, &out.Endpoints + *out = make([]*idv1alpha1.PartitionEndpointID, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(idv1alpha1.PartitionEndpointID) + (*in).DeepCopyInto(*out) + } + } + } + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinkSetSpec. +func (in *LinkSetSpec) DeepCopy() *LinkSetSpec { + if in == nil { + return nil + } + out := new(LinkSetSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LinkSetStatus) DeepCopyInto(out *LinkSetStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + if in.ESI != nil { + in, out := &in.ESI, &out.ESI + *out = new(uint32) + **out = **in + } + if in.LagId != nil { + in, out := &in.LagId, &out.LagId + *out = new(uint32) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinkSetStatus. +func (in *LinkSetStatus) DeepCopy() *LinkSetStatus { + if in == nil { + return nil + } + out := new(LinkSetStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LinkSpec) DeepCopyInto(out *LinkSpec) { + *out = *in + if in.Endpoints != nil { + in, out := &in.Endpoints, &out.Endpoints + *out = make([]*idv1alpha1.PartitionEndpointID, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(idv1alpha1.PartitionEndpointID) + (*in).DeepCopyInto(*out) + } + } + } + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinkSpec. +func (in *LinkSpec) DeepCopy() *LinkSpec { + if in == nil { + return nil + } + out := new(LinkSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LinkStatus) DeepCopyInto(out *LinkStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinkStatus. +func (in *LinkStatus) DeepCopy() *LinkStatus { + if in == nil { + return nil + } + out := new(LinkStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Location) DeepCopyInto(out *Location) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Location. +func (in *Location) DeepCopy() *Location { + if in == nil { + return nil + } + out := new(Location) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Module) DeepCopyInto(out *Module) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Module. +func (in *Module) DeepCopy() *Module { + if in == nil { + return nil + } + out := new(Module) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Module) 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 *ModuleBay) DeepCopyInto(out *ModuleBay) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleBay. +func (in *ModuleBay) DeepCopy() *ModuleBay { + if in == nil { + return nil + } + out := new(ModuleBay) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ModuleBay) 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 *ModuleBayList) DeepCopyInto(out *ModuleBayList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ModuleBay, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleBayList. +func (in *ModuleBayList) DeepCopy() *ModuleBayList { + if in == nil { + return nil + } + out := new(ModuleBayList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ModuleBayList) 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 *ModuleBaySpec) DeepCopyInto(out *ModuleBaySpec) { + *out = *in + out.PartitionNodeID = in.PartitionNodeID + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleBaySpec. +func (in *ModuleBaySpec) DeepCopy() *ModuleBaySpec { + if in == nil { + return nil + } + out := new(ModuleBaySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ModuleBayStatus) DeepCopyInto(out *ModuleBayStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleBayStatus. +func (in *ModuleBayStatus) DeepCopy() *ModuleBayStatus { + if in == nil { + return nil + } + out := new(ModuleBayStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ModuleList) DeepCopyInto(out *ModuleList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Module, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleList. +func (in *ModuleList) DeepCopy() *ModuleList { + if in == nil { + return nil + } + out := new(ModuleList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ModuleList) 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 *ModuleSpec) DeepCopyInto(out *ModuleSpec) { + *out = *in + out.PartitionNodeID = in.PartitionNodeID + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleSpec. +func (in *ModuleSpec) DeepCopy() *ModuleSpec { + if in == nil { + return nil + } + out := new(ModuleSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ModuleStatus) DeepCopyInto(out *ModuleStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleStatus. +func (in *ModuleStatus) DeepCopy() *ModuleStatus { + if in == nil { + return nil + } + out := new(ModuleStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Node) DeepCopyInto(out *Node) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Node. +func (in *Node) DeepCopy() *Node { + if in == nil { + return nil + } + out := new(Node) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Node) 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 *NodeItem) DeepCopyInto(out *NodeItem) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeItem. +func (in *NodeItem) DeepCopy() *NodeItem { + if in == nil { + return nil + } + out := new(NodeItem) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NodeItem) 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 *NodeItemList) DeepCopyInto(out *NodeItemList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]NodeItem, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeItemList. +func (in *NodeItemList) DeepCopy() *NodeItemList { + if in == nil { + return nil + } + out := new(NodeItemList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NodeItemList) 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 *NodeItemSpec) DeepCopyInto(out *NodeItemSpec) { + *out = *in + out.PartitionNodeID = in.PartitionNodeID + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeItemSpec. +func (in *NodeItemSpec) DeepCopy() *NodeItemSpec { + if in == nil { + return nil + } + out := new(NodeItemSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeItemStatus) DeepCopyInto(out *NodeItemStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeItemStatus. +func (in *NodeItemStatus) DeepCopy() *NodeItemStatus { + if in == nil { + return nil + } + out := new(NodeItemStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeList) DeepCopyInto(out *NodeList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Node, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeList. +func (in *NodeList) DeepCopy() *NodeList { + if in == nil { + return nil + } + out := new(NodeList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NodeList) 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 *NodeSet) DeepCopyInto(out *NodeSet) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeSet. +func (in *NodeSet) DeepCopy() *NodeSet { + if in == nil { + return nil + } + out := new(NodeSet) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NodeSet) 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 *NodeSetList) DeepCopyInto(out *NodeSetList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]NodeSet, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeSetList. +func (in *NodeSetList) DeepCopy() *NodeSetList { + if in == nil { + return nil + } + out := new(NodeSetList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NodeSetList) 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 *NodeSetSpec) DeepCopyInto(out *NodeSetSpec) { + *out = *in + out.PartitionClusterID = in.PartitionClusterID + in.ClaimLabels.DeepCopyInto(&out.ClaimLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeSetSpec. +func (in *NodeSetSpec) DeepCopy() *NodeSetSpec { + if in == nil { + return nil + } + out := new(NodeSetSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeSetStatus) DeepCopyInto(out *NodeSetStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeSetStatus. +func (in *NodeSetStatus) DeepCopy() *NodeSetStatus { + if in == nil { + return nil + } + out := new(NodeSetStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeSpec) DeepCopyInto(out *NodeSpec) { + *out = *in + out.PartitionNodeID = in.PartitionNodeID + if in.Rack != nil { + in, out := &in.Rack, &out.Rack + *out = new(string) + **out = **in + } + if in.Position != nil { + in, out := &in.Position, &out.Position + *out = new(string) + **out = **in + } + if in.Location != nil { + in, out := &in.Location, &out.Location + *out = new(Location) + **out = **in + } + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeSpec. +func (in *NodeSpec) DeepCopy() *NodeSpec { + if in == nil { + return nil + } + out := new(NodeSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeStatus) DeepCopyInto(out *NodeStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + if in.SystemID != nil { + in, out := &in.SystemID, &out.SystemID + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeStatus. +func (in *NodeStatus) DeepCopy() *NodeStatus { + if in == nil { + return nil + } + out := new(NodeStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Partition) DeepCopyInto(out *Partition) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Partition. +func (in *Partition) DeepCopy() *Partition { + if in == nil { + return nil + } + out := new(Partition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Partition) 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 *PartitionList) DeepCopyInto(out *PartitionList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Partition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PartitionList. +func (in *PartitionList) DeepCopy() *PartitionList { + if in == nil { + return nil + } + out := new(PartitionList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PartitionList) 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 *PartitionSpec) DeepCopyInto(out *PartitionSpec) { + *out = *in + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PartitionSpec. +func (in *PartitionSpec) DeepCopy() *PartitionSpec { + if in == nil { + return nil + } + out := new(PartitionSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PartitionStatus) DeepCopyInto(out *PartitionStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PartitionStatus. +func (in *PartitionStatus) DeepCopy() *PartitionStatus { + if in == nil { + return nil + } + out := new(PartitionStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Rack) DeepCopyInto(out *Rack) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Rack. +func (in *Rack) DeepCopy() *Rack { + if in == nil { + return nil + } + out := new(Rack) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Rack) 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 *RackList) DeepCopyInto(out *RackList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Rack, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RackList. +func (in *RackList) DeepCopy() *RackList { + if in == nil { + return nil + } + out := new(RackList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RackList) 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 *RackSpec) DeepCopyInto(out *RackSpec) { + *out = *in + out.SiteID = in.SiteID + if in.Location != nil { + in, out := &in.Location, &out.Location + *out = new(Location) + **out = **in + } + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RackSpec. +func (in *RackSpec) DeepCopy() *RackSpec { + if in == nil { + return nil + } + out := new(RackSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RackStatus) DeepCopyInto(out *RackStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RackStatus. +func (in *RackStatus) DeepCopy() *RackStatus { + if in == nil { + return nil + } + out := new(RackStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Region) DeepCopyInto(out *Region) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Region. +func (in *Region) DeepCopy() *Region { + if in == nil { + return nil + } + out := new(Region) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Region) 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 *RegionList) DeepCopyInto(out *RegionList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Region, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RegionList. +func (in *RegionList) DeepCopy() *RegionList { + if in == nil { + return nil + } + out := new(RegionList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RegionList) 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 *RegionSpec) DeepCopyInto(out *RegionSpec) { + *out = *in + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RegionSpec. +func (in *RegionSpec) DeepCopy() *RegionSpec { + if in == nil { + return nil + } + out := new(RegionSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RegionStatus) DeepCopyInto(out *RegionStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RegionStatus. +func (in *RegionStatus) DeepCopy() *RegionStatus { + if in == nil { + return nil + } + out := new(RegionStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Site) DeepCopyInto(out *Site) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Site. +func (in *Site) DeepCopy() *Site { + if in == nil { + return nil + } + out := new(Site) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Site) 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 *SiteList) DeepCopyInto(out *SiteList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Site, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SiteList. +func (in *SiteList) DeepCopy() *SiteList { + if in == nil { + return nil + } + out := new(SiteList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SiteList) 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 *SiteSpec) DeepCopyInto(out *SiteSpec) { + *out = *in + out.SiteID = in.SiteID + if in.Location != nil { + in, out := &in.Location, &out.Location + *out = new(Location) + **out = **in + } + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SiteSpec. +func (in *SiteSpec) DeepCopy() *SiteSpec { + if in == nil { + return nil + } + out := new(SiteSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SiteStatus) DeepCopyInto(out *SiteStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SiteStatus. +func (in *SiteStatus) DeepCopy() *SiteStatus { + if in == nil { + return nil + } + out := new(SiteStatus) + in.DeepCopyInto(out) + return out +} diff --git a/apis/infra/v1alpha1/zz_generated.defaults.go b/apis/infra/v1alpha1/zz_generated.defaults.go new file mode 100644 index 0000000..c38f9bb --- /dev/null +++ b/apis/infra/v1alpha1/zz_generated.defaults.go @@ -0,0 +1,32 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2024 Nokia. + +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 defaulter-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// RegisterDefaults adds defaulters functions to the given scheme. +// Public to allow building arbitrary schemes. +// All generated defaulters are covering - they call all nested defaulters. +func RegisterDefaults(scheme *runtime.Scheme) error { + return nil +} diff --git a/apis/infra/zz_generated.deepcopy.go b/apis/infra/zz_generated.deepcopy.go new file mode 100644 index 0000000..b790943 --- /dev/null +++ b/apis/infra/zz_generated.deepcopy.go @@ -0,0 +1,1703 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2024 Nokia. + +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 infra + +import ( + id "github.com/kuidio/kuid/apis/id" + 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 *Cluster) DeepCopyInto(out *Cluster) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Cluster. +func (in *Cluster) DeepCopy() *Cluster { + if in == nil { + return nil + } + out := new(Cluster) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Cluster) 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 *ClusterFilter) DeepCopyInto(out *ClusterFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterFilter. +func (in *ClusterFilter) DeepCopy() *ClusterFilter { + if in == nil { + return nil + } + out := new(ClusterFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterList) DeepCopyInto(out *ClusterList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Cluster, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterList. +func (in *ClusterList) DeepCopy() *ClusterList { + if in == nil { + return nil + } + out := new(ClusterList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterList) 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 *ClusterSpec) DeepCopyInto(out *ClusterSpec) { + *out = *in + out.PartitionClusterID = in.PartitionClusterID + if in.Location != nil { + in, out := &in.Location, &out.Location + *out = new(Location) + **out = **in + } + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterSpec. +func (in *ClusterSpec) DeepCopy() *ClusterSpec { + if in == nil { + return nil + } + out := new(ClusterSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterStatus) DeepCopyInto(out *ClusterStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterStatus. +func (in *ClusterStatus) DeepCopy() *ClusterStatus { + if in == nil { + return nil + } + out := new(ClusterStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Endpoint) DeepCopyInto(out *Endpoint) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Endpoint. +func (in *Endpoint) DeepCopy() *Endpoint { + if in == nil { + return nil + } + out := new(Endpoint) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Endpoint) 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 *EndpointFilter) DeepCopyInto(out *EndpointFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointFilter. +func (in *EndpointFilter) DeepCopy() *EndpointFilter { + if in == nil { + return nil + } + out := new(EndpointFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EndpointList) DeepCopyInto(out *EndpointList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Endpoint, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointList. +func (in *EndpointList) DeepCopy() *EndpointList { + if in == nil { + return nil + } + out := new(EndpointList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EndpointList) 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 *EndpointSet) DeepCopyInto(out *EndpointSet) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointSet. +func (in *EndpointSet) DeepCopy() *EndpointSet { + if in == nil { + return nil + } + out := new(EndpointSet) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EndpointSet) 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 *EndpointSetFilter) DeepCopyInto(out *EndpointSetFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointSetFilter. +func (in *EndpointSetFilter) DeepCopy() *EndpointSetFilter { + if in == nil { + return nil + } + out := new(EndpointSetFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EndpointSetList) DeepCopyInto(out *EndpointSetList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]EndpointSet, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointSetList. +func (in *EndpointSetList) DeepCopy() *EndpointSetList { + if in == nil { + return nil + } + out := new(EndpointSetList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EndpointSetList) 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 *EndpointSetSpec) DeepCopyInto(out *EndpointSetSpec) { + *out = *in + if in.Endpoints != nil { + in, out := &in.Endpoints, &out.Endpoints + *out = make([]*id.PartitionEndpointID, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(id.PartitionEndpointID) + (*in).DeepCopyInto(*out) + } + } + } + if in.Lacp != nil { + in, out := &in.Lacp, &out.Lacp + *out = new(bool) + **out = **in + } + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointSetSpec. +func (in *EndpointSetSpec) DeepCopy() *EndpointSetSpec { + if in == nil { + return nil + } + out := new(EndpointSetSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EndpointSetStatus) DeepCopyInto(out *EndpointSetStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + if in.ESI != nil { + in, out := &in.ESI, &out.ESI + *out = new(uint32) + **out = **in + } + if in.LagId != nil { + in, out := &in.LagId, &out.LagId + *out = new(uint32) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointSetStatus. +func (in *EndpointSetStatus) DeepCopy() *EndpointSetStatus { + if in == nil { + return nil + } + out := new(EndpointSetStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EndpointSpec) DeepCopyInto(out *EndpointSpec) { + *out = *in + in.PartitionEndpointID.DeepCopyInto(&out.PartitionEndpointID) + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + if in.Speed != nil { + in, out := &in.Speed, &out.Speed + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointSpec. +func (in *EndpointSpec) DeepCopy() *EndpointSpec { + if in == nil { + return nil + } + out := new(EndpointSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EndpointStatus) DeepCopyInto(out *EndpointStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointStatus. +func (in *EndpointStatus) DeepCopy() *EndpointStatus { + if in == nil { + return nil + } + out := new(EndpointStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Link) DeepCopyInto(out *Link) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Link. +func (in *Link) DeepCopy() *Link { + if in == nil { + return nil + } + out := new(Link) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Link) 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 *LinkFilter) DeepCopyInto(out *LinkFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinkFilter. +func (in *LinkFilter) DeepCopy() *LinkFilter { + if in == nil { + return nil + } + out := new(LinkFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LinkList) DeepCopyInto(out *LinkList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Link, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinkList. +func (in *LinkList) DeepCopy() *LinkList { + if in == nil { + return nil + } + out := new(LinkList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *LinkList) 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 *LinkSet) DeepCopyInto(out *LinkSet) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinkSet. +func (in *LinkSet) DeepCopy() *LinkSet { + if in == nil { + return nil + } + out := new(LinkSet) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *LinkSet) 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 *LinkSetFilter) DeepCopyInto(out *LinkSetFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinkSetFilter. +func (in *LinkSetFilter) DeepCopy() *LinkSetFilter { + if in == nil { + return nil + } + out := new(LinkSetFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LinkSetList) DeepCopyInto(out *LinkSetList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]LinkSet, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinkSetList. +func (in *LinkSetList) DeepCopy() *LinkSetList { + if in == nil { + return nil + } + out := new(LinkSetList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *LinkSetList) 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 *LinkSetSpec) DeepCopyInto(out *LinkSetSpec) { + *out = *in + if in.Endpoints != nil { + in, out := &in.Endpoints, &out.Endpoints + *out = make([]*id.PartitionEndpointID, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(id.PartitionEndpointID) + (*in).DeepCopyInto(*out) + } + } + } + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinkSetSpec. +func (in *LinkSetSpec) DeepCopy() *LinkSetSpec { + if in == nil { + return nil + } + out := new(LinkSetSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LinkSetStatus) DeepCopyInto(out *LinkSetStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + if in.ESI != nil { + in, out := &in.ESI, &out.ESI + *out = new(uint32) + **out = **in + } + if in.LagId != nil { + in, out := &in.LagId, &out.LagId + *out = new(uint32) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinkSetStatus. +func (in *LinkSetStatus) DeepCopy() *LinkSetStatus { + if in == nil { + return nil + } + out := new(LinkSetStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LinkSpec) DeepCopyInto(out *LinkSpec) { + *out = *in + if in.Endpoints != nil { + in, out := &in.Endpoints, &out.Endpoints + *out = make([]*id.PartitionEndpointID, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(id.PartitionEndpointID) + (*in).DeepCopyInto(*out) + } + } + } + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinkSpec. +func (in *LinkSpec) DeepCopy() *LinkSpec { + if in == nil { + return nil + } + out := new(LinkSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LinkStatus) DeepCopyInto(out *LinkStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinkStatus. +func (in *LinkStatus) DeepCopy() *LinkStatus { + if in == nil { + return nil + } + out := new(LinkStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Location) DeepCopyInto(out *Location) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Location. +func (in *Location) DeepCopy() *Location { + if in == nil { + return nil + } + out := new(Location) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Module) DeepCopyInto(out *Module) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Module. +func (in *Module) DeepCopy() *Module { + if in == nil { + return nil + } + out := new(Module) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Module) 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 *ModuleBay) DeepCopyInto(out *ModuleBay) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleBay. +func (in *ModuleBay) DeepCopy() *ModuleBay { + if in == nil { + return nil + } + out := new(ModuleBay) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ModuleBay) 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 *ModuleBayFilter) DeepCopyInto(out *ModuleBayFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleBayFilter. +func (in *ModuleBayFilter) DeepCopy() *ModuleBayFilter { + if in == nil { + return nil + } + out := new(ModuleBayFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ModuleBayList) DeepCopyInto(out *ModuleBayList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ModuleBay, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleBayList. +func (in *ModuleBayList) DeepCopy() *ModuleBayList { + if in == nil { + return nil + } + out := new(ModuleBayList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ModuleBayList) 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 *ModuleBaySpec) DeepCopyInto(out *ModuleBaySpec) { + *out = *in + out.PartitionNodeID = in.PartitionNodeID + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleBaySpec. +func (in *ModuleBaySpec) DeepCopy() *ModuleBaySpec { + if in == nil { + return nil + } + out := new(ModuleBaySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ModuleBayStatus) DeepCopyInto(out *ModuleBayStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleBayStatus. +func (in *ModuleBayStatus) DeepCopy() *ModuleBayStatus { + if in == nil { + return nil + } + out := new(ModuleBayStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ModuleFilter) DeepCopyInto(out *ModuleFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleFilter. +func (in *ModuleFilter) DeepCopy() *ModuleFilter { + if in == nil { + return nil + } + out := new(ModuleFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ModuleList) DeepCopyInto(out *ModuleList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Module, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleList. +func (in *ModuleList) DeepCopy() *ModuleList { + if in == nil { + return nil + } + out := new(ModuleList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ModuleList) 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 *ModuleSpec) DeepCopyInto(out *ModuleSpec) { + *out = *in + out.PartitionNodeID = in.PartitionNodeID + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleSpec. +func (in *ModuleSpec) DeepCopy() *ModuleSpec { + if in == nil { + return nil + } + out := new(ModuleSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ModuleStatus) DeepCopyInto(out *ModuleStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleStatus. +func (in *ModuleStatus) DeepCopy() *ModuleStatus { + if in == nil { + return nil + } + out := new(ModuleStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Node) DeepCopyInto(out *Node) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Node. +func (in *Node) DeepCopy() *Node { + if in == nil { + return nil + } + out := new(Node) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Node) 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 *NodeFilter) DeepCopyInto(out *NodeFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeFilter. +func (in *NodeFilter) DeepCopy() *NodeFilter { + if in == nil { + return nil + } + out := new(NodeFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeItem) DeepCopyInto(out *NodeItem) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeItem. +func (in *NodeItem) DeepCopy() *NodeItem { + if in == nil { + return nil + } + out := new(NodeItem) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NodeItem) 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 *NodeItemFilter) DeepCopyInto(out *NodeItemFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeItemFilter. +func (in *NodeItemFilter) DeepCopy() *NodeItemFilter { + if in == nil { + return nil + } + out := new(NodeItemFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeItemList) DeepCopyInto(out *NodeItemList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]NodeItem, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeItemList. +func (in *NodeItemList) DeepCopy() *NodeItemList { + if in == nil { + return nil + } + out := new(NodeItemList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NodeItemList) 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 *NodeItemSpec) DeepCopyInto(out *NodeItemSpec) { + *out = *in + out.PartitionNodeID = in.PartitionNodeID + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeItemSpec. +func (in *NodeItemSpec) DeepCopy() *NodeItemSpec { + if in == nil { + return nil + } + out := new(NodeItemSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeItemStatus) DeepCopyInto(out *NodeItemStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeItemStatus. +func (in *NodeItemStatus) DeepCopy() *NodeItemStatus { + if in == nil { + return nil + } + out := new(NodeItemStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeList) DeepCopyInto(out *NodeList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Node, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeList. +func (in *NodeList) DeepCopy() *NodeList { + if in == nil { + return nil + } + out := new(NodeList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NodeList) 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 *NodeSet) DeepCopyInto(out *NodeSet) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeSet. +func (in *NodeSet) DeepCopy() *NodeSet { + if in == nil { + return nil + } + out := new(NodeSet) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NodeSet) 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 *NodeSetFilter) DeepCopyInto(out *NodeSetFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeSetFilter. +func (in *NodeSetFilter) DeepCopy() *NodeSetFilter { + if in == nil { + return nil + } + out := new(NodeSetFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeSetList) DeepCopyInto(out *NodeSetList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]NodeSet, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeSetList. +func (in *NodeSetList) DeepCopy() *NodeSetList { + if in == nil { + return nil + } + out := new(NodeSetList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NodeSetList) 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 *NodeSetSpec) DeepCopyInto(out *NodeSetSpec) { + *out = *in + out.PartitionClusterID = in.PartitionClusterID + in.ClaimLabels.DeepCopyInto(&out.ClaimLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeSetSpec. +func (in *NodeSetSpec) DeepCopy() *NodeSetSpec { + if in == nil { + return nil + } + out := new(NodeSetSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeSetStatus) DeepCopyInto(out *NodeSetStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeSetStatus. +func (in *NodeSetStatus) DeepCopy() *NodeSetStatus { + if in == nil { + return nil + } + out := new(NodeSetStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeSpec) DeepCopyInto(out *NodeSpec) { + *out = *in + out.PartitionNodeID = in.PartitionNodeID + if in.Rack != nil { + in, out := &in.Rack, &out.Rack + *out = new(string) + **out = **in + } + if in.Position != nil { + in, out := &in.Position, &out.Position + *out = new(string) + **out = **in + } + if in.Location != nil { + in, out := &in.Location, &out.Location + *out = new(Location) + **out = **in + } + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeSpec. +func (in *NodeSpec) DeepCopy() *NodeSpec { + if in == nil { + return nil + } + out := new(NodeSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeStatus) DeepCopyInto(out *NodeStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + if in.SystemID != nil { + in, out := &in.SystemID, &out.SystemID + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeStatus. +func (in *NodeStatus) DeepCopy() *NodeStatus { + if in == nil { + return nil + } + out := new(NodeStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Partition) DeepCopyInto(out *Partition) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Partition. +func (in *Partition) DeepCopy() *Partition { + if in == nil { + return nil + } + out := new(Partition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Partition) 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 *PartitionFilter) DeepCopyInto(out *PartitionFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PartitionFilter. +func (in *PartitionFilter) DeepCopy() *PartitionFilter { + if in == nil { + return nil + } + out := new(PartitionFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PartitionList) DeepCopyInto(out *PartitionList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Partition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PartitionList. +func (in *PartitionList) DeepCopy() *PartitionList { + if in == nil { + return nil + } + out := new(PartitionList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PartitionList) 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 *PartitionSpec) DeepCopyInto(out *PartitionSpec) { + *out = *in + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PartitionSpec. +func (in *PartitionSpec) DeepCopy() *PartitionSpec { + if in == nil { + return nil + } + out := new(PartitionSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PartitionStatus) DeepCopyInto(out *PartitionStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PartitionStatus. +func (in *PartitionStatus) DeepCopy() *PartitionStatus { + if in == nil { + return nil + } + out := new(PartitionStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Rack) DeepCopyInto(out *Rack) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Rack. +func (in *Rack) DeepCopy() *Rack { + if in == nil { + return nil + } + out := new(Rack) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Rack) 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 *RackFilter) DeepCopyInto(out *RackFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RackFilter. +func (in *RackFilter) DeepCopy() *RackFilter { + if in == nil { + return nil + } + out := new(RackFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RackList) DeepCopyInto(out *RackList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Rack, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RackList. +func (in *RackList) DeepCopy() *RackList { + if in == nil { + return nil + } + out := new(RackList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RackList) 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 *RackSpec) DeepCopyInto(out *RackSpec) { + *out = *in + out.SiteID = in.SiteID + if in.Location != nil { + in, out := &in.Location, &out.Location + *out = new(Location) + **out = **in + } + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RackSpec. +func (in *RackSpec) DeepCopy() *RackSpec { + if in == nil { + return nil + } + out := new(RackSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RackStatus) DeepCopyInto(out *RackStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RackStatus. +func (in *RackStatus) DeepCopy() *RackStatus { + if in == nil { + return nil + } + out := new(RackStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Region) DeepCopyInto(out *Region) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Region. +func (in *Region) DeepCopy() *Region { + if in == nil { + return nil + } + out := new(Region) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Region) 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 *RegionFilter) DeepCopyInto(out *RegionFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RegionFilter. +func (in *RegionFilter) DeepCopy() *RegionFilter { + if in == nil { + return nil + } + out := new(RegionFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RegionList) DeepCopyInto(out *RegionList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Region, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RegionList. +func (in *RegionList) DeepCopy() *RegionList { + if in == nil { + return nil + } + out := new(RegionList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RegionList) 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 *RegionSpec) DeepCopyInto(out *RegionSpec) { + *out = *in + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RegionSpec. +func (in *RegionSpec) DeepCopy() *RegionSpec { + if in == nil { + return nil + } + out := new(RegionSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RegionStatus) DeepCopyInto(out *RegionStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RegionStatus. +func (in *RegionStatus) DeepCopy() *RegionStatus { + if in == nil { + return nil + } + out := new(RegionStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Site) DeepCopyInto(out *Site) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Site. +func (in *Site) DeepCopy() *Site { + if in == nil { + return nil + } + out := new(Site) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Site) 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 *SiteFilter) DeepCopyInto(out *SiteFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SiteFilter. +func (in *SiteFilter) DeepCopy() *SiteFilter { + if in == nil { + return nil + } + out := new(SiteFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SiteList) DeepCopyInto(out *SiteList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Site, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SiteList. +func (in *SiteList) DeepCopy() *SiteList { + if in == nil { + return nil + } + out := new(SiteList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SiteList) 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 *SiteSpec) DeepCopyInto(out *SiteSpec) { + *out = *in + out.SiteID = in.SiteID + if in.Location != nil { + in, out := &in.Location, &out.Location + *out = new(Location) + **out = **in + } + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SiteSpec. +func (in *SiteSpec) DeepCopy() *SiteSpec { + if in == nil { + return nil + } + out := new(SiteSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SiteStatus) DeepCopyInto(out *SiteStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SiteStatus. +func (in *SiteStatus) DeepCopy() *SiteStatus { + if in == nil { + return nil + } + out := new(SiteStatus) + in.DeepCopyInto(out) + return out +} diff --git a/artifacts/apiservice-infra.yaml b/artifacts/apiservice-infra.yaml index a5329c2..0aeaf74 100644 --- a/artifacts/apiservice-infra.yaml +++ b/artifacts/apiservice-infra.yaml @@ -1,10 +1,10 @@ apiVersion: apiregistration.k8s.io/v1 kind: APIService metadata: - name: v1alpha1.infra.be.kuid.dev + name: v1alpha1.infra.kuid.dev spec: insecureSkipTLSVerify: true - group: infra.be.kuid.dev + group: infra.kuid.dev groupPriorityMinimum: 1000 versionPriority: 15 service: diff --git a/artifacts/out/artifacts.yaml b/artifacts/out/artifacts.yaml index 40cef2e..ade919a 100644 --- a/artifacts/out/artifacts.yaml +++ b/artifacts/out/artifacts.yaml @@ -57,9 +57,9 @@ spec: apiVersion: apiregistration.k8s.io/v1 kind: APIService metadata: - name: v1alpha1.infra.be.kuid.dev + name: v1alpha1.infra.kuid.dev spec: - group: infra.be.kuid.dev + group: infra.kuid.dev groupPriorityMinimum: 1000 insecureSkipTLSVerify: true service: diff --git a/crds/as.be.kuid.dev_asclaims.yaml b/crds/as.be.kuid.dev_asclaims.yaml index e4de9ee..9e3b03d 100644 --- a/crds/as.be.kuid.dev_asclaims.yaml +++ b/crds/as.be.kuid.dev_asclaims.yaml @@ -187,9 +187,7 @@ spec: type: object type: object served: true - storage: true - subresources: - status: {} + storage: false - name: v1alpha1 schema: openAPIV3Schema: @@ -361,6 +359,6 @@ spec: type: object type: object served: true - storage: false + storage: true subresources: status: {} diff --git a/crds/as.be.kuid.dev_asentries.yaml b/crds/as.be.kuid.dev_asentries.yaml index 56f923e..1b1f16b 100644 --- a/crds/as.be.kuid.dev_asentries.yaml +++ b/crds/as.be.kuid.dev_asentries.yaml @@ -173,9 +173,7 @@ spec: type: object type: object served: true - storage: true - subresources: - status: {} + storage: false - name: v1alpha1 schema: openAPIV3Schema: @@ -333,6 +331,6 @@ spec: type: object type: object served: true - storage: false + storage: true subresources: status: {} diff --git a/crds/as.be.kuid.dev_asindexes.yaml b/crds/as.be.kuid.dev_asindexes.yaml index 9a48796..4820610 100644 --- a/crds/as.be.kuid.dev_asindexes.yaml +++ b/crds/as.be.kuid.dev_asindexes.yaml @@ -132,9 +132,7 @@ spec: type: object type: object served: true - storage: true - subresources: - status: {} + storage: false - name: v1alpha1 schema: openAPIV3Schema: @@ -251,6 +249,6 @@ spec: type: object type: object served: true - storage: false + storage: true subresources: status: {} diff --git a/crds/infra.kuid.dev_clusters.yaml b/crds/infra.kuid.dev_clusters.yaml new file mode 100644 index 0000000..d8ae4a4 --- /dev/null +++ b/crds/infra.kuid.dev_clusters.yaml @@ -0,0 +1,294 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: clusters.infra.kuid.dev +spec: + group: infra.kuid.dev + names: + categories: + - kuid + kind: Cluster + listKind: ClusterList + plural: clusters + singular: cluster + scope: Namespaced + versions: + - name: infra + schema: + openAPIV3Schema: + description: A Cluster represents a kubernetes cluster and is typically used + as a nodeGroup identifier. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: ClusterSpec defines the desired state of Cluster + properties: + cluster: + description: Cluster defines the name of the cluster + type: string + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + location: + description: |- + Location defines the location information where this resource is located + in lon/lat coordinates + properties: + latitude: + type: string + longitude: + type: string + required: + - latitude + - longitude + type: object + partition: + description: Partition defines the partition this resource belongs + to + type: string + provider: + description: Provider defines the provider implementing this resource. + type: string + region: + description: Region defines the region of the resource + type: string + site: + description: Site defines the site of the resource + type: string + required: + - cluster + - partition + - provider + - region + - site + type: object + status: + description: ClusterStatus defines the observed state of Cluster + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: false + - name: v1alpha1 + schema: + openAPIV3Schema: + description: A Cluster represents a kubernetes cluster and is typically used + as a nodeGroup identifier. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: ClusterSpec defines the desired state of Cluster + properties: + cluster: + description: Cluster defines the name of the cluster + type: string + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + location: + description: |- + Location defines the location information where this resource is located + in lon/lat coordinates + properties: + latitude: + type: string + longitude: + type: string + required: + - latitude + - longitude + type: object + partition: + description: Partition defines the partition this resource belongs + to + type: string + provider: + description: Provider defines the provider implementing this resource. + type: string + region: + description: Region defines the region of the resource + type: string + site: + description: Site defines the site of the resource + type: string + required: + - cluster + - partition + - provider + - region + - site + type: object + status: + description: ClusterStatus defines the observed state of Cluster + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/crds/infra.kuid.dev_endpoints.yaml b/crds/infra.kuid.dev_endpoints.yaml new file mode 100644 index 0000000..f9ffa2b --- /dev/null +++ b/crds/infra.kuid.dev_endpoints.yaml @@ -0,0 +1,316 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: endpoints.infra.kuid.dev +spec: + group: infra.kuid.dev + names: + kind: Endpoint + listKind: EndpointList + plural: endpoints + singular: endpoint + scope: Namespaced + versions: + - name: infra + schema: + openAPIV3Schema: + description: |- + An Endpoint represents a communication interface or connection point within a Node, + facilitating network communication and data transfer between different components + or systems within the environment. `Endpoints` serve as gateways for transmitting and + receiving data, enabling seamless communication between Nodes. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: EndpointSpec defines the desired state of Endpoint + properties: + adaptor: + description: Adaptor defines the name of the adaptor + type: string + endpoint: + description: Endpoint defines the name of the endpoint + type: integer + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + module: + description: Module defines the module reference id + type: integer + moduleBay: + description: ModuleBay defines the moduleBay reference id + type: integer + name: + description: Name is used to refer to internal names of the node + type: string + node: + description: Node defines the name of the node + type: string + partition: + description: Partition defines the partition this resource belongs + to + type: string + port: + description: Port defines the id of the port + type: integer + region: + description: Region defines the region of the resource + type: string + site: + description: Site defines the site of the resource + type: string + speed: + description: (Gbps) + type: string + vlanTagging: + description: VLANTagging defines if VLAN tagging is enabled or disabled + on the interface + type: boolean + required: + - endpoint + - node + - partition + - port + - region + - site + type: object + status: + description: EndpointStatus defines the observed state of Endpoint + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: false + - name: v1alpha1 + schema: + openAPIV3Schema: + description: |- + An Endpoint represents a communication interface or connection point within a Node, + facilitating network communication and data transfer between different components + or systems within the environment. `Endpoints` serve as gateways for transmitting and + receiving data, enabling seamless communication between Nodes. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: EndpointSpec defines the desired state of Endpoint + properties: + adaptor: + description: Adaptor defines the name of the adaptor + type: string + endpoint: + description: Endpoint defines the name of the endpoint + type: integer + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + module: + description: Module defines the module reference id + type: integer + moduleBay: + description: ModuleBay defines the moduleBay reference id + type: integer + name: + description: Name is used to refer to internal names of the node + type: string + node: + description: Node defines the name of the node + type: string + partition: + description: Partition defines the partition this resource belongs + to + type: string + port: + description: Port defines the id of the port + type: integer + region: + description: Region defines the region of the resource + type: string + site: + description: Site defines the site of the resource + type: string + speed: + description: (Gbps) + type: string + vlanTagging: + description: VLANTagging defines if VLAN tagging is enabled or disabled + on the interface + type: boolean + required: + - endpoint + - node + - partition + - port + - region + - site + type: object + status: + description: EndpointStatus defines the observed state of Endpoint + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: false diff --git a/crds/infra.kuid.dev_endpointsets.yaml b/crds/infra.kuid.dev_endpointsets.yaml new file mode 100644 index 0000000..c8b5de6 --- /dev/null +++ b/crds/infra.kuid.dev_endpointsets.yaml @@ -0,0 +1,362 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: endpointsets.infra.kuid.dev +spec: + group: infra.kuid.dev + names: + kind: EndpointSet + listKind: EndpointSetList + plural: endpointsets + singular: endpointset + scope: Namespaced + versions: + - name: infra + schema: + openAPIV3Schema: + description: |- + A EndpointSet represents a set of endpoints that belong together within a nodeGroup. + E.g. it can be used to model a logical Link Aggregation group within + a node or it can be used to represent a logical multi-homing construction + between a set of nodes belonging to a single nodeGroup. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: |- + EndpointSetSpec defines the desired state of EndpointSet + An EndpointSet can be a LAG (single Homed) or ESI (multiHomed). The EndpointSet + can only belong to a single NodeGroup + properties: + endpoints: + description: |- + Endpoints defines the Endpoints that are part of the EndpointSet + Min 1, Max 16 + items: + properties: + adaptor: + description: Adaptor defines the name of the adaptor + type: string + endpoint: + description: Endpoint defines the name of the endpoint + type: integer + module: + description: Module defines the module reference id + type: integer + moduleBay: + description: ModuleBay defines the moduleBay reference id + type: integer + name: + description: Name is used to refer to internal names of the + node + type: string + node: + description: Node defines the name of the node + type: string + partition: + description: Partition defines the partition this resource belongs + to + type: string + port: + description: Port defines the id of the port + type: integer + region: + description: Region defines the region of the resource + type: string + site: + description: Site defines the site of the resource + type: string + required: + - endpoint + - node + - partition + - port + - region + - site + type: object + type: array + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + lacp: + description: Lacp defines if the lag enabled LACP + type: boolean + required: + - endpoints + type: object + status: + description: EndpointSetStatus defines the observed state of EndpointSet + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + esi: + description: |- + ESI defines the ethernet segment identifier of the logical link + if set this is a multi-homed logical endpoint + the ESI is a global unique identifier within the administrative domain + format: int32 + type: integer + lagID: + description: |- + LagId defines the lag id for the logical single-homed or multi-homed + endpoint + format: int32 + type: integer + type: object + type: object + served: true + storage: false + - name: v1alpha1 + schema: + openAPIV3Schema: + description: |- + A EndpointSet represents a set of endpoints that belong together within a nodeGroup. + E.g. it can be used to model a logical Link Aggregation group within + a node or it can be used to represent a logical multi-homing construction + between a set of nodes belonging to a single nodeGroup. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: |- + EndpointSetSpec defines the desired state of EndpointSet + An EndpointSet can be a LAG (single Homed) or ESI (multiHomed). The EndpointSet + can only belong to a single NodeGroup + properties: + endpoints: + description: |- + Endpoints defines the Endpoints that are part of the EndpointSet + Min 1, Max 16 + items: + properties: + adaptor: + description: Adaptor defines the name of the adaptor + type: string + endpoint: + description: Endpoint defines the name of the endpoint + type: integer + module: + description: Module defines the module reference id + type: integer + moduleBay: + description: ModuleBay defines the moduleBay reference id + type: integer + name: + description: Name is used to refer to internal names of the + node + type: string + node: + description: Node defines the name of the node + type: string + partition: + description: Partition defines the partition this resource belongs + to + type: string + port: + description: Port defines the id of the port + type: integer + region: + description: Region defines the region of the resource + type: string + site: + description: Site defines the site of the resource + type: string + required: + - endpoint + - node + - partition + - port + - region + - site + type: object + type: array + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + lacp: + description: Lacp defines if the lag enabled LACP + type: boolean + required: + - endpoints + type: object + status: + description: EndpointSetStatus defines the observed state of EndpointSet + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + esi: + description: |- + ESI defines the ethernet segment identifier of the logical link + if set this is a multi-homed logical endpoint + the ESI is a global unique identifier within the administrative domain + format: int32 + type: integer + lagID: + description: |- + LagId defines the lag id for the logical single-homed or multi-homed + endpoint + format: int32 + type: integer + type: object + type: object + served: true + storage: false diff --git a/crds/infra.kuid.dev_links.yaml b/crds/infra.kuid.dev_links.yaml new file mode 100644 index 0000000..db5d10f --- /dev/null +++ b/crds/infra.kuid.dev_links.yaml @@ -0,0 +1,320 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: links.infra.kuid.dev +spec: + group: infra.kuid.dev + names: + kind: Link + listKind: LinkList + plural: links + singular: link + scope: Namespaced + versions: + - name: infra + schema: + openAPIV3Schema: + description: |- + A link represents a physical/logical connection that enables communication and data transfer + between 2 endpoints of a node. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: LinkSpec defines the desired state of Link + properties: + endpoints: + description: |- + Endpoints define the 2 endpoint identifiers of the link + Can only have 2 endpoints + items: + properties: + adaptor: + description: Adaptor defines the name of the adaptor + type: string + endpoint: + description: Endpoint defines the name of the endpoint + type: integer + module: + description: Module defines the module reference id + type: integer + moduleBay: + description: ModuleBay defines the moduleBay reference id + type: integer + name: + description: Name is used to refer to internal names of the + node + type: string + node: + description: Node defines the name of the node + type: string + partition: + description: Partition defines the partition this resource belongs + to + type: string + port: + description: Port defines the id of the port + type: integer + region: + description: Region defines the region of the resource + type: string + site: + description: Site defines the site of the resource + type: string + required: + - endpoint + - node + - partition + - port + - region + - site + type: object + type: array + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + required: + - endpoints + type: object + status: + description: LinkStatus defines the observed state of Link + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: false + - name: v1alpha1 + schema: + openAPIV3Schema: + description: |- + A link represents a physical/logical connection that enables communication and data transfer + between 2 endpoints of a node. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: LinkSpec defines the desired state of Link + properties: + endpoints: + description: |- + Endpoints define the 2 endpoint identifiers of the link + Can only have 2 endpoints + items: + properties: + adaptor: + description: Adaptor defines the name of the adaptor + type: string + endpoint: + description: Endpoint defines the name of the endpoint + type: integer + module: + description: Module defines the module reference id + type: integer + moduleBay: + description: ModuleBay defines the moduleBay reference id + type: integer + name: + description: Name is used to refer to internal names of the + node + type: string + node: + description: Node defines the name of the node + type: string + partition: + description: Partition defines the partition this resource belongs + to + type: string + port: + description: Port defines the id of the port + type: integer + region: + description: Region defines the region of the resource + type: string + site: + description: Site defines the site of the resource + type: string + required: + - endpoint + - node + - partition + - port + - region + - site + type: object + type: array + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + required: + - endpoints + type: object + status: + description: LinkStatus defines the observed state of Link + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: false diff --git a/crds/infra.kuid.dev_linksets.yaml b/crds/infra.kuid.dev_linksets.yaml new file mode 100644 index 0000000..f991cb0 --- /dev/null +++ b/crds/infra.kuid.dev_linksets.yaml @@ -0,0 +1,346 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: linksets.infra.kuid.dev +spec: + group: infra.kuid.dev + names: + kind: LinkSet + listKind: LinkSetList + plural: linksets + singular: linkset + scope: Namespaced + versions: + - name: infra + schema: + openAPIV3Schema: + description: |- + A linkSet represents a set of links that belong together within a node group or accross nodeGroups. + E.g. it can be used to model a logical Link Aggregation group between 2 nodes or + it can be used to represent a logical multi-homing construction between a set of nodes + belonging to 1 or multiple nodeGroups/Topologies. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: LinkSetSpec defines the desired state of LinkSet + properties: + endpoints: + description: Endpoints define the endpoint identifiers of the LinkSet + items: + properties: + adaptor: + description: Adaptor defines the name of the adaptor + type: string + endpoint: + description: Endpoint defines the name of the endpoint + type: integer + module: + description: Module defines the module reference id + type: integer + moduleBay: + description: ModuleBay defines the moduleBay reference id + type: integer + name: + description: Name is used to refer to internal names of the + node + type: string + node: + description: Node defines the name of the node + type: string + partition: + description: Partition defines the partition this resource belongs + to + type: string + port: + description: Port defines the id of the port + type: integer + region: + description: Region defines the region of the resource + type: string + site: + description: Site defines the site of the resource + type: string + required: + - endpoint + - node + - partition + - port + - region + - site + type: object + type: array + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + required: + - endpoints + type: object + status: + description: LinkSetStatus defines the observed state of LinkSet + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + esi: + description: |- + ESI defines the ethernet segment identifier of the logical link + if set this is a multi-homed linkset + the ESI is a global unique identifier within the administrative domain/topology + format: int32 + type: integer + lagId: + description: |- + LagId defines the lag id for the logical single-homed or multi-homed + endpoint + format: int32 + type: integer + type: object + type: object + served: true + storage: false + - name: v1alpha1 + schema: + openAPIV3Schema: + description: |- + A linkSet represents a set of links that belong together within a node group or accross nodeGroups. + E.g. it can be used to model a logical Link Aggregation group between 2 nodes or + it can be used to represent a logical multi-homing construction between a set of nodes + belonging to 1 or multiple nodeGroups/Topologies. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: LinkSetSpec defines the desired state of LinkSet + properties: + endpoints: + description: Endpoints define the endpoint identifiers of the LinkSet + items: + properties: + adaptor: + description: Adaptor defines the name of the adaptor + type: string + endpoint: + description: Endpoint defines the name of the endpoint + type: integer + module: + description: Module defines the module reference id + type: integer + moduleBay: + description: ModuleBay defines the moduleBay reference id + type: integer + name: + description: Name is used to refer to internal names of the + node + type: string + node: + description: Node defines the name of the node + type: string + partition: + description: Partition defines the partition this resource belongs + to + type: string + port: + description: Port defines the id of the port + type: integer + region: + description: Region defines the region of the resource + type: string + site: + description: Site defines the site of the resource + type: string + required: + - endpoint + - node + - partition + - port + - region + - site + type: object + type: array + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + required: + - endpoints + type: object + status: + description: LinkSetStatus defines the observed state of LinkSet + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + esi: + description: |- + ESI defines the ethernet segment identifier of the logical link + if set this is a multi-homed linkset + the ESI is a global unique identifier within the administrative domain/topology + format: int32 + type: integer + lagId: + description: |- + LagId defines the lag id for the logical single-homed or multi-homed + endpoint + format: int32 + type: integer + type: object + type: object + served: true + storage: false diff --git a/crds/infra.kuid.dev_modulebays.yaml b/crds/infra.kuid.dev_modulebays.yaml new file mode 100644 index 0000000..e7e96a5 --- /dev/null +++ b/crds/infra.kuid.dev_modulebays.yaml @@ -0,0 +1,270 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: modulebays.infra.kuid.dev +spec: + group: infra.kuid.dev + names: + kind: ModuleBay + listKind: ModuleBayList + plural: modulebays + singular: modulebay + scope: Namespaced + versions: + - name: infra + schema: + openAPIV3Schema: + description: |- + A ModuleBay serves as a modular slot or enclosure within a Node, designed to accommodate additional modules. + ModuleBays provide a flexible and scalable approach to extending the capabilities of Nodes, + allowing users to customize and enhance their infrastructure deployments according to specific requirements. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: ModuleBaySpec defines the desired state of ModuleBay + properties: + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + node: + description: Node defines the name of the node + type: string + partition: + description: Partition defines the partition this resource belongs + to + type: string + psoition: + description: Position defines the position in the node the moduleBay + is deployed + type: integer + region: + description: Region defines the region of the resource + type: string + site: + description: Site defines the site of the resource + type: string + required: + - node + - partition + - psoition + - region + - site + type: object + status: + description: ModuleBayStatus defines the observed state of ModuleBay + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: false + - name: v1alpha1 + schema: + openAPIV3Schema: + description: |- + A ModuleBay serves as a modular slot or enclosure within a Node, designed to accommodate additional modules. + ModuleBays provide a flexible and scalable approach to extending the capabilities of Nodes, + allowing users to customize and enhance their infrastructure deployments according to specific requirements. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: ModuleBaySpec defines the desired state of ModuleBay + properties: + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + node: + description: Node defines the name of the node + type: string + partition: + description: Partition defines the partition this resource belongs + to + type: string + psoition: + description: Position defines the position in the node the moduleBay + is deployed + type: integer + region: + description: Region defines the region of the resource + type: string + site: + description: Site defines the site of the resource + type: string + required: + - node + - partition + - psoition + - region + - site + type: object + status: + description: ModuleBayStatus defines the observed state of ModuleBay + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: false diff --git a/crds/infra.kuid.dev_modules.yaml b/crds/infra.kuid.dev_modules.yaml new file mode 100644 index 0000000..12ccbca --- /dev/null +++ b/crds/infra.kuid.dev_modules.yaml @@ -0,0 +1,268 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: modules.infra.kuid.dev +spec: + group: infra.kuid.dev + names: + kind: Module + listKind: ModuleList + plural: modules + singular: module + scope: Namespaced + versions: + - name: infra + schema: + openAPIV3Schema: + description: |- + A module refers to a hardware component or expansion module that can be installed within a ModuleBay of a Node. + Modules provide additional functionality and capabilities to the infrastructure environment, + allowing users to enhance and customize their deployments according to specific requirements. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: ModuleSpec defines the desired state of Module + properties: + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + moduleBay: + description: ModuelBay defines the bay in which the module is deployed + type: integer + node: + description: Node defines the name of the node + type: string + partition: + description: Partition defines the partition this resource belongs + to + type: string + region: + description: Region defines the region of the resource + type: string + site: + description: Site defines the site of the resource + type: string + required: + - moduleBay + - node + - partition + - region + - site + type: object + status: + description: ModuleStatus defines the observed state of Module + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: false + - name: v1alpha1 + schema: + openAPIV3Schema: + description: |- + A module refers to a hardware component or expansion module that can be installed within a ModuleBay of a Node. + Modules provide additional functionality and capabilities to the infrastructure environment, + allowing users to enhance and customize their deployments according to specific requirements. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: ModuleSpec defines the desired state of Module + properties: + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + moduleBay: + description: ModuelBay defines the bay in which the module is deployed + type: integer + node: + description: Node defines the name of the node + type: string + partition: + description: Partition defines the partition this resource belongs + to + type: string + region: + description: Region defines the region of the resource + type: string + site: + description: Site defines the site of the resource + type: string + required: + - moduleBay + - node + - partition + - region + - site + type: object + status: + description: ModuleStatus defines the observed state of Module + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: false diff --git a/crds/infra.kuid.dev_nodeitems.yaml b/crds/infra.kuid.dev_nodeitems.yaml new file mode 100644 index 0000000..8e6274d --- /dev/null +++ b/crds/infra.kuid.dev_nodeitems.yaml @@ -0,0 +1,262 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: nodeitems.infra.kuid.dev +spec: + group: infra.kuid.dev + names: + kind: NodeItem + listKind: NodeItemList + plural: nodeitems + singular: nodeitem + scope: Namespaced + versions: + - name: infra + schema: + openAPIV3Schema: + description: |- + A NodeItem represents a specific hardware component or accessory associated with a Node. + NodeItems represent a wide range of hardware elements, e.g Fan(s), PowerUnit(s), CPU(s), + and other peripheral devices essential for the operation of the Node. + NodeItem is used to represent the modular components of a node. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: NodeItemSpec defines the desired state of NodeItem + properties: + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + node: + description: Node defines the name of the node + type: string + partition: + description: Partition defines the partition this resource belongs + to + type: string + region: + description: Region defines the region of the resource + type: string + site: + description: Site defines the site of the resource + type: string + required: + - node + - partition + - region + - site + type: object + status: + description: NodeItemStatus defines the observed state of NodeItem + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: false + - name: v1alpha1 + schema: + openAPIV3Schema: + description: |- + A NodeItem represents a specific hardware component or accessory associated with a Node. + NodeItems represent a wide range of hardware elements, e.g Fan(s), PowerUnit(s), CPU(s), + and other peripheral devices essential for the operation of the Node. + NodeItem is used to represent the modular components of a node. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: NodeItemSpec defines the desired state of NodeItem + properties: + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + node: + description: Node defines the name of the node + type: string + partition: + description: Partition defines the partition this resource belongs + to + type: string + region: + description: Region defines the region of the resource + type: string + site: + description: Site defines the site of the resource + type: string + required: + - node + - partition + - region + - site + type: object + status: + description: NodeItemStatus defines the observed state of NodeItem + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: false diff --git a/crds/infra.kuid.dev_nodes.yaml b/crds/infra.kuid.dev_nodes.yaml new file mode 100644 index 0000000..b4f3f2e --- /dev/null +++ b/crds/infra.kuid.dev_nodes.yaml @@ -0,0 +1,330 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: nodes.infra.kuid.dev +spec: + group: infra.kuid.dev + names: + kind: Node + listKind: NodeList + plural: nodes + singular: node + scope: Namespaced + versions: + - name: infra + schema: + openAPIV3Schema: + description: |- + A Node represents a fundamental unit that implements compute, storage, and/or networking within your environment. + Nodes can embody physical, virtual, or containerized entities, offering versatility in deployment options to suit + diverse infrastructure requirements. + Nodes are logically organized within racks and sites/regions, establishing a hierarchical structure for efficient + resource management and organization. Additionally, Nodes are associated with nodeGroups, facilitating centralized + management and control within defined administrative boundaries. + Each Node is assigned a provider, representing the entity responsible for implementing the specifics of the Node. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: NodeSpec defines the desired state of Node + properties: + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + location: + description: |- + Location defines the location information where this resource is located + in lon/lat coordinates + properties: + latitude: + type: string + longitude: + type: string + required: + - latitude + - longitude + type: object + node: + description: Node defines the name of the node + type: string + partition: + description: Partition defines the partition this resource belongs + to + type: string + platformType: + description: PlatformType define the type of platform implementing + the nodespec + type: string + position: + description: relative position in the rack + type: string + provider: + description: Provider defines the provider implementing this resource. + type: string + rack: + description: Rack defines the rack in which the node is deployed + type: string + region: + description: Region defines the region of the resource + type: string + site: + description: Site defines the site of the resource + type: string + required: + - node + - partition + - platformType + - provider + - region + - site + type: object + status: + description: NodeStatus defines the observed state of Node + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + systemID: + description: System ID define the unique system id of the node + type: string + type: object + type: object + served: true + storage: false + - name: v1alpha1 + schema: + openAPIV3Schema: + description: |- + A Node represents a fundamental unit that implements compute, storage, and/or networking within your environment. + Nodes can embody physical, virtual, or containerized entities, offering versatility in deployment options to suit + diverse infrastructure requirements. + Nodes are logically organized within racks and sites/regions, establishing a hierarchical structure for efficient + resource management and organization. Additionally, Nodes are associated with nodeGroups, facilitating centralized + management and control within defined administrative boundaries. + Each Node is assigned a provider, representing the entity responsible for implementing the specifics of the Node. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: NodeSpec defines the desired state of Node + properties: + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + location: + description: |- + Location defines the location information where this resource is located + in lon/lat coordinates + properties: + latitude: + type: string + longitude: + type: string + required: + - latitude + - longitude + type: object + node: + description: Node defines the name of the node + type: string + partition: + description: Partition defines the partition this resource belongs + to + type: string + platformType: + description: PlatformType define the type of platform implementing + the nodespec + type: string + position: + description: relative position in the rack + type: string + provider: + description: Provider defines the provider implementing this resource. + type: string + rack: + description: Rack defines the rack in which the node is deployed + type: string + region: + description: Region defines the region of the resource + type: string + site: + description: Site defines the site of the resource + type: string + required: + - node + - partition + - platformType + - provider + - region + - site + type: object + status: + description: NodeStatus defines the observed state of Node + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + systemID: + description: System ID define the unique system id of the node + type: string + type: object + type: object + served: true + storage: false diff --git a/crds/infra.kuid.dev_nodesets.yaml b/crds/infra.kuid.dev_nodesets.yaml new file mode 100644 index 0000000..2338d6b --- /dev/null +++ b/crds/infra.kuid.dev_nodesets.yaml @@ -0,0 +1,360 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: nodesets.infra.kuid.dev +spec: + group: infra.kuid.dev + names: + kind: NodeSet + listKind: NodeSetList + plural: nodesets + singular: nodeset + scope: Namespaced + versions: + - name: infra + schema: + openAPIV3Schema: + description: |- + A NodeSet represents a set of nodes. + E.g. it can be used to model a set of nodes in a NodeSet that share the same + charecteristics wrt, Numa, interfaces, etc. + Another usage of NodeSet is the representation of a virtual Node that consists of multiple nodes. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: NodeSetSetSpec defines the desired state of NodeSet + properties: + cluster: + description: Cluster defines the name of the cluster + type: string + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + nodeSet: + type: string + partition: + description: Partition defines the partition this resource belongs + to + type: string + region: + description: Region defines the region of the resource + type: string + selector: + description: Selector defines the selector criterias + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. + The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector applies + to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + site: + description: Site defines the site of the resource + type: string + required: + - cluster + - nodeSet + - partition + - region + - site + type: object + status: + description: NodeSetStatus defines the observed state of NodeSet + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: false + - name: v1alpha1 + schema: + openAPIV3Schema: + description: |- + A NodeSet represents a set of nodes. + E.g. it can be used to model a set of nodes in a NodeSet that share the same + charecteristics wrt, Numa, interfaces, etc. + Another usage of NodeSet is the representation of a virtual Node that consists of multiple nodes. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: NodeSetSetSpec defines the desired state of NodeSet + properties: + cluster: + description: Cluster defines the name of the cluster + type: string + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + nodeSet: + type: string + partition: + description: Partition defines the partition this resource belongs + to + type: string + region: + description: Region defines the region of the resource + type: string + selector: + description: Selector defines the selector criterias + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. + The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector applies + to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + site: + description: Site defines the site of the resource + type: string + required: + - cluster + - nodeSet + - partition + - region + - site + type: object + status: + description: NodeSetStatus defines the observed state of NodeSet + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: false diff --git a/crds/infra.kuid.dev_partitions.yaml b/crds/infra.kuid.dev_partitions.yaml new file mode 100644 index 0000000..dc40ea9 --- /dev/null +++ b/crds/infra.kuid.dev_partitions.yaml @@ -0,0 +1,216 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: partitions.infra.kuid.dev +spec: + group: infra.kuid.dev + names: + kind: Partition + listKind: PartitionList + plural: partitions + singular: partition + scope: Namespaced + versions: + - name: infra + schema: + openAPIV3Schema: + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: PartitionSpec defines the desired state of the partition + properties: + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + type: object + status: + description: PartitionStatus defines the observed state of Partition + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: false + - name: v1alpha1 + schema: + openAPIV3Schema: + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: PartitionSpec defines the desired state of the partition + properties: + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + type: object + status: + description: PartitionStatus defines the observed state of Partition + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: false diff --git a/crds/infra.kuid.dev_racks.yaml b/crds/infra.kuid.dev_racks.yaml new file mode 100644 index 0000000..8b383c5 --- /dev/null +++ b/crds/infra.kuid.dev_racks.yaml @@ -0,0 +1,280 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: racks.infra.kuid.dev +spec: + group: infra.kuid.dev + names: + kind: Rack + listKind: RackList + plural: racks + singular: rack + scope: Namespaced + versions: + - name: infra + schema: + openAPIV3Schema: + description: |- + A rack represents a physical equipment rack within your environment. Each rack is designed to accommodate + the installation of devices and equipment. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: RackSpec defines the desired state of Rack + properties: + height: + description: The height of the rack, measured in units. + type: string + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + location: + description: |- + Location defines the location information where this resource is located + in lon/lat coordinates + properties: + latitude: + type: string + longitude: + type: string + required: + - latitude + - longitude + type: object + region: + description: Region defines the region of the resource + type: string + site: + description: Site defines the site of the resource + type: string + width: + description: The canonical distance between the two vertical rails + on a face. In inch + type: string + required: + - region + - site + type: object + status: + description: RackStatus defines the observed state of Rack + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: false + - name: v1alpha1 + schema: + openAPIV3Schema: + description: |- + A rack represents a physical equipment rack within your environment. Each rack is designed to accommodate + the installation of devices and equipment. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: RackSpec defines the desired state of Rack + properties: + height: + description: The height of the rack, measured in units. + type: string + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + location: + description: |- + Location defines the location information where this resource is located + in lon/lat coordinates + properties: + latitude: + type: string + longitude: + type: string + required: + - latitude + - longitude + type: object + region: + description: Region defines the region of the resource + type: string + site: + description: Site defines the site of the resource + type: string + width: + description: The canonical distance between the two vertical rails + on a face. In inch + type: string + required: + - region + - site + type: object + status: + description: RackStatus defines the observed state of Rack + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: false diff --git a/crds/infra.kuid.dev_regions.yaml b/crds/infra.kuid.dev_regions.yaml new file mode 100644 index 0000000..0184747 --- /dev/null +++ b/crds/infra.kuid.dev_regions.yaml @@ -0,0 +1,222 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: regions.infra.kuid.dev +spec: + group: infra.kuid.dev + names: + kind: Region + listKind: RegionList + plural: regions + singular: region + scope: Namespaced + versions: + - name: infra + schema: + openAPIV3Schema: + description: |- + A Region represent a geography in which multiple infrastructure resources are grouped + A Region might represent a continent, country, city, campus, or other area depending on your environment. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: RegionSpec defines the desired state of Region + properties: + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + type: object + status: + description: RegionStatus defines the observed state of Region + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: false + - name: v1alpha1 + schema: + openAPIV3Schema: + description: |- + A region represent a geography in which multiple infrastructure resources are grouped + A region might represent a continent, country, city, campus, or other area depending on your environment. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: RegionSpec defines the desired state of Region + properties: + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + type: object + status: + description: RegionStatus defines the observed state of Region + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: false diff --git a/crds/infra.kuid.dev_sites.yaml b/crds/infra.kuid.dev_sites.yaml new file mode 100644 index 0000000..a6210f0 --- /dev/null +++ b/crds/infra.kuid.dev_sites.yaml @@ -0,0 +1,268 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: sites.infra.kuid.dev +spec: + group: infra.kuid.dev + names: + kind: Site + listKind: SiteList + plural: sites + singular: site + scope: Namespaced + versions: + - name: infra + schema: + openAPIV3Schema: + description: |- + A site serves as a fundamental organizational unit for managing infrastructure resources within your environment. + The utilization of sites may vary based on the organizational structure and requirements, + but in essence, each site typically corresponds to a distinct building or campus. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: SiteSpec defines the desired state of Site + properties: + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + location: + description: |- + Location defines the location information where this resource is located + in lon/lat coordinates + properties: + latitude: + type: string + longitude: + type: string + required: + - latitude + - longitude + type: object + region: + description: Region defines the region of the resource + type: string + site: + description: Site defines the site of the resource + type: string + required: + - region + - site + type: object + status: + description: SiteStatus defines the observed state of Site + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: false + - name: v1alpha1 + schema: + openAPIV3Schema: + description: |- + A site serves as a fundamental organizational unit for managing infrastructure resources within your environment. + The utilization of sites may vary based on the organizational structure and requirements, + but in essence, each site typically corresponds to a distinct building or campus. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: SiteSpec defines the desired state of Site + properties: + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + location: + description: |- + Location defines the location information where this resource is located + in lon/lat coordinates + properties: + latitude: + type: string + longitude: + type: string + required: + - latitude + - longitude + type: object + region: + description: Region defines the region of the resource + type: string + site: + description: Site defines the site of the resource + type: string + required: + - region + - site + type: object + status: + description: SiteStatus defines the observed state of Site + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: false diff --git a/main.go b/main.go index 622f74c..8742dc8 100644 --- a/main.go +++ b/main.go @@ -107,14 +107,14 @@ func main() { be := groupConfig.BackendFn() backends[group] = be for _, resource := range groupConfig.Resources { - storageProvider := resource.StorageProviderFn(ctx, be, kuidGroupConfig.Sync, registryOptions) + storageProvider := resource.StorageProviderFn(ctx, resource.Internal, be, kuidGroupConfig.Sync, registryOptions) for _, resourceVersion := range resource.ResourceVersions { apiserver.WithResourceAndHandler(resourceVersion, storageProvider) } } } else { for _, resource := range groupConfig.Resources { - storageProvider := resource.StorageProviderFn(ctx, nil, kuidGroupConfig.Sync, registryOptions) + storageProvider := resource.StorageProviderFn(ctx, resource.Internal, nil, kuidGroupConfig.Sync, registryOptions) for _, resourceVersion := range resource.ResourceVersions { apiserver.WithResourceAndHandler(resourceVersion, storageProvider) } diff --git a/pkg/backend/astest/as_claim_test.go b/pkg/backend/astest/as_claim_test.go index cf60a24..58e0e3c 100644 --- a/pkg/backend/astest/as_claim_test.go +++ b/pkg/backend/astest/as_claim_test.go @@ -74,15 +74,15 @@ func Test(t *testing.T) { BackendFn: register.NewBackend, ApplyStorageToBackendFn: register.ApplyStorageToBackend, Resources: []*config.ResourceConfig{ - {StorageProviderFn: register.NewIndexStorageProvider, ResourceVersions: []resource.Object{&as.ASIndex{}, &asbev1alpha1.ASIndex{}}}, - {StorageProviderFn: register.NewClaimStorageProvider, ResourceVersions: []resource.Object{&as.ASClaim{}, &asbev1alpha1.ASClaim{}}}, - {StorageProviderFn: register.NewEntryStorageProvider, ResourceVersions: []resource.Object{&as.ASEntry{}, &asbev1alpha1.ASEntry{}}}, + {StorageProviderFn: register.NewIndexStorageProvider, Internal: &as.ASIndex{},ResourceVersions: []resource.Object{&as.ASIndex{}, &asbev1alpha1.ASIndex{}}}, + {StorageProviderFn: register.NewClaimStorageProvider, Internal: &as.ASClaim{}, ResourceVersions: []resource.Object{&as.ASClaim{}, &asbev1alpha1.ASClaim{}}}, + {StorageProviderFn: register.NewStorageProvider, Internal: &as.ASEntry{}, ResourceVersions: []resource.Object{&as.ASEntry{}, &asbev1alpha1.ASEntry{}}}, }, } be := groupConfig.BackendFn() for _, resource := range groupConfig.Resources { - storageProvider := resource.StorageProviderFn(ctx, be, true, &options.Options{ + storageProvider := resource.StorageProviderFn(ctx,resource.Internal, be, true, &options.Options{ Type: options.StorageType_Memory, }) for _, resourceVersion := range resource.ResourceVersions { diff --git a/pkg/backend/astest/as_index_test.go b/pkg/backend/astest/as_index_test.go index ab61c90..bcacc23 100644 --- a/pkg/backend/astest/as_index_test.go +++ b/pkg/backend/astest/as_index_test.go @@ -39,15 +39,15 @@ func TestIndex(t *testing.T) { BackendFn: register.NewBackend, ApplyStorageToBackendFn: register.ApplyStorageToBackend, Resources: []*config.ResourceConfig{ - {StorageProviderFn: register.NewIndexStorageProvider, ResourceVersions: []resource.Object{&as.ASIndex{}, &asbev1alpha1.ASIndex{}}}, - {StorageProviderFn: register.NewClaimStorageProvider, ResourceVersions: []resource.Object{&as.ASClaim{}, &asbev1alpha1.ASClaim{}}}, - {StorageProviderFn: register.NewEntryStorageProvider, ResourceVersions: []resource.Object{&as.ASEntry{}, &asbev1alpha1.ASEntry{}}}, + {StorageProviderFn: register.NewIndexStorageProvider, Internal: &as.ASIndex{},ResourceVersions: []resource.Object{&as.ASIndex{}, &asbev1alpha1.ASIndex{}}}, + {StorageProviderFn: register.NewClaimStorageProvider, Internal: &as.ASClaim{}, ResourceVersions: []resource.Object{&as.ASClaim{}, &asbev1alpha1.ASClaim{}}}, + {StorageProviderFn: register.NewStorageProvider, Internal: &as.ASEntry{}, ResourceVersions: []resource.Object{&as.ASEntry{}, &asbev1alpha1.ASEntry{}}}, }, } be := groupConfig.BackendFn() for _, resource := range groupConfig.Resources { - storageProvider := resource.StorageProviderFn(ctx, be, true, &options.Options{ + storageProvider := resource.StorageProviderFn(ctx,resource.Internal, be, true, &options.Options{ Type: options.StorageType_Memory, }) for _, resourceVersion := range resource.ResourceVersions { diff --git a/pkg/config/config.go b/pkg/config/config.go index e318ff0..e6a6147 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -71,6 +71,7 @@ func getDefaultConfig() *KuidConfig { Storage: StorageType_Badgerdb, Groups: []*KuidGroupConfig{ {Group: "as.be.kuid.dev", Enabled: true, Sync: true}, + {Group: "infra.kuid.dev", Enabled: true, Sync: true}, }, } } diff --git a/pkg/config/resource.go b/pkg/config/resource.go index 166790c..a558e31 100644 --- a/pkg/config/resource.go +++ b/pkg/config/resource.go @@ -31,7 +31,7 @@ var Groups = map[string]*GroupConfig{} type BackendFn func() bebackend.Backend -type StorageProviderFn func(ctx context.Context, be bebackend.Backend, sync bool, options *options.Options) *rest.StorageProvider +type StorageProviderFn func(ctx context.Context, obj resource.InternalObject, be bebackend.Backend, sync bool, options *options.Options) *rest.StorageProvider type ApplyStorageToBackendFn func(ctx context.Context, be bebackend.Backend, apiServer *builder.Server) error @@ -44,6 +44,7 @@ type GroupConfig struct { type ResourceConfig struct { StorageProviderFn StorageProviderFn + Internal resource.InternalObject ResourceVersions []resource.Object } diff --git a/pkg/generated/clientset/versioned/clientset.go b/pkg/generated/clientset/versioned/clientset.go index 00f3198..7f19a4e 100644 --- a/pkg/generated/clientset/versioned/clientset.go +++ b/pkg/generated/clientset/versioned/clientset.go @@ -22,6 +22,7 @@ import ( "net/http" asv1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/as/v1alpha1" + infrav1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/infra/v1alpha1" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" @@ -30,12 +31,14 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface AsV1alpha1() asv1alpha1.AsV1alpha1Interface + InfraV1alpha1() infrav1alpha1.InfraV1alpha1Interface } // Clientset contains the clients for groups. type Clientset struct { *discovery.DiscoveryClient - asV1alpha1 *asv1alpha1.AsV1alpha1Client + asV1alpha1 *asv1alpha1.AsV1alpha1Client + infraV1alpha1 *infrav1alpha1.InfraV1alpha1Client } // AsV1alpha1 retrieves the AsV1alpha1Client @@ -43,6 +46,11 @@ func (c *Clientset) AsV1alpha1() asv1alpha1.AsV1alpha1Interface { return c.asV1alpha1 } +// InfraV1alpha1 retrieves the InfraV1alpha1Client +func (c *Clientset) InfraV1alpha1() infrav1alpha1.InfraV1alpha1Interface { + return c.infraV1alpha1 +} + // Discovery retrieves the DiscoveryClient func (c *Clientset) Discovery() discovery.DiscoveryInterface { if c == nil { @@ -91,6 +99,10 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, if err != nil { return nil, err } + cs.infraV1alpha1, err = infrav1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient) if err != nil { @@ -113,6 +125,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { func New(c rest.Interface) *Clientset { var cs Clientset cs.asV1alpha1 = asv1alpha1.New(c) + cs.infraV1alpha1 = infrav1alpha1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/pkg/generated/clientset/versioned/fake/clientset_generated.go b/pkg/generated/clientset/versioned/fake/clientset_generated.go index ab82456..50510d2 100644 --- a/pkg/generated/clientset/versioned/fake/clientset_generated.go +++ b/pkg/generated/clientset/versioned/fake/clientset_generated.go @@ -21,6 +21,8 @@ import ( clientset "github.com/kuidio/kuid/pkg/generated/clientset/versioned" asv1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/as/v1alpha1" fakeasv1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/as/v1alpha1/fake" + infrav1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/infra/v1alpha1" + fakeinfrav1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" @@ -86,3 +88,8 @@ var ( func (c *Clientset) AsV1alpha1() asv1alpha1.AsV1alpha1Interface { return &fakeasv1alpha1.FakeAsV1alpha1{Fake: &c.Fake} } + +// InfraV1alpha1 retrieves the InfraV1alpha1Client +func (c *Clientset) InfraV1alpha1() infrav1alpha1.InfraV1alpha1Interface { + return &fakeinfrav1alpha1.FakeInfraV1alpha1{Fake: &c.Fake} +} diff --git a/pkg/generated/clientset/versioned/fake/register.go b/pkg/generated/clientset/versioned/fake/register.go index aa7bf38..c161830 100644 --- a/pkg/generated/clientset/versioned/fake/register.go +++ b/pkg/generated/clientset/versioned/fake/register.go @@ -19,6 +19,7 @@ package fake import ( asv1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" + infrav1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -31,6 +32,7 @@ var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ asv1alpha1.AddToScheme, + infrav1alpha1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/generated/clientset/versioned/scheme/register.go b/pkg/generated/clientset/versioned/scheme/register.go index 0f006dc..715351c 100644 --- a/pkg/generated/clientset/versioned/scheme/register.go +++ b/pkg/generated/clientset/versioned/scheme/register.go @@ -19,6 +19,7 @@ package scheme import ( asv1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" + infrav1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -31,6 +32,7 @@ var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ asv1alpha1.AddToScheme, + infrav1alpha1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/cluster.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/cluster.go new file mode 100644 index 0000000..f7aa647 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/cluster.go @@ -0,0 +1,68 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + scheme "github.com/kuidio/kuid/pkg/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// ClustersGetter has a method to return a ClusterInterface. +// A group's client should implement this interface. +type ClustersGetter interface { + Clusters(namespace string) ClusterInterface +} + +// ClusterInterface has methods to work with Cluster resources. +type ClusterInterface interface { + Create(ctx context.Context, cluster *v1alpha1.Cluster, opts v1.CreateOptions) (*v1alpha1.Cluster, error) + Update(ctx context.Context, cluster *v1alpha1.Cluster, opts v1.UpdateOptions) (*v1alpha1.Cluster, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, cluster *v1alpha1.Cluster, opts v1.UpdateOptions) (*v1alpha1.Cluster, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.Cluster, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ClusterList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Cluster, err error) + ClusterExpansion +} + +// clusters implements ClusterInterface +type clusters struct { + *gentype.ClientWithList[*v1alpha1.Cluster, *v1alpha1.ClusterList] +} + +// newClusters returns a Clusters +func newClusters(c *InfraV1alpha1Client, namespace string) *clusters { + return &clusters{ + gentype.NewClientWithList[*v1alpha1.Cluster, *v1alpha1.ClusterList]( + "clusters", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.Cluster { return &v1alpha1.Cluster{} }, + func() *v1alpha1.ClusterList { return &v1alpha1.ClusterList{} }), + } +} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/doc.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/doc.go new file mode 100644 index 0000000..cda7d5a --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/endpoint.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/endpoint.go new file mode 100644 index 0000000..0e38e9b --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/endpoint.go @@ -0,0 +1,68 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + scheme "github.com/kuidio/kuid/pkg/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// EndpointsGetter has a method to return a EndpointInterface. +// A group's client should implement this interface. +type EndpointsGetter interface { + Endpoints(namespace string) EndpointInterface +} + +// EndpointInterface has methods to work with Endpoint resources. +type EndpointInterface interface { + Create(ctx context.Context, endpoint *v1alpha1.Endpoint, opts v1.CreateOptions) (*v1alpha1.Endpoint, error) + Update(ctx context.Context, endpoint *v1alpha1.Endpoint, opts v1.UpdateOptions) (*v1alpha1.Endpoint, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, endpoint *v1alpha1.Endpoint, opts v1.UpdateOptions) (*v1alpha1.Endpoint, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.Endpoint, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.EndpointList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Endpoint, err error) + EndpointExpansion +} + +// endpoints implements EndpointInterface +type endpoints struct { + *gentype.ClientWithList[*v1alpha1.Endpoint, *v1alpha1.EndpointList] +} + +// newEndpoints returns a Endpoints +func newEndpoints(c *InfraV1alpha1Client, namespace string) *endpoints { + return &endpoints{ + gentype.NewClientWithList[*v1alpha1.Endpoint, *v1alpha1.EndpointList]( + "endpoints", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.Endpoint { return &v1alpha1.Endpoint{} }, + func() *v1alpha1.EndpointList { return &v1alpha1.EndpointList{} }), + } +} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/endpointset.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/endpointset.go new file mode 100644 index 0000000..cf41c90 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/endpointset.go @@ -0,0 +1,68 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + scheme "github.com/kuidio/kuid/pkg/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// EndpointSetsGetter has a method to return a EndpointSetInterface. +// A group's client should implement this interface. +type EndpointSetsGetter interface { + EndpointSets(namespace string) EndpointSetInterface +} + +// EndpointSetInterface has methods to work with EndpointSet resources. +type EndpointSetInterface interface { + Create(ctx context.Context, endpointSet *v1alpha1.EndpointSet, opts v1.CreateOptions) (*v1alpha1.EndpointSet, error) + Update(ctx context.Context, endpointSet *v1alpha1.EndpointSet, opts v1.UpdateOptions) (*v1alpha1.EndpointSet, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, endpointSet *v1alpha1.EndpointSet, opts v1.UpdateOptions) (*v1alpha1.EndpointSet, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.EndpointSet, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.EndpointSetList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.EndpointSet, err error) + EndpointSetExpansion +} + +// endpointSets implements EndpointSetInterface +type endpointSets struct { + *gentype.ClientWithList[*v1alpha1.EndpointSet, *v1alpha1.EndpointSetList] +} + +// newEndpointSets returns a EndpointSets +func newEndpointSets(c *InfraV1alpha1Client, namespace string) *endpointSets { + return &endpointSets{ + gentype.NewClientWithList[*v1alpha1.EndpointSet, *v1alpha1.EndpointSetList]( + "endpointsets", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.EndpointSet { return &v1alpha1.EndpointSet{} }, + func() *v1alpha1.EndpointSetList { return &v1alpha1.EndpointSetList{} }), + } +} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/doc.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/doc.go new file mode 100644 index 0000000..d4601f1 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2024 Nokia. + +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/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_cluster.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_cluster.go new file mode 100644 index 0000000..1b79174 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_cluster.go @@ -0,0 +1,146 @@ +/* +Copyright 2024 Nokia. + +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" + + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + v1 "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" +) + +// FakeClusters implements ClusterInterface +type FakeClusters struct { + Fake *FakeInfraV1alpha1 + ns string +} + +var clustersResource = v1alpha1.SchemeGroupVersion.WithResource("clusters") + +var clustersKind = v1alpha1.SchemeGroupVersion.WithKind("Cluster") + +// Get takes name of the cluster, and returns the corresponding cluster object, and an error if there is any. +func (c *FakeClusters) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Cluster, err error) { + emptyResult := &v1alpha1.Cluster{} + obj, err := c.Fake. + Invokes(testing.NewGetActionWithOptions(clustersResource, c.ns, name, options), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Cluster), err +} + +// List takes label and field selectors, and returns the list of Clusters that match those selectors. +func (c *FakeClusters) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterList, err error) { + emptyResult := &v1alpha1.ClusterList{} + obj, err := c.Fake. + Invokes(testing.NewListActionWithOptions(clustersResource, clustersKind, c.ns, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.ClusterList{ListMeta: obj.(*v1alpha1.ClusterList).ListMeta} + for _, item := range obj.(*v1alpha1.ClusterList).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 clusters. +func (c *FakeClusters) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchActionWithOptions(clustersResource, c.ns, opts)) + +} + +// Create takes the representation of a cluster and creates it. Returns the server's representation of the cluster, and an error, if there is any. +func (c *FakeClusters) Create(ctx context.Context, cluster *v1alpha1.Cluster, opts v1.CreateOptions) (result *v1alpha1.Cluster, err error) { + emptyResult := &v1alpha1.Cluster{} + obj, err := c.Fake. + Invokes(testing.NewCreateActionWithOptions(clustersResource, c.ns, cluster, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Cluster), err +} + +// Update takes the representation of a cluster and updates it. Returns the server's representation of the cluster, and an error, if there is any. +func (c *FakeClusters) Update(ctx context.Context, cluster *v1alpha1.Cluster, opts v1.UpdateOptions) (result *v1alpha1.Cluster, err error) { + emptyResult := &v1alpha1.Cluster{} + obj, err := c.Fake. + Invokes(testing.NewUpdateActionWithOptions(clustersResource, c.ns, cluster, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Cluster), 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 *FakeClusters) UpdateStatus(ctx context.Context, cluster *v1alpha1.Cluster, opts v1.UpdateOptions) (result *v1alpha1.Cluster, err error) { + emptyResult := &v1alpha1.Cluster{} + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceActionWithOptions(clustersResource, "status", c.ns, cluster, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Cluster), err +} + +// Delete takes name of the cluster and deletes it. Returns an error if one occurs. +func (c *FakeClusters) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(clustersResource, c.ns, name, opts), &v1alpha1.Cluster{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeClusters) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(clustersResource, c.ns, opts, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.ClusterList{}) + return err +} + +// Patch applies the patch and returns the patched cluster. +func (c *FakeClusters) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Cluster, err error) { + emptyResult := &v1alpha1.Cluster{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(clustersResource, c.ns, name, pt, data, opts, subresources...), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Cluster), err +} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_endpoint.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_endpoint.go new file mode 100644 index 0000000..e5840a3 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_endpoint.go @@ -0,0 +1,146 @@ +/* +Copyright 2024 Nokia. + +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" + + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + v1 "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" +) + +// FakeEndpoints implements EndpointInterface +type FakeEndpoints struct { + Fake *FakeInfraV1alpha1 + ns string +} + +var endpointsResource = v1alpha1.SchemeGroupVersion.WithResource("endpoints") + +var endpointsKind = v1alpha1.SchemeGroupVersion.WithKind("Endpoint") + +// Get takes name of the endpoint, and returns the corresponding endpoint object, and an error if there is any. +func (c *FakeEndpoints) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Endpoint, err error) { + emptyResult := &v1alpha1.Endpoint{} + obj, err := c.Fake. + Invokes(testing.NewGetActionWithOptions(endpointsResource, c.ns, name, options), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Endpoint), err +} + +// List takes label and field selectors, and returns the list of Endpoints that match those selectors. +func (c *FakeEndpoints) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.EndpointList, err error) { + emptyResult := &v1alpha1.EndpointList{} + obj, err := c.Fake. + Invokes(testing.NewListActionWithOptions(endpointsResource, endpointsKind, c.ns, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.EndpointList{ListMeta: obj.(*v1alpha1.EndpointList).ListMeta} + for _, item := range obj.(*v1alpha1.EndpointList).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 endpoints. +func (c *FakeEndpoints) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchActionWithOptions(endpointsResource, c.ns, opts)) + +} + +// Create takes the representation of a endpoint and creates it. Returns the server's representation of the endpoint, and an error, if there is any. +func (c *FakeEndpoints) Create(ctx context.Context, endpoint *v1alpha1.Endpoint, opts v1.CreateOptions) (result *v1alpha1.Endpoint, err error) { + emptyResult := &v1alpha1.Endpoint{} + obj, err := c.Fake. + Invokes(testing.NewCreateActionWithOptions(endpointsResource, c.ns, endpoint, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Endpoint), err +} + +// Update takes the representation of a endpoint and updates it. Returns the server's representation of the endpoint, and an error, if there is any. +func (c *FakeEndpoints) Update(ctx context.Context, endpoint *v1alpha1.Endpoint, opts v1.UpdateOptions) (result *v1alpha1.Endpoint, err error) { + emptyResult := &v1alpha1.Endpoint{} + obj, err := c.Fake. + Invokes(testing.NewUpdateActionWithOptions(endpointsResource, c.ns, endpoint, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Endpoint), 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 *FakeEndpoints) UpdateStatus(ctx context.Context, endpoint *v1alpha1.Endpoint, opts v1.UpdateOptions) (result *v1alpha1.Endpoint, err error) { + emptyResult := &v1alpha1.Endpoint{} + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceActionWithOptions(endpointsResource, "status", c.ns, endpoint, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Endpoint), err +} + +// Delete takes name of the endpoint and deletes it. Returns an error if one occurs. +func (c *FakeEndpoints) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(endpointsResource, c.ns, name, opts), &v1alpha1.Endpoint{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeEndpoints) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(endpointsResource, c.ns, opts, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.EndpointList{}) + return err +} + +// Patch applies the patch and returns the patched endpoint. +func (c *FakeEndpoints) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Endpoint, err error) { + emptyResult := &v1alpha1.Endpoint{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(endpointsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Endpoint), err +} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_endpointset.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_endpointset.go new file mode 100644 index 0000000..4422dcd --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_endpointset.go @@ -0,0 +1,146 @@ +/* +Copyright 2024 Nokia. + +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" + + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + v1 "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" +) + +// FakeEndpointSets implements EndpointSetInterface +type FakeEndpointSets struct { + Fake *FakeInfraV1alpha1 + ns string +} + +var endpointsetsResource = v1alpha1.SchemeGroupVersion.WithResource("endpointsets") + +var endpointsetsKind = v1alpha1.SchemeGroupVersion.WithKind("EndpointSet") + +// Get takes name of the endpointSet, and returns the corresponding endpointSet object, and an error if there is any. +func (c *FakeEndpointSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.EndpointSet, err error) { + emptyResult := &v1alpha1.EndpointSet{} + obj, err := c.Fake. + Invokes(testing.NewGetActionWithOptions(endpointsetsResource, c.ns, name, options), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.EndpointSet), err +} + +// List takes label and field selectors, and returns the list of EndpointSets that match those selectors. +func (c *FakeEndpointSets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.EndpointSetList, err error) { + emptyResult := &v1alpha1.EndpointSetList{} + obj, err := c.Fake. + Invokes(testing.NewListActionWithOptions(endpointsetsResource, endpointsetsKind, c.ns, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.EndpointSetList{ListMeta: obj.(*v1alpha1.EndpointSetList).ListMeta} + for _, item := range obj.(*v1alpha1.EndpointSetList).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 endpointSets. +func (c *FakeEndpointSets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchActionWithOptions(endpointsetsResource, c.ns, opts)) + +} + +// Create takes the representation of a endpointSet and creates it. Returns the server's representation of the endpointSet, and an error, if there is any. +func (c *FakeEndpointSets) Create(ctx context.Context, endpointSet *v1alpha1.EndpointSet, opts v1.CreateOptions) (result *v1alpha1.EndpointSet, err error) { + emptyResult := &v1alpha1.EndpointSet{} + obj, err := c.Fake. + Invokes(testing.NewCreateActionWithOptions(endpointsetsResource, c.ns, endpointSet, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.EndpointSet), err +} + +// Update takes the representation of a endpointSet and updates it. Returns the server's representation of the endpointSet, and an error, if there is any. +func (c *FakeEndpointSets) Update(ctx context.Context, endpointSet *v1alpha1.EndpointSet, opts v1.UpdateOptions) (result *v1alpha1.EndpointSet, err error) { + emptyResult := &v1alpha1.EndpointSet{} + obj, err := c.Fake. + Invokes(testing.NewUpdateActionWithOptions(endpointsetsResource, c.ns, endpointSet, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.EndpointSet), 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 *FakeEndpointSets) UpdateStatus(ctx context.Context, endpointSet *v1alpha1.EndpointSet, opts v1.UpdateOptions) (result *v1alpha1.EndpointSet, err error) { + emptyResult := &v1alpha1.EndpointSet{} + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceActionWithOptions(endpointsetsResource, "status", c.ns, endpointSet, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.EndpointSet), err +} + +// Delete takes name of the endpointSet and deletes it. Returns an error if one occurs. +func (c *FakeEndpointSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(endpointsetsResource, c.ns, name, opts), &v1alpha1.EndpointSet{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeEndpointSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(endpointsetsResource, c.ns, opts, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.EndpointSetList{}) + return err +} + +// Patch applies the patch and returns the patched endpointSet. +func (c *FakeEndpointSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.EndpointSet, err error) { + emptyResult := &v1alpha1.EndpointSet{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(endpointsetsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.EndpointSet), err +} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_infra_client.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_infra_client.go new file mode 100644 index 0000000..017a018 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_infra_client.go @@ -0,0 +1,91 @@ +/* +Copyright 2024 Nokia. + +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 ( + v1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/infra/v1alpha1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeInfraV1alpha1 struct { + *testing.Fake +} + +func (c *FakeInfraV1alpha1) Clusters(namespace string) v1alpha1.ClusterInterface { + return &FakeClusters{c, namespace} +} + +func (c *FakeInfraV1alpha1) Endpoints(namespace string) v1alpha1.EndpointInterface { + return &FakeEndpoints{c, namespace} +} + +func (c *FakeInfraV1alpha1) EndpointSets(namespace string) v1alpha1.EndpointSetInterface { + return &FakeEndpointSets{c, namespace} +} + +func (c *FakeInfraV1alpha1) Links(namespace string) v1alpha1.LinkInterface { + return &FakeLinks{c, namespace} +} + +func (c *FakeInfraV1alpha1) LinkSets(namespace string) v1alpha1.LinkSetInterface { + return &FakeLinkSets{c, namespace} +} + +func (c *FakeInfraV1alpha1) Modules(namespace string) v1alpha1.ModuleInterface { + return &FakeModules{c, namespace} +} + +func (c *FakeInfraV1alpha1) ModuleBays(namespace string) v1alpha1.ModuleBayInterface { + return &FakeModuleBays{c, namespace} +} + +func (c *FakeInfraV1alpha1) Nodes(namespace string) v1alpha1.NodeInterface { + return &FakeNodes{c, namespace} +} + +func (c *FakeInfraV1alpha1) NodeItems(namespace string) v1alpha1.NodeItemInterface { + return &FakeNodeItems{c, namespace} +} + +func (c *FakeInfraV1alpha1) NodeSets(namespace string) v1alpha1.NodeSetInterface { + return &FakeNodeSets{c, namespace} +} + +func (c *FakeInfraV1alpha1) Partitions(namespace string) v1alpha1.PartitionInterface { + return &FakePartitions{c, namespace} +} + +func (c *FakeInfraV1alpha1) Racks(namespace string) v1alpha1.RackInterface { + return &FakeRacks{c, namespace} +} + +func (c *FakeInfraV1alpha1) Regions(namespace string) v1alpha1.RegionInterface { + return &FakeRegions{c, namespace} +} + +func (c *FakeInfraV1alpha1) Sites(namespace string) v1alpha1.SiteInterface { + return &FakeSites{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeInfraV1alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_link.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_link.go new file mode 100644 index 0000000..015487c --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_link.go @@ -0,0 +1,146 @@ +/* +Copyright 2024 Nokia. + +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" + + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + v1 "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" +) + +// FakeLinks implements LinkInterface +type FakeLinks struct { + Fake *FakeInfraV1alpha1 + ns string +} + +var linksResource = v1alpha1.SchemeGroupVersion.WithResource("links") + +var linksKind = v1alpha1.SchemeGroupVersion.WithKind("Link") + +// Get takes name of the link, and returns the corresponding link object, and an error if there is any. +func (c *FakeLinks) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Link, err error) { + emptyResult := &v1alpha1.Link{} + obj, err := c.Fake. + Invokes(testing.NewGetActionWithOptions(linksResource, c.ns, name, options), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Link), err +} + +// List takes label and field selectors, and returns the list of Links that match those selectors. +func (c *FakeLinks) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.LinkList, err error) { + emptyResult := &v1alpha1.LinkList{} + obj, err := c.Fake. + Invokes(testing.NewListActionWithOptions(linksResource, linksKind, c.ns, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.LinkList{ListMeta: obj.(*v1alpha1.LinkList).ListMeta} + for _, item := range obj.(*v1alpha1.LinkList).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 links. +func (c *FakeLinks) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchActionWithOptions(linksResource, c.ns, opts)) + +} + +// Create takes the representation of a link and creates it. Returns the server's representation of the link, and an error, if there is any. +func (c *FakeLinks) Create(ctx context.Context, link *v1alpha1.Link, opts v1.CreateOptions) (result *v1alpha1.Link, err error) { + emptyResult := &v1alpha1.Link{} + obj, err := c.Fake. + Invokes(testing.NewCreateActionWithOptions(linksResource, c.ns, link, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Link), err +} + +// Update takes the representation of a link and updates it. Returns the server's representation of the link, and an error, if there is any. +func (c *FakeLinks) Update(ctx context.Context, link *v1alpha1.Link, opts v1.UpdateOptions) (result *v1alpha1.Link, err error) { + emptyResult := &v1alpha1.Link{} + obj, err := c.Fake. + Invokes(testing.NewUpdateActionWithOptions(linksResource, c.ns, link, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Link), 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 *FakeLinks) UpdateStatus(ctx context.Context, link *v1alpha1.Link, opts v1.UpdateOptions) (result *v1alpha1.Link, err error) { + emptyResult := &v1alpha1.Link{} + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceActionWithOptions(linksResource, "status", c.ns, link, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Link), err +} + +// Delete takes name of the link and deletes it. Returns an error if one occurs. +func (c *FakeLinks) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(linksResource, c.ns, name, opts), &v1alpha1.Link{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeLinks) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(linksResource, c.ns, opts, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.LinkList{}) + return err +} + +// Patch applies the patch and returns the patched link. +func (c *FakeLinks) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Link, err error) { + emptyResult := &v1alpha1.Link{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(linksResource, c.ns, name, pt, data, opts, subresources...), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Link), err +} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_linkset.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_linkset.go new file mode 100644 index 0000000..7c24dc0 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_linkset.go @@ -0,0 +1,146 @@ +/* +Copyright 2024 Nokia. + +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" + + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + v1 "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" +) + +// FakeLinkSets implements LinkSetInterface +type FakeLinkSets struct { + Fake *FakeInfraV1alpha1 + ns string +} + +var linksetsResource = v1alpha1.SchemeGroupVersion.WithResource("linksets") + +var linksetsKind = v1alpha1.SchemeGroupVersion.WithKind("LinkSet") + +// Get takes name of the linkSet, and returns the corresponding linkSet object, and an error if there is any. +func (c *FakeLinkSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.LinkSet, err error) { + emptyResult := &v1alpha1.LinkSet{} + obj, err := c.Fake. + Invokes(testing.NewGetActionWithOptions(linksetsResource, c.ns, name, options), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.LinkSet), err +} + +// List takes label and field selectors, and returns the list of LinkSets that match those selectors. +func (c *FakeLinkSets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.LinkSetList, err error) { + emptyResult := &v1alpha1.LinkSetList{} + obj, err := c.Fake. + Invokes(testing.NewListActionWithOptions(linksetsResource, linksetsKind, c.ns, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.LinkSetList{ListMeta: obj.(*v1alpha1.LinkSetList).ListMeta} + for _, item := range obj.(*v1alpha1.LinkSetList).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 linkSets. +func (c *FakeLinkSets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchActionWithOptions(linksetsResource, c.ns, opts)) + +} + +// Create takes the representation of a linkSet and creates it. Returns the server's representation of the linkSet, and an error, if there is any. +func (c *FakeLinkSets) Create(ctx context.Context, linkSet *v1alpha1.LinkSet, opts v1.CreateOptions) (result *v1alpha1.LinkSet, err error) { + emptyResult := &v1alpha1.LinkSet{} + obj, err := c.Fake. + Invokes(testing.NewCreateActionWithOptions(linksetsResource, c.ns, linkSet, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.LinkSet), err +} + +// Update takes the representation of a linkSet and updates it. Returns the server's representation of the linkSet, and an error, if there is any. +func (c *FakeLinkSets) Update(ctx context.Context, linkSet *v1alpha1.LinkSet, opts v1.UpdateOptions) (result *v1alpha1.LinkSet, err error) { + emptyResult := &v1alpha1.LinkSet{} + obj, err := c.Fake. + Invokes(testing.NewUpdateActionWithOptions(linksetsResource, c.ns, linkSet, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.LinkSet), 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 *FakeLinkSets) UpdateStatus(ctx context.Context, linkSet *v1alpha1.LinkSet, opts v1.UpdateOptions) (result *v1alpha1.LinkSet, err error) { + emptyResult := &v1alpha1.LinkSet{} + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceActionWithOptions(linksetsResource, "status", c.ns, linkSet, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.LinkSet), err +} + +// Delete takes name of the linkSet and deletes it. Returns an error if one occurs. +func (c *FakeLinkSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(linksetsResource, c.ns, name, opts), &v1alpha1.LinkSet{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeLinkSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(linksetsResource, c.ns, opts, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.LinkSetList{}) + return err +} + +// Patch applies the patch and returns the patched linkSet. +func (c *FakeLinkSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.LinkSet, err error) { + emptyResult := &v1alpha1.LinkSet{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(linksetsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.LinkSet), err +} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_module.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_module.go new file mode 100644 index 0000000..4b22e54 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_module.go @@ -0,0 +1,146 @@ +/* +Copyright 2024 Nokia. + +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" + + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + v1 "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" +) + +// FakeModules implements ModuleInterface +type FakeModules struct { + Fake *FakeInfraV1alpha1 + ns string +} + +var modulesResource = v1alpha1.SchemeGroupVersion.WithResource("modules") + +var modulesKind = v1alpha1.SchemeGroupVersion.WithKind("Module") + +// Get takes name of the module, and returns the corresponding module object, and an error if there is any. +func (c *FakeModules) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Module, err error) { + emptyResult := &v1alpha1.Module{} + obj, err := c.Fake. + Invokes(testing.NewGetActionWithOptions(modulesResource, c.ns, name, options), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Module), err +} + +// List takes label and field selectors, and returns the list of Modules that match those selectors. +func (c *FakeModules) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ModuleList, err error) { + emptyResult := &v1alpha1.ModuleList{} + obj, err := c.Fake. + Invokes(testing.NewListActionWithOptions(modulesResource, modulesKind, c.ns, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.ModuleList{ListMeta: obj.(*v1alpha1.ModuleList).ListMeta} + for _, item := range obj.(*v1alpha1.ModuleList).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 modules. +func (c *FakeModules) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchActionWithOptions(modulesResource, c.ns, opts)) + +} + +// Create takes the representation of a module and creates it. Returns the server's representation of the module, and an error, if there is any. +func (c *FakeModules) Create(ctx context.Context, module *v1alpha1.Module, opts v1.CreateOptions) (result *v1alpha1.Module, err error) { + emptyResult := &v1alpha1.Module{} + obj, err := c.Fake. + Invokes(testing.NewCreateActionWithOptions(modulesResource, c.ns, module, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Module), err +} + +// Update takes the representation of a module and updates it. Returns the server's representation of the module, and an error, if there is any. +func (c *FakeModules) Update(ctx context.Context, module *v1alpha1.Module, opts v1.UpdateOptions) (result *v1alpha1.Module, err error) { + emptyResult := &v1alpha1.Module{} + obj, err := c.Fake. + Invokes(testing.NewUpdateActionWithOptions(modulesResource, c.ns, module, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Module), 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 *FakeModules) UpdateStatus(ctx context.Context, module *v1alpha1.Module, opts v1.UpdateOptions) (result *v1alpha1.Module, err error) { + emptyResult := &v1alpha1.Module{} + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceActionWithOptions(modulesResource, "status", c.ns, module, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Module), err +} + +// Delete takes name of the module and deletes it. Returns an error if one occurs. +func (c *FakeModules) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(modulesResource, c.ns, name, opts), &v1alpha1.Module{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeModules) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(modulesResource, c.ns, opts, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.ModuleList{}) + return err +} + +// Patch applies the patch and returns the patched module. +func (c *FakeModules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Module, err error) { + emptyResult := &v1alpha1.Module{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(modulesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Module), err +} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_modulebay.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_modulebay.go new file mode 100644 index 0000000..146dedd --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_modulebay.go @@ -0,0 +1,146 @@ +/* +Copyright 2024 Nokia. + +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" + + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + v1 "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" +) + +// FakeModuleBays implements ModuleBayInterface +type FakeModuleBays struct { + Fake *FakeInfraV1alpha1 + ns string +} + +var modulebaysResource = v1alpha1.SchemeGroupVersion.WithResource("modulebays") + +var modulebaysKind = v1alpha1.SchemeGroupVersion.WithKind("ModuleBay") + +// Get takes name of the moduleBay, and returns the corresponding moduleBay object, and an error if there is any. +func (c *FakeModuleBays) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ModuleBay, err error) { + emptyResult := &v1alpha1.ModuleBay{} + obj, err := c.Fake. + Invokes(testing.NewGetActionWithOptions(modulebaysResource, c.ns, name, options), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.ModuleBay), err +} + +// List takes label and field selectors, and returns the list of ModuleBays that match those selectors. +func (c *FakeModuleBays) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ModuleBayList, err error) { + emptyResult := &v1alpha1.ModuleBayList{} + obj, err := c.Fake. + Invokes(testing.NewListActionWithOptions(modulebaysResource, modulebaysKind, c.ns, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.ModuleBayList{ListMeta: obj.(*v1alpha1.ModuleBayList).ListMeta} + for _, item := range obj.(*v1alpha1.ModuleBayList).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 moduleBays. +func (c *FakeModuleBays) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchActionWithOptions(modulebaysResource, c.ns, opts)) + +} + +// Create takes the representation of a moduleBay and creates it. Returns the server's representation of the moduleBay, and an error, if there is any. +func (c *FakeModuleBays) Create(ctx context.Context, moduleBay *v1alpha1.ModuleBay, opts v1.CreateOptions) (result *v1alpha1.ModuleBay, err error) { + emptyResult := &v1alpha1.ModuleBay{} + obj, err := c.Fake. + Invokes(testing.NewCreateActionWithOptions(modulebaysResource, c.ns, moduleBay, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.ModuleBay), err +} + +// Update takes the representation of a moduleBay and updates it. Returns the server's representation of the moduleBay, and an error, if there is any. +func (c *FakeModuleBays) Update(ctx context.Context, moduleBay *v1alpha1.ModuleBay, opts v1.UpdateOptions) (result *v1alpha1.ModuleBay, err error) { + emptyResult := &v1alpha1.ModuleBay{} + obj, err := c.Fake. + Invokes(testing.NewUpdateActionWithOptions(modulebaysResource, c.ns, moduleBay, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.ModuleBay), 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 *FakeModuleBays) UpdateStatus(ctx context.Context, moduleBay *v1alpha1.ModuleBay, opts v1.UpdateOptions) (result *v1alpha1.ModuleBay, err error) { + emptyResult := &v1alpha1.ModuleBay{} + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceActionWithOptions(modulebaysResource, "status", c.ns, moduleBay, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.ModuleBay), err +} + +// Delete takes name of the moduleBay and deletes it. Returns an error if one occurs. +func (c *FakeModuleBays) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(modulebaysResource, c.ns, name, opts), &v1alpha1.ModuleBay{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeModuleBays) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(modulebaysResource, c.ns, opts, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.ModuleBayList{}) + return err +} + +// Patch applies the patch and returns the patched moduleBay. +func (c *FakeModuleBays) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ModuleBay, err error) { + emptyResult := &v1alpha1.ModuleBay{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(modulebaysResource, c.ns, name, pt, data, opts, subresources...), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.ModuleBay), err +} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_node.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_node.go new file mode 100644 index 0000000..1be6df6 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_node.go @@ -0,0 +1,146 @@ +/* +Copyright 2024 Nokia. + +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" + + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + v1 "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" +) + +// FakeNodes implements NodeInterface +type FakeNodes struct { + Fake *FakeInfraV1alpha1 + ns string +} + +var nodesResource = v1alpha1.SchemeGroupVersion.WithResource("nodes") + +var nodesKind = v1alpha1.SchemeGroupVersion.WithKind("Node") + +// Get takes name of the node, and returns the corresponding node object, and an error if there is any. +func (c *FakeNodes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Node, err error) { + emptyResult := &v1alpha1.Node{} + obj, err := c.Fake. + Invokes(testing.NewGetActionWithOptions(nodesResource, c.ns, name, options), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Node), err +} + +// List takes label and field selectors, and returns the list of Nodes that match those selectors. +func (c *FakeNodes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NodeList, err error) { + emptyResult := &v1alpha1.NodeList{} + obj, err := c.Fake. + Invokes(testing.NewListActionWithOptions(nodesResource, nodesKind, c.ns, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.NodeList{ListMeta: obj.(*v1alpha1.NodeList).ListMeta} + for _, item := range obj.(*v1alpha1.NodeList).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 nodes. +func (c *FakeNodes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchActionWithOptions(nodesResource, c.ns, opts)) + +} + +// Create takes the representation of a node and creates it. Returns the server's representation of the node, and an error, if there is any. +func (c *FakeNodes) Create(ctx context.Context, node *v1alpha1.Node, opts v1.CreateOptions) (result *v1alpha1.Node, err error) { + emptyResult := &v1alpha1.Node{} + obj, err := c.Fake. + Invokes(testing.NewCreateActionWithOptions(nodesResource, c.ns, node, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Node), err +} + +// Update takes the representation of a node and updates it. Returns the server's representation of the node, and an error, if there is any. +func (c *FakeNodes) Update(ctx context.Context, node *v1alpha1.Node, opts v1.UpdateOptions) (result *v1alpha1.Node, err error) { + emptyResult := &v1alpha1.Node{} + obj, err := c.Fake. + Invokes(testing.NewUpdateActionWithOptions(nodesResource, c.ns, node, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Node), 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 *FakeNodes) UpdateStatus(ctx context.Context, node *v1alpha1.Node, opts v1.UpdateOptions) (result *v1alpha1.Node, err error) { + emptyResult := &v1alpha1.Node{} + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceActionWithOptions(nodesResource, "status", c.ns, node, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Node), err +} + +// Delete takes name of the node and deletes it. Returns an error if one occurs. +func (c *FakeNodes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(nodesResource, c.ns, name, opts), &v1alpha1.Node{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeNodes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(nodesResource, c.ns, opts, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.NodeList{}) + return err +} + +// Patch applies the patch and returns the patched node. +func (c *FakeNodes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Node, err error) { + emptyResult := &v1alpha1.Node{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(nodesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Node), err +} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_nodeitem.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_nodeitem.go new file mode 100644 index 0000000..730b613 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_nodeitem.go @@ -0,0 +1,146 @@ +/* +Copyright 2024 Nokia. + +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" + + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + v1 "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" +) + +// FakeNodeItems implements NodeItemInterface +type FakeNodeItems struct { + Fake *FakeInfraV1alpha1 + ns string +} + +var nodeitemsResource = v1alpha1.SchemeGroupVersion.WithResource("nodeitems") + +var nodeitemsKind = v1alpha1.SchemeGroupVersion.WithKind("NodeItem") + +// Get takes name of the nodeItem, and returns the corresponding nodeItem object, and an error if there is any. +func (c *FakeNodeItems) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NodeItem, err error) { + emptyResult := &v1alpha1.NodeItem{} + obj, err := c.Fake. + Invokes(testing.NewGetActionWithOptions(nodeitemsResource, c.ns, name, options), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.NodeItem), err +} + +// List takes label and field selectors, and returns the list of NodeItems that match those selectors. +func (c *FakeNodeItems) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NodeItemList, err error) { + emptyResult := &v1alpha1.NodeItemList{} + obj, err := c.Fake. + Invokes(testing.NewListActionWithOptions(nodeitemsResource, nodeitemsKind, c.ns, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.NodeItemList{ListMeta: obj.(*v1alpha1.NodeItemList).ListMeta} + for _, item := range obj.(*v1alpha1.NodeItemList).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 nodeItems. +func (c *FakeNodeItems) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchActionWithOptions(nodeitemsResource, c.ns, opts)) + +} + +// Create takes the representation of a nodeItem and creates it. Returns the server's representation of the nodeItem, and an error, if there is any. +func (c *FakeNodeItems) Create(ctx context.Context, nodeItem *v1alpha1.NodeItem, opts v1.CreateOptions) (result *v1alpha1.NodeItem, err error) { + emptyResult := &v1alpha1.NodeItem{} + obj, err := c.Fake. + Invokes(testing.NewCreateActionWithOptions(nodeitemsResource, c.ns, nodeItem, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.NodeItem), err +} + +// Update takes the representation of a nodeItem and updates it. Returns the server's representation of the nodeItem, and an error, if there is any. +func (c *FakeNodeItems) Update(ctx context.Context, nodeItem *v1alpha1.NodeItem, opts v1.UpdateOptions) (result *v1alpha1.NodeItem, err error) { + emptyResult := &v1alpha1.NodeItem{} + obj, err := c.Fake. + Invokes(testing.NewUpdateActionWithOptions(nodeitemsResource, c.ns, nodeItem, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.NodeItem), 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 *FakeNodeItems) UpdateStatus(ctx context.Context, nodeItem *v1alpha1.NodeItem, opts v1.UpdateOptions) (result *v1alpha1.NodeItem, err error) { + emptyResult := &v1alpha1.NodeItem{} + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceActionWithOptions(nodeitemsResource, "status", c.ns, nodeItem, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.NodeItem), err +} + +// Delete takes name of the nodeItem and deletes it. Returns an error if one occurs. +func (c *FakeNodeItems) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(nodeitemsResource, c.ns, name, opts), &v1alpha1.NodeItem{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeNodeItems) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(nodeitemsResource, c.ns, opts, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.NodeItemList{}) + return err +} + +// Patch applies the patch and returns the patched nodeItem. +func (c *FakeNodeItems) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.NodeItem, err error) { + emptyResult := &v1alpha1.NodeItem{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(nodeitemsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.NodeItem), err +} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_nodeset.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_nodeset.go new file mode 100644 index 0000000..9fbbe25 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_nodeset.go @@ -0,0 +1,146 @@ +/* +Copyright 2024 Nokia. + +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" + + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + v1 "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" +) + +// FakeNodeSets implements NodeSetInterface +type FakeNodeSets struct { + Fake *FakeInfraV1alpha1 + ns string +} + +var nodesetsResource = v1alpha1.SchemeGroupVersion.WithResource("nodesets") + +var nodesetsKind = v1alpha1.SchemeGroupVersion.WithKind("NodeSet") + +// Get takes name of the nodeSet, and returns the corresponding nodeSet object, and an error if there is any. +func (c *FakeNodeSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NodeSet, err error) { + emptyResult := &v1alpha1.NodeSet{} + obj, err := c.Fake. + Invokes(testing.NewGetActionWithOptions(nodesetsResource, c.ns, name, options), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.NodeSet), err +} + +// List takes label and field selectors, and returns the list of NodeSets that match those selectors. +func (c *FakeNodeSets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NodeSetList, err error) { + emptyResult := &v1alpha1.NodeSetList{} + obj, err := c.Fake. + Invokes(testing.NewListActionWithOptions(nodesetsResource, nodesetsKind, c.ns, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.NodeSetList{ListMeta: obj.(*v1alpha1.NodeSetList).ListMeta} + for _, item := range obj.(*v1alpha1.NodeSetList).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 nodeSets. +func (c *FakeNodeSets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchActionWithOptions(nodesetsResource, c.ns, opts)) + +} + +// Create takes the representation of a nodeSet and creates it. Returns the server's representation of the nodeSet, and an error, if there is any. +func (c *FakeNodeSets) Create(ctx context.Context, nodeSet *v1alpha1.NodeSet, opts v1.CreateOptions) (result *v1alpha1.NodeSet, err error) { + emptyResult := &v1alpha1.NodeSet{} + obj, err := c.Fake. + Invokes(testing.NewCreateActionWithOptions(nodesetsResource, c.ns, nodeSet, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.NodeSet), err +} + +// Update takes the representation of a nodeSet and updates it. Returns the server's representation of the nodeSet, and an error, if there is any. +func (c *FakeNodeSets) Update(ctx context.Context, nodeSet *v1alpha1.NodeSet, opts v1.UpdateOptions) (result *v1alpha1.NodeSet, err error) { + emptyResult := &v1alpha1.NodeSet{} + obj, err := c.Fake. + Invokes(testing.NewUpdateActionWithOptions(nodesetsResource, c.ns, nodeSet, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.NodeSet), 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 *FakeNodeSets) UpdateStatus(ctx context.Context, nodeSet *v1alpha1.NodeSet, opts v1.UpdateOptions) (result *v1alpha1.NodeSet, err error) { + emptyResult := &v1alpha1.NodeSet{} + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceActionWithOptions(nodesetsResource, "status", c.ns, nodeSet, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.NodeSet), err +} + +// Delete takes name of the nodeSet and deletes it. Returns an error if one occurs. +func (c *FakeNodeSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(nodesetsResource, c.ns, name, opts), &v1alpha1.NodeSet{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeNodeSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(nodesetsResource, c.ns, opts, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.NodeSetList{}) + return err +} + +// Patch applies the patch and returns the patched nodeSet. +func (c *FakeNodeSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.NodeSet, err error) { + emptyResult := &v1alpha1.NodeSet{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(nodesetsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.NodeSet), err +} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_partition.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_partition.go new file mode 100644 index 0000000..b67aeb7 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_partition.go @@ -0,0 +1,146 @@ +/* +Copyright 2024 Nokia. + +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" + + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + v1 "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" +) + +// FakePartitions implements PartitionInterface +type FakePartitions struct { + Fake *FakeInfraV1alpha1 + ns string +} + +var partitionsResource = v1alpha1.SchemeGroupVersion.WithResource("partitions") + +var partitionsKind = v1alpha1.SchemeGroupVersion.WithKind("Partition") + +// Get takes name of the partition, and returns the corresponding partition object, and an error if there is any. +func (c *FakePartitions) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Partition, err error) { + emptyResult := &v1alpha1.Partition{} + obj, err := c.Fake. + Invokes(testing.NewGetActionWithOptions(partitionsResource, c.ns, name, options), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Partition), err +} + +// List takes label and field selectors, and returns the list of Partitions that match those selectors. +func (c *FakePartitions) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.PartitionList, err error) { + emptyResult := &v1alpha1.PartitionList{} + obj, err := c.Fake. + Invokes(testing.NewListActionWithOptions(partitionsResource, partitionsKind, c.ns, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.PartitionList{ListMeta: obj.(*v1alpha1.PartitionList).ListMeta} + for _, item := range obj.(*v1alpha1.PartitionList).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 partitions. +func (c *FakePartitions) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchActionWithOptions(partitionsResource, c.ns, opts)) + +} + +// Create takes the representation of a partition and creates it. Returns the server's representation of the partition, and an error, if there is any. +func (c *FakePartitions) Create(ctx context.Context, partition *v1alpha1.Partition, opts v1.CreateOptions) (result *v1alpha1.Partition, err error) { + emptyResult := &v1alpha1.Partition{} + obj, err := c.Fake. + Invokes(testing.NewCreateActionWithOptions(partitionsResource, c.ns, partition, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Partition), err +} + +// Update takes the representation of a partition and updates it. Returns the server's representation of the partition, and an error, if there is any. +func (c *FakePartitions) Update(ctx context.Context, partition *v1alpha1.Partition, opts v1.UpdateOptions) (result *v1alpha1.Partition, err error) { + emptyResult := &v1alpha1.Partition{} + obj, err := c.Fake. + Invokes(testing.NewUpdateActionWithOptions(partitionsResource, c.ns, partition, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Partition), 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 *FakePartitions) UpdateStatus(ctx context.Context, partition *v1alpha1.Partition, opts v1.UpdateOptions) (result *v1alpha1.Partition, err error) { + emptyResult := &v1alpha1.Partition{} + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceActionWithOptions(partitionsResource, "status", c.ns, partition, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Partition), err +} + +// Delete takes name of the partition and deletes it. Returns an error if one occurs. +func (c *FakePartitions) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(partitionsResource, c.ns, name, opts), &v1alpha1.Partition{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakePartitions) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(partitionsResource, c.ns, opts, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.PartitionList{}) + return err +} + +// Patch applies the patch and returns the patched partition. +func (c *FakePartitions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Partition, err error) { + emptyResult := &v1alpha1.Partition{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(partitionsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Partition), err +} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_rack.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_rack.go new file mode 100644 index 0000000..86ec539 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_rack.go @@ -0,0 +1,146 @@ +/* +Copyright 2024 Nokia. + +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" + + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + v1 "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" +) + +// FakeRacks implements RackInterface +type FakeRacks struct { + Fake *FakeInfraV1alpha1 + ns string +} + +var racksResource = v1alpha1.SchemeGroupVersion.WithResource("racks") + +var racksKind = v1alpha1.SchemeGroupVersion.WithKind("Rack") + +// Get takes name of the rack, and returns the corresponding rack object, and an error if there is any. +func (c *FakeRacks) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Rack, err error) { + emptyResult := &v1alpha1.Rack{} + obj, err := c.Fake. + Invokes(testing.NewGetActionWithOptions(racksResource, c.ns, name, options), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Rack), err +} + +// List takes label and field selectors, and returns the list of Racks that match those selectors. +func (c *FakeRacks) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.RackList, err error) { + emptyResult := &v1alpha1.RackList{} + obj, err := c.Fake. + Invokes(testing.NewListActionWithOptions(racksResource, racksKind, c.ns, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.RackList{ListMeta: obj.(*v1alpha1.RackList).ListMeta} + for _, item := range obj.(*v1alpha1.RackList).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 racks. +func (c *FakeRacks) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchActionWithOptions(racksResource, c.ns, opts)) + +} + +// Create takes the representation of a rack and creates it. Returns the server's representation of the rack, and an error, if there is any. +func (c *FakeRacks) Create(ctx context.Context, rack *v1alpha1.Rack, opts v1.CreateOptions) (result *v1alpha1.Rack, err error) { + emptyResult := &v1alpha1.Rack{} + obj, err := c.Fake. + Invokes(testing.NewCreateActionWithOptions(racksResource, c.ns, rack, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Rack), err +} + +// Update takes the representation of a rack and updates it. Returns the server's representation of the rack, and an error, if there is any. +func (c *FakeRacks) Update(ctx context.Context, rack *v1alpha1.Rack, opts v1.UpdateOptions) (result *v1alpha1.Rack, err error) { + emptyResult := &v1alpha1.Rack{} + obj, err := c.Fake. + Invokes(testing.NewUpdateActionWithOptions(racksResource, c.ns, rack, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Rack), 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 *FakeRacks) UpdateStatus(ctx context.Context, rack *v1alpha1.Rack, opts v1.UpdateOptions) (result *v1alpha1.Rack, err error) { + emptyResult := &v1alpha1.Rack{} + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceActionWithOptions(racksResource, "status", c.ns, rack, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Rack), err +} + +// Delete takes name of the rack and deletes it. Returns an error if one occurs. +func (c *FakeRacks) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(racksResource, c.ns, name, opts), &v1alpha1.Rack{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeRacks) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(racksResource, c.ns, opts, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.RackList{}) + return err +} + +// Patch applies the patch and returns the patched rack. +func (c *FakeRacks) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Rack, err error) { + emptyResult := &v1alpha1.Rack{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(racksResource, c.ns, name, pt, data, opts, subresources...), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Rack), err +} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_region.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_region.go new file mode 100644 index 0000000..62c45de --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_region.go @@ -0,0 +1,146 @@ +/* +Copyright 2024 Nokia. + +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" + + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + v1 "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" +) + +// FakeRegions implements RegionInterface +type FakeRegions struct { + Fake *FakeInfraV1alpha1 + ns string +} + +var regionsResource = v1alpha1.SchemeGroupVersion.WithResource("regions") + +var regionsKind = v1alpha1.SchemeGroupVersion.WithKind("Region") + +// Get takes name of the region, and returns the corresponding region object, and an error if there is any. +func (c *FakeRegions) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Region, err error) { + emptyResult := &v1alpha1.Region{} + obj, err := c.Fake. + Invokes(testing.NewGetActionWithOptions(regionsResource, c.ns, name, options), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Region), err +} + +// List takes label and field selectors, and returns the list of Regions that match those selectors. +func (c *FakeRegions) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.RegionList, err error) { + emptyResult := &v1alpha1.RegionList{} + obj, err := c.Fake. + Invokes(testing.NewListActionWithOptions(regionsResource, regionsKind, c.ns, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.RegionList{ListMeta: obj.(*v1alpha1.RegionList).ListMeta} + for _, item := range obj.(*v1alpha1.RegionList).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 regions. +func (c *FakeRegions) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchActionWithOptions(regionsResource, c.ns, opts)) + +} + +// Create takes the representation of a region and creates it. Returns the server's representation of the region, and an error, if there is any. +func (c *FakeRegions) Create(ctx context.Context, region *v1alpha1.Region, opts v1.CreateOptions) (result *v1alpha1.Region, err error) { + emptyResult := &v1alpha1.Region{} + obj, err := c.Fake. + Invokes(testing.NewCreateActionWithOptions(regionsResource, c.ns, region, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Region), err +} + +// Update takes the representation of a region and updates it. Returns the server's representation of the region, and an error, if there is any. +func (c *FakeRegions) Update(ctx context.Context, region *v1alpha1.Region, opts v1.UpdateOptions) (result *v1alpha1.Region, err error) { + emptyResult := &v1alpha1.Region{} + obj, err := c.Fake. + Invokes(testing.NewUpdateActionWithOptions(regionsResource, c.ns, region, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Region), 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 *FakeRegions) UpdateStatus(ctx context.Context, region *v1alpha1.Region, opts v1.UpdateOptions) (result *v1alpha1.Region, err error) { + emptyResult := &v1alpha1.Region{} + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceActionWithOptions(regionsResource, "status", c.ns, region, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Region), err +} + +// Delete takes name of the region and deletes it. Returns an error if one occurs. +func (c *FakeRegions) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(regionsResource, c.ns, name, opts), &v1alpha1.Region{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeRegions) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(regionsResource, c.ns, opts, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.RegionList{}) + return err +} + +// Patch applies the patch and returns the patched region. +func (c *FakeRegions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Region, err error) { + emptyResult := &v1alpha1.Region{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(regionsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Region), err +} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_site.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_site.go new file mode 100644 index 0000000..5e1b45b --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_site.go @@ -0,0 +1,146 @@ +/* +Copyright 2024 Nokia. + +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" + + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + v1 "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" +) + +// FakeSites implements SiteInterface +type FakeSites struct { + Fake *FakeInfraV1alpha1 + ns string +} + +var sitesResource = v1alpha1.SchemeGroupVersion.WithResource("sites") + +var sitesKind = v1alpha1.SchemeGroupVersion.WithKind("Site") + +// Get takes name of the site, and returns the corresponding site object, and an error if there is any. +func (c *FakeSites) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Site, err error) { + emptyResult := &v1alpha1.Site{} + obj, err := c.Fake. + Invokes(testing.NewGetActionWithOptions(sitesResource, c.ns, name, options), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Site), err +} + +// List takes label and field selectors, and returns the list of Sites that match those selectors. +func (c *FakeSites) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.SiteList, err error) { + emptyResult := &v1alpha1.SiteList{} + obj, err := c.Fake. + Invokes(testing.NewListActionWithOptions(sitesResource, sitesKind, c.ns, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.SiteList{ListMeta: obj.(*v1alpha1.SiteList).ListMeta} + for _, item := range obj.(*v1alpha1.SiteList).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 sites. +func (c *FakeSites) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchActionWithOptions(sitesResource, c.ns, opts)) + +} + +// Create takes the representation of a site and creates it. Returns the server's representation of the site, and an error, if there is any. +func (c *FakeSites) Create(ctx context.Context, site *v1alpha1.Site, opts v1.CreateOptions) (result *v1alpha1.Site, err error) { + emptyResult := &v1alpha1.Site{} + obj, err := c.Fake. + Invokes(testing.NewCreateActionWithOptions(sitesResource, c.ns, site, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Site), err +} + +// Update takes the representation of a site and updates it. Returns the server's representation of the site, and an error, if there is any. +func (c *FakeSites) Update(ctx context.Context, site *v1alpha1.Site, opts v1.UpdateOptions) (result *v1alpha1.Site, err error) { + emptyResult := &v1alpha1.Site{} + obj, err := c.Fake. + Invokes(testing.NewUpdateActionWithOptions(sitesResource, c.ns, site, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Site), 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 *FakeSites) UpdateStatus(ctx context.Context, site *v1alpha1.Site, opts v1.UpdateOptions) (result *v1alpha1.Site, err error) { + emptyResult := &v1alpha1.Site{} + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceActionWithOptions(sitesResource, "status", c.ns, site, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Site), err +} + +// Delete takes name of the site and deletes it. Returns an error if one occurs. +func (c *FakeSites) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(sitesResource, c.ns, name, opts), &v1alpha1.Site{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeSites) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(sitesResource, c.ns, opts, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.SiteList{}) + return err +} + +// Patch applies the patch and returns the patched site. +func (c *FakeSites) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Site, err error) { + emptyResult := &v1alpha1.Site{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(sitesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Site), err +} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/generated_expansion.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/generated_expansion.go new file mode 100644 index 0000000..69e6aaa --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/generated_expansion.go @@ -0,0 +1,46 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +type ClusterExpansion interface{} + +type EndpointExpansion interface{} + +type EndpointSetExpansion interface{} + +type LinkExpansion interface{} + +type LinkSetExpansion interface{} + +type ModuleExpansion interface{} + +type ModuleBayExpansion interface{} + +type NodeExpansion interface{} + +type NodeItemExpansion interface{} + +type NodeSetExpansion interface{} + +type PartitionExpansion interface{} + +type RackExpansion interface{} + +type RegionExpansion interface{} + +type SiteExpansion interface{} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/infra_client.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/infra_client.go new file mode 100644 index 0000000..c7d4d4f --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/infra_client.go @@ -0,0 +1,171 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "net/http" + + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + "github.com/kuidio/kuid/pkg/generated/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" +) + +type InfraV1alpha1Interface interface { + RESTClient() rest.Interface + ClustersGetter + EndpointsGetter + EndpointSetsGetter + LinksGetter + LinkSetsGetter + ModulesGetter + ModuleBaysGetter + NodesGetter + NodeItemsGetter + NodeSetsGetter + PartitionsGetter + RacksGetter + RegionsGetter + SitesGetter +} + +// InfraV1alpha1Client is used to interact with features provided by the infra.kuid.dev group. +type InfraV1alpha1Client struct { + restClient rest.Interface +} + +func (c *InfraV1alpha1Client) Clusters(namespace string) ClusterInterface { + return newClusters(c, namespace) +} + +func (c *InfraV1alpha1Client) Endpoints(namespace string) EndpointInterface { + return newEndpoints(c, namespace) +} + +func (c *InfraV1alpha1Client) EndpointSets(namespace string) EndpointSetInterface { + return newEndpointSets(c, namespace) +} + +func (c *InfraV1alpha1Client) Links(namespace string) LinkInterface { + return newLinks(c, namespace) +} + +func (c *InfraV1alpha1Client) LinkSets(namespace string) LinkSetInterface { + return newLinkSets(c, namespace) +} + +func (c *InfraV1alpha1Client) Modules(namespace string) ModuleInterface { + return newModules(c, namespace) +} + +func (c *InfraV1alpha1Client) ModuleBays(namespace string) ModuleBayInterface { + return newModuleBays(c, namespace) +} + +func (c *InfraV1alpha1Client) Nodes(namespace string) NodeInterface { + return newNodes(c, namespace) +} + +func (c *InfraV1alpha1Client) NodeItems(namespace string) NodeItemInterface { + return newNodeItems(c, namespace) +} + +func (c *InfraV1alpha1Client) NodeSets(namespace string) NodeSetInterface { + return newNodeSets(c, namespace) +} + +func (c *InfraV1alpha1Client) Partitions(namespace string) PartitionInterface { + return newPartitions(c, namespace) +} + +func (c *InfraV1alpha1Client) Racks(namespace string) RackInterface { + return newRacks(c, namespace) +} + +func (c *InfraV1alpha1Client) Regions(namespace string) RegionInterface { + return newRegions(c, namespace) +} + +func (c *InfraV1alpha1Client) Sites(namespace string) SiteInterface { + return newSites(c, namespace) +} + +// NewForConfig creates a new InfraV1alpha1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*InfraV1alpha1Client, 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 InfraV1alpha1Client 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) (*InfraV1alpha1Client, 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 &InfraV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new InfraV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *InfraV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new InfraV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *InfraV1alpha1Client { + return &InfraV1alpha1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha1.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 *InfraV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/link.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/link.go new file mode 100644 index 0000000..d746f8e --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/link.go @@ -0,0 +1,68 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + scheme "github.com/kuidio/kuid/pkg/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// LinksGetter has a method to return a LinkInterface. +// A group's client should implement this interface. +type LinksGetter interface { + Links(namespace string) LinkInterface +} + +// LinkInterface has methods to work with Link resources. +type LinkInterface interface { + Create(ctx context.Context, link *v1alpha1.Link, opts v1.CreateOptions) (*v1alpha1.Link, error) + Update(ctx context.Context, link *v1alpha1.Link, opts v1.UpdateOptions) (*v1alpha1.Link, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, link *v1alpha1.Link, opts v1.UpdateOptions) (*v1alpha1.Link, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.Link, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.LinkList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Link, err error) + LinkExpansion +} + +// links implements LinkInterface +type links struct { + *gentype.ClientWithList[*v1alpha1.Link, *v1alpha1.LinkList] +} + +// newLinks returns a Links +func newLinks(c *InfraV1alpha1Client, namespace string) *links { + return &links{ + gentype.NewClientWithList[*v1alpha1.Link, *v1alpha1.LinkList]( + "links", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.Link { return &v1alpha1.Link{} }, + func() *v1alpha1.LinkList { return &v1alpha1.LinkList{} }), + } +} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/linkset.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/linkset.go new file mode 100644 index 0000000..7ec3cc1 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/linkset.go @@ -0,0 +1,68 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + scheme "github.com/kuidio/kuid/pkg/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// LinkSetsGetter has a method to return a LinkSetInterface. +// A group's client should implement this interface. +type LinkSetsGetter interface { + LinkSets(namespace string) LinkSetInterface +} + +// LinkSetInterface has methods to work with LinkSet resources. +type LinkSetInterface interface { + Create(ctx context.Context, linkSet *v1alpha1.LinkSet, opts v1.CreateOptions) (*v1alpha1.LinkSet, error) + Update(ctx context.Context, linkSet *v1alpha1.LinkSet, opts v1.UpdateOptions) (*v1alpha1.LinkSet, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, linkSet *v1alpha1.LinkSet, opts v1.UpdateOptions) (*v1alpha1.LinkSet, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.LinkSet, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.LinkSetList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.LinkSet, err error) + LinkSetExpansion +} + +// linkSets implements LinkSetInterface +type linkSets struct { + *gentype.ClientWithList[*v1alpha1.LinkSet, *v1alpha1.LinkSetList] +} + +// newLinkSets returns a LinkSets +func newLinkSets(c *InfraV1alpha1Client, namespace string) *linkSets { + return &linkSets{ + gentype.NewClientWithList[*v1alpha1.LinkSet, *v1alpha1.LinkSetList]( + "linksets", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.LinkSet { return &v1alpha1.LinkSet{} }, + func() *v1alpha1.LinkSetList { return &v1alpha1.LinkSetList{} }), + } +} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/module.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/module.go new file mode 100644 index 0000000..217651c --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/module.go @@ -0,0 +1,68 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + scheme "github.com/kuidio/kuid/pkg/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// ModulesGetter has a method to return a ModuleInterface. +// A group's client should implement this interface. +type ModulesGetter interface { + Modules(namespace string) ModuleInterface +} + +// ModuleInterface has methods to work with Module resources. +type ModuleInterface interface { + Create(ctx context.Context, module *v1alpha1.Module, opts v1.CreateOptions) (*v1alpha1.Module, error) + Update(ctx context.Context, module *v1alpha1.Module, opts v1.UpdateOptions) (*v1alpha1.Module, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, module *v1alpha1.Module, opts v1.UpdateOptions) (*v1alpha1.Module, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.Module, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ModuleList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Module, err error) + ModuleExpansion +} + +// modules implements ModuleInterface +type modules struct { + *gentype.ClientWithList[*v1alpha1.Module, *v1alpha1.ModuleList] +} + +// newModules returns a Modules +func newModules(c *InfraV1alpha1Client, namespace string) *modules { + return &modules{ + gentype.NewClientWithList[*v1alpha1.Module, *v1alpha1.ModuleList]( + "modules", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.Module { return &v1alpha1.Module{} }, + func() *v1alpha1.ModuleList { return &v1alpha1.ModuleList{} }), + } +} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/modulebay.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/modulebay.go new file mode 100644 index 0000000..7ec7704 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/modulebay.go @@ -0,0 +1,68 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + scheme "github.com/kuidio/kuid/pkg/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// ModuleBaysGetter has a method to return a ModuleBayInterface. +// A group's client should implement this interface. +type ModuleBaysGetter interface { + ModuleBays(namespace string) ModuleBayInterface +} + +// ModuleBayInterface has methods to work with ModuleBay resources. +type ModuleBayInterface interface { + Create(ctx context.Context, moduleBay *v1alpha1.ModuleBay, opts v1.CreateOptions) (*v1alpha1.ModuleBay, error) + Update(ctx context.Context, moduleBay *v1alpha1.ModuleBay, opts v1.UpdateOptions) (*v1alpha1.ModuleBay, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, moduleBay *v1alpha1.ModuleBay, opts v1.UpdateOptions) (*v1alpha1.ModuleBay, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.ModuleBay, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ModuleBayList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ModuleBay, err error) + ModuleBayExpansion +} + +// moduleBays implements ModuleBayInterface +type moduleBays struct { + *gentype.ClientWithList[*v1alpha1.ModuleBay, *v1alpha1.ModuleBayList] +} + +// newModuleBays returns a ModuleBays +func newModuleBays(c *InfraV1alpha1Client, namespace string) *moduleBays { + return &moduleBays{ + gentype.NewClientWithList[*v1alpha1.ModuleBay, *v1alpha1.ModuleBayList]( + "modulebays", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.ModuleBay { return &v1alpha1.ModuleBay{} }, + func() *v1alpha1.ModuleBayList { return &v1alpha1.ModuleBayList{} }), + } +} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/node.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/node.go new file mode 100644 index 0000000..9dafcb5 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/node.go @@ -0,0 +1,68 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + scheme "github.com/kuidio/kuid/pkg/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// NodesGetter has a method to return a NodeInterface. +// A group's client should implement this interface. +type NodesGetter interface { + Nodes(namespace string) NodeInterface +} + +// NodeInterface has methods to work with Node resources. +type NodeInterface interface { + Create(ctx context.Context, node *v1alpha1.Node, opts v1.CreateOptions) (*v1alpha1.Node, error) + Update(ctx context.Context, node *v1alpha1.Node, opts v1.UpdateOptions) (*v1alpha1.Node, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, node *v1alpha1.Node, opts v1.UpdateOptions) (*v1alpha1.Node, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.Node, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.NodeList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Node, err error) + NodeExpansion +} + +// nodes implements NodeInterface +type nodes struct { + *gentype.ClientWithList[*v1alpha1.Node, *v1alpha1.NodeList] +} + +// newNodes returns a Nodes +func newNodes(c *InfraV1alpha1Client, namespace string) *nodes { + return &nodes{ + gentype.NewClientWithList[*v1alpha1.Node, *v1alpha1.NodeList]( + "nodes", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.Node { return &v1alpha1.Node{} }, + func() *v1alpha1.NodeList { return &v1alpha1.NodeList{} }), + } +} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/nodeitem.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/nodeitem.go new file mode 100644 index 0000000..aaedf41 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/nodeitem.go @@ -0,0 +1,68 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + scheme "github.com/kuidio/kuid/pkg/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// NodeItemsGetter has a method to return a NodeItemInterface. +// A group's client should implement this interface. +type NodeItemsGetter interface { + NodeItems(namespace string) NodeItemInterface +} + +// NodeItemInterface has methods to work with NodeItem resources. +type NodeItemInterface interface { + Create(ctx context.Context, nodeItem *v1alpha1.NodeItem, opts v1.CreateOptions) (*v1alpha1.NodeItem, error) + Update(ctx context.Context, nodeItem *v1alpha1.NodeItem, opts v1.UpdateOptions) (*v1alpha1.NodeItem, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, nodeItem *v1alpha1.NodeItem, opts v1.UpdateOptions) (*v1alpha1.NodeItem, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.NodeItem, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.NodeItemList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.NodeItem, err error) + NodeItemExpansion +} + +// nodeItems implements NodeItemInterface +type nodeItems struct { + *gentype.ClientWithList[*v1alpha1.NodeItem, *v1alpha1.NodeItemList] +} + +// newNodeItems returns a NodeItems +func newNodeItems(c *InfraV1alpha1Client, namespace string) *nodeItems { + return &nodeItems{ + gentype.NewClientWithList[*v1alpha1.NodeItem, *v1alpha1.NodeItemList]( + "nodeitems", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.NodeItem { return &v1alpha1.NodeItem{} }, + func() *v1alpha1.NodeItemList { return &v1alpha1.NodeItemList{} }), + } +} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/nodeset.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/nodeset.go new file mode 100644 index 0000000..ad6b91f --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/nodeset.go @@ -0,0 +1,68 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + scheme "github.com/kuidio/kuid/pkg/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// NodeSetsGetter has a method to return a NodeSetInterface. +// A group's client should implement this interface. +type NodeSetsGetter interface { + NodeSets(namespace string) NodeSetInterface +} + +// NodeSetInterface has methods to work with NodeSet resources. +type NodeSetInterface interface { + Create(ctx context.Context, nodeSet *v1alpha1.NodeSet, opts v1.CreateOptions) (*v1alpha1.NodeSet, error) + Update(ctx context.Context, nodeSet *v1alpha1.NodeSet, opts v1.UpdateOptions) (*v1alpha1.NodeSet, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, nodeSet *v1alpha1.NodeSet, opts v1.UpdateOptions) (*v1alpha1.NodeSet, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.NodeSet, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.NodeSetList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.NodeSet, err error) + NodeSetExpansion +} + +// nodeSets implements NodeSetInterface +type nodeSets struct { + *gentype.ClientWithList[*v1alpha1.NodeSet, *v1alpha1.NodeSetList] +} + +// newNodeSets returns a NodeSets +func newNodeSets(c *InfraV1alpha1Client, namespace string) *nodeSets { + return &nodeSets{ + gentype.NewClientWithList[*v1alpha1.NodeSet, *v1alpha1.NodeSetList]( + "nodesets", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.NodeSet { return &v1alpha1.NodeSet{} }, + func() *v1alpha1.NodeSetList { return &v1alpha1.NodeSetList{} }), + } +} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/partition.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/partition.go new file mode 100644 index 0000000..cf2d071 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/partition.go @@ -0,0 +1,68 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + scheme "github.com/kuidio/kuid/pkg/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// PartitionsGetter has a method to return a PartitionInterface. +// A group's client should implement this interface. +type PartitionsGetter interface { + Partitions(namespace string) PartitionInterface +} + +// PartitionInterface has methods to work with Partition resources. +type PartitionInterface interface { + Create(ctx context.Context, partition *v1alpha1.Partition, opts v1.CreateOptions) (*v1alpha1.Partition, error) + Update(ctx context.Context, partition *v1alpha1.Partition, opts v1.UpdateOptions) (*v1alpha1.Partition, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, partition *v1alpha1.Partition, opts v1.UpdateOptions) (*v1alpha1.Partition, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.Partition, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.PartitionList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Partition, err error) + PartitionExpansion +} + +// partitions implements PartitionInterface +type partitions struct { + *gentype.ClientWithList[*v1alpha1.Partition, *v1alpha1.PartitionList] +} + +// newPartitions returns a Partitions +func newPartitions(c *InfraV1alpha1Client, namespace string) *partitions { + return &partitions{ + gentype.NewClientWithList[*v1alpha1.Partition, *v1alpha1.PartitionList]( + "partitions", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.Partition { return &v1alpha1.Partition{} }, + func() *v1alpha1.PartitionList { return &v1alpha1.PartitionList{} }), + } +} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/rack.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/rack.go new file mode 100644 index 0000000..e673f32 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/rack.go @@ -0,0 +1,68 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + scheme "github.com/kuidio/kuid/pkg/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// RacksGetter has a method to return a RackInterface. +// A group's client should implement this interface. +type RacksGetter interface { + Racks(namespace string) RackInterface +} + +// RackInterface has methods to work with Rack resources. +type RackInterface interface { + Create(ctx context.Context, rack *v1alpha1.Rack, opts v1.CreateOptions) (*v1alpha1.Rack, error) + Update(ctx context.Context, rack *v1alpha1.Rack, opts v1.UpdateOptions) (*v1alpha1.Rack, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, rack *v1alpha1.Rack, opts v1.UpdateOptions) (*v1alpha1.Rack, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.Rack, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.RackList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Rack, err error) + RackExpansion +} + +// racks implements RackInterface +type racks struct { + *gentype.ClientWithList[*v1alpha1.Rack, *v1alpha1.RackList] +} + +// newRacks returns a Racks +func newRacks(c *InfraV1alpha1Client, namespace string) *racks { + return &racks{ + gentype.NewClientWithList[*v1alpha1.Rack, *v1alpha1.RackList]( + "racks", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.Rack { return &v1alpha1.Rack{} }, + func() *v1alpha1.RackList { return &v1alpha1.RackList{} }), + } +} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/region.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/region.go new file mode 100644 index 0000000..0da2b53 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/region.go @@ -0,0 +1,68 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + scheme "github.com/kuidio/kuid/pkg/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// RegionsGetter has a method to return a RegionInterface. +// A group's client should implement this interface. +type RegionsGetter interface { + Regions(namespace string) RegionInterface +} + +// RegionInterface has methods to work with Region resources. +type RegionInterface interface { + Create(ctx context.Context, region *v1alpha1.Region, opts v1.CreateOptions) (*v1alpha1.Region, error) + Update(ctx context.Context, region *v1alpha1.Region, opts v1.UpdateOptions) (*v1alpha1.Region, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, region *v1alpha1.Region, opts v1.UpdateOptions) (*v1alpha1.Region, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.Region, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.RegionList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Region, err error) + RegionExpansion +} + +// regions implements RegionInterface +type regions struct { + *gentype.ClientWithList[*v1alpha1.Region, *v1alpha1.RegionList] +} + +// newRegions returns a Regions +func newRegions(c *InfraV1alpha1Client, namespace string) *regions { + return ®ions{ + gentype.NewClientWithList[*v1alpha1.Region, *v1alpha1.RegionList]( + "regions", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.Region { return &v1alpha1.Region{} }, + func() *v1alpha1.RegionList { return &v1alpha1.RegionList{} }), + } +} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/site.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/site.go new file mode 100644 index 0000000..81e35f4 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/site.go @@ -0,0 +1,68 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + scheme "github.com/kuidio/kuid/pkg/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// SitesGetter has a method to return a SiteInterface. +// A group's client should implement this interface. +type SitesGetter interface { + Sites(namespace string) SiteInterface +} + +// SiteInterface has methods to work with Site resources. +type SiteInterface interface { + Create(ctx context.Context, site *v1alpha1.Site, opts v1.CreateOptions) (*v1alpha1.Site, error) + Update(ctx context.Context, site *v1alpha1.Site, opts v1.UpdateOptions) (*v1alpha1.Site, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, site *v1alpha1.Site, opts v1.UpdateOptions) (*v1alpha1.Site, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.Site, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.SiteList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Site, err error) + SiteExpansion +} + +// sites implements SiteInterface +type sites struct { + *gentype.ClientWithList[*v1alpha1.Site, *v1alpha1.SiteList] +} + +// newSites returns a Sites +func newSites(c *InfraV1alpha1Client, namespace string) *sites { + return &sites{ + gentype.NewClientWithList[*v1alpha1.Site, *v1alpha1.SiteList]( + "sites", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.Site { return &v1alpha1.Site{} }, + func() *v1alpha1.SiteList { return &v1alpha1.SiteList{} }), + } +} diff --git a/pkg/generated/informers/externalversions/factory.go b/pkg/generated/informers/externalversions/factory.go index 9724cb9..26070e6 100644 --- a/pkg/generated/informers/externalversions/factory.go +++ b/pkg/generated/informers/externalversions/factory.go @@ -24,6 +24,7 @@ import ( versioned "github.com/kuidio/kuid/pkg/generated/clientset/versioned" as "github.com/kuidio/kuid/pkg/generated/informers/externalversions/as" + infra "github.com/kuidio/kuid/pkg/generated/informers/externalversions/infra" internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" @@ -254,8 +255,13 @@ type SharedInformerFactory interface { InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer As() as.Interface + Infra() infra.Interface } func (f *sharedInformerFactory) As() as.Interface { return as.New(f, f.namespace, f.tweakListOptions) } + +func (f *sharedInformerFactory) Infra() infra.Interface { + return infra.New(f, f.namespace, f.tweakListOptions) +} diff --git a/pkg/generated/informers/externalversions/generic.go b/pkg/generated/informers/externalversions/generic.go index c92f2c2..45b9b4e 100644 --- a/pkg/generated/informers/externalversions/generic.go +++ b/pkg/generated/informers/externalversions/generic.go @@ -21,6 +21,7 @@ import ( "fmt" v1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" + infrav1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" ) @@ -59,6 +60,36 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case v1alpha1.SchemeGroupVersion.WithResource("asindexes"): return &genericInformer{resource: resource.GroupResource(), informer: f.As().V1alpha1().ASIndexes().Informer()}, nil + // Group=infra.kuid.dev, Version=v1alpha1 + case infrav1alpha1.SchemeGroupVersion.WithResource("clusters"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().Clusters().Informer()}, nil + case infrav1alpha1.SchemeGroupVersion.WithResource("endpoints"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().Endpoints().Informer()}, nil + case infrav1alpha1.SchemeGroupVersion.WithResource("endpointsets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().EndpointSets().Informer()}, nil + case infrav1alpha1.SchemeGroupVersion.WithResource("links"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().Links().Informer()}, nil + case infrav1alpha1.SchemeGroupVersion.WithResource("linksets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().LinkSets().Informer()}, nil + case infrav1alpha1.SchemeGroupVersion.WithResource("modules"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().Modules().Informer()}, nil + case infrav1alpha1.SchemeGroupVersion.WithResource("modulebays"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().ModuleBays().Informer()}, nil + case infrav1alpha1.SchemeGroupVersion.WithResource("nodes"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().Nodes().Informer()}, nil + case infrav1alpha1.SchemeGroupVersion.WithResource("nodeitems"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().NodeItems().Informer()}, nil + case infrav1alpha1.SchemeGroupVersion.WithResource("nodesets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().NodeSets().Informer()}, nil + case infrav1alpha1.SchemeGroupVersion.WithResource("partitions"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().Partitions().Informer()}, nil + case infrav1alpha1.SchemeGroupVersion.WithResource("racks"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().Racks().Informer()}, nil + case infrav1alpha1.SchemeGroupVersion.WithResource("regions"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().Regions().Informer()}, nil + case infrav1alpha1.SchemeGroupVersion.WithResource("sites"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().Sites().Informer()}, nil + } return nil, fmt.Errorf("no informer found for %v", resource) diff --git a/pkg/generated/informers/externalversions/infra/interface.go b/pkg/generated/informers/externalversions/infra/interface.go new file mode 100644 index 0000000..3e55d64 --- /dev/null +++ b/pkg/generated/informers/externalversions/infra/interface.go @@ -0,0 +1,45 @@ +/* +Copyright 2024 Nokia. + +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 infra + +import ( + v1alpha1 "github.com/kuidio/kuid/pkg/generated/informers/externalversions/infra/v1alpha1" + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() v1alpha1.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} +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/generated/informers/externalversions/infra/v1alpha1/cluster.go b/pkg/generated/informers/externalversions/infra/v1alpha1/cluster.go new file mode 100644 index 0000000..9cba163 --- /dev/null +++ b/pkg/generated/informers/externalversions/infra/v1alpha1/cluster.go @@ -0,0 +1,89 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + time "time" + + infrav1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + versioned "github.com/kuidio/kuid/pkg/generated/clientset/versioned" + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kuidio/kuid/pkg/generated/listers/infra/v1alpha1" + v1 "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" +) + +// ClusterInformer provides access to a shared informer and lister for +// Clusters. +type ClusterInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.ClusterLister +} + +type clusterInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewClusterInformer constructs a new informer for Cluster 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 NewClusterInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClusterInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterInformer constructs a new informer for Cluster 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 NewFilteredClusterInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InfraV1alpha1().Clusters(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InfraV1alpha1().Clusters(namespace).Watch(context.TODO(), options) + }, + }, + &infrav1alpha1.Cluster{}, + resyncPeriod, + indexers, + ) +} + +func (f *clusterInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClusterInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *clusterInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&infrav1alpha1.Cluster{}, f.defaultInformer) +} + +func (f *clusterInformer) Lister() v1alpha1.ClusterLister { + return v1alpha1.NewClusterLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/informers/externalversions/infra/v1alpha1/endpoint.go b/pkg/generated/informers/externalversions/infra/v1alpha1/endpoint.go new file mode 100644 index 0000000..2fef49a --- /dev/null +++ b/pkg/generated/informers/externalversions/infra/v1alpha1/endpoint.go @@ -0,0 +1,89 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + time "time" + + infrav1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + versioned "github.com/kuidio/kuid/pkg/generated/clientset/versioned" + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kuidio/kuid/pkg/generated/listers/infra/v1alpha1" + v1 "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" +) + +// EndpointInformer provides access to a shared informer and lister for +// Endpoints. +type EndpointInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.EndpointLister +} + +type endpointInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEndpointInformer constructs a new informer for Endpoint 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 NewEndpointInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEndpointInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredEndpointInformer constructs a new informer for Endpoint 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 NewFilteredEndpointInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InfraV1alpha1().Endpoints(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InfraV1alpha1().Endpoints(namespace).Watch(context.TODO(), options) + }, + }, + &infrav1alpha1.Endpoint{}, + resyncPeriod, + indexers, + ) +} + +func (f *endpointInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEndpointInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *endpointInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&infrav1alpha1.Endpoint{}, f.defaultInformer) +} + +func (f *endpointInformer) Lister() v1alpha1.EndpointLister { + return v1alpha1.NewEndpointLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/informers/externalversions/infra/v1alpha1/endpointset.go b/pkg/generated/informers/externalversions/infra/v1alpha1/endpointset.go new file mode 100644 index 0000000..f06d6d5 --- /dev/null +++ b/pkg/generated/informers/externalversions/infra/v1alpha1/endpointset.go @@ -0,0 +1,89 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + time "time" + + infrav1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + versioned "github.com/kuidio/kuid/pkg/generated/clientset/versioned" + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kuidio/kuid/pkg/generated/listers/infra/v1alpha1" + v1 "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" +) + +// EndpointSetInformer provides access to a shared informer and lister for +// EndpointSets. +type EndpointSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.EndpointSetLister +} + +type endpointSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEndpointSetInformer constructs a new informer for EndpointSet 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 NewEndpointSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEndpointSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredEndpointSetInformer constructs a new informer for EndpointSet 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 NewFilteredEndpointSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InfraV1alpha1().EndpointSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InfraV1alpha1().EndpointSets(namespace).Watch(context.TODO(), options) + }, + }, + &infrav1alpha1.EndpointSet{}, + resyncPeriod, + indexers, + ) +} + +func (f *endpointSetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEndpointSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *endpointSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&infrav1alpha1.EndpointSet{}, f.defaultInformer) +} + +func (f *endpointSetInformer) Lister() v1alpha1.EndpointSetLister { + return v1alpha1.NewEndpointSetLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/informers/externalversions/infra/v1alpha1/interface.go b/pkg/generated/informers/externalversions/infra/v1alpha1/interface.go new file mode 100644 index 0000000..62d941f --- /dev/null +++ b/pkg/generated/informers/externalversions/infra/v1alpha1/interface.go @@ -0,0 +1,135 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Clusters returns a ClusterInformer. + Clusters() ClusterInformer + // Endpoints returns a EndpointInformer. + Endpoints() EndpointInformer + // EndpointSets returns a EndpointSetInformer. + EndpointSets() EndpointSetInformer + // Links returns a LinkInformer. + Links() LinkInformer + // LinkSets returns a LinkSetInformer. + LinkSets() LinkSetInformer + // Modules returns a ModuleInformer. + Modules() ModuleInformer + // ModuleBays returns a ModuleBayInformer. + ModuleBays() ModuleBayInformer + // Nodes returns a NodeInformer. + Nodes() NodeInformer + // NodeItems returns a NodeItemInformer. + NodeItems() NodeItemInformer + // NodeSets returns a NodeSetInformer. + NodeSets() NodeSetInformer + // Partitions returns a PartitionInformer. + Partitions() PartitionInformer + // Racks returns a RackInformer. + Racks() RackInformer + // Regions returns a RegionInformer. + Regions() RegionInformer + // Sites returns a SiteInformer. + Sites() SiteInformer +} + +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} +} + +// Clusters returns a ClusterInformer. +func (v *version) Clusters() ClusterInformer { + return &clusterInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Endpoints returns a EndpointInformer. +func (v *version) Endpoints() EndpointInformer { + return &endpointInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// EndpointSets returns a EndpointSetInformer. +func (v *version) EndpointSets() EndpointSetInformer { + return &endpointSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Links returns a LinkInformer. +func (v *version) Links() LinkInformer { + return &linkInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// LinkSets returns a LinkSetInformer. +func (v *version) LinkSets() LinkSetInformer { + return &linkSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Modules returns a ModuleInformer. +func (v *version) Modules() ModuleInformer { + return &moduleInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ModuleBays returns a ModuleBayInformer. +func (v *version) ModuleBays() ModuleBayInformer { + return &moduleBayInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Nodes returns a NodeInformer. +func (v *version) Nodes() NodeInformer { + return &nodeInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// NodeItems returns a NodeItemInformer. +func (v *version) NodeItems() NodeItemInformer { + return &nodeItemInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// NodeSets returns a NodeSetInformer. +func (v *version) NodeSets() NodeSetInformer { + return &nodeSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Partitions returns a PartitionInformer. +func (v *version) Partitions() PartitionInformer { + return &partitionInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Racks returns a RackInformer. +func (v *version) Racks() RackInformer { + return &rackInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Regions returns a RegionInformer. +func (v *version) Regions() RegionInformer { + return ®ionInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Sites returns a SiteInformer. +func (v *version) Sites() SiteInformer { + return &siteInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/generated/informers/externalversions/infra/v1alpha1/link.go b/pkg/generated/informers/externalversions/infra/v1alpha1/link.go new file mode 100644 index 0000000..b369151 --- /dev/null +++ b/pkg/generated/informers/externalversions/infra/v1alpha1/link.go @@ -0,0 +1,89 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + time "time" + + infrav1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + versioned "github.com/kuidio/kuid/pkg/generated/clientset/versioned" + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kuidio/kuid/pkg/generated/listers/infra/v1alpha1" + v1 "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" +) + +// LinkInformer provides access to a shared informer and lister for +// Links. +type LinkInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.LinkLister +} + +type linkInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewLinkInformer constructs a new informer for Link 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 NewLinkInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredLinkInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredLinkInformer constructs a new informer for Link 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 NewFilteredLinkInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InfraV1alpha1().Links(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InfraV1alpha1().Links(namespace).Watch(context.TODO(), options) + }, + }, + &infrav1alpha1.Link{}, + resyncPeriod, + indexers, + ) +} + +func (f *linkInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredLinkInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *linkInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&infrav1alpha1.Link{}, f.defaultInformer) +} + +func (f *linkInformer) Lister() v1alpha1.LinkLister { + return v1alpha1.NewLinkLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/informers/externalversions/infra/v1alpha1/linkset.go b/pkg/generated/informers/externalversions/infra/v1alpha1/linkset.go new file mode 100644 index 0000000..36961eb --- /dev/null +++ b/pkg/generated/informers/externalversions/infra/v1alpha1/linkset.go @@ -0,0 +1,89 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + time "time" + + infrav1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + versioned "github.com/kuidio/kuid/pkg/generated/clientset/versioned" + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kuidio/kuid/pkg/generated/listers/infra/v1alpha1" + v1 "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" +) + +// LinkSetInformer provides access to a shared informer and lister for +// LinkSets. +type LinkSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.LinkSetLister +} + +type linkSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewLinkSetInformer constructs a new informer for LinkSet 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 NewLinkSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredLinkSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredLinkSetInformer constructs a new informer for LinkSet 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 NewFilteredLinkSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InfraV1alpha1().LinkSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InfraV1alpha1().LinkSets(namespace).Watch(context.TODO(), options) + }, + }, + &infrav1alpha1.LinkSet{}, + resyncPeriod, + indexers, + ) +} + +func (f *linkSetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredLinkSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *linkSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&infrav1alpha1.LinkSet{}, f.defaultInformer) +} + +func (f *linkSetInformer) Lister() v1alpha1.LinkSetLister { + return v1alpha1.NewLinkSetLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/informers/externalversions/infra/v1alpha1/module.go b/pkg/generated/informers/externalversions/infra/v1alpha1/module.go new file mode 100644 index 0000000..367e0d5 --- /dev/null +++ b/pkg/generated/informers/externalversions/infra/v1alpha1/module.go @@ -0,0 +1,89 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + time "time" + + infrav1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + versioned "github.com/kuidio/kuid/pkg/generated/clientset/versioned" + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kuidio/kuid/pkg/generated/listers/infra/v1alpha1" + v1 "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" +) + +// ModuleInformer provides access to a shared informer and lister for +// Modules. +type ModuleInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.ModuleLister +} + +type moduleInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewModuleInformer constructs a new informer for Module 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 NewModuleInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredModuleInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredModuleInformer constructs a new informer for Module 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 NewFilteredModuleInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InfraV1alpha1().Modules(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InfraV1alpha1().Modules(namespace).Watch(context.TODO(), options) + }, + }, + &infrav1alpha1.Module{}, + resyncPeriod, + indexers, + ) +} + +func (f *moduleInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredModuleInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *moduleInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&infrav1alpha1.Module{}, f.defaultInformer) +} + +func (f *moduleInformer) Lister() v1alpha1.ModuleLister { + return v1alpha1.NewModuleLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/informers/externalversions/infra/v1alpha1/modulebay.go b/pkg/generated/informers/externalversions/infra/v1alpha1/modulebay.go new file mode 100644 index 0000000..82d36e9 --- /dev/null +++ b/pkg/generated/informers/externalversions/infra/v1alpha1/modulebay.go @@ -0,0 +1,89 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + time "time" + + infrav1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + versioned "github.com/kuidio/kuid/pkg/generated/clientset/versioned" + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kuidio/kuid/pkg/generated/listers/infra/v1alpha1" + v1 "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" +) + +// ModuleBayInformer provides access to a shared informer and lister for +// ModuleBays. +type ModuleBayInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.ModuleBayLister +} + +type moduleBayInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewModuleBayInformer constructs a new informer for ModuleBay 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 NewModuleBayInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredModuleBayInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredModuleBayInformer constructs a new informer for ModuleBay 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 NewFilteredModuleBayInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InfraV1alpha1().ModuleBays(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InfraV1alpha1().ModuleBays(namespace).Watch(context.TODO(), options) + }, + }, + &infrav1alpha1.ModuleBay{}, + resyncPeriod, + indexers, + ) +} + +func (f *moduleBayInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredModuleBayInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *moduleBayInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&infrav1alpha1.ModuleBay{}, f.defaultInformer) +} + +func (f *moduleBayInformer) Lister() v1alpha1.ModuleBayLister { + return v1alpha1.NewModuleBayLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/informers/externalversions/infra/v1alpha1/node.go b/pkg/generated/informers/externalversions/infra/v1alpha1/node.go new file mode 100644 index 0000000..32fc876 --- /dev/null +++ b/pkg/generated/informers/externalversions/infra/v1alpha1/node.go @@ -0,0 +1,89 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + time "time" + + infrav1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + versioned "github.com/kuidio/kuid/pkg/generated/clientset/versioned" + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kuidio/kuid/pkg/generated/listers/infra/v1alpha1" + v1 "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" +) + +// NodeInformer provides access to a shared informer and lister for +// Nodes. +type NodeInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.NodeLister +} + +type nodeInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewNodeInformer constructs a new informer for Node 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 NewNodeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredNodeInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredNodeInformer constructs a new informer for Node 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 NewFilteredNodeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InfraV1alpha1().Nodes(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InfraV1alpha1().Nodes(namespace).Watch(context.TODO(), options) + }, + }, + &infrav1alpha1.Node{}, + resyncPeriod, + indexers, + ) +} + +func (f *nodeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredNodeInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *nodeInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&infrav1alpha1.Node{}, f.defaultInformer) +} + +func (f *nodeInformer) Lister() v1alpha1.NodeLister { + return v1alpha1.NewNodeLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/informers/externalversions/infra/v1alpha1/nodeitem.go b/pkg/generated/informers/externalversions/infra/v1alpha1/nodeitem.go new file mode 100644 index 0000000..d5cc751 --- /dev/null +++ b/pkg/generated/informers/externalversions/infra/v1alpha1/nodeitem.go @@ -0,0 +1,89 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + time "time" + + infrav1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + versioned "github.com/kuidio/kuid/pkg/generated/clientset/versioned" + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kuidio/kuid/pkg/generated/listers/infra/v1alpha1" + v1 "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" +) + +// NodeItemInformer provides access to a shared informer and lister for +// NodeItems. +type NodeItemInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.NodeItemLister +} + +type nodeItemInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewNodeItemInformer constructs a new informer for NodeItem 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 NewNodeItemInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredNodeItemInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredNodeItemInformer constructs a new informer for NodeItem 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 NewFilteredNodeItemInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InfraV1alpha1().NodeItems(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InfraV1alpha1().NodeItems(namespace).Watch(context.TODO(), options) + }, + }, + &infrav1alpha1.NodeItem{}, + resyncPeriod, + indexers, + ) +} + +func (f *nodeItemInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredNodeItemInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *nodeItemInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&infrav1alpha1.NodeItem{}, f.defaultInformer) +} + +func (f *nodeItemInformer) Lister() v1alpha1.NodeItemLister { + return v1alpha1.NewNodeItemLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/informers/externalversions/infra/v1alpha1/nodeset.go b/pkg/generated/informers/externalversions/infra/v1alpha1/nodeset.go new file mode 100644 index 0000000..a29704b --- /dev/null +++ b/pkg/generated/informers/externalversions/infra/v1alpha1/nodeset.go @@ -0,0 +1,89 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + time "time" + + infrav1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + versioned "github.com/kuidio/kuid/pkg/generated/clientset/versioned" + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kuidio/kuid/pkg/generated/listers/infra/v1alpha1" + v1 "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" +) + +// NodeSetInformer provides access to a shared informer and lister for +// NodeSets. +type NodeSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.NodeSetLister +} + +type nodeSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewNodeSetInformer constructs a new informer for NodeSet 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 NewNodeSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredNodeSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredNodeSetInformer constructs a new informer for NodeSet 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 NewFilteredNodeSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InfraV1alpha1().NodeSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InfraV1alpha1().NodeSets(namespace).Watch(context.TODO(), options) + }, + }, + &infrav1alpha1.NodeSet{}, + resyncPeriod, + indexers, + ) +} + +func (f *nodeSetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredNodeSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *nodeSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&infrav1alpha1.NodeSet{}, f.defaultInformer) +} + +func (f *nodeSetInformer) Lister() v1alpha1.NodeSetLister { + return v1alpha1.NewNodeSetLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/informers/externalversions/infra/v1alpha1/partition.go b/pkg/generated/informers/externalversions/infra/v1alpha1/partition.go new file mode 100644 index 0000000..9517a2c --- /dev/null +++ b/pkg/generated/informers/externalversions/infra/v1alpha1/partition.go @@ -0,0 +1,89 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + time "time" + + infrav1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + versioned "github.com/kuidio/kuid/pkg/generated/clientset/versioned" + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kuidio/kuid/pkg/generated/listers/infra/v1alpha1" + v1 "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" +) + +// PartitionInformer provides access to a shared informer and lister for +// Partitions. +type PartitionInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.PartitionLister +} + +type partitionInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPartitionInformer constructs a new informer for Partition 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 NewPartitionInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPartitionInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredPartitionInformer constructs a new informer for Partition 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 NewFilteredPartitionInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InfraV1alpha1().Partitions(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InfraV1alpha1().Partitions(namespace).Watch(context.TODO(), options) + }, + }, + &infrav1alpha1.Partition{}, + resyncPeriod, + indexers, + ) +} + +func (f *partitionInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPartitionInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *partitionInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&infrav1alpha1.Partition{}, f.defaultInformer) +} + +func (f *partitionInformer) Lister() v1alpha1.PartitionLister { + return v1alpha1.NewPartitionLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/informers/externalversions/infra/v1alpha1/rack.go b/pkg/generated/informers/externalversions/infra/v1alpha1/rack.go new file mode 100644 index 0000000..dc667b1 --- /dev/null +++ b/pkg/generated/informers/externalversions/infra/v1alpha1/rack.go @@ -0,0 +1,89 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + time "time" + + infrav1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + versioned "github.com/kuidio/kuid/pkg/generated/clientset/versioned" + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kuidio/kuid/pkg/generated/listers/infra/v1alpha1" + v1 "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" +) + +// RackInformer provides access to a shared informer and lister for +// Racks. +type RackInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.RackLister +} + +type rackInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewRackInformer constructs a new informer for Rack 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 NewRackInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRackInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredRackInformer constructs a new informer for Rack 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 NewFilteredRackInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InfraV1alpha1().Racks(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InfraV1alpha1().Racks(namespace).Watch(context.TODO(), options) + }, + }, + &infrav1alpha1.Rack{}, + resyncPeriod, + indexers, + ) +} + +func (f *rackInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRackInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *rackInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&infrav1alpha1.Rack{}, f.defaultInformer) +} + +func (f *rackInformer) Lister() v1alpha1.RackLister { + return v1alpha1.NewRackLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/informers/externalversions/infra/v1alpha1/region.go b/pkg/generated/informers/externalversions/infra/v1alpha1/region.go new file mode 100644 index 0000000..29f20d7 --- /dev/null +++ b/pkg/generated/informers/externalversions/infra/v1alpha1/region.go @@ -0,0 +1,89 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + time "time" + + infrav1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + versioned "github.com/kuidio/kuid/pkg/generated/clientset/versioned" + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kuidio/kuid/pkg/generated/listers/infra/v1alpha1" + v1 "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" +) + +// RegionInformer provides access to a shared informer and lister for +// Regions. +type RegionInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.RegionLister +} + +type regionInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewRegionInformer constructs a new informer for Region 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 NewRegionInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRegionInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredRegionInformer constructs a new informer for Region 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 NewFilteredRegionInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InfraV1alpha1().Regions(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InfraV1alpha1().Regions(namespace).Watch(context.TODO(), options) + }, + }, + &infrav1alpha1.Region{}, + resyncPeriod, + indexers, + ) +} + +func (f *regionInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRegionInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *regionInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&infrav1alpha1.Region{}, f.defaultInformer) +} + +func (f *regionInformer) Lister() v1alpha1.RegionLister { + return v1alpha1.NewRegionLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/informers/externalversions/infra/v1alpha1/site.go b/pkg/generated/informers/externalversions/infra/v1alpha1/site.go new file mode 100644 index 0000000..e1997e7 --- /dev/null +++ b/pkg/generated/informers/externalversions/infra/v1alpha1/site.go @@ -0,0 +1,89 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + time "time" + + infrav1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + versioned "github.com/kuidio/kuid/pkg/generated/clientset/versioned" + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kuidio/kuid/pkg/generated/listers/infra/v1alpha1" + v1 "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" +) + +// SiteInformer provides access to a shared informer and lister for +// Sites. +type SiteInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.SiteLister +} + +type siteInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewSiteInformer constructs a new informer for Site 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 NewSiteInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredSiteInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredSiteInformer constructs a new informer for Site 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 NewFilteredSiteInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InfraV1alpha1().Sites(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InfraV1alpha1().Sites(namespace).Watch(context.TODO(), options) + }, + }, + &infrav1alpha1.Site{}, + resyncPeriod, + indexers, + ) +} + +func (f *siteInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredSiteInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *siteInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&infrav1alpha1.Site{}, f.defaultInformer) +} + +func (f *siteInformer) Lister() v1alpha1.SiteLister { + return v1alpha1.NewSiteLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/listers/infra/v1alpha1/cluster.go b/pkg/generated/listers/infra/v1alpha1/cluster.go new file mode 100644 index 0000000..86be714 --- /dev/null +++ b/pkg/generated/listers/infra/v1alpha1/cluster.go @@ -0,0 +1,69 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" + "k8s.io/client-go/tools/cache" +) + +// ClusterLister helps list Clusters. +// All objects returned here must be treated as read-only. +type ClusterLister interface { + // List lists all Clusters in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Cluster, err error) + // Clusters returns an object that can list and get Clusters. + Clusters(namespace string) ClusterNamespaceLister + ClusterListerExpansion +} + +// clusterLister implements the ClusterLister interface. +type clusterLister struct { + listers.ResourceIndexer[*v1alpha1.Cluster] +} + +// NewClusterLister returns a new ClusterLister. +func NewClusterLister(indexer cache.Indexer) ClusterLister { + return &clusterLister{listers.New[*v1alpha1.Cluster](indexer, v1alpha1.Resource("cluster"))} +} + +// Clusters returns an object that can list and get Clusters. +func (s *clusterLister) Clusters(namespace string) ClusterNamespaceLister { + return clusterNamespaceLister{listers.NewNamespaced[*v1alpha1.Cluster](s.ResourceIndexer, namespace)} +} + +// ClusterNamespaceLister helps list and get Clusters. +// All objects returned here must be treated as read-only. +type ClusterNamespaceLister interface { + // List lists all Clusters in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Cluster, err error) + // Get retrieves the Cluster from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.Cluster, error) + ClusterNamespaceListerExpansion +} + +// clusterNamespaceLister implements the ClusterNamespaceLister +// interface. +type clusterNamespaceLister struct { + listers.ResourceIndexer[*v1alpha1.Cluster] +} diff --git a/pkg/generated/listers/infra/v1alpha1/endpoint.go b/pkg/generated/listers/infra/v1alpha1/endpoint.go new file mode 100644 index 0000000..e66844e --- /dev/null +++ b/pkg/generated/listers/infra/v1alpha1/endpoint.go @@ -0,0 +1,69 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" + "k8s.io/client-go/tools/cache" +) + +// EndpointLister helps list Endpoints. +// All objects returned here must be treated as read-only. +type EndpointLister interface { + // List lists all Endpoints in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Endpoint, err error) + // Endpoints returns an object that can list and get Endpoints. + Endpoints(namespace string) EndpointNamespaceLister + EndpointListerExpansion +} + +// endpointLister implements the EndpointLister interface. +type endpointLister struct { + listers.ResourceIndexer[*v1alpha1.Endpoint] +} + +// NewEndpointLister returns a new EndpointLister. +func NewEndpointLister(indexer cache.Indexer) EndpointLister { + return &endpointLister{listers.New[*v1alpha1.Endpoint](indexer, v1alpha1.Resource("endpoint"))} +} + +// Endpoints returns an object that can list and get Endpoints. +func (s *endpointLister) Endpoints(namespace string) EndpointNamespaceLister { + return endpointNamespaceLister{listers.NewNamespaced[*v1alpha1.Endpoint](s.ResourceIndexer, namespace)} +} + +// EndpointNamespaceLister helps list and get Endpoints. +// All objects returned here must be treated as read-only. +type EndpointNamespaceLister interface { + // List lists all Endpoints in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Endpoint, err error) + // Get retrieves the Endpoint from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.Endpoint, error) + EndpointNamespaceListerExpansion +} + +// endpointNamespaceLister implements the EndpointNamespaceLister +// interface. +type endpointNamespaceLister struct { + listers.ResourceIndexer[*v1alpha1.Endpoint] +} diff --git a/pkg/generated/listers/infra/v1alpha1/endpointset.go b/pkg/generated/listers/infra/v1alpha1/endpointset.go new file mode 100644 index 0000000..85fce0e --- /dev/null +++ b/pkg/generated/listers/infra/v1alpha1/endpointset.go @@ -0,0 +1,69 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" + "k8s.io/client-go/tools/cache" +) + +// EndpointSetLister helps list EndpointSets. +// All objects returned here must be treated as read-only. +type EndpointSetLister interface { + // List lists all EndpointSets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.EndpointSet, err error) + // EndpointSets returns an object that can list and get EndpointSets. + EndpointSets(namespace string) EndpointSetNamespaceLister + EndpointSetListerExpansion +} + +// endpointSetLister implements the EndpointSetLister interface. +type endpointSetLister struct { + listers.ResourceIndexer[*v1alpha1.EndpointSet] +} + +// NewEndpointSetLister returns a new EndpointSetLister. +func NewEndpointSetLister(indexer cache.Indexer) EndpointSetLister { + return &endpointSetLister{listers.New[*v1alpha1.EndpointSet](indexer, v1alpha1.Resource("endpointset"))} +} + +// EndpointSets returns an object that can list and get EndpointSets. +func (s *endpointSetLister) EndpointSets(namespace string) EndpointSetNamespaceLister { + return endpointSetNamespaceLister{listers.NewNamespaced[*v1alpha1.EndpointSet](s.ResourceIndexer, namespace)} +} + +// EndpointSetNamespaceLister helps list and get EndpointSets. +// All objects returned here must be treated as read-only. +type EndpointSetNamespaceLister interface { + // List lists all EndpointSets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.EndpointSet, err error) + // Get retrieves the EndpointSet from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.EndpointSet, error) + EndpointSetNamespaceListerExpansion +} + +// endpointSetNamespaceLister implements the EndpointSetNamespaceLister +// interface. +type endpointSetNamespaceLister struct { + listers.ResourceIndexer[*v1alpha1.EndpointSet] +} diff --git a/pkg/generated/listers/infra/v1alpha1/expansion_generated.go b/pkg/generated/listers/infra/v1alpha1/expansion_generated.go new file mode 100644 index 0000000..241995f --- /dev/null +++ b/pkg/generated/listers/infra/v1alpha1/expansion_generated.go @@ -0,0 +1,130 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +// ClusterListerExpansion allows custom methods to be added to +// ClusterLister. +type ClusterListerExpansion interface{} + +// ClusterNamespaceListerExpansion allows custom methods to be added to +// ClusterNamespaceLister. +type ClusterNamespaceListerExpansion interface{} + +// EndpointListerExpansion allows custom methods to be added to +// EndpointLister. +type EndpointListerExpansion interface{} + +// EndpointNamespaceListerExpansion allows custom methods to be added to +// EndpointNamespaceLister. +type EndpointNamespaceListerExpansion interface{} + +// EndpointSetListerExpansion allows custom methods to be added to +// EndpointSetLister. +type EndpointSetListerExpansion interface{} + +// EndpointSetNamespaceListerExpansion allows custom methods to be added to +// EndpointSetNamespaceLister. +type EndpointSetNamespaceListerExpansion interface{} + +// LinkListerExpansion allows custom methods to be added to +// LinkLister. +type LinkListerExpansion interface{} + +// LinkNamespaceListerExpansion allows custom methods to be added to +// LinkNamespaceLister. +type LinkNamespaceListerExpansion interface{} + +// LinkSetListerExpansion allows custom methods to be added to +// LinkSetLister. +type LinkSetListerExpansion interface{} + +// LinkSetNamespaceListerExpansion allows custom methods to be added to +// LinkSetNamespaceLister. +type LinkSetNamespaceListerExpansion interface{} + +// ModuleListerExpansion allows custom methods to be added to +// ModuleLister. +type ModuleListerExpansion interface{} + +// ModuleNamespaceListerExpansion allows custom methods to be added to +// ModuleNamespaceLister. +type ModuleNamespaceListerExpansion interface{} + +// ModuleBayListerExpansion allows custom methods to be added to +// ModuleBayLister. +type ModuleBayListerExpansion interface{} + +// ModuleBayNamespaceListerExpansion allows custom methods to be added to +// ModuleBayNamespaceLister. +type ModuleBayNamespaceListerExpansion interface{} + +// NodeListerExpansion allows custom methods to be added to +// NodeLister. +type NodeListerExpansion interface{} + +// NodeNamespaceListerExpansion allows custom methods to be added to +// NodeNamespaceLister. +type NodeNamespaceListerExpansion interface{} + +// NodeItemListerExpansion allows custom methods to be added to +// NodeItemLister. +type NodeItemListerExpansion interface{} + +// NodeItemNamespaceListerExpansion allows custom methods to be added to +// NodeItemNamespaceLister. +type NodeItemNamespaceListerExpansion interface{} + +// NodeSetListerExpansion allows custom methods to be added to +// NodeSetLister. +type NodeSetListerExpansion interface{} + +// NodeSetNamespaceListerExpansion allows custom methods to be added to +// NodeSetNamespaceLister. +type NodeSetNamespaceListerExpansion interface{} + +// PartitionListerExpansion allows custom methods to be added to +// PartitionLister. +type PartitionListerExpansion interface{} + +// PartitionNamespaceListerExpansion allows custom methods to be added to +// PartitionNamespaceLister. +type PartitionNamespaceListerExpansion interface{} + +// RackListerExpansion allows custom methods to be added to +// RackLister. +type RackListerExpansion interface{} + +// RackNamespaceListerExpansion allows custom methods to be added to +// RackNamespaceLister. +type RackNamespaceListerExpansion interface{} + +// RegionListerExpansion allows custom methods to be added to +// RegionLister. +type RegionListerExpansion interface{} + +// RegionNamespaceListerExpansion allows custom methods to be added to +// RegionNamespaceLister. +type RegionNamespaceListerExpansion interface{} + +// SiteListerExpansion allows custom methods to be added to +// SiteLister. +type SiteListerExpansion interface{} + +// SiteNamespaceListerExpansion allows custom methods to be added to +// SiteNamespaceLister. +type SiteNamespaceListerExpansion interface{} diff --git a/pkg/generated/listers/infra/v1alpha1/link.go b/pkg/generated/listers/infra/v1alpha1/link.go new file mode 100644 index 0000000..7317c24 --- /dev/null +++ b/pkg/generated/listers/infra/v1alpha1/link.go @@ -0,0 +1,69 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" + "k8s.io/client-go/tools/cache" +) + +// LinkLister helps list Links. +// All objects returned here must be treated as read-only. +type LinkLister interface { + // List lists all Links in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Link, err error) + // Links returns an object that can list and get Links. + Links(namespace string) LinkNamespaceLister + LinkListerExpansion +} + +// linkLister implements the LinkLister interface. +type linkLister struct { + listers.ResourceIndexer[*v1alpha1.Link] +} + +// NewLinkLister returns a new LinkLister. +func NewLinkLister(indexer cache.Indexer) LinkLister { + return &linkLister{listers.New[*v1alpha1.Link](indexer, v1alpha1.Resource("link"))} +} + +// Links returns an object that can list and get Links. +func (s *linkLister) Links(namespace string) LinkNamespaceLister { + return linkNamespaceLister{listers.NewNamespaced[*v1alpha1.Link](s.ResourceIndexer, namespace)} +} + +// LinkNamespaceLister helps list and get Links. +// All objects returned here must be treated as read-only. +type LinkNamespaceLister interface { + // List lists all Links in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Link, err error) + // Get retrieves the Link from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.Link, error) + LinkNamespaceListerExpansion +} + +// linkNamespaceLister implements the LinkNamespaceLister +// interface. +type linkNamespaceLister struct { + listers.ResourceIndexer[*v1alpha1.Link] +} diff --git a/pkg/generated/listers/infra/v1alpha1/linkset.go b/pkg/generated/listers/infra/v1alpha1/linkset.go new file mode 100644 index 0000000..8a204e1 --- /dev/null +++ b/pkg/generated/listers/infra/v1alpha1/linkset.go @@ -0,0 +1,69 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" + "k8s.io/client-go/tools/cache" +) + +// LinkSetLister helps list LinkSets. +// All objects returned here must be treated as read-only. +type LinkSetLister interface { + // List lists all LinkSets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.LinkSet, err error) + // LinkSets returns an object that can list and get LinkSets. + LinkSets(namespace string) LinkSetNamespaceLister + LinkSetListerExpansion +} + +// linkSetLister implements the LinkSetLister interface. +type linkSetLister struct { + listers.ResourceIndexer[*v1alpha1.LinkSet] +} + +// NewLinkSetLister returns a new LinkSetLister. +func NewLinkSetLister(indexer cache.Indexer) LinkSetLister { + return &linkSetLister{listers.New[*v1alpha1.LinkSet](indexer, v1alpha1.Resource("linkset"))} +} + +// LinkSets returns an object that can list and get LinkSets. +func (s *linkSetLister) LinkSets(namespace string) LinkSetNamespaceLister { + return linkSetNamespaceLister{listers.NewNamespaced[*v1alpha1.LinkSet](s.ResourceIndexer, namespace)} +} + +// LinkSetNamespaceLister helps list and get LinkSets. +// All objects returned here must be treated as read-only. +type LinkSetNamespaceLister interface { + // List lists all LinkSets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.LinkSet, err error) + // Get retrieves the LinkSet from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.LinkSet, error) + LinkSetNamespaceListerExpansion +} + +// linkSetNamespaceLister implements the LinkSetNamespaceLister +// interface. +type linkSetNamespaceLister struct { + listers.ResourceIndexer[*v1alpha1.LinkSet] +} diff --git a/pkg/generated/listers/infra/v1alpha1/module.go b/pkg/generated/listers/infra/v1alpha1/module.go new file mode 100644 index 0000000..53c989a --- /dev/null +++ b/pkg/generated/listers/infra/v1alpha1/module.go @@ -0,0 +1,69 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" + "k8s.io/client-go/tools/cache" +) + +// ModuleLister helps list Modules. +// All objects returned here must be treated as read-only. +type ModuleLister interface { + // List lists all Modules in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Module, err error) + // Modules returns an object that can list and get Modules. + Modules(namespace string) ModuleNamespaceLister + ModuleListerExpansion +} + +// moduleLister implements the ModuleLister interface. +type moduleLister struct { + listers.ResourceIndexer[*v1alpha1.Module] +} + +// NewModuleLister returns a new ModuleLister. +func NewModuleLister(indexer cache.Indexer) ModuleLister { + return &moduleLister{listers.New[*v1alpha1.Module](indexer, v1alpha1.Resource("module"))} +} + +// Modules returns an object that can list and get Modules. +func (s *moduleLister) Modules(namespace string) ModuleNamespaceLister { + return moduleNamespaceLister{listers.NewNamespaced[*v1alpha1.Module](s.ResourceIndexer, namespace)} +} + +// ModuleNamespaceLister helps list and get Modules. +// All objects returned here must be treated as read-only. +type ModuleNamespaceLister interface { + // List lists all Modules in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Module, err error) + // Get retrieves the Module from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.Module, error) + ModuleNamespaceListerExpansion +} + +// moduleNamespaceLister implements the ModuleNamespaceLister +// interface. +type moduleNamespaceLister struct { + listers.ResourceIndexer[*v1alpha1.Module] +} diff --git a/pkg/generated/listers/infra/v1alpha1/modulebay.go b/pkg/generated/listers/infra/v1alpha1/modulebay.go new file mode 100644 index 0000000..b30bbd2 --- /dev/null +++ b/pkg/generated/listers/infra/v1alpha1/modulebay.go @@ -0,0 +1,69 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" + "k8s.io/client-go/tools/cache" +) + +// ModuleBayLister helps list ModuleBays. +// All objects returned here must be treated as read-only. +type ModuleBayLister interface { + // List lists all ModuleBays in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.ModuleBay, err error) + // ModuleBays returns an object that can list and get ModuleBays. + ModuleBays(namespace string) ModuleBayNamespaceLister + ModuleBayListerExpansion +} + +// moduleBayLister implements the ModuleBayLister interface. +type moduleBayLister struct { + listers.ResourceIndexer[*v1alpha1.ModuleBay] +} + +// NewModuleBayLister returns a new ModuleBayLister. +func NewModuleBayLister(indexer cache.Indexer) ModuleBayLister { + return &moduleBayLister{listers.New[*v1alpha1.ModuleBay](indexer, v1alpha1.Resource("modulebay"))} +} + +// ModuleBays returns an object that can list and get ModuleBays. +func (s *moduleBayLister) ModuleBays(namespace string) ModuleBayNamespaceLister { + return moduleBayNamespaceLister{listers.NewNamespaced[*v1alpha1.ModuleBay](s.ResourceIndexer, namespace)} +} + +// ModuleBayNamespaceLister helps list and get ModuleBays. +// All objects returned here must be treated as read-only. +type ModuleBayNamespaceLister interface { + // List lists all ModuleBays in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.ModuleBay, err error) + // Get retrieves the ModuleBay from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.ModuleBay, error) + ModuleBayNamespaceListerExpansion +} + +// moduleBayNamespaceLister implements the ModuleBayNamespaceLister +// interface. +type moduleBayNamespaceLister struct { + listers.ResourceIndexer[*v1alpha1.ModuleBay] +} diff --git a/pkg/generated/listers/infra/v1alpha1/node.go b/pkg/generated/listers/infra/v1alpha1/node.go new file mode 100644 index 0000000..4e7e0fb --- /dev/null +++ b/pkg/generated/listers/infra/v1alpha1/node.go @@ -0,0 +1,69 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" + "k8s.io/client-go/tools/cache" +) + +// NodeLister helps list Nodes. +// All objects returned here must be treated as read-only. +type NodeLister interface { + // List lists all Nodes in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Node, err error) + // Nodes returns an object that can list and get Nodes. + Nodes(namespace string) NodeNamespaceLister + NodeListerExpansion +} + +// nodeLister implements the NodeLister interface. +type nodeLister struct { + listers.ResourceIndexer[*v1alpha1.Node] +} + +// NewNodeLister returns a new NodeLister. +func NewNodeLister(indexer cache.Indexer) NodeLister { + return &nodeLister{listers.New[*v1alpha1.Node](indexer, v1alpha1.Resource("node"))} +} + +// Nodes returns an object that can list and get Nodes. +func (s *nodeLister) Nodes(namespace string) NodeNamespaceLister { + return nodeNamespaceLister{listers.NewNamespaced[*v1alpha1.Node](s.ResourceIndexer, namespace)} +} + +// NodeNamespaceLister helps list and get Nodes. +// All objects returned here must be treated as read-only. +type NodeNamespaceLister interface { + // List lists all Nodes in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Node, err error) + // Get retrieves the Node from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.Node, error) + NodeNamespaceListerExpansion +} + +// nodeNamespaceLister implements the NodeNamespaceLister +// interface. +type nodeNamespaceLister struct { + listers.ResourceIndexer[*v1alpha1.Node] +} diff --git a/pkg/generated/listers/infra/v1alpha1/nodeitem.go b/pkg/generated/listers/infra/v1alpha1/nodeitem.go new file mode 100644 index 0000000..8c905a7 --- /dev/null +++ b/pkg/generated/listers/infra/v1alpha1/nodeitem.go @@ -0,0 +1,69 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" + "k8s.io/client-go/tools/cache" +) + +// NodeItemLister helps list NodeItems. +// All objects returned here must be treated as read-only. +type NodeItemLister interface { + // List lists all NodeItems in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.NodeItem, err error) + // NodeItems returns an object that can list and get NodeItems. + NodeItems(namespace string) NodeItemNamespaceLister + NodeItemListerExpansion +} + +// nodeItemLister implements the NodeItemLister interface. +type nodeItemLister struct { + listers.ResourceIndexer[*v1alpha1.NodeItem] +} + +// NewNodeItemLister returns a new NodeItemLister. +func NewNodeItemLister(indexer cache.Indexer) NodeItemLister { + return &nodeItemLister{listers.New[*v1alpha1.NodeItem](indexer, v1alpha1.Resource("nodeitem"))} +} + +// NodeItems returns an object that can list and get NodeItems. +func (s *nodeItemLister) NodeItems(namespace string) NodeItemNamespaceLister { + return nodeItemNamespaceLister{listers.NewNamespaced[*v1alpha1.NodeItem](s.ResourceIndexer, namespace)} +} + +// NodeItemNamespaceLister helps list and get NodeItems. +// All objects returned here must be treated as read-only. +type NodeItemNamespaceLister interface { + // List lists all NodeItems in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.NodeItem, err error) + // Get retrieves the NodeItem from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.NodeItem, error) + NodeItemNamespaceListerExpansion +} + +// nodeItemNamespaceLister implements the NodeItemNamespaceLister +// interface. +type nodeItemNamespaceLister struct { + listers.ResourceIndexer[*v1alpha1.NodeItem] +} diff --git a/pkg/generated/listers/infra/v1alpha1/nodeset.go b/pkg/generated/listers/infra/v1alpha1/nodeset.go new file mode 100644 index 0000000..e6efbfc --- /dev/null +++ b/pkg/generated/listers/infra/v1alpha1/nodeset.go @@ -0,0 +1,69 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" + "k8s.io/client-go/tools/cache" +) + +// NodeSetLister helps list NodeSets. +// All objects returned here must be treated as read-only. +type NodeSetLister interface { + // List lists all NodeSets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.NodeSet, err error) + // NodeSets returns an object that can list and get NodeSets. + NodeSets(namespace string) NodeSetNamespaceLister + NodeSetListerExpansion +} + +// nodeSetLister implements the NodeSetLister interface. +type nodeSetLister struct { + listers.ResourceIndexer[*v1alpha1.NodeSet] +} + +// NewNodeSetLister returns a new NodeSetLister. +func NewNodeSetLister(indexer cache.Indexer) NodeSetLister { + return &nodeSetLister{listers.New[*v1alpha1.NodeSet](indexer, v1alpha1.Resource("nodeset"))} +} + +// NodeSets returns an object that can list and get NodeSets. +func (s *nodeSetLister) NodeSets(namespace string) NodeSetNamespaceLister { + return nodeSetNamespaceLister{listers.NewNamespaced[*v1alpha1.NodeSet](s.ResourceIndexer, namespace)} +} + +// NodeSetNamespaceLister helps list and get NodeSets. +// All objects returned here must be treated as read-only. +type NodeSetNamespaceLister interface { + // List lists all NodeSets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.NodeSet, err error) + // Get retrieves the NodeSet from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.NodeSet, error) + NodeSetNamespaceListerExpansion +} + +// nodeSetNamespaceLister implements the NodeSetNamespaceLister +// interface. +type nodeSetNamespaceLister struct { + listers.ResourceIndexer[*v1alpha1.NodeSet] +} diff --git a/pkg/generated/listers/infra/v1alpha1/partition.go b/pkg/generated/listers/infra/v1alpha1/partition.go new file mode 100644 index 0000000..8b0af5e --- /dev/null +++ b/pkg/generated/listers/infra/v1alpha1/partition.go @@ -0,0 +1,69 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" + "k8s.io/client-go/tools/cache" +) + +// PartitionLister helps list Partitions. +// All objects returned here must be treated as read-only. +type PartitionLister interface { + // List lists all Partitions in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Partition, err error) + // Partitions returns an object that can list and get Partitions. + Partitions(namespace string) PartitionNamespaceLister + PartitionListerExpansion +} + +// partitionLister implements the PartitionLister interface. +type partitionLister struct { + listers.ResourceIndexer[*v1alpha1.Partition] +} + +// NewPartitionLister returns a new PartitionLister. +func NewPartitionLister(indexer cache.Indexer) PartitionLister { + return &partitionLister{listers.New[*v1alpha1.Partition](indexer, v1alpha1.Resource("partition"))} +} + +// Partitions returns an object that can list and get Partitions. +func (s *partitionLister) Partitions(namespace string) PartitionNamespaceLister { + return partitionNamespaceLister{listers.NewNamespaced[*v1alpha1.Partition](s.ResourceIndexer, namespace)} +} + +// PartitionNamespaceLister helps list and get Partitions. +// All objects returned here must be treated as read-only. +type PartitionNamespaceLister interface { + // List lists all Partitions in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Partition, err error) + // Get retrieves the Partition from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.Partition, error) + PartitionNamespaceListerExpansion +} + +// partitionNamespaceLister implements the PartitionNamespaceLister +// interface. +type partitionNamespaceLister struct { + listers.ResourceIndexer[*v1alpha1.Partition] +} diff --git a/pkg/generated/listers/infra/v1alpha1/rack.go b/pkg/generated/listers/infra/v1alpha1/rack.go new file mode 100644 index 0000000..6246392 --- /dev/null +++ b/pkg/generated/listers/infra/v1alpha1/rack.go @@ -0,0 +1,69 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" + "k8s.io/client-go/tools/cache" +) + +// RackLister helps list Racks. +// All objects returned here must be treated as read-only. +type RackLister interface { + // List lists all Racks in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Rack, err error) + // Racks returns an object that can list and get Racks. + Racks(namespace string) RackNamespaceLister + RackListerExpansion +} + +// rackLister implements the RackLister interface. +type rackLister struct { + listers.ResourceIndexer[*v1alpha1.Rack] +} + +// NewRackLister returns a new RackLister. +func NewRackLister(indexer cache.Indexer) RackLister { + return &rackLister{listers.New[*v1alpha1.Rack](indexer, v1alpha1.Resource("rack"))} +} + +// Racks returns an object that can list and get Racks. +func (s *rackLister) Racks(namespace string) RackNamespaceLister { + return rackNamespaceLister{listers.NewNamespaced[*v1alpha1.Rack](s.ResourceIndexer, namespace)} +} + +// RackNamespaceLister helps list and get Racks. +// All objects returned here must be treated as read-only. +type RackNamespaceLister interface { + // List lists all Racks in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Rack, err error) + // Get retrieves the Rack from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.Rack, error) + RackNamespaceListerExpansion +} + +// rackNamespaceLister implements the RackNamespaceLister +// interface. +type rackNamespaceLister struct { + listers.ResourceIndexer[*v1alpha1.Rack] +} diff --git a/pkg/generated/listers/infra/v1alpha1/region.go b/pkg/generated/listers/infra/v1alpha1/region.go new file mode 100644 index 0000000..6b51500 --- /dev/null +++ b/pkg/generated/listers/infra/v1alpha1/region.go @@ -0,0 +1,69 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" + "k8s.io/client-go/tools/cache" +) + +// RegionLister helps list Regions. +// All objects returned here must be treated as read-only. +type RegionLister interface { + // List lists all Regions in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Region, err error) + // Regions returns an object that can list and get Regions. + Regions(namespace string) RegionNamespaceLister + RegionListerExpansion +} + +// regionLister implements the RegionLister interface. +type regionLister struct { + listers.ResourceIndexer[*v1alpha1.Region] +} + +// NewRegionLister returns a new RegionLister. +func NewRegionLister(indexer cache.Indexer) RegionLister { + return ®ionLister{listers.New[*v1alpha1.Region](indexer, v1alpha1.Resource("region"))} +} + +// Regions returns an object that can list and get Regions. +func (s *regionLister) Regions(namespace string) RegionNamespaceLister { + return regionNamespaceLister{listers.NewNamespaced[*v1alpha1.Region](s.ResourceIndexer, namespace)} +} + +// RegionNamespaceLister helps list and get Regions. +// All objects returned here must be treated as read-only. +type RegionNamespaceLister interface { + // List lists all Regions in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Region, err error) + // Get retrieves the Region from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.Region, error) + RegionNamespaceListerExpansion +} + +// regionNamespaceLister implements the RegionNamespaceLister +// interface. +type regionNamespaceLister struct { + listers.ResourceIndexer[*v1alpha1.Region] +} diff --git a/pkg/generated/listers/infra/v1alpha1/site.go b/pkg/generated/listers/infra/v1alpha1/site.go new file mode 100644 index 0000000..f36fae4 --- /dev/null +++ b/pkg/generated/listers/infra/v1alpha1/site.go @@ -0,0 +1,69 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" + "k8s.io/client-go/tools/cache" +) + +// SiteLister helps list Sites. +// All objects returned here must be treated as read-only. +type SiteLister interface { + // List lists all Sites in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Site, err error) + // Sites returns an object that can list and get Sites. + Sites(namespace string) SiteNamespaceLister + SiteListerExpansion +} + +// siteLister implements the SiteLister interface. +type siteLister struct { + listers.ResourceIndexer[*v1alpha1.Site] +} + +// NewSiteLister returns a new SiteLister. +func NewSiteLister(indexer cache.Indexer) SiteLister { + return &siteLister{listers.New[*v1alpha1.Site](indexer, v1alpha1.Resource("site"))} +} + +// Sites returns an object that can list and get Sites. +func (s *siteLister) Sites(namespace string) SiteNamespaceLister { + return siteNamespaceLister{listers.NewNamespaced[*v1alpha1.Site](s.ResourceIndexer, namespace)} +} + +// SiteNamespaceLister helps list and get Sites. +// All objects returned here must be treated as read-only. +type SiteNamespaceLister interface { + // List lists all Sites in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Site, err error) + // Get retrieves the Site from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.Site, error) + SiteNamespaceListerExpansion +} + +// siteNamespaceLister implements the SiteNamespaceLister +// interface. +type siteNamespaceLister struct { + listers.ResourceIndexer[*v1alpha1.Site] +} diff --git a/pkg/generated/openapi/zz_generated.openapi.go b/pkg/generated/openapi/zz_generated.openapi.go index c0ec2fc..67365c3 100644 --- a/pkg/generated/openapi/zz_generated.openapi.go +++ b/pkg/generated/openapi/zz_generated.openapi.go @@ -56,6 +56,63 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/kuidio/kuid/apis/id/v1alpha1.PartitionNodeID": schema_kuid_apis_id_v1alpha1_PartitionNodeID(ref), "github.com/kuidio/kuid/apis/id/v1alpha1.PortID": schema_kuid_apis_id_v1alpha1_PortID(ref), "github.com/kuidio/kuid/apis/id/v1alpha1.SiteID": schema_kuid_apis_id_v1alpha1_SiteID(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.Cluster": schema_kuid_apis_infra_v1alpha1_Cluster(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.ClusterList": schema_kuid_apis_infra_v1alpha1_ClusterList(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.ClusterSpec": schema_kuid_apis_infra_v1alpha1_ClusterSpec(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.ClusterStatus": schema_kuid_apis_infra_v1alpha1_ClusterStatus(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.Endpoint": schema_kuid_apis_infra_v1alpha1_Endpoint(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.EndpointList": schema_kuid_apis_infra_v1alpha1_EndpointList(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.EndpointSet": schema_kuid_apis_infra_v1alpha1_EndpointSet(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.EndpointSetList": schema_kuid_apis_infra_v1alpha1_EndpointSetList(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.EndpointSetSpec": schema_kuid_apis_infra_v1alpha1_EndpointSetSpec(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.EndpointSetStatus": schema_kuid_apis_infra_v1alpha1_EndpointSetStatus(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.EndpointSpec": schema_kuid_apis_infra_v1alpha1_EndpointSpec(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.EndpointStatus": schema_kuid_apis_infra_v1alpha1_EndpointStatus(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.Link": schema_kuid_apis_infra_v1alpha1_Link(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.LinkList": schema_kuid_apis_infra_v1alpha1_LinkList(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.LinkSet": schema_kuid_apis_infra_v1alpha1_LinkSet(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.LinkSetList": schema_kuid_apis_infra_v1alpha1_LinkSetList(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.LinkSetSpec": schema_kuid_apis_infra_v1alpha1_LinkSetSpec(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.LinkSetStatus": schema_kuid_apis_infra_v1alpha1_LinkSetStatus(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.LinkSpec": schema_kuid_apis_infra_v1alpha1_LinkSpec(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.LinkStatus": schema_kuid_apis_infra_v1alpha1_LinkStatus(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.Location": schema_kuid_apis_infra_v1alpha1_Location(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.Module": schema_kuid_apis_infra_v1alpha1_Module(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.ModuleBay": schema_kuid_apis_infra_v1alpha1_ModuleBay(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.ModuleBayList": schema_kuid_apis_infra_v1alpha1_ModuleBayList(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.ModuleBaySpec": schema_kuid_apis_infra_v1alpha1_ModuleBaySpec(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.ModuleBayStatus": schema_kuid_apis_infra_v1alpha1_ModuleBayStatus(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.ModuleList": schema_kuid_apis_infra_v1alpha1_ModuleList(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.ModuleSpec": schema_kuid_apis_infra_v1alpha1_ModuleSpec(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.ModuleStatus": schema_kuid_apis_infra_v1alpha1_ModuleStatus(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.Node": schema_kuid_apis_infra_v1alpha1_Node(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeItem": schema_kuid_apis_infra_v1alpha1_NodeItem(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeItemList": schema_kuid_apis_infra_v1alpha1_NodeItemList(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeItemSpec": schema_kuid_apis_infra_v1alpha1_NodeItemSpec(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeItemStatus": schema_kuid_apis_infra_v1alpha1_NodeItemStatus(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeList": schema_kuid_apis_infra_v1alpha1_NodeList(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeSet": schema_kuid_apis_infra_v1alpha1_NodeSet(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeSetList": schema_kuid_apis_infra_v1alpha1_NodeSetList(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeSetSpec": schema_kuid_apis_infra_v1alpha1_NodeSetSpec(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeSetStatus": schema_kuid_apis_infra_v1alpha1_NodeSetStatus(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeSpec": schema_kuid_apis_infra_v1alpha1_NodeSpec(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeStatus": schema_kuid_apis_infra_v1alpha1_NodeStatus(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.Partition": schema_kuid_apis_infra_v1alpha1_Partition(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.PartitionList": schema_kuid_apis_infra_v1alpha1_PartitionList(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.PartitionSpec": schema_kuid_apis_infra_v1alpha1_PartitionSpec(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.PartitionStatus": schema_kuid_apis_infra_v1alpha1_PartitionStatus(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.Rack": schema_kuid_apis_infra_v1alpha1_Rack(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.RackList": schema_kuid_apis_infra_v1alpha1_RackList(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.RackSpec": schema_kuid_apis_infra_v1alpha1_RackSpec(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.RackStatus": schema_kuid_apis_infra_v1alpha1_RackStatus(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.Region": schema_kuid_apis_infra_v1alpha1_Region(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.RegionList": schema_kuid_apis_infra_v1alpha1_RegionList(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.RegionSpec": schema_kuid_apis_infra_v1alpha1_RegionSpec(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.RegionStatus": schema_kuid_apis_infra_v1alpha1_RegionStatus(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.Site": schema_kuid_apis_infra_v1alpha1_Site(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.SiteList": schema_kuid_apis_infra_v1alpha1_SiteList(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.SiteSpec": schema_kuid_apis_infra_v1alpha1_SiteSpec(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.SiteStatus": schema_kuid_apis_infra_v1alpha1_SiteStatus(ref), "k8s.io/apimachinery/pkg/api/resource.Quantity": schema_apimachinery_pkg_api_resource_Quantity(ref), "k8s.io/apimachinery/pkg/api/resource.int64Amount": schema_apimachinery_pkg_api_resource_int64Amount(ref), "k8s.io/apimachinery/pkg/apis/meta/v1.APIGroup": schema_pkg_apis_meta_v1_APIGroup(ref), @@ -1450,6 +1507,2716 @@ func schema_kuid_apis_id_v1alpha1_SiteID(ref common.ReferenceCallback) common.Op } } +func schema_kuid_apis_infra_v1alpha1_Cluster(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "A Cluster represents a kubernetes cluster and is typically used as a nodeGroup identifier.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.ClusterSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.ClusterStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.ClusterSpec", "github.com/kuidio/kuid/apis/infra/v1alpha1.ClusterStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_ClusterList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ClusterList contains a list of Clusters", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.Cluster"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.Cluster", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_ClusterSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ClusterSpec defines the desired state of Cluster", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "partition": { + SchemaProps: spec.SchemaProps{ + Description: "Partition defines the partition this resource belongs to", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "region": { + SchemaProps: spec.SchemaProps{ + Description: "Region defines the region of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "site": { + SchemaProps: spec.SchemaProps{ + Description: "Site defines the site of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "cluster": { + SchemaProps: spec.SchemaProps{ + Description: "Cluster defines the name of the cluster", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "provider": { + SchemaProps: spec.SchemaProps{ + Description: "Provider defines the provider implementing this resource.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "location": { + SchemaProps: spec.SchemaProps{ + Description: "Location defines the location information where this resource is located in lon/lat coordinates", + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.Location"), + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels as user defined labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"partition", "region", "site", "cluster", "provider"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.Location"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_ClusterStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ClusterStatus defines the observed state of Cluster", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_Endpoint(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "An Endpoint represents a communication interface or connection point within a Node, facilitating network communication and data transfer between different components or systems within the environment. `Endpoints` serve as gateways for transmitting and receiving data, enabling seamless communication between Nodes.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.EndpointSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.EndpointStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.EndpointSpec", "github.com/kuidio/kuid/apis/infra/v1alpha1.EndpointStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_EndpointList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "EndpointList contains a list of Endpoints", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.Endpoint"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.Endpoint", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_EndpointSet(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "A EndpointSet represents a set of endpoints that belong together within a nodeGroup. E.g. it can be used to model a logical Link Aggregation group within a node or it can be used to represent a logical multi-homing construction between a set of nodes belonging to a single nodeGroup.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.EndpointSetSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.EndpointSetStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.EndpointSetSpec", "github.com/kuidio/kuid/apis/infra/v1alpha1.EndpointSetStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_EndpointSetList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "EndpointSetList contains a list of EndpointSets", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.EndpointSet"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.EndpointSet", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_EndpointSetSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "EndpointSetSpec defines the desired state of EndpointSet An EndpointSet can be a LAG (single Homed) or ESI (multiHomed). The EndpointSet can only belong to a single NodeGroup", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "endpoints": { + SchemaProps: spec.SchemaProps{ + Description: "Endpoints defines the Endpoints that are part of the EndpointSet Min 1, Max 16", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/kuidio/kuid/apis/id/v1alpha1.PartitionEndpointID"), + }, + }, + }, + }, + }, + "lacp": { + SchemaProps: spec.SchemaProps{ + Description: "Lacp defines if the lag enabled LACP", + Type: []string{"boolean"}, + Format: "", + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels as user defined labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"endpoints"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/id/v1alpha1.PartitionEndpointID"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_EndpointSetStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "EndpointSetStatus defines the observed state of EndpointSet", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"), + }, + }, + }, + }, + }, + "esi": { + SchemaProps: spec.SchemaProps{ + Description: "ESI defines the ethernet segment identifier of the logical link if set this is a multi-homed logical endpoint the ESI is a global unique identifier within the administrative domain", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "lagID": { + SchemaProps: spec.SchemaProps{ + Description: "LagId defines the lag id for the logical single-homed or multi-homed endpoint", + Type: []string{"integer"}, + Format: "int64", + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_EndpointSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "EndpointSpec defines the desired state of Endpoint", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "partition": { + SchemaProps: spec.SchemaProps{ + Description: "Partition defines the partition this resource belongs to", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "region": { + SchemaProps: spec.SchemaProps{ + Description: "Region defines the region of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "site": { + SchemaProps: spec.SchemaProps{ + Description: "Site defines the site of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "node": { + SchemaProps: spec.SchemaProps{ + Description: "Node defines the name of the node", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "moduleBay": { + SchemaProps: spec.SchemaProps{ + Description: "ModuleBay defines the moduleBay reference id", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "module": { + SchemaProps: spec.SchemaProps{ + Description: "Module defines the module reference id", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "port": { + SchemaProps: spec.SchemaProps{ + Description: "Port defines the id of the port", + Default: 0, + Type: []string{"integer"}, + Format: "int32", + }, + }, + "adaptor": { + SchemaProps: spec.SchemaProps{ + Description: "Adaptor defines the name of the adaptor", + Type: []string{"string"}, + Format: "", + }, + }, + "endpoint": { + SchemaProps: spec.SchemaProps{ + Description: "Endpoint defines the name of the endpoint", + Default: 0, + Type: []string{"integer"}, + Format: "int32", + }, + }, + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name is used to refer to internal names of the node", + Type: []string{"string"}, + Format: "", + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels as user defined labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "speed": { + SchemaProps: spec.SchemaProps{ + Description: "(Gbps)", + Type: []string{"string"}, + Format: "", + }, + }, + "vlanTagging": { + SchemaProps: spec.SchemaProps{ + Description: "VLANTagging defines if VLAN tagging is enabled or disabled on the interface", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"partition", "region", "site", "node", "port", "endpoint"}, + }, + }, + } +} + +func schema_kuid_apis_infra_v1alpha1_EndpointStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "EndpointStatus defines the observed state of Endpoint", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_Link(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "A link represents a physical/logical connection that enables communication and data transfer between 2 endpoints of a node.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.LinkSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.LinkStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.LinkSpec", "github.com/kuidio/kuid/apis/infra/v1alpha1.LinkStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_LinkList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "LinkList contains a list of Links", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.Link"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.Link", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_LinkSet(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "A linkSet represents a set of links that belong together within a node group or accross nodeGroups. E.g. it can be used to model a logical Link Aggregation group between 2 nodes or it can be used to represent a logical multi-homing construction between a set of nodes belonging to 1 or multiple nodeGroups/Topologies.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.LinkSetSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.LinkSetStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.LinkSetSpec", "github.com/kuidio/kuid/apis/infra/v1alpha1.LinkSetStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_LinkSetList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "LinkSetList contains a list of LinkSets", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.LinkSet"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.LinkSet", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_LinkSetSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "LinkSetSpec defines the desired state of LinkSet", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "endpoints": { + SchemaProps: spec.SchemaProps{ + Description: "Endpoints define the endpoint identifiers of the LinkSet", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/kuidio/kuid/apis/id/v1alpha1.PartitionEndpointID"), + }, + }, + }, + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels as user defined labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"endpoints"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/id/v1alpha1.PartitionEndpointID"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_LinkSetStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "LinkSetStatus defines the observed state of LinkSet", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"), + }, + }, + }, + }, + }, + "esi": { + SchemaProps: spec.SchemaProps{ + Description: "ESI defines the ethernet segment identifier of the logical link if set this is a multi-homed linkset the ESI is a global unique identifier within the administrative domain/topology", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "lagId": { + SchemaProps: spec.SchemaProps{ + Description: "LagId defines the lag id for the logical single-homed or multi-homed endpoint", + Type: []string{"integer"}, + Format: "int64", + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_LinkSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "LinkSpec defines the desired state of Link", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "endpoints": { + SchemaProps: spec.SchemaProps{ + Description: "Endpoints define the 2 endpoint identifiers of the link Can only have 2 endpoints", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/kuidio/kuid/apis/id/v1alpha1.PartitionEndpointID"), + }, + }, + }, + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels as user defined labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"endpoints"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/id/v1alpha1.PartitionEndpointID"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_LinkStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "LinkStatus defines the observed state of Link", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_Location(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "latitude": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "longitude": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"latitude", "longitude"}, + }, + }, + } +} + +func schema_kuid_apis_infra_v1alpha1_Module(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "A module refers to a hardware component or expansion module that can be installed within a ModuleBay of a Node. Modules provide additional functionality and capabilities to the infrastructure environment, allowing users to enhance and customize their deployments according to specific requirements.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.ModuleSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.ModuleStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.ModuleSpec", "github.com/kuidio/kuid/apis/infra/v1alpha1.ModuleStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_ModuleBay(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "A ModuleBay serves as a modular slot or enclosure within a Node, designed to accommodate additional modules. ModuleBays provide a flexible and scalable approach to extending the capabilities of Nodes, allowing users to customize and enhance their infrastructure deployments according to specific requirements.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.ModuleBaySpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.ModuleBayStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.ModuleBaySpec", "github.com/kuidio/kuid/apis/infra/v1alpha1.ModuleBayStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_ModuleBayList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ModuleBayList contains a list of ModuleBays", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.ModuleBay"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.ModuleBay", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_ModuleBaySpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ModuleBaySpec defines the desired state of ModuleBay", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "partition": { + SchemaProps: spec.SchemaProps{ + Description: "Partition defines the partition this resource belongs to", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "region": { + SchemaProps: spec.SchemaProps{ + Description: "Region defines the region of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "site": { + SchemaProps: spec.SchemaProps{ + Description: "Site defines the site of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "node": { + SchemaProps: spec.SchemaProps{ + Description: "Node defines the name of the node", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "psoition": { + SchemaProps: spec.SchemaProps{ + Description: "Position defines the position in the node the moduleBay is deployed", + Default: 0, + Type: []string{"integer"}, + Format: "int32", + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels as user defined labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"partition", "region", "site", "node", "psoition"}, + }, + }, + } +} + +func schema_kuid_apis_infra_v1alpha1_ModuleBayStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ModuleBayStatus defines the observed state of ModuleBay", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_ModuleList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ModuleList contains a list of Modules", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.Module"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.Module", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_ModuleSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ModuleSpec defines the desired state of Module", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "partition": { + SchemaProps: spec.SchemaProps{ + Description: "Partition defines the partition this resource belongs to", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "region": { + SchemaProps: spec.SchemaProps{ + Description: "Region defines the region of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "site": { + SchemaProps: spec.SchemaProps{ + Description: "Site defines the site of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "node": { + SchemaProps: spec.SchemaProps{ + Description: "Node defines the name of the node", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "moduleBay": { + SchemaProps: spec.SchemaProps{ + Description: "ModuelBay defines the bay in which the module is deployed", + Default: 0, + Type: []string{"integer"}, + Format: "int32", + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels as user defined labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"partition", "region", "site", "node", "moduleBay"}, + }, + }, + } +} + +func schema_kuid_apis_infra_v1alpha1_ModuleStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ModuleStatus defines the observed state of Module", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_Node(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "A Node represents a fundamental unit that implements compute, storage, and/or networking within your environment. Nodes can embody physical, virtual, or containerized entities, offering versatility in deployment options to suit diverse infrastructure requirements. Nodes are logically organized within racks and sites/regions, establishing a hierarchical structure for efficient resource management and organization. Additionally, Nodes are associated with nodeGroups, facilitating centralized management and control within defined administrative boundaries. Each Node is assigned a provider, representing the entity responsible for implementing the specifics of the Node.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.NodeSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.NodeStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeSpec", "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_NodeItem(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "A NodeItem represents a specific hardware component or accessory associated with a Node. NodeItems represent a wide range of hardware elements, e.g Fan(s), PowerUnit(s), CPU(s), and other peripheral devices essential for the operation of the Node. NodeItem is used to represent the modular components of a node.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.NodeItemSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.NodeItemStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeItemSpec", "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeItemStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_NodeItemList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NodeItemList contains a list of NodeItems", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.NodeItem"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeItem", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_NodeItemSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NodeItemSpec defines the desired state of NodeItem", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "partition": { + SchemaProps: spec.SchemaProps{ + Description: "Partition defines the partition this resource belongs to", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "region": { + SchemaProps: spec.SchemaProps{ + Description: "Region defines the region of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "site": { + SchemaProps: spec.SchemaProps{ + Description: "Site defines the site of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "node": { + SchemaProps: spec.SchemaProps{ + Description: "Node defines the name of the node", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels as user defined labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"partition", "region", "site", "node"}, + }, + }, + } +} + +func schema_kuid_apis_infra_v1alpha1_NodeItemStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NodeItemStatus defines the observed state of NodeItem", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_NodeList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NodeList contains a list of Nodes", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.Node"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.Node", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_NodeSet(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "A NodeSet represents a set of nodes. E.g. it can be used to model a set of nodes in a NodeSet that share the same charecteristics wrt, Numa, interfaces, etc. Another usage of NodeSet is the representation of a virtual Node that consists of multiple nodes.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.NodeSetSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.NodeSetStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeSetSpec", "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeSetStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_NodeSetList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NodeSetList contains a list of NodeSets", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.NodeSet"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeSet", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_NodeSetSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NodeSetSetSpec defines the desired state of NodeSet", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "nodeSet": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "partition": { + SchemaProps: spec.SchemaProps{ + Description: "Partition defines the partition this resource belongs to", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "region": { + SchemaProps: spec.SchemaProps{ + Description: "Region defines the region of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "site": { + SchemaProps: spec.SchemaProps{ + Description: "Site defines the site of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "cluster": { + SchemaProps: spec.SchemaProps{ + Description: "Cluster defines the name of the cluster", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels as user defined labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "selector": { + SchemaProps: spec.SchemaProps{ + Description: "Selector defines the selector criterias", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), + }, + }, + }, + Required: []string{"nodeSet", "partition", "region", "site", "cluster"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_NodeSetStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NodeSetStatus defines the observed state of NodeSet", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_NodeSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NodeSpec defines the desired state of Node", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "partition": { + SchemaProps: spec.SchemaProps{ + Description: "Partition defines the partition this resource belongs to", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "region": { + SchemaProps: spec.SchemaProps{ + Description: "Region defines the region of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "site": { + SchemaProps: spec.SchemaProps{ + Description: "Site defines the site of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "node": { + SchemaProps: spec.SchemaProps{ + Description: "Node defines the name of the node", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "rack": { + SchemaProps: spec.SchemaProps{ + Description: "Rack defines the rack in which the node is deployed", + Type: []string{"string"}, + Format: "", + }, + }, + "position": { + SchemaProps: spec.SchemaProps{ + Description: "relative position in the rack", + Type: []string{"string"}, + Format: "", + }, + }, + "location": { + SchemaProps: spec.SchemaProps{ + Description: "Location defines the location information where this resource is located in lon/lat coordinates", + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.Location"), + }, + }, + "provider": { + SchemaProps: spec.SchemaProps{ + Description: "Provider defines the provider implementing this resource.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "platformType": { + SchemaProps: spec.SchemaProps{ + Description: "PlatformType define the type of platform implementing the nodespec", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels as user defined labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"partition", "region", "site", "node", "provider", "platformType"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.Location"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_NodeStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NodeStatus defines the observed state of Node", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"), + }, + }, + }, + }, + }, + "systemID": { + SchemaProps: spec.SchemaProps{ + Description: "System ID define the unique system id of the node", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_Partition(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.PartitionSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.PartitionStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.PartitionSpec", "github.com/kuidio/kuid/apis/infra/v1alpha1.PartitionStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_PartitionList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PartitionList contains a list of Partitions", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.Partition"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.Partition", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_PartitionSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PartitionSpec defines the desired state of the partition", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels as user defined labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + }, + }, + } +} + +func schema_kuid_apis_infra_v1alpha1_PartitionStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PartitionStatus defines the observed state of Partition", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_Rack(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "A rack represents a physical equipment rack within your environment. Each rack is designed to accommodate the installation of devices and equipment.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.RackSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.RackStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.RackSpec", "github.com/kuidio/kuid/apis/infra/v1alpha1.RackStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_RackList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RackList contains a list of Racks", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.Rack"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.Rack", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_RackSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RackSpec defines the desired state of Rack", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "region": { + SchemaProps: spec.SchemaProps{ + Description: "Region defines the region of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "site": { + SchemaProps: spec.SchemaProps{ + Description: "Site defines the site of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "location": { + SchemaProps: spec.SchemaProps{ + Description: "Location defines the location information where this resource is located in lon/lat coordinates", + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.Location"), + }, + }, + "height": { + SchemaProps: spec.SchemaProps{ + Description: "The height of the rack, measured in units.", + Type: []string{"string"}, + Format: "", + }, + }, + "width": { + SchemaProps: spec.SchemaProps{ + Description: "The canonical distance between the two vertical rails on a face. In inch", + Type: []string{"string"}, + Format: "", + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels as user defined labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"region", "site"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.Location"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_RackStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RackStatus defines the observed state of Rack", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_Region(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "A region represent a geography in which multiple infrastructure resources are grouped A region might represent a continent, country, city, campus, or other area depending on your environment.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.RegionSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.RegionStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.RegionSpec", "github.com/kuidio/kuid/apis/infra/v1alpha1.RegionStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_RegionList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RegionList contains a list of Regions", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.Region"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.Region", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_RegionSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RegionSpec defines the desired state of Region", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels as user defined labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + }, + }, + } +} + +func schema_kuid_apis_infra_v1alpha1_RegionStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RegionStatus defines the observed state of Region", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_Site(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "A site serves as a fundamental organizational unit for managing infrastructure resources within your environment. The utilization of sites may vary based on the organizational structure and requirements, but in essence, each site typically corresponds to a distinct building or campus.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.SiteSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.SiteStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.SiteSpec", "github.com/kuidio/kuid/apis/infra/v1alpha1.SiteStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_SiteList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "SiteList contains a list of Sites", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.Site"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.Site", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_SiteSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "SiteSpec defines the desired state of Site", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "region": { + SchemaProps: spec.SchemaProps{ + Description: "Region defines the region of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "site": { + SchemaProps: spec.SchemaProps{ + Description: "Site defines the site of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "location": { + SchemaProps: spec.SchemaProps{ + Description: "Location defines the location information where this resource is located in lon/lat coordinates", + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.Location"), + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels as user defined labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"region", "site"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.Location"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_SiteStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "SiteStatus defines the observed state of Site", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"}, + } +} + func schema_apimachinery_pkg_api_resource_Quantity(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.EmbedOpenAPIDefinitionIntoV2Extension(common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/tools/apiserver-runtime-gen/main.go b/tools/apiserver-runtime-gen/main.go index 39ffcf6..7e59609 100644 --- a/tools/apiserver-runtime-gen/main.go +++ b/tools/apiserver-runtime-gen/main.go @@ -59,19 +59,21 @@ func runE(cmd *cobra.Command, args []string) error { } // install the generators if install { - for _, gen := range generators { + //for _, gen := range generators { // nolint:gosec - if gen == "openapi-gen" { - err := run(exec.Command("go", "install", "k8s.io/kube-openapi/cmd/openapi-gen@latest")) - if err != nil { - return err - } - } else { - err := run(exec.Command("go", "install", path.Join("k8s.io/code-generator/cmd", gen))) - if err != nil { - return err + /* + if gen == "openapi-gen" { + err := run(exec.Command("go", "install", "k8s.io/kube-openapi/cmd/openapi-gen@latest")) + if err != nil { + return err + } + } else { + err := run(exec.Command("go", "install", path.Join("k8s.io/code-generator/cmd", gen))) + if err != nil { + return err + } } - } + */ /* if gen == "go-to-protobuf" { @@ -86,7 +88,7 @@ func runE(cmd *cobra.Command, args []string) error { } */ - } + //} } return doGen() From 10306e42c08524b06e420c1f281f37bf19326e74 Mon Sep 17 00:00:00 2001 From: Wim Henderickx Date: Fri, 25 Oct 2024 21:27:16 +0200 Subject: [PATCH 09/23] added vlan --- Makefile | 2 +- apis/all/all.go | 1 + apis/backend/as/handlers/confighandler.go | 45 +- apis/backend/as/v1alpha1/conversion.go | 2 +- apis/backend/vlan/doc.go | 21 + apis/backend/vlan/helper.go | 34 + apis/backend/vlan/register.go | 52 ++ apis/backend/vlan/register/register.go | 121 ++++ apis/backend/vlan/v1alpha1/doc.go | 28 + apis/backend/vlan/v1alpha1/register.go | 67 ++ .../vlan/v1alpha1/vlanclaim_resource.go | 80 +++ apis/backend/vlan/v1alpha1/vlanclaim_types.go | 82 +++ .../vlan/v1alpha1/vlanentry_resource.go | 80 +++ apis/backend/vlan/v1alpha1/vlanentry_types.go | 71 +++ .../vlan/v1alpha1/vlanindex_resource.go | 80 +++ apis/backend/vlan/v1alpha1/vlanindex_types.go | 76 +++ .../vlan/v1alpha1/zz_generated.conversion.go | 553 +++++++++++++++++ .../vlan/v1alpha1/zz_generated.deepcopy.go | 355 +++++++++++ .../v1alpha1/zz_generated.defaults.go} | 30 +- apis/backend/vlan/vlanclaim_object.go | 394 ++++++++++++ apis/backend/vlan/vlanclaim_resource.go | 318 ++++++++++ .../backend/vlan/vlanclaim_syntaxvalidator.go | 69 +++ apis/backend/vlan/vlanclaim_types.go | 82 +++ apis/backend/vlan/vlanentry_object.go | 133 ++++ apis/backend/vlan/vlanentry_resource.go | 315 ++++++++++ apis/backend/vlan/vlanentry_types.go | 71 +++ apis/backend/vlan/vlanindex_helpers.go | 90 +++ apis/backend/vlan/vlanindex_object.go | 148 +++++ apis/backend/vlan/vlanindex_resource.go | 314 ++++++++++ apis/backend/vlan/vlanindex_types.go | 76 +++ apis/backend/vlan/zz_generated.deepcopy.go | 451 ++++++++++++++ pkg/config/config.go | 1 + .../clientset/versioned/clientset.go | 13 + .../versioned/fake/clientset_generated.go | 7 + .../clientset/versioned/fake/register.go | 2 + .../clientset/versioned/scheme/register.go | 2 + .../versioned/typed/vlan/v1alpha1/doc.go | 19 + .../versioned/typed/vlan/v1alpha1/fake/doc.go | 19 + .../vlan/v1alpha1/fake/fake_vlan_client.go | 47 ++ .../vlan/v1alpha1/fake/fake_vlanclaim.go | 146 +++++ .../vlan/v1alpha1/fake/fake_vlanentry.go | 146 +++++ .../vlan/v1alpha1/fake/fake_vlanindex.go | 146 +++++ .../vlan/v1alpha1/generated_expansion.go | 24 + .../typed/vlan/v1alpha1/vlan_client.go | 116 ++++ .../typed/vlan/v1alpha1/vlanclaim.go | 68 ++ .../typed/vlan/v1alpha1/vlanentry.go | 68 ++ .../typed/vlan/v1alpha1/vlanindex.go | 68 ++ .../informers/externalversions/factory.go | 6 + .../informers/externalversions/generic.go | 9 + .../externalversions/vlan/interface.go | 45 ++ .../vlan/v1alpha1/interface.go | 58 ++ .../vlan/v1alpha1/vlanclaim.go | 89 +++ .../vlan/v1alpha1/vlanentry.go | 89 +++ .../vlan/v1alpha1/vlanindex.go | 89 +++ .../vlan/v1alpha1/expansion_generated.go | 42 ++ .../listers/vlan/v1alpha1/vlanclaim.go | 69 +++ .../listers/vlan/v1alpha1/vlanentry.go | 69 +++ .../listers/vlan/v1alpha1/vlanindex.go | 69 +++ pkg/generated/openapi/zz_generated.openapi.go | 585 ++++++++++++++++++ 59 files changed, 6287 insertions(+), 65 deletions(-) create mode 100644 apis/backend/vlan/doc.go create mode 100644 apis/backend/vlan/helper.go create mode 100644 apis/backend/vlan/register.go create mode 100644 apis/backend/vlan/register/register.go create mode 100644 apis/backend/vlan/v1alpha1/doc.go create mode 100644 apis/backend/vlan/v1alpha1/register.go create mode 100644 apis/backend/vlan/v1alpha1/vlanclaim_resource.go create mode 100644 apis/backend/vlan/v1alpha1/vlanclaim_types.go create mode 100644 apis/backend/vlan/v1alpha1/vlanentry_resource.go create mode 100644 apis/backend/vlan/v1alpha1/vlanentry_types.go create mode 100644 apis/backend/vlan/v1alpha1/vlanindex_resource.go create mode 100644 apis/backend/vlan/v1alpha1/vlanindex_types.go create mode 100644 apis/backend/vlan/v1alpha1/zz_generated.conversion.go create mode 100644 apis/backend/vlan/v1alpha1/zz_generated.deepcopy.go rename apis/backend/{as/v1alpha1/helper.go => vlan/v1alpha1/zz_generated.defaults.go} (59%) create mode 100644 apis/backend/vlan/vlanclaim_object.go create mode 100644 apis/backend/vlan/vlanclaim_resource.go create mode 100644 apis/backend/vlan/vlanclaim_syntaxvalidator.go create mode 100644 apis/backend/vlan/vlanclaim_types.go create mode 100644 apis/backend/vlan/vlanentry_object.go create mode 100644 apis/backend/vlan/vlanentry_resource.go create mode 100644 apis/backend/vlan/vlanentry_types.go create mode 100644 apis/backend/vlan/vlanindex_helpers.go create mode 100644 apis/backend/vlan/vlanindex_object.go create mode 100644 apis/backend/vlan/vlanindex_resource.go create mode 100644 apis/backend/vlan/vlanindex_types.go create mode 100644 apis/backend/vlan/zz_generated.deepcopy.go create mode 100644 pkg/generated/clientset/versioned/typed/vlan/v1alpha1/doc.go create mode 100644 pkg/generated/clientset/versioned/typed/vlan/v1alpha1/fake/doc.go create mode 100644 pkg/generated/clientset/versioned/typed/vlan/v1alpha1/fake/fake_vlan_client.go create mode 100644 pkg/generated/clientset/versioned/typed/vlan/v1alpha1/fake/fake_vlanclaim.go create mode 100644 pkg/generated/clientset/versioned/typed/vlan/v1alpha1/fake/fake_vlanentry.go create mode 100644 pkg/generated/clientset/versioned/typed/vlan/v1alpha1/fake/fake_vlanindex.go create mode 100644 pkg/generated/clientset/versioned/typed/vlan/v1alpha1/generated_expansion.go create mode 100644 pkg/generated/clientset/versioned/typed/vlan/v1alpha1/vlan_client.go create mode 100644 pkg/generated/clientset/versioned/typed/vlan/v1alpha1/vlanclaim.go create mode 100644 pkg/generated/clientset/versioned/typed/vlan/v1alpha1/vlanentry.go create mode 100644 pkg/generated/clientset/versioned/typed/vlan/v1alpha1/vlanindex.go create mode 100644 pkg/generated/informers/externalversions/vlan/interface.go create mode 100644 pkg/generated/informers/externalversions/vlan/v1alpha1/interface.go create mode 100644 pkg/generated/informers/externalversions/vlan/v1alpha1/vlanclaim.go create mode 100644 pkg/generated/informers/externalversions/vlan/v1alpha1/vlanentry.go create mode 100644 pkg/generated/informers/externalversions/vlan/v1alpha1/vlanindex.go create mode 100644 pkg/generated/listers/vlan/v1alpha1/expansion_generated.go create mode 100644 pkg/generated/listers/vlan/v1alpha1/vlanclaim.go create mode 100644 pkg/generated/listers/vlan/v1alpha1/vlanentry.go create mode 100644 pkg/generated/listers/vlan/v1alpha1/vlanindex.go diff --git a/Makefile b/Makefile index 60c61da..32d6e78 100644 --- a/Makefile +++ b/Makefile @@ -63,7 +63,7 @@ genclients: -g lister-gen \ -g openapi-gen \ -g defaulter-gen \ - #-g conversion-gen \ + -g conversion-gen \ #-g go-to-protobuf \ --module $(REPO) \ diff --git a/apis/all/all.go b/apis/all/all.go index 0d574fd..3230b86 100644 --- a/apis/all/all.go +++ b/apis/all/all.go @@ -18,6 +18,7 @@ package all import ( _ "github.com/kuidio/kuid/apis/backend/as/register" + _ "github.com/kuidio/kuid/apis/backend/vlan/register" _ "github.com/kuidio/kuid/apis/infra/register" ) diff --git a/apis/backend/as/handlers/confighandler.go b/apis/backend/as/handlers/confighandler.go index 794e843..b46b8ee 100644 --- a/apis/backend/as/handlers/confighandler.go +++ b/apis/backend/as/handlers/confighandler.go @@ -1,5 +1,7 @@ package handlers +/* + import ( "context" @@ -11,53 +13,12 @@ type ASStoreHandler struct { } func (r *ASStoreHandler) DryRunCreateFn(ctx context.Context, key types.NamespacedName, obj runtime.Object, dryrun bool) (runtime.Object, error) { - /* - accessor, err := meta.Accessor(obj) - if err != nil { - return obj, err - } - targetKey, err := config.GetTargetKey(accessor.GetLabels()) - if err != nil { - return obj, err - } - cfg := obj.(*config.Config) - obj, _, err = r.Handler.SetIntent(ctx, targetKey, cfg, true, dryrun) - if err != nil { - return obj, err - } - */ return obj, nil } func (r *ASStoreHandler) DryRunUpdateFn(ctx context.Context, key types.NamespacedName, obj, old runtime.Object, dryrun bool) (runtime.Object, error) { - /* - accessor, err := meta.Accessor(obj) - if err != nil { - return obj, err - } - targetKey, err := config.GetTargetKey(accessor.GetLabels()) - if err != nil { - return obj, err - } - cfg := obj.(*config.Config) - obj, _, err = r.Handler.SetIntent(ctx, targetKey, cfg, true, dryrun) - if err != nil { - return obj, err - } - */ return obj, nil } func (r *ASStoreHandler) DryRunDeleteFn(ctx context.Context, key types.NamespacedName, obj runtime.Object, dryrun bool) (runtime.Object, error) { - /* - accessor, err := meta.Accessor(obj) - if err != nil { - return obj, err - } - targetKey, err := config.GetTargetKey(accessor.GetLabels()) - if err != nil { - return obj, err - } - cfg := obj.(*config.Config) - return r.Handler.DeleteIntent(ctx, targetKey, cfg, dryrun) - */ return obj, nil } +*/ \ No newline at end of file diff --git a/apis/backend/as/v1alpha1/conversion.go b/apis/backend/as/v1alpha1/conversion.go index 770b724..5d7ce3d 100644 --- a/apis/backend/as/v1alpha1/conversion.go +++ b/apis/backend/as/v1alpha1/conversion.go @@ -114,7 +114,7 @@ func Convert_v1alpha1_ClaimLabels_To_common_ClaimLabels(in *commonv1alpha1.Claim return autoConvert_v1alpha1_ClaimLabels_To_common_ClaimLabels(in, out, s) } -func autoConvert_v1alpha1_ClaimLabels_To_common_ClaimLabels(in *commonv1alpha1.ClaimLabels, out *common.ClaimLabels, s conversion.Scope) error { +func autoConvert_v1alpha1_ClaimLabels_To_common_ClaimLabels(in *commonv1alpha1.ClaimLabels, out *common.ClaimLabels, _ conversion.Scope) error { if in == nil { return errors.New("input v1alpha1.ClaimLabels is nil") } diff --git a/apis/backend/vlan/doc.go b/apis/backend/vlan/doc.go new file mode 100644 index 0000000..638c80a --- /dev/null +++ b/apis/backend/vlan/doc.go @@ -0,0 +1,21 @@ +/* +Copyright 2024 Nokia. + +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. +*/ + +// +k8s:deepcopy-gen=package,register +// +groupName=vlan.be.kuid.dev + +// Package vlan is the internal version of the API. +package vlan // import "github.com/kuidio/kuid/apis/backend/vlan" diff --git a/apis/backend/vlan/helper.go b/apis/backend/vlan/helper.go new file mode 100644 index 0000000..6c5e07b --- /dev/null +++ b/apis/backend/vlan/helper.go @@ -0,0 +1,34 @@ +/* +Copyright 2024 Nokia. + +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 vlan + +import ( + "fmt" +) + +const VLANID_Min = 0 +const VLANID_Max = 4095 + +func validateVLANID(id int) error { + if id < VLANID_Min { + return fmt.Errorf("invalid vlan id, got %d", id) + } + if id > VLANID_Max { + return fmt.Errorf("invalid vlan id, got %d", id) + } + return nil +} diff --git a/apis/backend/vlan/register.go b/apis/backend/vlan/register.go new file mode 100644 index 0000000..6f80564 --- /dev/null +++ b/apis/backend/vlan/register.go @@ -0,0 +1,52 @@ +// Copyright 2022 The kpt 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. + +package vlan + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +const ( + GroupName = "vlan.be.kuid.dev" + Version = runtime.APIVersionInternal +) + +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: Version} + +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme +) + +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &VLANIndex{}, + &VLANIndexList{}, + &VLANClaim{}, + &VLANClaimList{}, + &VLANEntry{}, + &VLANEntryList{}, + ) + return nil +} diff --git a/apis/backend/vlan/register/register.go b/apis/backend/vlan/register/register.go new file mode 100644 index 0000000..331e117 --- /dev/null +++ b/apis/backend/vlan/register/register.go @@ -0,0 +1,121 @@ +/* +Copyright 2024 Nokia. + +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 register + +import ( + "context" + + "github.com/henderiw/apiserver-builder/pkg/builder" + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-builder/pkg/builder/rest" + "github.com/kuidio/kuid/apis/backend/vlan" + vlanbev1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" + bebackend "github.com/kuidio/kuid/pkg/backend" + genericbackend "github.com/kuidio/kuid/pkg/backend/generic" + "github.com/kuidio/kuid/pkg/config" + genericregistry "github.com/kuidio/kuid/pkg/registry/generic" + "github.com/kuidio/kuid/pkg/registry/options" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apiserver/pkg/registry/generic" +) + +func init() { + config.Register( + vlan.SchemeGroupVersion.Group, + vlanbev1alpha1.AddToScheme, + NewBackend, + ApplyStorageToBackend, + []*config.ResourceConfig{ + {StorageProviderFn: NewIndexStorageProvider, Internal: &vlan.VLANIndex{}, ResourceVersions: []resource.Object{&vlan.VLANIndex{}, &vlanbev1alpha1.VLANIndex{}}}, + {StorageProviderFn: NewClaimStorageProvider, Internal: &vlan.VLANClaim{}, ResourceVersions: []resource.Object{&vlan.VLANClaim{}, &vlanbev1alpha1.VLANClaim{}}}, + {StorageProviderFn: NewStorageProvider, Internal: &vlan.VLANEntry{}, ResourceVersions: []resource.Object{&vlan.VLANEntry{}, &vlanbev1alpha1.VLANEntry{}}}, + }, + ) +} + +func NewBackend() bebackend.Backend { + return genericbackend.New( + vlan.VLANClaimKind, + vlan.VLANIndexFromRuntime, + vlan.VLANClaimFromRuntime, + vlan.VLANEntryFromRuntime, + vlan.GetVLANEntry, + ) +} + +func NewIndexStorageProvider(ctx context.Context, obj resource.InternalObject, be bebackend.Backend, sync bool, options *options.Options) *rest.StorageProvider { + opts := *options + if sync { + opts.BackendInvoker = bebackend.NewIndexInvoker(be) + return genericregistry.NewStorageProvider(ctx, obj, &opts) + } + return genericregistry.NewStorageProvider(ctx, obj, &opts) +} + +func NewClaimStorageProvider(ctx context.Context, obj resource.InternalObject, be bebackend.Backend, sync bool, options *options.Options) *rest.StorageProvider { + opts := *options + if sync { + opts.BackendInvoker = bebackend.NewClaimInvoker(be) + return genericregistry.NewStorageProvider(ctx, obj, &opts) + } + return genericregistry.NewStorageProvider(ctx, obj, &opts) +} + +func NewStorageProvider(ctx context.Context, obj resource.InternalObject, be bebackend.Backend, sync bool, options *options.Options) *rest.StorageProvider { + return genericregistry.NewStorageProvider(ctx, obj, options) +} + +func ApplyStorageToBackend(ctx context.Context, be bebackend.Backend, apiServer *builder.Server) error { + claimStorageProvider := apiServer.StorageProvider[schema.GroupResource{ + Group: vlan.SchemeGroupVersion.Group, + Resource: vlan.VLANClaimPlural, + }] + + claimStorage, err := claimStorageProvider.Get(ctx, apiServer.Schemes[0], &ClaimGetter{}) + if err != nil { + return err + } + + entryStorageProvider := apiServer.StorageProvider[schema.GroupResource{ + Group: vlan.SchemeGroupVersion.Group, + Resource: vlan.VLANEntryPlural, + }] + + entryStorage, err := entryStorageProvider.Get(ctx, apiServer.Schemes[0], &EntryGetter{}) + if err != nil { + return err + } + + return be.AddStorage(entryStorage, claimStorage) +} + +var _ generic.RESTOptionsGetter = &ClaimGetter{} + +type ClaimGetter struct{} + +func (r *ClaimGetter) GetRESTOptions(resource schema.GroupResource, example runtime.Object) (generic.RESTOptions, error) { + return generic.RESTOptions{}, nil +} + +var _ generic.RESTOptionsGetter = &EntryGetter{} + +type EntryGetter struct{} + +func (r *EntryGetter) GetRESTOptions(resource schema.GroupResource, example runtime.Object) (generic.RESTOptions, error) { + return generic.RESTOptions{}, nil +} diff --git a/apis/backend/vlan/v1alpha1/doc.go b/apis/backend/vlan/v1alpha1/doc.go new file mode 100644 index 0000000..7ea9922 --- /dev/null +++ b/apis/backend/vlan/v1alpha1/doc.go @@ -0,0 +1,28 @@ +/* +Copyright 2024 Nokia. + +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. +*/ + +//go:generate deepcopy-gen -O zz_generated.deepcopy -i . -h ../../../../boilerplate.go.txt +//go:generate defaulter-gen -O zz_generated.defaults -i . -h ../../../../boilerplate.go.txt +//go:generate conversion-gen -O zz_generated.conversion -i . -h ../../../../boilerplate.go.txt + +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen=package,register +// +k8s:conversion-gen=github.com/kuidio/kuid/apis/backend/vlan +// +k8s:defaulter-gen=TypeMeta +// +groupName=vlan.be.kuid.dev + +// v1alpha1 is the v1alpha1 version of the API. +package v1alpha1 diff --git a/apis/backend/vlan/v1alpha1/register.go b/apis/backend/vlan/v1alpha1/register.go new file mode 100644 index 0000000..61f6eb3 --- /dev/null +++ b/apis/backend/vlan/v1alpha1/register.go @@ -0,0 +1,67 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +const ( + Group = "vlan.be.kuid.dev" + Version = "v1alpha1" +) + +var ( + // SchemeGroupVersion contains the API group and version information for the types in this package. + SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version} + // AddToScheme applies all the stored functions to the scheme. A non-nil error + // indicates that one function failed and the attempt was abandoned. + //AddToScheme = (&runtime.SchemeBuilder{}).AddToScheme + AddToScheme = localSchemeBuilder.AddToScheme + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + schemeBuilder runtime.SchemeBuilder + localSchemeBuilder = &schemeBuilder +) + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +func init() { + localSchemeBuilder.Register(addKnownTypes) +} + +// Adds the list of known types to the given scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + // +kubebuilder:scaffold:install + + scheme.AddKnownTypes(SchemeGroupVersion, + &VLANIndex{}, + &VLANIndexList{}, + &VLANClaim{}, + &VLANClaimList{}, + &VLANEntry{}, + &VLANEntryList{}, + ) + + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/apis/backend/vlan/v1alpha1/vlanclaim_resource.go b/apis/backend/vlan/v1alpha1/vlanclaim_resource.go new file mode 100644 index 0000000..7f080f4 --- /dev/null +++ b/apis/backend/vlan/v1alpha1/vlanclaim_resource.go @@ -0,0 +1,80 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/kuidio/kuid/apis/backend/vlan" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +k8s:deepcopy-gen=false +var _ resource.Object = &VLANClaim{} +var _ resource.ObjectList = &VLANClaimList{} +var _ resource.MultiVersionObject = &VLANClaim{} + +func (VLANClaim) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: vlan.VLANClaimPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (VLANClaim) IsStorageVersion() bool { + return false +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (VLANClaim) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *VLANClaim) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// New return an empty resource +// New implements resource.Object +func (VLANClaim) New() runtime.Object { + return &VLANClaim{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (VLANClaim) NewList() runtime.Object { + return &VLANClaimList{} +} + +// GetListMeta returns the ListMeta +// GetListMeta implements resource.ObjectList +func (r *VLANClaimList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// RegisterConversions registers the conversions. +// RegisterConversions implements resource.MultiVersionObject +func (VLANClaim) RegisterConversions() func(s *runtime.Scheme) error { + return RegisterConversions +} diff --git a/apis/backend/vlan/v1alpha1/vlanclaim_types.go b/apis/backend/vlan/v1alpha1/vlanclaim_types.go new file mode 100644 index 0000000..608ca13 --- /dev/null +++ b/apis/backend/vlan/v1alpha1/vlanclaim_types.go @@ -0,0 +1,82 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "reflect" + + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// VLANClaimSpec defines the desired state of VLANClaim +type VLANClaimSpec struct { + // Index defines the index for the resource + Index string `json:"index" yaml:"index" protobuf:"bytes,1,opt,name=index"` + // ID defines the id of the resource + ID *uint32 `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,2,opt,name=id"` + // Range defines the VLAN range of the resource + // The following notation is used: start-end - + // the VLANs in the range must be consecutive + Range *string `json:"range,omitempty" yaml:"range,omitempty" protobuf:"bytes,3,opt,name=range"` + // ClaimLabels define the user defined labels and selector labels used + // in resource claim + commonv1alpha1.ClaimLabels `json:",inline" yaml:",inline" protobuf:"bytes,4,opt,name=claimLabels"` +} + +// VLANClaimStatus defines the observed state of VLANClaim +type VLANClaimStatus struct { + // ConditionedStatus provides the status of the VLANClain using conditions + // - a ready condition indicates the overall status of the resource + condv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` + // VLANID defines the VLAN for the VLAN claim + // +optional + ID *uint32 `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,2,opt,name=id"` + // VLANRange defines the VLAN range for the VLAN claim + // +optional + Range *string `json:"range,omitempty" yaml:"range,omitempty" protobuf:"bytes,3,opt,name=range"` + // ExpiryTime defines when the claim expires + // +kubebuilder:validation:Optional + // +optional + ExpiryTime *string `json:"expiryTime,omitempty" yaml:"expiryTime,omitempty" protobuf:"bytes,4,opt,name=expiryTime"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// VLANClaim is the Schema for the VLANClaim API +type VLANClaim struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec VLANClaimSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status VLANClaimStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// VLANClaimList contains a list of VLANClaims +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type VLANClaimList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []VLANClaim `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + VLANClaimKind = reflect.TypeOf(VLANClaim{}).Name() + VLANClaimListKind = reflect.TypeOf(VLANClaimList{}).Name() +) diff --git a/apis/backend/vlan/v1alpha1/vlanentry_resource.go b/apis/backend/vlan/v1alpha1/vlanentry_resource.go new file mode 100644 index 0000000..5688903 --- /dev/null +++ b/apis/backend/vlan/v1alpha1/vlanentry_resource.go @@ -0,0 +1,80 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/kuidio/kuid/apis/backend/vlan" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +k8s:deepcopy-gen=false +var _ resource.Object = &VLANEntry{} +var _ resource.ObjectList = &VLANEntryList{} +var _ resource.MultiVersionObject = &VLANEntry{} + +func (VLANEntry) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: vlan.VLANEntryPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (VLANEntry) IsStorageVersion() bool { + return false +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (VLANEntry) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *VLANEntry) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// New return an empty resource +// New implements resource.Object +func (VLANEntry) New() runtime.Object { + return &VLANEntry{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (VLANEntry) NewList() runtime.Object { + return &VLANEntryList{} +} + +// GetListMeta returns the ListMeta +// GetListMeta implements resource.ObjectList +func (r *VLANEntryList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// RegisterConversions registers the conversions. +// RegisterConversions implements resource.MultiVersionObject +func (VLANEntry) RegisterConversions() func(s *runtime.Scheme) error { + return RegisterConversions +} diff --git a/apis/backend/vlan/v1alpha1/vlanentry_types.go b/apis/backend/vlan/v1alpha1/vlanentry_types.go new file mode 100644 index 0000000..52e76a4 --- /dev/null +++ b/apis/backend/vlan/v1alpha1/vlanentry_types.go @@ -0,0 +1,71 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "reflect" + + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + "github.com/kuidio/kuid/apis/backend" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// VLANEntrySpec defines the desired state of VLANEntry +type VLANEntrySpec struct { + // Index defines the index for the resource + Index string `json:"index" yaml:"index" protobuf:"bytes,1,opt,name=index"` + // ClaimType defines the claimType of the resource + ClaimType backend.ClaimType `json:"claimType,omitempty" yaml:"claimType,omitempty" protobuf:"bytes,2,opt,name=claimType"` + // ID defines the id of the resource in the tree + ID string `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,3,opt,name=id"` + // ClaimLabels define the user defined labels and selector labels used + // in resource claim + commonv1alpha1.ClaimLabels `json:",inline" yaml:",inline" protobuf:"bytes,5,opt,name=claimLabels"` +} + +// VLANEntryStatus defines the observed state of VLANEntry +type VLANEntryStatus struct { + // ConditionedStatus provides the status of the VLANEntry using conditions + // - a ready condition indicates the overall status of the resource + condv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// VLANEntry is the Schema for the VLANentry API +type VLANEntry struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec VLANEntrySpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status VLANEntryStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// VLANEntryList contains a list of VLANEntries +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type VLANEntryList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []VLANEntry `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + VLANEntryKind = reflect.TypeOf(VLANEntry{}).Name() + VLANEntryListKind = reflect.TypeOf(VLANEntryList{}).Name() +) diff --git a/apis/backend/vlan/v1alpha1/vlanindex_resource.go b/apis/backend/vlan/v1alpha1/vlanindex_resource.go new file mode 100644 index 0000000..7c39957 --- /dev/null +++ b/apis/backend/vlan/v1alpha1/vlanindex_resource.go @@ -0,0 +1,80 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/kuidio/kuid/apis/backend/vlan" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +k8s:deepcopy-gen=false +var _ resource.Object = &VLANIndex{} +var _ resource.ObjectList = &VLANIndexList{} +var _ resource.MultiVersionObject = &VLANIndex{} + +func (VLANIndex) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: vlan.VLANIndexPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (VLANIndex) IsStorageVersion() bool { + return false +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (VLANIndex) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *VLANIndex) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// New return an empty resource +// New implements resource.Object +func (VLANIndex) New() runtime.Object { + return &VLANIndex{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (VLANIndex) NewList() runtime.Object { + return &VLANIndexList{} +} + +// GetListMeta returns the ListMeta +// GetListMeta implements resource.ObjectList +func (r *VLANIndexList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// RegisterConversions registers the conversions. +// RegisterConversions implements resource.MultiVersionObject +func (VLANIndex) RegisterConversions() func(s *runtime.Scheme) error { + return RegisterConversions +} diff --git a/apis/backend/vlan/v1alpha1/vlanindex_types.go b/apis/backend/vlan/v1alpha1/vlanindex_types.go new file mode 100644 index 0000000..69af271 --- /dev/null +++ b/apis/backend/vlan/v1alpha1/vlanindex_types.go @@ -0,0 +1,76 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "reflect" + + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// VLANIndexSpec defines the desired state of VLANIndex +type VLANIndexSpec struct { + // MinID defines the min VLAN ID the index supports + // +optional + MinID *uint32 `json:"minID,omitempty" yaml:"minID,omitempty" protobuf:"bytes,1,opt,name=minID"` + // MaxID defines the max VLAN ID the index supports + // +optional + MaxID *uint32 `json:"maxID,omitempty" yaml:"maxID,omitempty" protobuf:"bytes,2,opt,name=maxID"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` +} + +// VLANIndexStatus defines the observed state of VLANIndex +type VLANIndexStatus struct { + // MinID defines the min VLAN ID the index supports + // +optional + MinID *uint32 `json:"minID,omitempty" yaml:"minID,omitempty" protobuf:"bytes,1,opt,name=minID"` + // MaxID defines the max VLAN ID the index supports + // +optional + MaxID *uint32 `json:"maxID,omitempty" yaml:"maxID,omitempty" protobuf:"bytes,2,opt,name=maxID"` + // ConditionedStatus provides the status of the VLANIndex using conditions + // - a ready condition indicates the overall status of the resource + condv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// VLANIndex is the Schema for the VLANIndex API +type VLANIndex struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec VLANIndexSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status VLANIndexStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// VLANIndexList contains a list of VLANIndexs +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type VLANIndexList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []VLANIndex `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + VLANIndexKind = reflect.TypeOf(VLANIndex{}).Name() + VLANIndexListKind = reflect.TypeOf(VLANIndexList{}).Name() +) diff --git a/apis/backend/vlan/v1alpha1/zz_generated.conversion.go b/apis/backend/vlan/v1alpha1/zz_generated.conversion.go new file mode 100644 index 0000000..03ad546 --- /dev/null +++ b/apis/backend/vlan/v1alpha1/zz_generated.conversion.go @@ -0,0 +1,553 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2024 Nokia. + +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 conversion-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + unsafe "unsafe" + + backend "github.com/kuidio/kuid/apis/backend" + asv1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" + vlan "github.com/kuidio/kuid/apis/backend/vlan" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +func init() { + localSchemeBuilder.Register(RegisterConversions) +} + +// RegisterConversions adds conversion functions to the given scheme. +// Public to allow building arbitrary schemes. +func RegisterConversions(s *runtime.Scheme) error { + if err := s.AddGeneratedConversionFunc((*VLANClaim)(nil), (*vlan.VLANClaim)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_VLANClaim_To_vlan_VLANClaim(a.(*VLANClaim), b.(*vlan.VLANClaim), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*vlan.VLANClaim)(nil), (*VLANClaim)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_vlan_VLANClaim_To_v1alpha1_VLANClaim(a.(*vlan.VLANClaim), b.(*VLANClaim), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*VLANClaimList)(nil), (*vlan.VLANClaimList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_VLANClaimList_To_vlan_VLANClaimList(a.(*VLANClaimList), b.(*vlan.VLANClaimList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*vlan.VLANClaimList)(nil), (*VLANClaimList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_vlan_VLANClaimList_To_v1alpha1_VLANClaimList(a.(*vlan.VLANClaimList), b.(*VLANClaimList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*VLANClaimSpec)(nil), (*vlan.VLANClaimSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_VLANClaimSpec_To_vlan_VLANClaimSpec(a.(*VLANClaimSpec), b.(*vlan.VLANClaimSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*vlan.VLANClaimSpec)(nil), (*VLANClaimSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_vlan_VLANClaimSpec_To_v1alpha1_VLANClaimSpec(a.(*vlan.VLANClaimSpec), b.(*VLANClaimSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*VLANClaimStatus)(nil), (*vlan.VLANClaimStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_VLANClaimStatus_To_vlan_VLANClaimStatus(a.(*VLANClaimStatus), b.(*vlan.VLANClaimStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*vlan.VLANClaimStatus)(nil), (*VLANClaimStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_vlan_VLANClaimStatus_To_v1alpha1_VLANClaimStatus(a.(*vlan.VLANClaimStatus), b.(*VLANClaimStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*VLANEntry)(nil), (*vlan.VLANEntry)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_VLANEntry_To_vlan_VLANEntry(a.(*VLANEntry), b.(*vlan.VLANEntry), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*vlan.VLANEntry)(nil), (*VLANEntry)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_vlan_VLANEntry_To_v1alpha1_VLANEntry(a.(*vlan.VLANEntry), b.(*VLANEntry), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*VLANEntryList)(nil), (*vlan.VLANEntryList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_VLANEntryList_To_vlan_VLANEntryList(a.(*VLANEntryList), b.(*vlan.VLANEntryList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*vlan.VLANEntryList)(nil), (*VLANEntryList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_vlan_VLANEntryList_To_v1alpha1_VLANEntryList(a.(*vlan.VLANEntryList), b.(*VLANEntryList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*VLANEntrySpec)(nil), (*vlan.VLANEntrySpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_VLANEntrySpec_To_vlan_VLANEntrySpec(a.(*VLANEntrySpec), b.(*vlan.VLANEntrySpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*vlan.VLANEntrySpec)(nil), (*VLANEntrySpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_vlan_VLANEntrySpec_To_v1alpha1_VLANEntrySpec(a.(*vlan.VLANEntrySpec), b.(*VLANEntrySpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*VLANEntryStatus)(nil), (*vlan.VLANEntryStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_VLANEntryStatus_To_vlan_VLANEntryStatus(a.(*VLANEntryStatus), b.(*vlan.VLANEntryStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*vlan.VLANEntryStatus)(nil), (*VLANEntryStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_vlan_VLANEntryStatus_To_v1alpha1_VLANEntryStatus(a.(*vlan.VLANEntryStatus), b.(*VLANEntryStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*VLANIndex)(nil), (*vlan.VLANIndex)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_VLANIndex_To_vlan_VLANIndex(a.(*VLANIndex), b.(*vlan.VLANIndex), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*vlan.VLANIndex)(nil), (*VLANIndex)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_vlan_VLANIndex_To_v1alpha1_VLANIndex(a.(*vlan.VLANIndex), b.(*VLANIndex), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*VLANIndexList)(nil), (*vlan.VLANIndexList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_VLANIndexList_To_vlan_VLANIndexList(a.(*VLANIndexList), b.(*vlan.VLANIndexList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*vlan.VLANIndexList)(nil), (*VLANIndexList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_vlan_VLANIndexList_To_v1alpha1_VLANIndexList(a.(*vlan.VLANIndexList), b.(*VLANIndexList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*VLANIndexSpec)(nil), (*vlan.VLANIndexSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_VLANIndexSpec_To_vlan_VLANIndexSpec(a.(*VLANIndexSpec), b.(*vlan.VLANIndexSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*vlan.VLANIndexSpec)(nil), (*VLANIndexSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_vlan_VLANIndexSpec_To_v1alpha1_VLANIndexSpec(a.(*vlan.VLANIndexSpec), b.(*VLANIndexSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*VLANIndexStatus)(nil), (*vlan.VLANIndexStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_VLANIndexStatus_To_vlan_VLANIndexStatus(a.(*VLANIndexStatus), b.(*vlan.VLANIndexStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*vlan.VLANIndexStatus)(nil), (*VLANIndexStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_vlan_VLANIndexStatus_To_v1alpha1_VLANIndexStatus(a.(*vlan.VLANIndexStatus), b.(*VLANIndexStatus), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1alpha1_VLANClaim_To_vlan_VLANClaim(in *VLANClaim, out *vlan.VLANClaim, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_VLANClaimSpec_To_vlan_VLANClaimSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_VLANClaimStatus_To_vlan_VLANClaimStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_VLANClaim_To_vlan_VLANClaim is an autogenerated conversion function. +func Convert_v1alpha1_VLANClaim_To_vlan_VLANClaim(in *VLANClaim, out *vlan.VLANClaim, s conversion.Scope) error { + return autoConvert_v1alpha1_VLANClaim_To_vlan_VLANClaim(in, out, s) +} + +func autoConvert_vlan_VLANClaim_To_v1alpha1_VLANClaim(in *vlan.VLANClaim, out *VLANClaim, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_vlan_VLANClaimSpec_To_v1alpha1_VLANClaimSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_vlan_VLANClaimStatus_To_v1alpha1_VLANClaimStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_vlan_VLANClaim_To_v1alpha1_VLANClaim is an autogenerated conversion function. +func Convert_vlan_VLANClaim_To_v1alpha1_VLANClaim(in *vlan.VLANClaim, out *VLANClaim, s conversion.Scope) error { + return autoConvert_vlan_VLANClaim_To_v1alpha1_VLANClaim(in, out, s) +} + +func autoConvert_v1alpha1_VLANClaimList_To_vlan_VLANClaimList(in *VLANClaimList, out *vlan.VLANClaimList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]vlan.VLANClaim, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_VLANClaim_To_vlan_VLANClaim(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_VLANClaimList_To_vlan_VLANClaimList is an autogenerated conversion function. +func Convert_v1alpha1_VLANClaimList_To_vlan_VLANClaimList(in *VLANClaimList, out *vlan.VLANClaimList, s conversion.Scope) error { + return autoConvert_v1alpha1_VLANClaimList_To_vlan_VLANClaimList(in, out, s) +} + +func autoConvert_vlan_VLANClaimList_To_v1alpha1_VLANClaimList(in *vlan.VLANClaimList, out *VLANClaimList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]VLANClaim, len(*in)) + for i := range *in { + if err := Convert_vlan_VLANClaim_To_v1alpha1_VLANClaim(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_vlan_VLANClaimList_To_v1alpha1_VLANClaimList is an autogenerated conversion function. +func Convert_vlan_VLANClaimList_To_v1alpha1_VLANClaimList(in *vlan.VLANClaimList, out *VLANClaimList, s conversion.Scope) error { + return autoConvert_vlan_VLANClaimList_To_v1alpha1_VLANClaimList(in, out, s) +} + +func autoConvert_v1alpha1_VLANClaimSpec_To_vlan_VLANClaimSpec(in *VLANClaimSpec, out *vlan.VLANClaimSpec, s conversion.Scope) error { + out.Index = in.Index + out.ID = (*uint32)(unsafe.Pointer(in.ID)) + out.Range = (*string)(unsafe.Pointer(in.Range)) + if err := asv1alpha1.Convert_v1alpha1_ClaimLabels_To_common_ClaimLabels(&in.ClaimLabels, &out.ClaimLabels, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_VLANClaimSpec_To_vlan_VLANClaimSpec is an autogenerated conversion function. +func Convert_v1alpha1_VLANClaimSpec_To_vlan_VLANClaimSpec(in *VLANClaimSpec, out *vlan.VLANClaimSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_VLANClaimSpec_To_vlan_VLANClaimSpec(in, out, s) +} + +func autoConvert_vlan_VLANClaimSpec_To_v1alpha1_VLANClaimSpec(in *vlan.VLANClaimSpec, out *VLANClaimSpec, s conversion.Scope) error { + out.Index = in.Index + out.ID = (*uint32)(unsafe.Pointer(in.ID)) + out.Range = (*string)(unsafe.Pointer(in.Range)) + if err := asv1alpha1.Convert_common_ClaimLabels_To_v1alpha1_ClaimLabels(&in.ClaimLabels, &out.ClaimLabels, s); err != nil { + return err + } + return nil +} + +// Convert_vlan_VLANClaimSpec_To_v1alpha1_VLANClaimSpec is an autogenerated conversion function. +func Convert_vlan_VLANClaimSpec_To_v1alpha1_VLANClaimSpec(in *vlan.VLANClaimSpec, out *VLANClaimSpec, s conversion.Scope) error { + return autoConvert_vlan_VLANClaimSpec_To_v1alpha1_VLANClaimSpec(in, out, s) +} + +func autoConvert_v1alpha1_VLANClaimStatus_To_vlan_VLANClaimStatus(in *VLANClaimStatus, out *vlan.VLANClaimStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + out.ID = (*uint32)(unsafe.Pointer(in.ID)) + out.Range = (*string)(unsafe.Pointer(in.Range)) + out.ExpiryTime = (*string)(unsafe.Pointer(in.ExpiryTime)) + return nil +} + +// Convert_v1alpha1_VLANClaimStatus_To_vlan_VLANClaimStatus is an autogenerated conversion function. +func Convert_v1alpha1_VLANClaimStatus_To_vlan_VLANClaimStatus(in *VLANClaimStatus, out *vlan.VLANClaimStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_VLANClaimStatus_To_vlan_VLANClaimStatus(in, out, s) +} + +func autoConvert_vlan_VLANClaimStatus_To_v1alpha1_VLANClaimStatus(in *vlan.VLANClaimStatus, out *VLANClaimStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + out.ID = (*uint32)(unsafe.Pointer(in.ID)) + out.Range = (*string)(unsafe.Pointer(in.Range)) + out.ExpiryTime = (*string)(unsafe.Pointer(in.ExpiryTime)) + return nil +} + +// Convert_vlan_VLANClaimStatus_To_v1alpha1_VLANClaimStatus is an autogenerated conversion function. +func Convert_vlan_VLANClaimStatus_To_v1alpha1_VLANClaimStatus(in *vlan.VLANClaimStatus, out *VLANClaimStatus, s conversion.Scope) error { + return autoConvert_vlan_VLANClaimStatus_To_v1alpha1_VLANClaimStatus(in, out, s) +} + +func autoConvert_v1alpha1_VLANEntry_To_vlan_VLANEntry(in *VLANEntry, out *vlan.VLANEntry, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_VLANEntrySpec_To_vlan_VLANEntrySpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_VLANEntryStatus_To_vlan_VLANEntryStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_VLANEntry_To_vlan_VLANEntry is an autogenerated conversion function. +func Convert_v1alpha1_VLANEntry_To_vlan_VLANEntry(in *VLANEntry, out *vlan.VLANEntry, s conversion.Scope) error { + return autoConvert_v1alpha1_VLANEntry_To_vlan_VLANEntry(in, out, s) +} + +func autoConvert_vlan_VLANEntry_To_v1alpha1_VLANEntry(in *vlan.VLANEntry, out *VLANEntry, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_vlan_VLANEntrySpec_To_v1alpha1_VLANEntrySpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_vlan_VLANEntryStatus_To_v1alpha1_VLANEntryStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_vlan_VLANEntry_To_v1alpha1_VLANEntry is an autogenerated conversion function. +func Convert_vlan_VLANEntry_To_v1alpha1_VLANEntry(in *vlan.VLANEntry, out *VLANEntry, s conversion.Scope) error { + return autoConvert_vlan_VLANEntry_To_v1alpha1_VLANEntry(in, out, s) +} + +func autoConvert_v1alpha1_VLANEntryList_To_vlan_VLANEntryList(in *VLANEntryList, out *vlan.VLANEntryList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]vlan.VLANEntry, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_VLANEntry_To_vlan_VLANEntry(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_VLANEntryList_To_vlan_VLANEntryList is an autogenerated conversion function. +func Convert_v1alpha1_VLANEntryList_To_vlan_VLANEntryList(in *VLANEntryList, out *vlan.VLANEntryList, s conversion.Scope) error { + return autoConvert_v1alpha1_VLANEntryList_To_vlan_VLANEntryList(in, out, s) +} + +func autoConvert_vlan_VLANEntryList_To_v1alpha1_VLANEntryList(in *vlan.VLANEntryList, out *VLANEntryList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]VLANEntry, len(*in)) + for i := range *in { + if err := Convert_vlan_VLANEntry_To_v1alpha1_VLANEntry(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_vlan_VLANEntryList_To_v1alpha1_VLANEntryList is an autogenerated conversion function. +func Convert_vlan_VLANEntryList_To_v1alpha1_VLANEntryList(in *vlan.VLANEntryList, out *VLANEntryList, s conversion.Scope) error { + return autoConvert_vlan_VLANEntryList_To_v1alpha1_VLANEntryList(in, out, s) +} + +func autoConvert_v1alpha1_VLANEntrySpec_To_vlan_VLANEntrySpec(in *VLANEntrySpec, out *vlan.VLANEntrySpec, s conversion.Scope) error { + out.Index = in.Index + out.ClaimType = backend.ClaimType(in.ClaimType) + out.ID = in.ID + if err := asv1alpha1.Convert_v1alpha1_ClaimLabels_To_common_ClaimLabels(&in.ClaimLabels, &out.ClaimLabels, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_VLANEntrySpec_To_vlan_VLANEntrySpec is an autogenerated conversion function. +func Convert_v1alpha1_VLANEntrySpec_To_vlan_VLANEntrySpec(in *VLANEntrySpec, out *vlan.VLANEntrySpec, s conversion.Scope) error { + return autoConvert_v1alpha1_VLANEntrySpec_To_vlan_VLANEntrySpec(in, out, s) +} + +func autoConvert_vlan_VLANEntrySpec_To_v1alpha1_VLANEntrySpec(in *vlan.VLANEntrySpec, out *VLANEntrySpec, s conversion.Scope) error { + out.Index = in.Index + out.ClaimType = backend.ClaimType(in.ClaimType) + out.ID = in.ID + if err := asv1alpha1.Convert_common_ClaimLabels_To_v1alpha1_ClaimLabels(&in.ClaimLabels, &out.ClaimLabels, s); err != nil { + return err + } + return nil +} + +// Convert_vlan_VLANEntrySpec_To_v1alpha1_VLANEntrySpec is an autogenerated conversion function. +func Convert_vlan_VLANEntrySpec_To_v1alpha1_VLANEntrySpec(in *vlan.VLANEntrySpec, out *VLANEntrySpec, s conversion.Scope) error { + return autoConvert_vlan_VLANEntrySpec_To_v1alpha1_VLANEntrySpec(in, out, s) +} + +func autoConvert_v1alpha1_VLANEntryStatus_To_vlan_VLANEntryStatus(in *VLANEntryStatus, out *vlan.VLANEntryStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_VLANEntryStatus_To_vlan_VLANEntryStatus is an autogenerated conversion function. +func Convert_v1alpha1_VLANEntryStatus_To_vlan_VLANEntryStatus(in *VLANEntryStatus, out *vlan.VLANEntryStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_VLANEntryStatus_To_vlan_VLANEntryStatus(in, out, s) +} + +func autoConvert_vlan_VLANEntryStatus_To_v1alpha1_VLANEntryStatus(in *vlan.VLANEntryStatus, out *VLANEntryStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_vlan_VLANEntryStatus_To_v1alpha1_VLANEntryStatus is an autogenerated conversion function. +func Convert_vlan_VLANEntryStatus_To_v1alpha1_VLANEntryStatus(in *vlan.VLANEntryStatus, out *VLANEntryStatus, s conversion.Scope) error { + return autoConvert_vlan_VLANEntryStatus_To_v1alpha1_VLANEntryStatus(in, out, s) +} + +func autoConvert_v1alpha1_VLANIndex_To_vlan_VLANIndex(in *VLANIndex, out *vlan.VLANIndex, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_VLANIndexSpec_To_vlan_VLANIndexSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_VLANIndexStatus_To_vlan_VLANIndexStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_VLANIndex_To_vlan_VLANIndex is an autogenerated conversion function. +func Convert_v1alpha1_VLANIndex_To_vlan_VLANIndex(in *VLANIndex, out *vlan.VLANIndex, s conversion.Scope) error { + return autoConvert_v1alpha1_VLANIndex_To_vlan_VLANIndex(in, out, s) +} + +func autoConvert_vlan_VLANIndex_To_v1alpha1_VLANIndex(in *vlan.VLANIndex, out *VLANIndex, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_vlan_VLANIndexSpec_To_v1alpha1_VLANIndexSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_vlan_VLANIndexStatus_To_v1alpha1_VLANIndexStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_vlan_VLANIndex_To_v1alpha1_VLANIndex is an autogenerated conversion function. +func Convert_vlan_VLANIndex_To_v1alpha1_VLANIndex(in *vlan.VLANIndex, out *VLANIndex, s conversion.Scope) error { + return autoConvert_vlan_VLANIndex_To_v1alpha1_VLANIndex(in, out, s) +} + +func autoConvert_v1alpha1_VLANIndexList_To_vlan_VLANIndexList(in *VLANIndexList, out *vlan.VLANIndexList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]vlan.VLANIndex, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_VLANIndex_To_vlan_VLANIndex(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_VLANIndexList_To_vlan_VLANIndexList is an autogenerated conversion function. +func Convert_v1alpha1_VLANIndexList_To_vlan_VLANIndexList(in *VLANIndexList, out *vlan.VLANIndexList, s conversion.Scope) error { + return autoConvert_v1alpha1_VLANIndexList_To_vlan_VLANIndexList(in, out, s) +} + +func autoConvert_vlan_VLANIndexList_To_v1alpha1_VLANIndexList(in *vlan.VLANIndexList, out *VLANIndexList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]VLANIndex, len(*in)) + for i := range *in { + if err := Convert_vlan_VLANIndex_To_v1alpha1_VLANIndex(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_vlan_VLANIndexList_To_v1alpha1_VLANIndexList is an autogenerated conversion function. +func Convert_vlan_VLANIndexList_To_v1alpha1_VLANIndexList(in *vlan.VLANIndexList, out *VLANIndexList, s conversion.Scope) error { + return autoConvert_vlan_VLANIndexList_To_v1alpha1_VLANIndexList(in, out, s) +} + +func autoConvert_v1alpha1_VLANIndexSpec_To_vlan_VLANIndexSpec(in *VLANIndexSpec, out *vlan.VLANIndexSpec, s conversion.Scope) error { + out.MinID = (*uint32)(unsafe.Pointer(in.MinID)) + out.MaxID = (*uint32)(unsafe.Pointer(in.MaxID)) + if err := asv1alpha1.Convert_v1alpha1_UserDefinedLabels_To_common_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_VLANIndexSpec_To_vlan_VLANIndexSpec is an autogenerated conversion function. +func Convert_v1alpha1_VLANIndexSpec_To_vlan_VLANIndexSpec(in *VLANIndexSpec, out *vlan.VLANIndexSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_VLANIndexSpec_To_vlan_VLANIndexSpec(in, out, s) +} + +func autoConvert_vlan_VLANIndexSpec_To_v1alpha1_VLANIndexSpec(in *vlan.VLANIndexSpec, out *VLANIndexSpec, s conversion.Scope) error { + out.MinID = (*uint32)(unsafe.Pointer(in.MinID)) + out.MaxID = (*uint32)(unsafe.Pointer(in.MaxID)) + if err := asv1alpha1.Convert_common_UserDefinedLabels_To_v1alpha1_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_vlan_VLANIndexSpec_To_v1alpha1_VLANIndexSpec is an autogenerated conversion function. +func Convert_vlan_VLANIndexSpec_To_v1alpha1_VLANIndexSpec(in *vlan.VLANIndexSpec, out *VLANIndexSpec, s conversion.Scope) error { + return autoConvert_vlan_VLANIndexSpec_To_v1alpha1_VLANIndexSpec(in, out, s) +} + +func autoConvert_v1alpha1_VLANIndexStatus_To_vlan_VLANIndexStatus(in *VLANIndexStatus, out *vlan.VLANIndexStatus, s conversion.Scope) error { + out.MinID = (*uint32)(unsafe.Pointer(in.MinID)) + out.MaxID = (*uint32)(unsafe.Pointer(in.MaxID)) + if err := asv1alpha1.Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_VLANIndexStatus_To_vlan_VLANIndexStatus is an autogenerated conversion function. +func Convert_v1alpha1_VLANIndexStatus_To_vlan_VLANIndexStatus(in *VLANIndexStatus, out *vlan.VLANIndexStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_VLANIndexStatus_To_vlan_VLANIndexStatus(in, out, s) +} + +func autoConvert_vlan_VLANIndexStatus_To_v1alpha1_VLANIndexStatus(in *vlan.VLANIndexStatus, out *VLANIndexStatus, s conversion.Scope) error { + out.MinID = (*uint32)(unsafe.Pointer(in.MinID)) + out.MaxID = (*uint32)(unsafe.Pointer(in.MaxID)) + if err := asv1alpha1.Convert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_vlan_VLANIndexStatus_To_v1alpha1_VLANIndexStatus is an autogenerated conversion function. +func Convert_vlan_VLANIndexStatus_To_v1alpha1_VLANIndexStatus(in *vlan.VLANIndexStatus, out *VLANIndexStatus, s conversion.Scope) error { + return autoConvert_vlan_VLANIndexStatus_To_v1alpha1_VLANIndexStatus(in, out, s) +} diff --git a/apis/backend/vlan/v1alpha1/zz_generated.deepcopy.go b/apis/backend/vlan/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 0000000..61b126b --- /dev/null +++ b/apis/backend/vlan/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,355 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +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 *VLANClaim) DeepCopyInto(out *VLANClaim) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANClaim. +func (in *VLANClaim) DeepCopy() *VLANClaim { + if in == nil { + return nil + } + out := new(VLANClaim) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VLANClaim) 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 *VLANClaimList) DeepCopyInto(out *VLANClaimList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]VLANClaim, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANClaimList. +func (in *VLANClaimList) DeepCopy() *VLANClaimList { + if in == nil { + return nil + } + out := new(VLANClaimList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VLANClaimList) 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 *VLANClaimSpec) DeepCopyInto(out *VLANClaimSpec) { + *out = *in + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(uint32) + **out = **in + } + if in.Range != nil { + in, out := &in.Range, &out.Range + *out = new(string) + **out = **in + } + in.ClaimLabels.DeepCopyInto(&out.ClaimLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANClaimSpec. +func (in *VLANClaimSpec) DeepCopy() *VLANClaimSpec { + if in == nil { + return nil + } + out := new(VLANClaimSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VLANClaimStatus) DeepCopyInto(out *VLANClaimStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(uint32) + **out = **in + } + if in.Range != nil { + in, out := &in.Range, &out.Range + *out = new(string) + **out = **in + } + if in.ExpiryTime != nil { + in, out := &in.ExpiryTime, &out.ExpiryTime + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANClaimStatus. +func (in *VLANClaimStatus) DeepCopy() *VLANClaimStatus { + if in == nil { + return nil + } + out := new(VLANClaimStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VLANEntry) DeepCopyInto(out *VLANEntry) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANEntry. +func (in *VLANEntry) DeepCopy() *VLANEntry { + if in == nil { + return nil + } + out := new(VLANEntry) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VLANEntry) 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 *VLANEntryList) DeepCopyInto(out *VLANEntryList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]VLANEntry, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANEntryList. +func (in *VLANEntryList) DeepCopy() *VLANEntryList { + if in == nil { + return nil + } + out := new(VLANEntryList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VLANEntryList) 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 *VLANEntrySpec) DeepCopyInto(out *VLANEntrySpec) { + *out = *in + in.ClaimLabels.DeepCopyInto(&out.ClaimLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANEntrySpec. +func (in *VLANEntrySpec) DeepCopy() *VLANEntrySpec { + if in == nil { + return nil + } + out := new(VLANEntrySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VLANEntryStatus) DeepCopyInto(out *VLANEntryStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANEntryStatus. +func (in *VLANEntryStatus) DeepCopy() *VLANEntryStatus { + if in == nil { + return nil + } + out := new(VLANEntryStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VLANIndex) DeepCopyInto(out *VLANIndex) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANIndex. +func (in *VLANIndex) DeepCopy() *VLANIndex { + if in == nil { + return nil + } + out := new(VLANIndex) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VLANIndex) 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 *VLANIndexList) DeepCopyInto(out *VLANIndexList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]VLANIndex, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANIndexList. +func (in *VLANIndexList) DeepCopy() *VLANIndexList { + if in == nil { + return nil + } + out := new(VLANIndexList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VLANIndexList) 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 *VLANIndexSpec) DeepCopyInto(out *VLANIndexSpec) { + *out = *in + if in.MinID != nil { + in, out := &in.MinID, &out.MinID + *out = new(uint32) + **out = **in + } + if in.MaxID != nil { + in, out := &in.MaxID, &out.MaxID + *out = new(uint32) + **out = **in + } + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANIndexSpec. +func (in *VLANIndexSpec) DeepCopy() *VLANIndexSpec { + if in == nil { + return nil + } + out := new(VLANIndexSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VLANIndexStatus) DeepCopyInto(out *VLANIndexStatus) { + *out = *in + if in.MinID != nil { + in, out := &in.MinID, &out.MinID + *out = new(uint32) + **out = **in + } + if in.MaxID != nil { + in, out := &in.MaxID, &out.MaxID + *out = new(uint32) + **out = **in + } + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANIndexStatus. +func (in *VLANIndexStatus) DeepCopy() *VLANIndexStatus { + if in == nil { + return nil + } + out := new(VLANIndexStatus) + in.DeepCopyInto(out) + return out +} diff --git a/apis/backend/as/v1alpha1/helper.go b/apis/backend/vlan/v1alpha1/zz_generated.defaults.go similarity index 59% rename from apis/backend/as/v1alpha1/helper.go rename to apis/backend/vlan/v1alpha1/zz_generated.defaults.go index e65077c..c38f9bb 100644 --- a/apis/backend/as/v1alpha1/helper.go +++ b/apis/backend/vlan/v1alpha1/zz_generated.defaults.go @@ -1,3 +1,6 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + /* Copyright 2024 Nokia. @@ -13,32 +16,17 @@ 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 defaulter-gen. DO NOT EDIT. package v1alpha1 import ( - "fmt" - "strconv" + runtime "k8s.io/apimachinery/pkg/runtime" ) -const ASID_Min = 0 -const ASID_Max = 4294967295 - -func validateASID(id int) error { - if id < ASID_Min { - return fmt.Errorf("invalid id, got %d", id) - } - if id > ASID_Max { - return fmt.Errorf("invalid id, got %d", id) - } +// RegisterDefaults adds defaulters functions to the given scheme. +// Public to allow building arbitrary schemes. +// All generated defaulters are covering - they call all nested defaulters. +func RegisterDefaults(scheme *runtime.Scheme) error { return nil } - -func getASDot(asn uint32) string { - if asn > 65536 { - a := asn / 65536 - b := asn - (a * 65536) - return fmt.Sprintf("%d.%d", a, b) - } - return strconv.Itoa(int(asn)) -} diff --git a/apis/backend/vlan/vlanclaim_object.go b/apis/backend/vlan/vlanclaim_object.go new file mode 100644 index 0000000..090be31 --- /dev/null +++ b/apis/backend/vlan/vlanclaim_object.go @@ -0,0 +1,394 @@ +/* +Copyright 2024 Nokia. + +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 "VLAN IS" BVLANIS, +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 vlan + +import ( + "errors" + "fmt" + "strconv" + "strings" + + "github.com/henderiw/idxtable/pkg/table" + "github.com/henderiw/idxtable/pkg/table/table32" + "github.com/henderiw/idxtable/pkg/tree" + "github.com/henderiw/idxtable/pkg/tree/id32" + "github.com/henderiw/store" + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/backend" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/apimachinery/pkg/util/validation/field" + "k8s.io/utils/ptr" +) + +var _ backend.ClaimObject = &VLANClaim{} + +func (r *VLANClaim) GetNamespacedName() types.NamespacedName { + return types.NamespacedName{ + Namespace: r.GetNamespace(), + Name: r.GetName(), + } +} + +func (r *VLANClaim) GetKey() store.Key { + return store.KeyFromNSN(types.NamespacedName{Namespace: r.Namespace, Name: r.Spec.Index}) +} + +// GetCondition returns the condition bVLANed on the condition kind +func (r *VLANClaim) GetCondition(t condition.ConditionType) condition.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *VLANClaim) SetConditions(c ...condition.Condition) { + r.Status.SetConditions(c...) +} + +func (r *VLANClaim) ValidateSyntax(s string) field.ErrorList { + var allErrs field.ErrorList + + if err := r.ValidateVLANClaimType(); err != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath(""), + r, + err.Error(), + )) + return allErrs + } + var v SyntaxValidator + claimType := r.GetClaimType() + switch claimType { + case backend.ClaimType_DynamicID: + v = &VLANDynamicIDSyntaxValidator{name: string(claimType)} + case backend.ClaimType_StaticID: + v = &VLANStaticIDSyntaxValidator{name: string(claimType)} + case backend.ClaimType_Range: + v = &VLANRangeSyntaxValidator{name: string(claimType)} + default: + return allErrs + } + return v.Validate(r) +} + +func (r *VLANClaim) ValidateVLANRange() error { + if r.Spec.Range == nil { + return fmt.Errorf("no vlan range provided") + } + parts := strings.SplitN(*r.Spec.Range, "-", 2) + if len(parts) != 2 { + return fmt.Errorf("invalid vlan range, expected -, got: %s", *r.Spec.Range) + } + var errm error + if r.Name == r.Spec.Index { + // to be able to check if the entry is reserved we get a parentname (rang name) equal to index + // this is because the ownerreference uses the name of the index in its labels in the cache + errm = errors.Join(errm, fmt.Errorf("a name of range cannot be the same as the index")) + } + start, err := strconv.Atoi(parts[0]) + if err != nil { + errm = errors.Join(errm, fmt.Errorf("invalid vlan range start, got: %s, err: %s", *r.Spec.Range, err.Error())) + } + end, err := strconv.Atoi(parts[1]) + if err != nil { + errm = errors.Join(errm, fmt.Errorf("invalid vlan range end, got: %s, err: %s", *r.Spec.Range, err.Error())) + } + if errm != nil { + return errm + } + if start > end { + errm = errors.Join(errm, fmt.Errorf("invalid vlan range start > end %s", *r.Spec.Range)) + } + if err := validateVLANID(start); err != nil { + errm = errors.Join(errm, fmt.Errorf("invalid vlan start err %s", err.Error())) + } + if err := validateVLANID(end); err != nil { + errm = errors.Join(errm, fmt.Errorf("invalid vlan end err %s", err.Error())) + } + return errm +} + +func (r *VLANClaim) ValidateVLANID() error { + if r.Spec.ID == nil { + return fmt.Errorf("no vlan id provided") + } + if err := validateVLANID(int(*r.Spec.ID)); err != nil { + return fmt.Errorf("invalid vlan id err %s", err.Error()) + } + return nil +} + +func (r *VLANClaim) ValidateVLANClaimType() error { + var sb strings.Builder + count := 0 + if r.Spec.ID != nil { + sb.WriteString(fmt.Sprintf("id: %d", *r.Spec.ID)) + count++ + + } + if r.Spec.Range != nil { + if count > 0 { + sb.WriteString(", ") + } + sb.WriteString(fmt.Sprintf("range: %s", *r.Spec.Range)) + count++ + + } + if count > 1 { + return fmt.Errorf("a claim can only have 1 addressing, got %s", sb.String()) + } + return nil +} + +func (r *VLANClaim) GetIndex() string { return r.Spec.Index } + +func (r *VLANClaim) GetSelector() *metav1.LabelSelector { return r.Spec.Selector } + +func (r *VLANClaim) IsOwner(labels labels.Set) bool { + ownerLabels := r.getOnwerLabels() + for k, v := range ownerLabels { + if val, ok := labels[k]; !ok || val != v { + return false + } + } + return true +} + +func (r *VLANClaim) getOnwerLabels() map[string]string { + claimName := r.Name + claimKind := r.Kind + claimUID := r.UID + for _, owner := range r.GetOwnerReferences() { + if owner.APIVersion == SchemeGroupVersion.Identifier() && + owner.Kind == VLANIndexKind { + claimName = owner.Name + claimKind = owner.Kind + claimUID = owner.UID + } + } + + return map[string]string{ + backend.KuidClaimNameKey: claimName, + backend.KuidClaimUIDKey: string(claimUID), + backend.KuidOwnerKindKey: claimKind, + } +} + +// GetOwnerSelector selects the route bVLANed on the name of the claim +func (r *VLANClaim) GetOwnerSelector() (labels.Selector, error) { + l := r.getOnwerLabels() + + fullselector := labels.NewSelector() + for k, v := range l { + req, err := labels.NewRequirement(k, selection.Equals, []string{v}) + if err != nil { + return nil, err + } + fullselector = fullselector.Add(*req) + } + return fullselector, nil +} + +func (r *VLANClaim) GetLabelSelector() (labels.Selector, error) { return r.Spec.GetLabelSelector() } + +func (r *VLANClaim) GetClaimLabels() labels.Set { + labels := r.Spec.GetUserDefinedLabels() + + // for claims originated from the index we need to use the ownerreferences, since these claims + // are never stored in the apiserver, the ip entries need to reference the index instead + claimName := r.Name + claimKind := VLANClaimKind + claimUID := r.UID + for _, owner := range r.GetOwnerReferences() { + if owner.APIVersion == SchemeGroupVersion.Identifier() && + owner.Kind == VLANIndexKind { + claimName = owner.Name + claimKind = owner.Kind + claimUID = owner.UID + } + } + // system defined labels + labels[backend.KuidClaimTypeKey] = string(r.GetClaimType()) + labels[backend.KuidClaimNameKey] = claimName + labels[backend.KuidClaimUIDKey] = string(claimUID) + labels[backend.KuidOwnerKindKey] = claimKind + return labels +} + +func (r *VLANClaim) ValidateOwner(labels labels.Set) error { + routeClaimName := labels[backend.KuidClaimNameKey] + routeClaimUID := labels[backend.KuidClaimUIDKey] + + if string(r.UID) != routeClaimUID && r.Name != routeClaimName { + return fmt.Errorf("route owned by different claim got name %s/%s uid %s/%s", + r.Name, + routeClaimName, + string(r.UID), + routeClaimUID, + ) + } + return nil +} + +func (r *VLANClaim) GetClaimType() backend.ClaimType { + claimType := backend.ClaimType_Invalid + count := 0 + if r.Spec.ID != nil { + claimType = backend.ClaimType_StaticID + count++ + + } + if r.Spec.Range != nil { + claimType = backend.ClaimType_Range + count++ + + } + if count > 1 { + return backend.ClaimType_Invalid + } + if count == 0 { + return backend.ClaimType_DynamicID + } + return claimType +} +func (r *VLANClaim) GetStaticID() *uint64 { + if r.Spec.ID == nil { + return nil + } + return ptr.To[uint64](uint64(*r.Spec.ID)) +} +func (r *VLANClaim) GetStaticTreeID(t string) tree.ID { + if r.Spec.ID == nil { + return nil + } + return id32.NewID(*r.Spec.ID, id32.IDBitSize) +} + +func (r *VLANClaim) GetClaimID(t string, id uint64) tree.ID { + return id32.NewID(uint32(id), id32.IDBitSize) +} + +func (r *VLANClaim) GetRange() *string { + return r.Spec.Range +} + +func (r *VLANClaim) GetRangeID(t string) (tree.Range, error) { + if r.Spec.Range == nil { + return nil, fmt.Errorf("cannot provide a range without an id") + } + return id32.ParseRange(*r.Spec.Range) +} + +func (r *VLANClaim) GetTable(t string, to, from uint64) table.Table { + return table32.New(uint32(to), uint32(from)) +} + +func (r *VLANClaim) SetStatusRange(s *string) { + r.Status.Range = s +} + +func (r *VLANClaim) SetStatusID(s *uint64) { + if s == nil { + r.Status.ID = nil + return + } + r.Status.ID = ptr.To[uint32](uint32(*s)) +} + +func (r *VLANClaim) GetStatusID() *uint64 { + if r.Status.ID == nil { + return nil + } + return ptr.To[uint64](uint64(*r.Status.ID)) +} + +func (r *VLANClaim) GetClaimRequest() string { + // we assume validation is already done when calling this + if r.Spec.ID != nil { + return strconv.Itoa(int(*r.Spec.ID)) + } + if r.Spec.Range != nil { + return *r.Spec.Range + } + return "" +} + +func (r *VLANClaim) GetClaimResponse() string { + // we assume validation is already done when calling this + if r.Status.ID != nil { + return strconv.Itoa(int(*r.Status.ID)) + } + if r.Status.Range != nil { + return *r.Status.Range + } + return "" +} + +func (r *VLANClaim) GetClaimSet(typ string) (sets.Set[tree.ID], error) { + arange, err := r.GetRangeID(typ) + if err != nil { + return nil, fmt.Errorf("cannot get range from claim: %v", err) + } + // claim set represents the new entries + newClaimSet := sets.New[tree.ID]() + for _, rangeID := range arange.IDs() { + newClaimSet.Insert(rangeID) + } + return newClaimSet, nil +} + +func VLANClaimFromUnstructured(ru runtime.Unstructured) (backend.ClaimObject, error) { + obj := &VLANClaim{} + err := runtime.DefaultUnstructuredConverter.FromUnstructured(ru.UnstructuredContent(), obj) + if err != nil { + return nil, fmt.Errorf("error converting unstructured to asIndex: %v", err) + } + return obj, nil +} + +func VLANClaimFromRuntime(ru runtime.Object) (backend.ClaimObject, error) { + claim, ok := ru.(*VLANClaim) + if !ok { + return nil, errors.New("runtime object not VLANClaim") + } + return claim, nil +} + +// BuildVLANClaim returns a reource from a client Object a Spec/Status +func BuildVLANClaim(meta metav1.ObjectMeta, spec *VLANClaimSpec, status *VLANClaimStatus) backend.ClaimObject { + vlanspec := VLANClaimSpec{} + if spec != nil { + vlanspec = *spec + } + vlanstatus := VLANClaimStatus{} + if status != nil { + vlanstatus = *status + } + return &VLANClaim{ + TypeMeta: metav1.TypeMeta{ + APIVersion: SchemeGroupVersion.Identifier(), + Kind: VLANClaimKind, + }, + ObjectMeta: meta, + Spec: vlanspec, + Status: vlanstatus, + } +} diff --git a/apis/backend/vlan/vlanclaim_resource.go b/apis/backend/vlan/vlanclaim_resource.go new file mode 100644 index 0000000..bcffc3e --- /dev/null +++ b/apis/backend/vlan/vlanclaim_resource.go @@ -0,0 +1,318 @@ +/* +Copyright 2024 Nokia. + +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 "VLAN IS" BVLANIS, +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 vlan + +import ( + "context" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/kform-dev/choreo/apis/condition" + apiequality "k8s.io/apimachinery/pkg/api/equality" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/util/validation/field" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +const ( + VLANClaimPlural = "vlanclaims" + VLANClaimSingular = "vlanclaim" +) + +var ( + VLANClaimShortNames = []string{} + VLANClaimCategories = []string{"kuid", "knet"} +) + +// +k8s:deepcopy-gen=false +var _ resource.InternalObject = &VLANClaim{} +var _ resource.ObjectList = &VLANClaimList{} +var _ resource.ObjectWithStatusSubResource = &VLANClaim{} +var _ resource.StatusSubResource = &VLANClaimStatus{} + +func (VLANClaim) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: VLANClaimPlural, + } +} + +// IsStorageVersion returns true -- Config is used VLAN the internal version. +// IsStorageVersion implements resource.Object +func (VLANClaim) IsStorageVersion() bool { + return true +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (VLANClaim) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *VLANClaim) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// GetSingularName returns the singular name of the resource +// GetSingularName implements resource.Object +func (VLANClaim) GetSingularName() string { + return VLANClaimSingular +} + +// GetShortNames returns the shortnames for the resource +// GetShortNames implements resource.Object +func (VLANClaim) GetShortNames() []string { + return VLANClaimShortNames +} + +// GetCategories return the categories of the resource +// GetCategories implements resource.Object +func (VLANClaim) GetCategories() []string { + return VLANClaimCategories +} + +// New return an empty resource +// New implements resource.Object +func (VLANClaim) New() runtime.Object { + return &VLANClaim{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (VLANClaim) NewList() runtime.Object { + return &VLANClaimList{} +} + +// IsEqual returns a bool indicating if the desired state of both resources is equal or not +func (r *VLANClaim) IsEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*VLANClaim) + oldobj := old.(*VLANClaim) + + if !apiequality.Semantic.DeepEqual(oldobj.ObjectMeta, newobj.ObjectMeta) { + return false + } + // if equal we also test the spec + return apiequality.Semantic.DeepEqual(oldobj.Spec, newobj.Spec) +} + +// GetStatus return the resource.StatusSubResource interface +func (r *VLANClaim) GetStatus() resource.StatusSubResource { + return r.Status +} + +// IsStatusEqual returns a bool indicating if the status of both resources is equal or not +func (r *VLANClaim) IsStatusEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*VLANClaim) + oldobj := old.(*VLANClaim) + return apiequality.Semantic.DeepEqual(oldobj.Status, newobj.Status) +} + +// PrepareForStatusUpdate prepares the status update +func (r *VLANClaim) PrepareForStatusUpdate(ctx context.Context, obj, old runtime.Object) { + newObj := obj.(*VLANClaim) + oldObj := old.(*VLANClaim) + newObj.Spec = oldObj.Spec + + // Status updates are for only for updating status, not objectmeta. + metav1.ResetObjectMetaForStatus(&newObj.ObjectMeta, &newObj.ObjectMeta) +} + +// ValidateStatusUpdate validates status updates +func (r *VLANClaim) ValidateStatusUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +// SubResourceName resturns the name of the subresource +// SubResourceName implements the resource.StatusSubResource +func (VLANClaimStatus) SubResourceName() string { + return fmt.Sprintf("%s/%s", VLANClaimPlural, "status") +} + +// CopyTo copies the content of the status subresource to a parent resource. +// CopyTo implements the resource.StatusSubResource +func (r VLANClaimStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { + parent, ok := obj.(*VLANClaim) + if ok { + parent.Status = r + } +} + +// GetListMeta returns the ListMeta +// GetListMeta implements the resource.ObjectList +func (r *VLANClaimList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// TableConvertor return the table format of the resource +func (r *VLANClaim) TableConvertor() func(gr schema.GroupResource) rest.TableConvertor { + return func(gr schema.GroupResource) rest.TableConvertor { + return registry.NewTableConverter( + gr, + func(obj runtime.Object) []interface{} { + claim, ok := obj.(*VLANClaim) + if !ok { + return nil + } + return []interface{}{ + claim.GetName(), + claim.GetCondition(condition.ConditionTypeReady).Status, + claim.GetIndex(), + string(claim.GetClaimType()), + claim.GetClaimRequest(), + claim.GetClaimResponse(), + } + }, + []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + {Name: "Ready", Type: "string"}, + {Name: "Index", Type: "string"}, + {Name: "ClaimType", Type: "string"}, + {Name: "ClaimReq", Type: "string"}, + {Name: "ClaimRsp", Type: "string"}, + }, + ) + } +} + +// FieldLabelConversion is the schema conversion function for normalizing the FieldSelector for the resource +func (r *VLANClaim) FieldLabelConversion() runtime.FieldLabelConversionFunc { + return func(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } + } +} + +func (r *VLANClaim) FieldSelector() func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + return func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + var filter *VLANClaimFilter + + // add the namespace to the list + namespace, ok := genericapirequest.NamespaceFrom(ctx) + if fieldSelector == nil { + if ok { + return &VLANClaimFilter{Namespace: namespace}, nil + } + return filter, nil + } + requirements := fieldSelector.Requirements() + for _, requirement := range requirements { + filter = &VLANClaimFilter{} + switch requirement.Operator { + case selection.Equals, selection.DoesNotExist: + if requirement.Value == "" { + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) + } + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) + } + + switch requirement.Field { + case "metadata.name": + filter.Name = requirement.Value + case "metadata.namespace": + filter.Namespace = requirement.Value + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) + } + } + // add namespace to the filter selector if specified + if ok { + if filter != nil { + filter.Namespace = namespace + } else { + filter = &VLANClaimFilter{Namespace: namespace} + } + return filter, nil + } + + return &VLANClaimFilter{}, nil + } + +} + +type VLANClaimFilter struct { + // Name filters by the name of the objects + Name string `protobuf:"bytes,1,opt,name=name"` + + // Namespace filters by the namespace of the objects + Namespace string `protobuf:"bytes,2,opt,name=namespace"` +} + +func (r *VLANClaimFilter) Filter(ctx context.Context, obj runtime.Object) bool { + f := false // result of the previous filter + o, ok := obj.(*VLANClaim) + if !ok { + return f + } + if r == nil { + return false + } + if r.Name != "" { + if o.GetName() == r.Name { + f = false + } else { + f = true + } + } + if r.Namespace != "" { + if o.GetNamespace() == r.Namespace { + f = false + } else { + f = true + } + } + return f +} + +func (r *VLANClaim) PrepareForCreate(ctx context.Context, obj runtime.Object) { + // status cannot be set upon create -> reset it + newobj := obj.(*VLANClaim) + newobj.Status = VLANClaimStatus{} +} + +// ValidateCreate statically validates +func (r *VLANClaim) ValidateCreate(ctx context.Context, obj runtime.Object) field.ErrorList { + return r.ValidateSyntax("") +} + +func (r *VLANClaim) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { + // ensure the status dont get updated + newobj := obj.(*VLANClaim) + oldObj := old.(*VLANClaim) + newobj.Status = oldObj.Status +} + +func (r *VLANClaim) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + return r.ValidateSyntax("") +} diff --git a/apis/backend/vlan/vlanclaim_syntaxvalidator.go b/apis/backend/vlan/vlanclaim_syntaxvalidator.go new file mode 100644 index 0000000..f53b136 --- /dev/null +++ b/apis/backend/vlan/vlanclaim_syntaxvalidator.go @@ -0,0 +1,69 @@ +/* +Copyright 2024 Nokia. + +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 vlan + +import ( + fmt "fmt" + + "k8s.io/apimachinery/pkg/util/validation/field" +) + +// +kubebuilder:object:generate=false +type SyntaxValidator interface { + Validate(claim *VLANClaim) field.ErrorList +} + +type VLANDynamicIDSyntaxValidator struct { + name string +} + +func (r *VLANDynamicIDSyntaxValidator) Validate(claim *VLANClaim) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +type VLANStaticIDSyntaxValidator struct { + name string +} + +func (r *VLANStaticIDSyntaxValidator) Validate(claim *VLANClaim) field.ErrorList { + var allErrs field.ErrorList + if err := claim.ValidateVLANID(); err != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.id"), + claim, + fmt.Errorf("invalid vlan id %s", r.name).Error(), + )) + } + return allErrs +} + +type VLANRangeSyntaxValidator struct { + name string +} + +func (r *VLANRangeSyntaxValidator) Validate(claim *VLANClaim) field.ErrorList { + var allErrs field.ErrorList + if err := claim.ValidateVLANRange(); err != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.range"), + claim, + fmt.Errorf("invalid vlan range %s, err: %s", r.name, err.Error()).Error(), + )) + } + return allErrs +} diff --git a/apis/backend/vlan/vlanclaim_types.go b/apis/backend/vlan/vlanclaim_types.go new file mode 100644 index 0000000..d15b766 --- /dev/null +++ b/apis/backend/vlan/vlanclaim_types.go @@ -0,0 +1,82 @@ +/* +Copyright 2024 Nokia. + +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 "VLAN IS" BVLANIS, +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 vlan + +import ( + "reflect" + + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// VLANClaimSpec defines the desired state of VLANClaim +type VLANClaimSpec struct { + // Index defines the index for the resource + Index string `json:"index" yaml:"index" protobuf:"bytes,1,opt,name=index"` + // ID defines the id of the resource + ID *uint32 `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,2,opt,name=id"` + // Range defines the VLAN range of the resource + // The following notation is used: start-end - + // the VLANs in the range must be consecutive + Range *string `json:"range,omitempty" yaml:"range,omitempty" protobuf:"bytes,3,opt,name=range"` + // ClaimLabels define the user defined labels and selector labels used + // in resource claim + common.ClaimLabels `json:",inline" yaml:",inline" protobuf:"bytes,4,opt,name=claimLabels"` +} + +// VLANClaimStatus defines the observed state of VLANClaim +type VLANClaimStatus struct { + // ConditionedStatus provides the status of the VLANClain using conditions + // - a ready condition indicates the overall status of the resource + condition.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` + // VLANID defines the VLAN for the VLAN claim + // +optional + ID *uint32 `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,2,opt,name=id"` + // VLANRange defines the VLAN range for the VLAN claim + // +optional + Range *string `json:"range,omitempty" yaml:"range,omitempty" protobuf:"bytes,3,opt,name=range"` + // ExpiryTime defines when the claim expires + // +kubebuilder:validation:Optional + // +optional + ExpiryTime *string `json:"expiryTime,omitempty" yaml:"expiryTime,omitempty" protobuf:"bytes,4,opt,name=expiryTime"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// VLANClaim is the Schema for the VLANClaim API +type VLANClaim struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec VLANClaimSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status VLANClaimStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// VLANClaimList contains a list of VLANClaims +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type VLANClaimList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []VLANClaim `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + VLANClaimKind = reflect.TypeOf(VLANClaim{}).Name() + VLANClaimListKind = reflect.TypeOf(VLANClaimList{}).Name() +) diff --git a/apis/backend/vlan/vlanentry_object.go b/apis/backend/vlan/vlanentry_object.go new file mode 100644 index 0000000..6dc92b5 --- /dev/null +++ b/apis/backend/vlan/vlanentry_object.go @@ -0,0 +1,133 @@ +/* +Copyright 2024 Nokia. + +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 vlan + +import ( + "errors" + "fmt" + "strings" + + "github.com/henderiw/store" + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/backend" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +var _ backend.EntryObject = &VLANEntry{} + +func (r *VLANEntry) GetNamespacedName() types.NamespacedName { + return types.NamespacedName{ + Namespace: r.GetNamespace(), + Name: r.GetName(), + } +} +func (r *VLANEntry) GetKey() store.Key { + return store.KeyFromNSN(types.NamespacedName{Namespace: r.Namespace, Name: r.Spec.Index}) +} + +// GetCondition returns the condition based on the condition kind +func (r *VLANEntry) GetCondition(t condition.ConditionType) condition.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *VLANEntry) SetConditions(c ...condition.Condition) { + r.Status.SetConditions(c...) +} + +func (r *VLANEntry) ValidateSyntax(s string) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +func (r *VLANEntry) GetIndex() string { return r.Spec.Index } +func (r *VLANEntry) GetClaimType() backend.ClaimType { return r.Spec.ClaimType } +func (r *VLANEntry) GetSpecID() string { return r.Spec.ID } + +func VLANEntryFromRuntime(ru runtime.Object) (backend.EntryObject, error) { + entry, ok := ru.(*VLANEntry) + if !ok { + return nil, errors.New("runtime object not ASIndex") + } + return entry, nil +} + +func GetVLANEntry(k store.Key, vrange, id string, labels map[string]string) backend.EntryObject { + index := k.Name + ns := k.Namespace + + spec := &VLANEntrySpec{ + Index: index, + ClaimType: backend.GetClaimTypeFromString(labels[backend.KuidClaimTypeKey]), + ID: id, + } + // filter the system defined labels from the labels to prepare for the user defined labels + udLabels := map[string]string{} + for k, v := range labels { + if !backend.BackendSystemKeys.Has(k) { + udLabels[k] = v + } + } + spec.UserDefinedLabels.Labels = udLabels + + id = strings.ReplaceAll(id, "/", "-") + name := fmt.Sprintf("%s.%s", index, id) + if vrange != "" { + name = fmt.Sprintf("%s.%s", vrange, id) + } + + return BuildVLANEntry( + metav1.ObjectMeta{ + Name: name, + Namespace: ns, + OwnerReferences: []metav1.OwnerReference{ + { + APIVersion: SchemeGroupVersion.Identifier(), + Kind: labels[backend.KuidOwnerKindKey], + Name: labels[backend.KuidClaimNameKey], + UID: types.UID(labels[backend.KuidClaimUIDKey]), + }, + }, + }, + spec, + nil, + ) +} + +func BuildVLANEntry(meta metav1.ObjectMeta, spec *VLANEntrySpec, status *VLANEntryStatus) backend.EntryObject { + vlanspec := VLANEntrySpec{} + if spec != nil { + vlanspec = *spec + } + vlanstatus := VLANEntryStatus{} + if status != nil { + vlanstatus = *status + } + return &VLANEntry{ + TypeMeta: metav1.TypeMeta{ + APIVersion: SchemeGroupVersion.Identifier(), + Kind: VLANEntryKind, + }, + ObjectMeta: meta, + Spec: vlanspec, + Status: vlanstatus, + } +} diff --git a/apis/backend/vlan/vlanentry_resource.go b/apis/backend/vlan/vlanentry_resource.go new file mode 100644 index 0000000..be184a0 --- /dev/null +++ b/apis/backend/vlan/vlanentry_resource.go @@ -0,0 +1,315 @@ +/* +Copyright 2024 Nokia. + +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 vlan + +import ( + "context" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + apiequality "k8s.io/apimachinery/pkg/api/equality" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/util/validation/field" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +const ( + VLANEntryPlural = "vlanentries" + VLANEntrySingular = "vlanEntry" +) + +var ( + VLANEntryShortNames = []string{} + VLANEntryCategories = []string{"kuid", "knet"} +) + +// +k8s:deepcopy-gen=false +var _ resource.InternalObject = &VLANEntry{} +var _ resource.ObjectList = &VLANEntryList{} +var _ resource.ObjectWithStatusSubResource = &VLANEntry{} +var _ resource.StatusSubResource = &VLANEntryStatus{} + +func (VLANEntry) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: VLANEntryPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (VLANEntry) IsStorageVersion() bool { + return true +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (VLANEntry) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *VLANEntry) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// GetSingularName returns the singular name of the resource +// GetSingularName implements resource.Object +func (VLANEntry) GetSingularName() string { + return VLANEntrySingular +} + +// GetShortNames returns the shortnames for the resource +// GetShortNames implements resource.Object +func (VLANEntry) GetShortNames() []string { + return VLANEntryShortNames +} + +// GetCategories return the categories of the resource +// GetCategories implements resource.Object +func (VLANEntry) GetCategories() []string { + return VLANEntryCategories +} + +// New return an empty resource +// New implements resource.Object +func (VLANEntry) New() runtime.Object { + return &VLANEntry{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (VLANEntry) NewList() runtime.Object { + return &VLANEntryList{} +} + +// IsEqual returns a bool indicating if the desired state of both resources is equal or not +func (r *VLANEntry) IsEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*VLANEntry) + oldobj := old.(*VLANEntry) + + if !apiequality.Semantic.DeepEqual(oldobj.ObjectMeta, newobj.ObjectMeta) { + return false + } + // if equal we also test the spec + return apiequality.Semantic.DeepEqual(oldobj.Spec, newobj.Spec) +} + +// GetStatus return the resource.StatusSubResource interface +func (r *VLANEntry) GetStatus() resource.StatusSubResource { + return r.Status +} + +// IsStatusEqual returns a bool indicating if the status of both resources is equal or not +func (r *VLANEntry) IsStatusEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*VLANEntry) + oldobj := old.(*VLANEntry) + return apiequality.Semantic.DeepEqual(oldobj.Status, newobj.Status) +} + +// PrepareForStatusUpdate prepares the status update +func (r *VLANEntry) PrepareForStatusUpdate(ctx context.Context, obj, old runtime.Object) { + newObj := obj.(*VLANEntry) + oldObj := old.(*VLANEntry) + newObj.Spec = oldObj.Spec + + // Status updates are for only for updating status, not objectmeta. + metav1.ResetObjectMetaForStatus(&newObj.ObjectMeta, &newObj.ObjectMeta) +} + +// ValidateStatusUpdate validates status updates +func (r *VLANEntry) ValidateStatusUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +// SubResourceName resturns the name of the subresource +// SubResourceName implements the resource.StatusSubResource +func (VLANEntryStatus) SubResourceName() string { + return fmt.Sprintf("%s/%s", VLANEntryPlural, "status") +} + +// CopyTo copies the content of the status subresource to a parent resource. +// CopyTo implements the resource.StatusSubResource +func (r VLANEntryStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { + parent, ok := obj.(*VLANEntry) + if ok { + parent.Status = r + } +} + +// GetListMeta returns the ListMeta +// GetListMeta implements the resource.ObjectList +func (r *VLANEntryList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// TableConvertor return the table format of the resource +func (r *VLANEntry) TableConvertor() func(gr schema.GroupResource) rest.TableConvertor { + return func(gr schema.GroupResource) rest.TableConvertor { + return registry.NewTableConverter( + gr, + func(obj runtime.Object) []interface{} { + entry, ok := obj.(*VLANEntry) + if !ok { + return nil + } + return []interface{}{ + entry.GetName(), + //entry.GetCondition(condition.ConditionTypeReady).Status, + entry.GetIndex(), + entry.GetClaimType(), + entry.GetSpecID(), + } + }, + []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + //{Name: "Ready", Type: "string"}, + {Name: "Index", Type: "string"}, + {Name: "ClaimType", Type: "string"}, + {Name: "ID", Type: "string"}, + }, + ) + } +} + +// FieldLabelConversion is the schema conversion function for normalizing the FieldSelector for the resource +func (r *VLANEntry) FieldLabelConversion() runtime.FieldLabelConversionFunc { + return func(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } + } +} + +func (r *VLANEntry) FieldSelector() func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + return func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + var filter *VLANEntryFilter + + // add the namespace to the list + namespace, ok := genericapirequest.NamespaceFrom(ctx) + if fieldSelector == nil { + if ok { + return &VLANEntryFilter{Namespace: namespace}, nil + } + return filter, nil + } + requirements := fieldSelector.Requirements() + for _, requirement := range requirements { + filter = &VLANEntryFilter{} + switch requirement.Operator { + case selection.Equals, selection.DoesNotExist: + if requirement.Value == "" { + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) + } + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) + } + + switch requirement.Field { + case "metadata.name": + filter.Name = requirement.Value + case "metadata.namespace": + filter.Namespace = requirement.Value + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) + } + } + // add namespace to the filter selector if specified + if ok { + if filter != nil { + filter.Namespace = namespace + } else { + filter = &VLANEntryFilter{Namespace: namespace} + } + return filter, nil + } + + return &VLANEntryFilter{}, nil + } + +} + +type VLANEntryFilter struct { + // Name filters by the name of the objects + Name string `protobuf:"bytes,1,opt,name=name"` + + // Namespace filters by the namespace of the objects + Namespace string `protobuf:"bytes,2,opt,name=namespace"` +} + +func (r *VLANEntryFilter) Filter(ctx context.Context, obj runtime.Object) bool { + f := false // result of the previous filter + o, ok := obj.(*VLANEntry) + if !ok { + return f + } + if r == nil { + return false + } + if r.Name != "" { + if o.GetName() == r.Name { + f = false + } else { + f = true + } + } + if r.Namespace != "" { + if o.GetNamespace() == r.Namespace { + f = false + } else { + f = true + } + } + return f +} + +func (r *VLANEntry) PrepareForCreate(ctx context.Context, obj runtime.Object) { + // status cannot be set upon create -> reset it + newobj := obj.(*VLANEntry) + newobj.Status = VLANEntryStatus{} +} + +// ValidateCreate statically validates +func (r *VLANEntry) ValidateCreate(ctx context.Context, obj runtime.Object) field.ErrorList { + return r.ValidateSyntax("") +} + +func (r *VLANEntry) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { + // ensure the sttaus dont get updated + newobj := obj.(*VLANEntry) + oldObj := old.(*VLANEntry) + newobj.Status = oldObj.Status +} + +func (r *VLANEntry) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + return r.ValidateSyntax("") +} diff --git a/apis/backend/vlan/vlanentry_types.go b/apis/backend/vlan/vlanentry_types.go new file mode 100644 index 0000000..cfbba42 --- /dev/null +++ b/apis/backend/vlan/vlanentry_types.go @@ -0,0 +1,71 @@ +/* +Copyright 2024 Nokia. + +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 "VLAN IS" BVLANIS, +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 vlan + +import ( + "reflect" + + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/common" + "github.com/kuidio/kuid/apis/backend" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// VLANEntrySpec defines the desired state of VLANEntry +type VLANEntrySpec struct { + // Index defines the index for the resource + Index string `json:"index" yaml:"index" protobuf:"bytes,1,opt,name=index"` + // ClaimType defines the claimType of the resource + ClaimType backend.ClaimType `json:"claimType,omitempty" yaml:"claimType,omitempty" protobuf:"bytes,2,opt,name=claimType"` + // ID defines the id of the resource in the tree + ID string `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,3,opt,name=id"` + // ClaimLabels define the user defined labels and selector labels used + // in resource claim + common.ClaimLabels `json:",inline" yaml:",inline" protobuf:"bytes,5,opt,name=claimLabels"` +} + +// VLANEntryStatus defines the observed state of VLANEntry +type VLANEntryStatus struct { + // ConditionedStatus provides the status of the VLANEntry using conditions + // - a ready condition indicates the overall status of the resource + condition.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// VLANEntry is the Schema for the VLANentry API +type VLANEntry struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec VLANEntrySpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status VLANEntryStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// VLANEntryList contains a list of VLANEntries +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type VLANEntryList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []VLANEntry `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + VLANEntryKind = reflect.TypeOf(VLANEntry{}).Name() + VLANEntryListKind = reflect.TypeOf(VLANEntryList{}).Name() +) diff --git a/apis/backend/vlan/vlanindex_helpers.go b/apis/backend/vlan/vlanindex_helpers.go new file mode 100644 index 0000000..2927fee --- /dev/null +++ b/apis/backend/vlan/vlanindex_helpers.go @@ -0,0 +1,90 @@ +/* +Copyright 2024 Nokia. + +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 vlan + +import ( + "fmt" + + "github.com/kform-dev/choreo/apis/condition" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +// GetCondition returns the condition based on the condition kind +func (r *VLANIndex) GetCondition(t condition.ConditionType) condition.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *VLANIndex) SetConditions(c ...condition.Condition) { + r.Status.SetConditions(c...) +} + +func (r *VLANIndex) ValidateSyntax(s string) field.ErrorList { + var allErrs field.ErrorList + + if r.Spec.MinID != nil { + if err := validateVLANID(int(*r.Spec.MinID)); err != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.minID"), + r, + fmt.Errorf("invalid vlan ID %d", *r.Spec.MinID).Error(), + )) + } + } + if r.Spec.MaxID != nil { + if err := validateVLANID(int(*r.Spec.MaxID)); err != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.maxID"), + r, + fmt.Errorf("invalid vlan ID %d", *r.Spec.MaxID).Error(), + )) + } + } + if r.Spec.MinID != nil && r.Spec.MaxID != nil { + if *r.Spec.MinID > *r.Spec.MaxID { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.maxID"), + r, + fmt.Errorf("min vlan ID %d cannot be bigger than max vlan ID %d", *r.Spec.MinID, *r.Spec.MaxID).Error(), + )) + } + } + return allErrs +} + +// BuildVLANIndex returns a reource from a client Object a Spec/Status +func BuildVLANIndex(meta metav1.ObjectMeta, spec *VLANIndexSpec, status *VLANIndexStatus) *VLANIndex { + aspec := VLANIndexSpec{} + if spec != nil { + aspec = *spec + } + astatus := VLANIndexStatus{} + if status != nil { + astatus = *status + } + return &VLANIndex{ + TypeMeta: metav1.TypeMeta{ + APIVersion: SchemeGroupVersion.Identifier(), + Kind: VLANIndexKind, + }, + ObjectMeta: meta, + Spec: aspec, + Status: astatus, + } +} diff --git a/apis/backend/vlan/vlanindex_object.go b/apis/backend/vlan/vlanindex_object.go new file mode 100644 index 0000000..65b3eaa --- /dev/null +++ b/apis/backend/vlan/vlanindex_object.go @@ -0,0 +1,148 @@ +/* +Copyright 2024 Nokia. + +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 vlan + +import ( + "errors" + "fmt" + + "github.com/henderiw/idxtable/pkg/tree/gtree" + "github.com/henderiw/idxtable/pkg/tree/tree32" + "github.com/henderiw/store" + "github.com/kuidio/kuid/apis/backend" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" + "k8s.io/utils/ptr" +) + +var _ backend.IndexObject = &VLANIndex{} + +func (r *VLANIndex) GetKey() store.Key { + return store.KeyFromNSN(r.GetNamespacedName()) +} + +func (r *VLANIndex) GetNamespacedName() types.NamespacedName { + return types.NamespacedName{ + Namespace: r.GetNamespace(), + Name: r.GetName(), + } +} + +func (r *VLANIndex) GetTree() gtree.GTree { + tree, err := tree32.New(32) + if err != nil { + panic(err) + } + return tree +} + +func (r *VLANIndex) GetType() string { + return "" +} + +func (r *VLANIndex) GetMinID() *uint64 { + if r.Spec.MinID == nil { + return nil + } + return ptr.To[uint64](uint64(*r.Spec.MinID)) +} + +func (r *VLANIndex) GetMaxID() *uint64 { + if r.Spec.MaxID == nil { + return nil + } + return ptr.To[uint64](uint64(*r.Spec.MaxID)) +} + +func (r *VLANIndex) GetMax() uint64 { + return VLANID_Max +} + +func GetMinClaimRange(id uint32) string { + return fmt.Sprintf("%d-%d", VLANID_Min, id-1) +} + +func GetMaxClaimRange(id uint32) string { + return fmt.Sprintf("%d-%d", id+1, VLANID_Max) +} + +func (r *VLANIndex) GetMinClaimNSN() types.NamespacedName { + return types.NamespacedName{ + Namespace: r.Namespace, + Name: fmt.Sprintf("%s.%s", r.Name, backend.IndexReservedMinName), + } +} + +func (r *VLANIndex) GetMaxClaimNSN() types.NamespacedName { + return types.NamespacedName{ + Namespace: r.Namespace, + Name: fmt.Sprintf("%s.%s", r.Name, backend.IndexReservedMaxName), + } +} + +func (r *VLANIndex) GetMinClaim() backend.ClaimObject { + return BuildVLANClaim( + metav1.ObjectMeta{ + Namespace: r.GetNamespace(), + Name: r.GetMinClaimNSN().Name, + OwnerReferences: []metav1.OwnerReference{ + { + APIVersion: r.APIVersion, + Kind: r.Kind, + Name: r.Name, + UID: r.UID, + }, + }, + }, + &VLANClaimSpec{ + Index: r.Name, + Range: ptr.To[string](GetMinClaimRange(*r.Spec.MinID)), + }, + nil, + ) +} + +func (r *VLANIndex) GetMaxClaim() backend.ClaimObject { + return BuildVLANClaim( + metav1.ObjectMeta{ + Namespace: r.GetNamespace(), + Name: r.GetMaxClaimNSN().Name, + OwnerReferences: []metav1.OwnerReference{ + { + APIVersion: r.APIVersion, + Kind: r.Kind, + Name: r.Name, + UID: r.UID, + }, + }, + }, + &VLANClaimSpec{ + Index: r.Name, + Range: ptr.To[string](GetMaxClaimRange(*r.Spec.MaxID)), + }, + nil, + ) +} + +func VLANIndexFromRuntime(ru runtime.Object) (backend.IndexObject, error) { + index, ok := ru.(*VLANIndex) + if !ok { + return nil, errors.New("runtime object not VLANIndex") + } + return index, nil +} diff --git a/apis/backend/vlan/vlanindex_resource.go b/apis/backend/vlan/vlanindex_resource.go new file mode 100644 index 0000000..f44fba4 --- /dev/null +++ b/apis/backend/vlan/vlanindex_resource.go @@ -0,0 +1,314 @@ +/* +Copyright 2024 Nokia. + +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 vlan + +import ( + "context" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/kform-dev/choreo/apis/condition" + apiequality "k8s.io/apimachinery/pkg/api/equality" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/util/validation/field" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +const ( + VLANIndexPlural = "vlanindices" + VLANIndexSingular = "vlanIndex" +) + +var ( + VLANIndexShortNames = []string{} + VLANIndexCategories = []string{"kuid", "knet"} +) + +// +k8s:deepcopy-gen=false +var _ resource.InternalObject = &VLANIndex{} +var _ resource.ObjectList = &VLANIndexList{} +var _ resource.ObjectWithStatusSubResource = &VLANIndex{} +var _ resource.StatusSubResource = &VLANIndexStatus{} + +func (VLANIndex) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: VLANIndexPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (VLANIndex) IsStorageVersion() bool { + return true +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (VLANIndex) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *VLANIndex) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// GetSingularName returns the singular name of the resource +// GetSingularName implements resource.Object +func (VLANIndex) GetSingularName() string { + return VLANIndexSingular +} + +// GetShortNames returns the shortnames for the resource +// GetShortNames implements resource.Object +func (VLANIndex) GetShortNames() []string { + return VLANIndexShortNames +} + +// GetCategories return the categories of the resource +// GetCategories implements resource.Object +func (VLANIndex) GetCategories() []string { + return VLANIndexCategories +} + +// New return an empty resource +// New implements resource.Object +func (VLANIndex) New() runtime.Object { + return &VLANIndex{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (VLANIndex) NewList() runtime.Object { + return &VLANIndexList{} +} + +// IsEqual returns a bool indicating if the desired state of both resources is equal or not +func (r *VLANIndex) IsEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*VLANIndex) + oldobj := old.(*VLANIndex) + + if !apiequality.Semantic.DeepEqual(oldobj.ObjectMeta, newobj.ObjectMeta) { + return false + } + // if equal we also test the spec + return apiequality.Semantic.DeepEqual(oldobj.Spec, newobj.Spec) +} + +// GetStatus return the resource.StatusSubResource interface +func (r *VLANIndex) GetStatus() resource.StatusSubResource { + return r.Status +} + +// IsStatusEqual returns a bool indicating if the status of both resources is equal or not +func (r *VLANIndex) IsStatusEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*VLANIndex) + oldobj := old.(*VLANIndex) + return apiequality.Semantic.DeepEqual(oldobj.Status, newobj.Status) +} + +// PrepareForStatusUpdate prepares the status update +func (r *VLANIndex) PrepareForStatusUpdate(ctx context.Context, obj, old runtime.Object) { + newObj := obj.(*VLANIndex) + oldObj := old.(*VLANIndex) + newObj.Spec = oldObj.Spec + + // Status updates are for only for updating status, not objectmeta. + metav1.ResetObjectMetaForStatus(&newObj.ObjectMeta, &newObj.ObjectMeta) +} + +// ValidateStatusUpdate validates status updates +func (r *VLANIndex) ValidateStatusUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +// SubResourceName resturns the name of the subresource +// SubResourceName implements the resource.StatusSubResource +func (VLANIndexStatus) SubResourceName() string { + return fmt.Sprintf("%s/%s", VLANIndexPlural, "status") +} + +// CopyTo copies the content of the status subresource to a parent resource. +// CopyTo implements the resource.StatusSubResource +func (r VLANIndexStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { + parent, ok := obj.(*VLANIndex) + if ok { + parent.Status = r + } +} + +// GetListMeta returns the ListMeta +// GetListMeta implements the resource.ObjectList +func (r *VLANIndexList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// TableConvertor return the table format of the resource +func (r *VLANIndex) TableConvertor() func(gr schema.GroupResource) rest.TableConvertor { + return func(gr schema.GroupResource) rest.TableConvertor { + return registry.NewTableConverter( + gr, + func(obj runtime.Object) []interface{} { + index, ok := obj.(*VLANIndex) + if !ok { + return nil + } + return []interface{}{ + index.GetName(), + index.GetCondition(condition.ConditionTypeReady).Status, + index.GetMinID(), + index.GetMaxID(), + } + }, + []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + {Name: "Ready", Type: "string"}, + {Name: "MinID", Type: "integer"}, + {Name: "MaxID", Type: "integer"}, + }, + ) + } +} + +// FieldLabelConversion is the schema conversion function for normalizing the FieldSelector for the resource +func (r *VLANIndex) FieldLabelConversion() runtime.FieldLabelConversionFunc { + return func(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } + } +} + +func (r *VLANIndex) FieldSelector() func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + return func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + var filter *VLANIndexFilter + + // add the namespace to the list + namespace, ok := genericapirequest.NamespaceFrom(ctx) + if fieldSelector == nil { + if ok { + return &VLANIndexFilter{Namespace: namespace}, nil + } + return filter, nil + } + requirements := fieldSelector.Requirements() + for _, requirement := range requirements { + filter = &VLANIndexFilter{} + switch requirement.Operator { + case selection.Equals, selection.DoesNotExist: + if requirement.Value == "" { + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) + } + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) + } + + switch requirement.Field { + case "metadata.name": + filter.Name = requirement.Value + case "metadata.namespace": + filter.Namespace = requirement.Value + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) + } + } + // add namespace to the filter selector if specified + if ok { + if filter != nil { + filter.Namespace = namespace + } else { + filter = &VLANIndexFilter{Namespace: namespace} + } + return filter, nil + } + + return &VLANIndexFilter{}, nil + } + +} + +type VLANIndexFilter struct { + // Name filters by the name of the objects + Name string `protobuf:"bytes,1,opt,name=name"` + + // Namespace filters by the namespace of the objects + Namespace string `protobuf:"bytes,2,opt,name=namespace"` +} + +func (r *VLANIndexFilter) Filter(ctx context.Context, obj runtime.Object) bool { + f := false // result of the previous filter + o, ok := obj.(*VLANIndex) + if !ok { + return f + } + if r == nil { + return false + } + if r.Name != "" { + if o.GetName() == r.Name { + f = false + } else { + f = true + } + } + if r.Namespace != "" { + if o.GetNamespace() == r.Namespace { + f = false + } else { + f = true + } + } + return f +} + +func (r *VLANIndex) PrepareForCreate(ctx context.Context, obj runtime.Object) { + // status cannot be set upon create -> reset it + newobj := obj.(*VLANIndex) + newobj.Status = VLANIndexStatus{} +} + +// ValidateCreate statically validates +func (r *VLANIndex) ValidateCreate(ctx context.Context, obj runtime.Object) field.ErrorList { + return r.ValidateSyntax("") +} + +func (r *VLANIndex) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { + // ensure the sttaus dont get updated + newobj := obj.(*VLANIndex) + oldObj := old.(*VLANIndex) + newobj.Status = oldObj.Status +} + +func (r *VLANIndex) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + return r.ValidateSyntax("") +} diff --git a/apis/backend/vlan/vlanindex_types.go b/apis/backend/vlan/vlanindex_types.go new file mode 100644 index 0000000..3322784 --- /dev/null +++ b/apis/backend/vlan/vlanindex_types.go @@ -0,0 +1,76 @@ +/* +Copyright 2024 Nokia. + +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 "VLAN IS" BVLANIS, +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 vlan + +import ( + "reflect" + + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// VLANIndexSpec defines the desired state of VLANIndex +type VLANIndexSpec struct { + // MinID defines the min VLAN ID the index supports + // +optional + MinID *uint32 `json:"minID,omitempty" yaml:"minID,omitempty" protobuf:"bytes,1,opt,name=minID"` + // MaxID defines the max VLAN ID the index supports + // +optional + MaxID *uint32 `json:"maxID,omitempty" yaml:"maxID,omitempty" protobuf:"bytes,2,opt,name=maxID"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + common.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` +} + +// VLANIndexStatus defines the observed state of VLANIndex +type VLANIndexStatus struct { + // MinID defines the min VLAN ID the index supports + // +optional + MinID *uint32 `json:"minID,omitempty" yaml:"minID,omitempty" protobuf:"bytes,1,opt,name=minID"` + // MaxID defines the max VLAN ID the index supports + // +optional + MaxID *uint32 `json:"maxID,omitempty" yaml:"maxID,omitempty" protobuf:"bytes,2,opt,name=maxID"` + // ConditionedStatus provides the status of the VLANIndex using conditions + // - a ready condition indicates the overall status of the resource + condition.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// VLANIndex is the Schema for the VLANIndex API +type VLANIndex struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec VLANIndexSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status VLANIndexStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// VLANIndexList contains a list of VLANIndexs +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type VLANIndexList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []VLANIndex `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + VLANIndexKind = reflect.TypeOf(VLANIndex{}).Name() + VLANIndexListKind = reflect.TypeOf(VLANIndexList{}).Name() +) diff --git a/apis/backend/vlan/zz_generated.deepcopy.go b/apis/backend/vlan/zz_generated.deepcopy.go new file mode 100644 index 0000000..a53bc59 --- /dev/null +++ b/apis/backend/vlan/zz_generated.deepcopy.go @@ -0,0 +1,451 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2024 Nokia. + +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 vlan + +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 *VLANClaim) DeepCopyInto(out *VLANClaim) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANClaim. +func (in *VLANClaim) DeepCopy() *VLANClaim { + if in == nil { + return nil + } + out := new(VLANClaim) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VLANClaim) 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 *VLANClaimFilter) DeepCopyInto(out *VLANClaimFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANClaimFilter. +func (in *VLANClaimFilter) DeepCopy() *VLANClaimFilter { + if in == nil { + return nil + } + out := new(VLANClaimFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VLANClaimList) DeepCopyInto(out *VLANClaimList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]VLANClaim, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANClaimList. +func (in *VLANClaimList) DeepCopy() *VLANClaimList { + if in == nil { + return nil + } + out := new(VLANClaimList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VLANClaimList) 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 *VLANClaimSpec) DeepCopyInto(out *VLANClaimSpec) { + *out = *in + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(uint32) + **out = **in + } + if in.Range != nil { + in, out := &in.Range, &out.Range + *out = new(string) + **out = **in + } + in.ClaimLabels.DeepCopyInto(&out.ClaimLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANClaimSpec. +func (in *VLANClaimSpec) DeepCopy() *VLANClaimSpec { + if in == nil { + return nil + } + out := new(VLANClaimSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VLANClaimStatus) DeepCopyInto(out *VLANClaimStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(uint32) + **out = **in + } + if in.Range != nil { + in, out := &in.Range, &out.Range + *out = new(string) + **out = **in + } + if in.ExpiryTime != nil { + in, out := &in.ExpiryTime, &out.ExpiryTime + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANClaimStatus. +func (in *VLANClaimStatus) DeepCopy() *VLANClaimStatus { + if in == nil { + return nil + } + out := new(VLANClaimStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VLANDynamicIDSyntaxValidator) DeepCopyInto(out *VLANDynamicIDSyntaxValidator) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANDynamicIDSyntaxValidator. +func (in *VLANDynamicIDSyntaxValidator) DeepCopy() *VLANDynamicIDSyntaxValidator { + if in == nil { + return nil + } + out := new(VLANDynamicIDSyntaxValidator) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VLANEntry) DeepCopyInto(out *VLANEntry) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANEntry. +func (in *VLANEntry) DeepCopy() *VLANEntry { + if in == nil { + return nil + } + out := new(VLANEntry) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VLANEntry) 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 *VLANEntryFilter) DeepCopyInto(out *VLANEntryFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANEntryFilter. +func (in *VLANEntryFilter) DeepCopy() *VLANEntryFilter { + if in == nil { + return nil + } + out := new(VLANEntryFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VLANEntryList) DeepCopyInto(out *VLANEntryList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]VLANEntry, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANEntryList. +func (in *VLANEntryList) DeepCopy() *VLANEntryList { + if in == nil { + return nil + } + out := new(VLANEntryList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VLANEntryList) 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 *VLANEntrySpec) DeepCopyInto(out *VLANEntrySpec) { + *out = *in + in.ClaimLabels.DeepCopyInto(&out.ClaimLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANEntrySpec. +func (in *VLANEntrySpec) DeepCopy() *VLANEntrySpec { + if in == nil { + return nil + } + out := new(VLANEntrySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VLANEntryStatus) DeepCopyInto(out *VLANEntryStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANEntryStatus. +func (in *VLANEntryStatus) DeepCopy() *VLANEntryStatus { + if in == nil { + return nil + } + out := new(VLANEntryStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VLANIndex) DeepCopyInto(out *VLANIndex) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANIndex. +func (in *VLANIndex) DeepCopy() *VLANIndex { + if in == nil { + return nil + } + out := new(VLANIndex) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VLANIndex) 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 *VLANIndexFilter) DeepCopyInto(out *VLANIndexFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANIndexFilter. +func (in *VLANIndexFilter) DeepCopy() *VLANIndexFilter { + if in == nil { + return nil + } + out := new(VLANIndexFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VLANIndexList) DeepCopyInto(out *VLANIndexList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]VLANIndex, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANIndexList. +func (in *VLANIndexList) DeepCopy() *VLANIndexList { + if in == nil { + return nil + } + out := new(VLANIndexList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VLANIndexList) 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 *VLANIndexSpec) DeepCopyInto(out *VLANIndexSpec) { + *out = *in + if in.MinID != nil { + in, out := &in.MinID, &out.MinID + *out = new(uint32) + **out = **in + } + if in.MaxID != nil { + in, out := &in.MaxID, &out.MaxID + *out = new(uint32) + **out = **in + } + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANIndexSpec. +func (in *VLANIndexSpec) DeepCopy() *VLANIndexSpec { + if in == nil { + return nil + } + out := new(VLANIndexSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VLANIndexStatus) DeepCopyInto(out *VLANIndexStatus) { + *out = *in + if in.MinID != nil { + in, out := &in.MinID, &out.MinID + *out = new(uint32) + **out = **in + } + if in.MaxID != nil { + in, out := &in.MaxID, &out.MaxID + *out = new(uint32) + **out = **in + } + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANIndexStatus. +func (in *VLANIndexStatus) DeepCopy() *VLANIndexStatus { + if in == nil { + return nil + } + out := new(VLANIndexStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VLANRangeSyntaxValidator) DeepCopyInto(out *VLANRangeSyntaxValidator) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANRangeSyntaxValidator. +func (in *VLANRangeSyntaxValidator) DeepCopy() *VLANRangeSyntaxValidator { + if in == nil { + return nil + } + out := new(VLANRangeSyntaxValidator) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VLANStaticIDSyntaxValidator) DeepCopyInto(out *VLANStaticIDSyntaxValidator) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VLANStaticIDSyntaxValidator. +func (in *VLANStaticIDSyntaxValidator) DeepCopy() *VLANStaticIDSyntaxValidator { + if in == nil { + return nil + } + out := new(VLANStaticIDSyntaxValidator) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/config/config.go b/pkg/config/config.go index e6a6147..74555f9 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -71,6 +71,7 @@ func getDefaultConfig() *KuidConfig { Storage: StorageType_Badgerdb, Groups: []*KuidGroupConfig{ {Group: "as.be.kuid.dev", Enabled: true, Sync: true}, + {Group: "vlan.be.kuid.dev", Enabled: true, Sync: true}, {Group: "infra.kuid.dev", Enabled: true, Sync: true}, }, } diff --git a/pkg/generated/clientset/versioned/clientset.go b/pkg/generated/clientset/versioned/clientset.go index 7f19a4e..6b95ed5 100644 --- a/pkg/generated/clientset/versioned/clientset.go +++ b/pkg/generated/clientset/versioned/clientset.go @@ -23,6 +23,7 @@ import ( asv1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/as/v1alpha1" infrav1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/infra/v1alpha1" + vlanv1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/vlan/v1alpha1" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" @@ -32,6 +33,7 @@ type Interface interface { Discovery() discovery.DiscoveryInterface AsV1alpha1() asv1alpha1.AsV1alpha1Interface InfraV1alpha1() infrav1alpha1.InfraV1alpha1Interface + VlanV1alpha1() vlanv1alpha1.VlanV1alpha1Interface } // Clientset contains the clients for groups. @@ -39,6 +41,7 @@ type Clientset struct { *discovery.DiscoveryClient asV1alpha1 *asv1alpha1.AsV1alpha1Client infraV1alpha1 *infrav1alpha1.InfraV1alpha1Client + vlanV1alpha1 *vlanv1alpha1.VlanV1alpha1Client } // AsV1alpha1 retrieves the AsV1alpha1Client @@ -51,6 +54,11 @@ func (c *Clientset) InfraV1alpha1() infrav1alpha1.InfraV1alpha1Interface { return c.infraV1alpha1 } +// VlanV1alpha1 retrieves the VlanV1alpha1Client +func (c *Clientset) VlanV1alpha1() vlanv1alpha1.VlanV1alpha1Interface { + return c.vlanV1alpha1 +} + // Discovery retrieves the DiscoveryClient func (c *Clientset) Discovery() discovery.DiscoveryInterface { if c == nil { @@ -103,6 +111,10 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, if err != nil { return nil, err } + cs.vlanV1alpha1, err = vlanv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient) if err != nil { @@ -126,6 +138,7 @@ func New(c rest.Interface) *Clientset { var cs Clientset cs.asV1alpha1 = asv1alpha1.New(c) cs.infraV1alpha1 = infrav1alpha1.New(c) + cs.vlanV1alpha1 = vlanv1alpha1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/pkg/generated/clientset/versioned/fake/clientset_generated.go b/pkg/generated/clientset/versioned/fake/clientset_generated.go index 50510d2..80b9e2d 100644 --- a/pkg/generated/clientset/versioned/fake/clientset_generated.go +++ b/pkg/generated/clientset/versioned/fake/clientset_generated.go @@ -23,6 +23,8 @@ import ( fakeasv1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/as/v1alpha1/fake" infrav1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/infra/v1alpha1" fakeinfrav1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake" + vlanv1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/vlan/v1alpha1" + fakevlanv1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" @@ -93,3 +95,8 @@ func (c *Clientset) AsV1alpha1() asv1alpha1.AsV1alpha1Interface { func (c *Clientset) InfraV1alpha1() infrav1alpha1.InfraV1alpha1Interface { return &fakeinfrav1alpha1.FakeInfraV1alpha1{Fake: &c.Fake} } + +// VlanV1alpha1 retrieves the VlanV1alpha1Client +func (c *Clientset) VlanV1alpha1() vlanv1alpha1.VlanV1alpha1Interface { + return &fakevlanv1alpha1.FakeVlanV1alpha1{Fake: &c.Fake} +} diff --git a/pkg/generated/clientset/versioned/fake/register.go b/pkg/generated/clientset/versioned/fake/register.go index c161830..1f67be9 100644 --- a/pkg/generated/clientset/versioned/fake/register.go +++ b/pkg/generated/clientset/versioned/fake/register.go @@ -19,6 +19,7 @@ package fake import ( asv1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" + vlanv1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" infrav1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" @@ -33,6 +34,7 @@ var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ asv1alpha1.AddToScheme, infrav1alpha1.AddToScheme, + vlanv1alpha1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/generated/clientset/versioned/scheme/register.go b/pkg/generated/clientset/versioned/scheme/register.go index 715351c..6dfd358 100644 --- a/pkg/generated/clientset/versioned/scheme/register.go +++ b/pkg/generated/clientset/versioned/scheme/register.go @@ -19,6 +19,7 @@ package scheme import ( asv1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" + vlanv1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" infrav1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" @@ -33,6 +34,7 @@ var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ asv1alpha1.AddToScheme, infrav1alpha1.AddToScheme, + vlanv1alpha1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/doc.go b/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/doc.go new file mode 100644 index 0000000..cda7d5a --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 diff --git a/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/fake/doc.go b/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/fake/doc.go new file mode 100644 index 0000000..d4601f1 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/fake/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2024 Nokia. + +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/generated/clientset/versioned/typed/vlan/v1alpha1/fake/fake_vlan_client.go b/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/fake/fake_vlan_client.go new file mode 100644 index 0000000..c8e995f --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/fake/fake_vlan_client.go @@ -0,0 +1,47 @@ +/* +Copyright 2024 Nokia. + +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 ( + v1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/vlan/v1alpha1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeVlanV1alpha1 struct { + *testing.Fake +} + +func (c *FakeVlanV1alpha1) VLANClaims(namespace string) v1alpha1.VLANClaimInterface { + return &FakeVLANClaims{c, namespace} +} + +func (c *FakeVlanV1alpha1) VLANEntries(namespace string) v1alpha1.VLANEntryInterface { + return &FakeVLANEntries{c, namespace} +} + +func (c *FakeVlanV1alpha1) VLANIndexes(namespace string) v1alpha1.VLANIndexInterface { + return &FakeVLANIndexes{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeVlanV1alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/fake/fake_vlanclaim.go b/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/fake/fake_vlanclaim.go new file mode 100644 index 0000000..f9055ac --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/fake/fake_vlanclaim.go @@ -0,0 +1,146 @@ +/* +Copyright 2024 Nokia. + +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" + + v1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" + v1 "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" +) + +// FakeVLANClaims implements VLANClaimInterface +type FakeVLANClaims struct { + Fake *FakeVlanV1alpha1 + ns string +} + +var vlanclaimsResource = v1alpha1.SchemeGroupVersion.WithResource("vlanclaims") + +var vlanclaimsKind = v1alpha1.SchemeGroupVersion.WithKind("VLANClaim") + +// Get takes name of the vLANClaim, and returns the corresponding vLANClaim object, and an error if there is any. +func (c *FakeVLANClaims) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VLANClaim, err error) { + emptyResult := &v1alpha1.VLANClaim{} + obj, err := c.Fake. + Invokes(testing.NewGetActionWithOptions(vlanclaimsResource, c.ns, name, options), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.VLANClaim), err +} + +// List takes label and field selectors, and returns the list of VLANClaims that match those selectors. +func (c *FakeVLANClaims) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VLANClaimList, err error) { + emptyResult := &v1alpha1.VLANClaimList{} + obj, err := c.Fake. + Invokes(testing.NewListActionWithOptions(vlanclaimsResource, vlanclaimsKind, c.ns, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.VLANClaimList{ListMeta: obj.(*v1alpha1.VLANClaimList).ListMeta} + for _, item := range obj.(*v1alpha1.VLANClaimList).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 vLANClaims. +func (c *FakeVLANClaims) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchActionWithOptions(vlanclaimsResource, c.ns, opts)) + +} + +// Create takes the representation of a vLANClaim and creates it. Returns the server's representation of the vLANClaim, and an error, if there is any. +func (c *FakeVLANClaims) Create(ctx context.Context, vLANClaim *v1alpha1.VLANClaim, opts v1.CreateOptions) (result *v1alpha1.VLANClaim, err error) { + emptyResult := &v1alpha1.VLANClaim{} + obj, err := c.Fake. + Invokes(testing.NewCreateActionWithOptions(vlanclaimsResource, c.ns, vLANClaim, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.VLANClaim), err +} + +// Update takes the representation of a vLANClaim and updates it. Returns the server's representation of the vLANClaim, and an error, if there is any. +func (c *FakeVLANClaims) Update(ctx context.Context, vLANClaim *v1alpha1.VLANClaim, opts v1.UpdateOptions) (result *v1alpha1.VLANClaim, err error) { + emptyResult := &v1alpha1.VLANClaim{} + obj, err := c.Fake. + Invokes(testing.NewUpdateActionWithOptions(vlanclaimsResource, c.ns, vLANClaim, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.VLANClaim), 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 *FakeVLANClaims) UpdateStatus(ctx context.Context, vLANClaim *v1alpha1.VLANClaim, opts v1.UpdateOptions) (result *v1alpha1.VLANClaim, err error) { + emptyResult := &v1alpha1.VLANClaim{} + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceActionWithOptions(vlanclaimsResource, "status", c.ns, vLANClaim, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.VLANClaim), err +} + +// Delete takes name of the vLANClaim and deletes it. Returns an error if one occurs. +func (c *FakeVLANClaims) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(vlanclaimsResource, c.ns, name, opts), &v1alpha1.VLANClaim{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeVLANClaims) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(vlanclaimsResource, c.ns, opts, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.VLANClaimList{}) + return err +} + +// Patch applies the patch and returns the patched vLANClaim. +func (c *FakeVLANClaims) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VLANClaim, err error) { + emptyResult := &v1alpha1.VLANClaim{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(vlanclaimsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.VLANClaim), err +} diff --git a/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/fake/fake_vlanentry.go b/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/fake/fake_vlanentry.go new file mode 100644 index 0000000..dbcfdaf --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/fake/fake_vlanentry.go @@ -0,0 +1,146 @@ +/* +Copyright 2024 Nokia. + +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" + + v1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" + v1 "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" +) + +// FakeVLANEntries implements VLANEntryInterface +type FakeVLANEntries struct { + Fake *FakeVlanV1alpha1 + ns string +} + +var vlanentriesResource = v1alpha1.SchemeGroupVersion.WithResource("vlanentries") + +var vlanentriesKind = v1alpha1.SchemeGroupVersion.WithKind("VLANEntry") + +// Get takes name of the vLANEntry, and returns the corresponding vLANEntry object, and an error if there is any. +func (c *FakeVLANEntries) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VLANEntry, err error) { + emptyResult := &v1alpha1.VLANEntry{} + obj, err := c.Fake. + Invokes(testing.NewGetActionWithOptions(vlanentriesResource, c.ns, name, options), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.VLANEntry), err +} + +// List takes label and field selectors, and returns the list of VLANEntries that match those selectors. +func (c *FakeVLANEntries) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VLANEntryList, err error) { + emptyResult := &v1alpha1.VLANEntryList{} + obj, err := c.Fake. + Invokes(testing.NewListActionWithOptions(vlanentriesResource, vlanentriesKind, c.ns, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.VLANEntryList{ListMeta: obj.(*v1alpha1.VLANEntryList).ListMeta} + for _, item := range obj.(*v1alpha1.VLANEntryList).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 vLANEntries. +func (c *FakeVLANEntries) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchActionWithOptions(vlanentriesResource, c.ns, opts)) + +} + +// Create takes the representation of a vLANEntry and creates it. Returns the server's representation of the vLANEntry, and an error, if there is any. +func (c *FakeVLANEntries) Create(ctx context.Context, vLANEntry *v1alpha1.VLANEntry, opts v1.CreateOptions) (result *v1alpha1.VLANEntry, err error) { + emptyResult := &v1alpha1.VLANEntry{} + obj, err := c.Fake. + Invokes(testing.NewCreateActionWithOptions(vlanentriesResource, c.ns, vLANEntry, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.VLANEntry), err +} + +// Update takes the representation of a vLANEntry and updates it. Returns the server's representation of the vLANEntry, and an error, if there is any. +func (c *FakeVLANEntries) Update(ctx context.Context, vLANEntry *v1alpha1.VLANEntry, opts v1.UpdateOptions) (result *v1alpha1.VLANEntry, err error) { + emptyResult := &v1alpha1.VLANEntry{} + obj, err := c.Fake. + Invokes(testing.NewUpdateActionWithOptions(vlanentriesResource, c.ns, vLANEntry, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.VLANEntry), 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 *FakeVLANEntries) UpdateStatus(ctx context.Context, vLANEntry *v1alpha1.VLANEntry, opts v1.UpdateOptions) (result *v1alpha1.VLANEntry, err error) { + emptyResult := &v1alpha1.VLANEntry{} + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceActionWithOptions(vlanentriesResource, "status", c.ns, vLANEntry, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.VLANEntry), err +} + +// Delete takes name of the vLANEntry and deletes it. Returns an error if one occurs. +func (c *FakeVLANEntries) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(vlanentriesResource, c.ns, name, opts), &v1alpha1.VLANEntry{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeVLANEntries) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(vlanentriesResource, c.ns, opts, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.VLANEntryList{}) + return err +} + +// Patch applies the patch and returns the patched vLANEntry. +func (c *FakeVLANEntries) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VLANEntry, err error) { + emptyResult := &v1alpha1.VLANEntry{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(vlanentriesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.VLANEntry), err +} diff --git a/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/fake/fake_vlanindex.go b/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/fake/fake_vlanindex.go new file mode 100644 index 0000000..54b3675 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/fake/fake_vlanindex.go @@ -0,0 +1,146 @@ +/* +Copyright 2024 Nokia. + +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" + + v1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" + v1 "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" +) + +// FakeVLANIndexes implements VLANIndexInterface +type FakeVLANIndexes struct { + Fake *FakeVlanV1alpha1 + ns string +} + +var vlanindexesResource = v1alpha1.SchemeGroupVersion.WithResource("vlanindexes") + +var vlanindexesKind = v1alpha1.SchemeGroupVersion.WithKind("VLANIndex") + +// Get takes name of the vLANIndex, and returns the corresponding vLANIndex object, and an error if there is any. +func (c *FakeVLANIndexes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VLANIndex, err error) { + emptyResult := &v1alpha1.VLANIndex{} + obj, err := c.Fake. + Invokes(testing.NewGetActionWithOptions(vlanindexesResource, c.ns, name, options), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.VLANIndex), err +} + +// List takes label and field selectors, and returns the list of VLANIndexes that match those selectors. +func (c *FakeVLANIndexes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VLANIndexList, err error) { + emptyResult := &v1alpha1.VLANIndexList{} + obj, err := c.Fake. + Invokes(testing.NewListActionWithOptions(vlanindexesResource, vlanindexesKind, c.ns, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.VLANIndexList{ListMeta: obj.(*v1alpha1.VLANIndexList).ListMeta} + for _, item := range obj.(*v1alpha1.VLANIndexList).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 vLANIndexes. +func (c *FakeVLANIndexes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchActionWithOptions(vlanindexesResource, c.ns, opts)) + +} + +// Create takes the representation of a vLANIndex and creates it. Returns the server's representation of the vLANIndex, and an error, if there is any. +func (c *FakeVLANIndexes) Create(ctx context.Context, vLANIndex *v1alpha1.VLANIndex, opts v1.CreateOptions) (result *v1alpha1.VLANIndex, err error) { + emptyResult := &v1alpha1.VLANIndex{} + obj, err := c.Fake. + Invokes(testing.NewCreateActionWithOptions(vlanindexesResource, c.ns, vLANIndex, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.VLANIndex), err +} + +// Update takes the representation of a vLANIndex and updates it. Returns the server's representation of the vLANIndex, and an error, if there is any. +func (c *FakeVLANIndexes) Update(ctx context.Context, vLANIndex *v1alpha1.VLANIndex, opts v1.UpdateOptions) (result *v1alpha1.VLANIndex, err error) { + emptyResult := &v1alpha1.VLANIndex{} + obj, err := c.Fake. + Invokes(testing.NewUpdateActionWithOptions(vlanindexesResource, c.ns, vLANIndex, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.VLANIndex), 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 *FakeVLANIndexes) UpdateStatus(ctx context.Context, vLANIndex *v1alpha1.VLANIndex, opts v1.UpdateOptions) (result *v1alpha1.VLANIndex, err error) { + emptyResult := &v1alpha1.VLANIndex{} + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceActionWithOptions(vlanindexesResource, "status", c.ns, vLANIndex, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.VLANIndex), err +} + +// Delete takes name of the vLANIndex and deletes it. Returns an error if one occurs. +func (c *FakeVLANIndexes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(vlanindexesResource, c.ns, name, opts), &v1alpha1.VLANIndex{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeVLANIndexes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(vlanindexesResource, c.ns, opts, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.VLANIndexList{}) + return err +} + +// Patch applies the patch and returns the patched vLANIndex. +func (c *FakeVLANIndexes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VLANIndex, err error) { + emptyResult := &v1alpha1.VLANIndex{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(vlanindexesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.VLANIndex), err +} diff --git a/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/generated_expansion.go b/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/generated_expansion.go new file mode 100644 index 0000000..3854756 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/generated_expansion.go @@ -0,0 +1,24 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +type VLANClaimExpansion interface{} + +type VLANEntryExpansion interface{} + +type VLANIndexExpansion interface{} diff --git a/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/vlan_client.go b/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/vlan_client.go new file mode 100644 index 0000000..0833473 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/vlan_client.go @@ -0,0 +1,116 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "net/http" + + v1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" + "github.com/kuidio/kuid/pkg/generated/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" +) + +type VlanV1alpha1Interface interface { + RESTClient() rest.Interface + VLANClaimsGetter + VLANEntriesGetter + VLANIndexesGetter +} + +// VlanV1alpha1Client is used to interact with features provided by the vlan.be.kuid.dev group. +type VlanV1alpha1Client struct { + restClient rest.Interface +} + +func (c *VlanV1alpha1Client) VLANClaims(namespace string) VLANClaimInterface { + return newVLANClaims(c, namespace) +} + +func (c *VlanV1alpha1Client) VLANEntries(namespace string) VLANEntryInterface { + return newVLANEntries(c, namespace) +} + +func (c *VlanV1alpha1Client) VLANIndexes(namespace string) VLANIndexInterface { + return newVLANIndexes(c, namespace) +} + +// NewForConfig creates a new VlanV1alpha1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*VlanV1alpha1Client, 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 VlanV1alpha1Client 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) (*VlanV1alpha1Client, 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 &VlanV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new VlanV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *VlanV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new VlanV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *VlanV1alpha1Client { + return &VlanV1alpha1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha1.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 *VlanV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/vlanclaim.go b/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/vlanclaim.go new file mode 100644 index 0000000..d2a5bd2 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/vlanclaim.go @@ -0,0 +1,68 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + + v1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" + scheme "github.com/kuidio/kuid/pkg/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// VLANClaimsGetter has a method to return a VLANClaimInterface. +// A group's client should implement this interface. +type VLANClaimsGetter interface { + VLANClaims(namespace string) VLANClaimInterface +} + +// VLANClaimInterface has methods to work with VLANClaim resources. +type VLANClaimInterface interface { + Create(ctx context.Context, vLANClaim *v1alpha1.VLANClaim, opts v1.CreateOptions) (*v1alpha1.VLANClaim, error) + Update(ctx context.Context, vLANClaim *v1alpha1.VLANClaim, opts v1.UpdateOptions) (*v1alpha1.VLANClaim, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, vLANClaim *v1alpha1.VLANClaim, opts v1.UpdateOptions) (*v1alpha1.VLANClaim, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.VLANClaim, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.VLANClaimList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VLANClaim, err error) + VLANClaimExpansion +} + +// vLANClaims implements VLANClaimInterface +type vLANClaims struct { + *gentype.ClientWithList[*v1alpha1.VLANClaim, *v1alpha1.VLANClaimList] +} + +// newVLANClaims returns a VLANClaims +func newVLANClaims(c *VlanV1alpha1Client, namespace string) *vLANClaims { + return &vLANClaims{ + gentype.NewClientWithList[*v1alpha1.VLANClaim, *v1alpha1.VLANClaimList]( + "vlanclaims", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.VLANClaim { return &v1alpha1.VLANClaim{} }, + func() *v1alpha1.VLANClaimList { return &v1alpha1.VLANClaimList{} }), + } +} diff --git a/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/vlanentry.go b/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/vlanentry.go new file mode 100644 index 0000000..9c02bd1 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/vlanentry.go @@ -0,0 +1,68 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + + v1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" + scheme "github.com/kuidio/kuid/pkg/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// VLANEntriesGetter has a method to return a VLANEntryInterface. +// A group's client should implement this interface. +type VLANEntriesGetter interface { + VLANEntries(namespace string) VLANEntryInterface +} + +// VLANEntryInterface has methods to work with VLANEntry resources. +type VLANEntryInterface interface { + Create(ctx context.Context, vLANEntry *v1alpha1.VLANEntry, opts v1.CreateOptions) (*v1alpha1.VLANEntry, error) + Update(ctx context.Context, vLANEntry *v1alpha1.VLANEntry, opts v1.UpdateOptions) (*v1alpha1.VLANEntry, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, vLANEntry *v1alpha1.VLANEntry, opts v1.UpdateOptions) (*v1alpha1.VLANEntry, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.VLANEntry, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.VLANEntryList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VLANEntry, err error) + VLANEntryExpansion +} + +// vLANEntries implements VLANEntryInterface +type vLANEntries struct { + *gentype.ClientWithList[*v1alpha1.VLANEntry, *v1alpha1.VLANEntryList] +} + +// newVLANEntries returns a VLANEntries +func newVLANEntries(c *VlanV1alpha1Client, namespace string) *vLANEntries { + return &vLANEntries{ + gentype.NewClientWithList[*v1alpha1.VLANEntry, *v1alpha1.VLANEntryList]( + "vlanentries", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.VLANEntry { return &v1alpha1.VLANEntry{} }, + func() *v1alpha1.VLANEntryList { return &v1alpha1.VLANEntryList{} }), + } +} diff --git a/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/vlanindex.go b/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/vlanindex.go new file mode 100644 index 0000000..b9d9626 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/vlanindex.go @@ -0,0 +1,68 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + + v1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" + scheme "github.com/kuidio/kuid/pkg/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// VLANIndexesGetter has a method to return a VLANIndexInterface. +// A group's client should implement this interface. +type VLANIndexesGetter interface { + VLANIndexes(namespace string) VLANIndexInterface +} + +// VLANIndexInterface has methods to work with VLANIndex resources. +type VLANIndexInterface interface { + Create(ctx context.Context, vLANIndex *v1alpha1.VLANIndex, opts v1.CreateOptions) (*v1alpha1.VLANIndex, error) + Update(ctx context.Context, vLANIndex *v1alpha1.VLANIndex, opts v1.UpdateOptions) (*v1alpha1.VLANIndex, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, vLANIndex *v1alpha1.VLANIndex, opts v1.UpdateOptions) (*v1alpha1.VLANIndex, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.VLANIndex, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.VLANIndexList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VLANIndex, err error) + VLANIndexExpansion +} + +// vLANIndexes implements VLANIndexInterface +type vLANIndexes struct { + *gentype.ClientWithList[*v1alpha1.VLANIndex, *v1alpha1.VLANIndexList] +} + +// newVLANIndexes returns a VLANIndexes +func newVLANIndexes(c *VlanV1alpha1Client, namespace string) *vLANIndexes { + return &vLANIndexes{ + gentype.NewClientWithList[*v1alpha1.VLANIndex, *v1alpha1.VLANIndexList]( + "vlanindexes", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.VLANIndex { return &v1alpha1.VLANIndex{} }, + func() *v1alpha1.VLANIndexList { return &v1alpha1.VLANIndexList{} }), + } +} diff --git a/pkg/generated/informers/externalversions/factory.go b/pkg/generated/informers/externalversions/factory.go index 26070e6..27fd74d 100644 --- a/pkg/generated/informers/externalversions/factory.go +++ b/pkg/generated/informers/externalversions/factory.go @@ -26,6 +26,7 @@ import ( as "github.com/kuidio/kuid/pkg/generated/informers/externalversions/as" infra "github.com/kuidio/kuid/pkg/generated/informers/externalversions/infra" internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" + vlan "github.com/kuidio/kuid/pkg/generated/informers/externalversions/vlan" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -256,6 +257,7 @@ type SharedInformerFactory interface { As() as.Interface Infra() infra.Interface + Vlan() vlan.Interface } func (f *sharedInformerFactory) As() as.Interface { @@ -265,3 +267,7 @@ func (f *sharedInformerFactory) As() as.Interface { func (f *sharedInformerFactory) Infra() infra.Interface { return infra.New(f, f.namespace, f.tweakListOptions) } + +func (f *sharedInformerFactory) Vlan() vlan.Interface { + return vlan.New(f, f.namespace, f.tweakListOptions) +} diff --git a/pkg/generated/informers/externalversions/generic.go b/pkg/generated/informers/externalversions/generic.go index 45b9b4e..361d38c 100644 --- a/pkg/generated/informers/externalversions/generic.go +++ b/pkg/generated/informers/externalversions/generic.go @@ -21,6 +21,7 @@ import ( "fmt" v1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" + vlanv1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" infrav1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" @@ -90,6 +91,14 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case infrav1alpha1.SchemeGroupVersion.WithResource("sites"): return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().Sites().Informer()}, nil + // Group=vlan.be.kuid.dev, Version=v1alpha1 + case vlanv1alpha1.SchemeGroupVersion.WithResource("vlanclaims"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Vlan().V1alpha1().VLANClaims().Informer()}, nil + case vlanv1alpha1.SchemeGroupVersion.WithResource("vlanentries"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Vlan().V1alpha1().VLANEntries().Informer()}, nil + case vlanv1alpha1.SchemeGroupVersion.WithResource("vlanindexes"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Vlan().V1alpha1().VLANIndexes().Informer()}, nil + } return nil, fmt.Errorf("no informer found for %v", resource) diff --git a/pkg/generated/informers/externalversions/vlan/interface.go b/pkg/generated/informers/externalversions/vlan/interface.go new file mode 100644 index 0000000..07be5e8 --- /dev/null +++ b/pkg/generated/informers/externalversions/vlan/interface.go @@ -0,0 +1,45 @@ +/* +Copyright 2024 Nokia. + +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 vlan + +import ( + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kuidio/kuid/pkg/generated/informers/externalversions/vlan/v1alpha1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() v1alpha1.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} +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/generated/informers/externalversions/vlan/v1alpha1/interface.go b/pkg/generated/informers/externalversions/vlan/v1alpha1/interface.go new file mode 100644 index 0000000..8c96cc6 --- /dev/null +++ b/pkg/generated/informers/externalversions/vlan/v1alpha1/interface.go @@ -0,0 +1,58 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // VLANClaims returns a VLANClaimInformer. + VLANClaims() VLANClaimInformer + // VLANEntries returns a VLANEntryInformer. + VLANEntries() VLANEntryInformer + // VLANIndexes returns a VLANIndexInformer. + VLANIndexes() VLANIndexInformer +} + +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} +} + +// VLANClaims returns a VLANClaimInformer. +func (v *version) VLANClaims() VLANClaimInformer { + return &vLANClaimInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// VLANEntries returns a VLANEntryInformer. +func (v *version) VLANEntries() VLANEntryInformer { + return &vLANEntryInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// VLANIndexes returns a VLANIndexInformer. +func (v *version) VLANIndexes() VLANIndexInformer { + return &vLANIndexInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/generated/informers/externalversions/vlan/v1alpha1/vlanclaim.go b/pkg/generated/informers/externalversions/vlan/v1alpha1/vlanclaim.go new file mode 100644 index 0000000..8c9985f --- /dev/null +++ b/pkg/generated/informers/externalversions/vlan/v1alpha1/vlanclaim.go @@ -0,0 +1,89 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + time "time" + + vlanv1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" + versioned "github.com/kuidio/kuid/pkg/generated/clientset/versioned" + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kuidio/kuid/pkg/generated/listers/vlan/v1alpha1" + v1 "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" +) + +// VLANClaimInformer provides access to a shared informer and lister for +// VLANClaims. +type VLANClaimInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.VLANClaimLister +} + +type vLANClaimInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewVLANClaimInformer constructs a new informer for VLANClaim 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 NewVLANClaimInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredVLANClaimInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredVLANClaimInformer constructs a new informer for VLANClaim 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 NewFilteredVLANClaimInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.VlanV1alpha1().VLANClaims(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.VlanV1alpha1().VLANClaims(namespace).Watch(context.TODO(), options) + }, + }, + &vlanv1alpha1.VLANClaim{}, + resyncPeriod, + indexers, + ) +} + +func (f *vLANClaimInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredVLANClaimInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *vLANClaimInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&vlanv1alpha1.VLANClaim{}, f.defaultInformer) +} + +func (f *vLANClaimInformer) Lister() v1alpha1.VLANClaimLister { + return v1alpha1.NewVLANClaimLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/informers/externalversions/vlan/v1alpha1/vlanentry.go b/pkg/generated/informers/externalversions/vlan/v1alpha1/vlanentry.go new file mode 100644 index 0000000..9854aad --- /dev/null +++ b/pkg/generated/informers/externalversions/vlan/v1alpha1/vlanentry.go @@ -0,0 +1,89 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + time "time" + + vlanv1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" + versioned "github.com/kuidio/kuid/pkg/generated/clientset/versioned" + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kuidio/kuid/pkg/generated/listers/vlan/v1alpha1" + v1 "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" +) + +// VLANEntryInformer provides access to a shared informer and lister for +// VLANEntries. +type VLANEntryInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.VLANEntryLister +} + +type vLANEntryInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewVLANEntryInformer constructs a new informer for VLANEntry 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 NewVLANEntryInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredVLANEntryInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredVLANEntryInformer constructs a new informer for VLANEntry 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 NewFilteredVLANEntryInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.VlanV1alpha1().VLANEntries(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.VlanV1alpha1().VLANEntries(namespace).Watch(context.TODO(), options) + }, + }, + &vlanv1alpha1.VLANEntry{}, + resyncPeriod, + indexers, + ) +} + +func (f *vLANEntryInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredVLANEntryInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *vLANEntryInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&vlanv1alpha1.VLANEntry{}, f.defaultInformer) +} + +func (f *vLANEntryInformer) Lister() v1alpha1.VLANEntryLister { + return v1alpha1.NewVLANEntryLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/informers/externalversions/vlan/v1alpha1/vlanindex.go b/pkg/generated/informers/externalversions/vlan/v1alpha1/vlanindex.go new file mode 100644 index 0000000..5dc3b6e --- /dev/null +++ b/pkg/generated/informers/externalversions/vlan/v1alpha1/vlanindex.go @@ -0,0 +1,89 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + time "time" + + vlanv1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" + versioned "github.com/kuidio/kuid/pkg/generated/clientset/versioned" + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kuidio/kuid/pkg/generated/listers/vlan/v1alpha1" + v1 "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" +) + +// VLANIndexInformer provides access to a shared informer and lister for +// VLANIndexes. +type VLANIndexInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.VLANIndexLister +} + +type vLANIndexInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewVLANIndexInformer constructs a new informer for VLANIndex 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 NewVLANIndexInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredVLANIndexInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredVLANIndexInformer constructs a new informer for VLANIndex 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 NewFilteredVLANIndexInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.VlanV1alpha1().VLANIndexes(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.VlanV1alpha1().VLANIndexes(namespace).Watch(context.TODO(), options) + }, + }, + &vlanv1alpha1.VLANIndex{}, + resyncPeriod, + indexers, + ) +} + +func (f *vLANIndexInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredVLANIndexInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *vLANIndexInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&vlanv1alpha1.VLANIndex{}, f.defaultInformer) +} + +func (f *vLANIndexInformer) Lister() v1alpha1.VLANIndexLister { + return v1alpha1.NewVLANIndexLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/listers/vlan/v1alpha1/expansion_generated.go b/pkg/generated/listers/vlan/v1alpha1/expansion_generated.go new file mode 100644 index 0000000..46726a2 --- /dev/null +++ b/pkg/generated/listers/vlan/v1alpha1/expansion_generated.go @@ -0,0 +1,42 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +// VLANClaimListerExpansion allows custom methods to be added to +// VLANClaimLister. +type VLANClaimListerExpansion interface{} + +// VLANClaimNamespaceListerExpansion allows custom methods to be added to +// VLANClaimNamespaceLister. +type VLANClaimNamespaceListerExpansion interface{} + +// VLANEntryListerExpansion allows custom methods to be added to +// VLANEntryLister. +type VLANEntryListerExpansion interface{} + +// VLANEntryNamespaceListerExpansion allows custom methods to be added to +// VLANEntryNamespaceLister. +type VLANEntryNamespaceListerExpansion interface{} + +// VLANIndexListerExpansion allows custom methods to be added to +// VLANIndexLister. +type VLANIndexListerExpansion interface{} + +// VLANIndexNamespaceListerExpansion allows custom methods to be added to +// VLANIndexNamespaceLister. +type VLANIndexNamespaceListerExpansion interface{} diff --git a/pkg/generated/listers/vlan/v1alpha1/vlanclaim.go b/pkg/generated/listers/vlan/v1alpha1/vlanclaim.go new file mode 100644 index 0000000..547eaf5 --- /dev/null +++ b/pkg/generated/listers/vlan/v1alpha1/vlanclaim.go @@ -0,0 +1,69 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + v1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" + "k8s.io/client-go/tools/cache" +) + +// VLANClaimLister helps list VLANClaims. +// All objects returned here must be treated as read-only. +type VLANClaimLister interface { + // List lists all VLANClaims in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.VLANClaim, err error) + // VLANClaims returns an object that can list and get VLANClaims. + VLANClaims(namespace string) VLANClaimNamespaceLister + VLANClaimListerExpansion +} + +// vLANClaimLister implements the VLANClaimLister interface. +type vLANClaimLister struct { + listers.ResourceIndexer[*v1alpha1.VLANClaim] +} + +// NewVLANClaimLister returns a new VLANClaimLister. +func NewVLANClaimLister(indexer cache.Indexer) VLANClaimLister { + return &vLANClaimLister{listers.New[*v1alpha1.VLANClaim](indexer, v1alpha1.Resource("vlanclaim"))} +} + +// VLANClaims returns an object that can list and get VLANClaims. +func (s *vLANClaimLister) VLANClaims(namespace string) VLANClaimNamespaceLister { + return vLANClaimNamespaceLister{listers.NewNamespaced[*v1alpha1.VLANClaim](s.ResourceIndexer, namespace)} +} + +// VLANClaimNamespaceLister helps list and get VLANClaims. +// All objects returned here must be treated as read-only. +type VLANClaimNamespaceLister interface { + // List lists all VLANClaims in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.VLANClaim, err error) + // Get retrieves the VLANClaim from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.VLANClaim, error) + VLANClaimNamespaceListerExpansion +} + +// vLANClaimNamespaceLister implements the VLANClaimNamespaceLister +// interface. +type vLANClaimNamespaceLister struct { + listers.ResourceIndexer[*v1alpha1.VLANClaim] +} diff --git a/pkg/generated/listers/vlan/v1alpha1/vlanentry.go b/pkg/generated/listers/vlan/v1alpha1/vlanentry.go new file mode 100644 index 0000000..20b6a4c --- /dev/null +++ b/pkg/generated/listers/vlan/v1alpha1/vlanentry.go @@ -0,0 +1,69 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + v1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" + "k8s.io/client-go/tools/cache" +) + +// VLANEntryLister helps list VLANEntries. +// All objects returned here must be treated as read-only. +type VLANEntryLister interface { + // List lists all VLANEntries in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.VLANEntry, err error) + // VLANEntries returns an object that can list and get VLANEntries. + VLANEntries(namespace string) VLANEntryNamespaceLister + VLANEntryListerExpansion +} + +// vLANEntryLister implements the VLANEntryLister interface. +type vLANEntryLister struct { + listers.ResourceIndexer[*v1alpha1.VLANEntry] +} + +// NewVLANEntryLister returns a new VLANEntryLister. +func NewVLANEntryLister(indexer cache.Indexer) VLANEntryLister { + return &vLANEntryLister{listers.New[*v1alpha1.VLANEntry](indexer, v1alpha1.Resource("vlanentry"))} +} + +// VLANEntries returns an object that can list and get VLANEntries. +func (s *vLANEntryLister) VLANEntries(namespace string) VLANEntryNamespaceLister { + return vLANEntryNamespaceLister{listers.NewNamespaced[*v1alpha1.VLANEntry](s.ResourceIndexer, namespace)} +} + +// VLANEntryNamespaceLister helps list and get VLANEntries. +// All objects returned here must be treated as read-only. +type VLANEntryNamespaceLister interface { + // List lists all VLANEntries in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.VLANEntry, err error) + // Get retrieves the VLANEntry from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.VLANEntry, error) + VLANEntryNamespaceListerExpansion +} + +// vLANEntryNamespaceLister implements the VLANEntryNamespaceLister +// interface. +type vLANEntryNamespaceLister struct { + listers.ResourceIndexer[*v1alpha1.VLANEntry] +} diff --git a/pkg/generated/listers/vlan/v1alpha1/vlanindex.go b/pkg/generated/listers/vlan/v1alpha1/vlanindex.go new file mode 100644 index 0000000..c083bba --- /dev/null +++ b/pkg/generated/listers/vlan/v1alpha1/vlanindex.go @@ -0,0 +1,69 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + v1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" + "k8s.io/client-go/tools/cache" +) + +// VLANIndexLister helps list VLANIndexes. +// All objects returned here must be treated as read-only. +type VLANIndexLister interface { + // List lists all VLANIndexes in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.VLANIndex, err error) + // VLANIndexes returns an object that can list and get VLANIndexes. + VLANIndexes(namespace string) VLANIndexNamespaceLister + VLANIndexListerExpansion +} + +// vLANIndexLister implements the VLANIndexLister interface. +type vLANIndexLister struct { + listers.ResourceIndexer[*v1alpha1.VLANIndex] +} + +// NewVLANIndexLister returns a new VLANIndexLister. +func NewVLANIndexLister(indexer cache.Indexer) VLANIndexLister { + return &vLANIndexLister{listers.New[*v1alpha1.VLANIndex](indexer, v1alpha1.Resource("vlanindex"))} +} + +// VLANIndexes returns an object that can list and get VLANIndexes. +func (s *vLANIndexLister) VLANIndexes(namespace string) VLANIndexNamespaceLister { + return vLANIndexNamespaceLister{listers.NewNamespaced[*v1alpha1.VLANIndex](s.ResourceIndexer, namespace)} +} + +// VLANIndexNamespaceLister helps list and get VLANIndexes. +// All objects returned here must be treated as read-only. +type VLANIndexNamespaceLister interface { + // List lists all VLANIndexes in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.VLANIndex, err error) + // Get retrieves the VLANIndex from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.VLANIndex, error) + VLANIndexNamespaceListerExpansion +} + +// vLANIndexNamespaceLister implements the VLANIndexNamespaceLister +// interface. +type vLANIndexNamespaceLister struct { + listers.ResourceIndexer[*v1alpha1.VLANIndex] +} diff --git a/pkg/generated/openapi/zz_generated.openapi.go b/pkg/generated/openapi/zz_generated.openapi.go index 67365c3..f79b108 100644 --- a/pkg/generated/openapi/zz_generated.openapi.go +++ b/pkg/generated/openapi/zz_generated.openapi.go @@ -44,6 +44,18 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndexList": schema_apis_backend_as_v1alpha1_ASIndexList(ref), "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndexSpec": schema_apis_backend_as_v1alpha1_ASIndexSpec(ref), "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndexStatus": schema_apis_backend_as_v1alpha1_ASIndexStatus(ref), + "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANClaim": schema_apis_backend_vlan_v1alpha1_VLANClaim(ref), + "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANClaimList": schema_apis_backend_vlan_v1alpha1_VLANClaimList(ref), + "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANClaimSpec": schema_apis_backend_vlan_v1alpha1_VLANClaimSpec(ref), + "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANClaimStatus": schema_apis_backend_vlan_v1alpha1_VLANClaimStatus(ref), + "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANEntry": schema_apis_backend_vlan_v1alpha1_VLANEntry(ref), + "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANEntryList": schema_apis_backend_vlan_v1alpha1_VLANEntryList(ref), + "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANEntrySpec": schema_apis_backend_vlan_v1alpha1_VLANEntrySpec(ref), + "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANEntryStatus": schema_apis_backend_vlan_v1alpha1_VLANEntryStatus(ref), + "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANIndex": schema_apis_backend_vlan_v1alpha1_VLANIndex(ref), + "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANIndexList": schema_apis_backend_vlan_v1alpha1_VLANIndexList(ref), + "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANIndexSpec": schema_apis_backend_vlan_v1alpha1_VLANIndexSpec(ref), + "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANIndexStatus": schema_apis_backend_vlan_v1alpha1_VLANIndexStatus(ref), "github.com/kuidio/kuid/apis/common/v1alpha1.ClaimLabels": schema_kuid_apis_common_v1alpha1_ClaimLabels(ref), "github.com/kuidio/kuid/apis/common/v1alpha1.UserDefinedLabels": schema_kuid_apis_common_v1alpha1_UserDefinedLabels(ref), "github.com/kuidio/kuid/apis/id/v1alpha1.AdaptorID": schema_kuid_apis_id_v1alpha1_AdaptorID(ref), @@ -893,6 +905,579 @@ func schema_apis_backend_as_v1alpha1_ASIndexStatus(ref common.ReferenceCallback) } } +func schema_apis_backend_vlan_v1alpha1_VLANClaim(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "VLANClaim is the Schema for the VLANClaim API", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANClaimSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANClaimStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANClaimSpec", "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANClaimStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_apis_backend_vlan_v1alpha1_VLANClaimList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "VLANClaimList contains a list of VLANClaims", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANClaim"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANClaim", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_apis_backend_vlan_v1alpha1_VLANClaimSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "VLANClaimSpec defines the desired state of VLANClaim", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "index": { + SchemaProps: spec.SchemaProps{ + Description: "Index defines the index for the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "id": { + SchemaProps: spec.SchemaProps{ + Description: "ID defines the id of the resource", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "range": { + SchemaProps: spec.SchemaProps{ + Description: "Range defines the VLAN range of the resource The following notation is used: start-end - the VLANs in the range must be consecutive", + Type: []string{"string"}, + Format: "", + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels as user defined labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "selector": { + SchemaProps: spec.SchemaProps{ + Description: "Selector defines the selector criterias", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), + }, + }, + }, + Required: []string{"index"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, + } +} + +func schema_apis_backend_vlan_v1alpha1_VLANClaimStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "VLANClaimStatus defines the observed state of VLANClaim", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"), + }, + }, + }, + }, + }, + "id": { + SchemaProps: spec.SchemaProps{ + Description: "VLANID defines the VLAN for the VLAN claim", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "range": { + SchemaProps: spec.SchemaProps{ + Description: "VLANRange defines the VLAN range for the VLAN claim", + Type: []string{"string"}, + Format: "", + }, + }, + "expiryTime": { + SchemaProps: spec.SchemaProps{ + Description: "ExpiryTime defines when the claim expires", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"}, + } +} + +func schema_apis_backend_vlan_v1alpha1_VLANEntry(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "VLANEntry is the Schema for the VLANentry API", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANEntrySpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANEntryStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANEntrySpec", "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANEntryStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_apis_backend_vlan_v1alpha1_VLANEntryList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "VLANEntryList contains a list of VLANEntries", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANEntry"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANEntry", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_apis_backend_vlan_v1alpha1_VLANEntrySpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "VLANEntrySpec defines the desired state of VLANEntry", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "index": { + SchemaProps: spec.SchemaProps{ + Description: "Index defines the index for the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "claimType": { + SchemaProps: spec.SchemaProps{ + Description: "ClaimType defines the claimType of the resource", + Type: []string{"string"}, + Format: "", + }, + }, + "id": { + SchemaProps: spec.SchemaProps{ + Description: "ID defines the id of the resource in the tree", + Type: []string{"string"}, + Format: "", + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels as user defined labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "selector": { + SchemaProps: spec.SchemaProps{ + Description: "Selector defines the selector criterias", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), + }, + }, + }, + Required: []string{"index"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, + } +} + +func schema_apis_backend_vlan_v1alpha1_VLANEntryStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "VLANEntryStatus defines the observed state of VLANEntry", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"}, + } +} + +func schema_apis_backend_vlan_v1alpha1_VLANIndex(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "VLANIndex is the Schema for the VLANIndex API", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANIndexSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANIndexStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANIndexSpec", "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANIndexStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_apis_backend_vlan_v1alpha1_VLANIndexList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "VLANIndexList contains a list of VLANIndexs", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANIndex"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANIndex", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_apis_backend_vlan_v1alpha1_VLANIndexSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "VLANIndexSpec defines the desired state of VLANIndex", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "minID": { + SchemaProps: spec.SchemaProps{ + Description: "MinID defines the min VLAN ID the index supports", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "maxID": { + SchemaProps: spec.SchemaProps{ + Description: "MaxID defines the max VLAN ID the index supports", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels as user defined labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + }, + }, + } +} + +func schema_apis_backend_vlan_v1alpha1_VLANIndexStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "VLANIndexStatus defines the observed state of VLANIndex", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "minID": { + SchemaProps: spec.SchemaProps{ + Description: "MinID defines the min VLAN ID the index supports", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "maxID": { + SchemaProps: spec.SchemaProps{ + Description: "MaxID defines the max VLAN ID the index supports", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"}, + } +} + func schema_kuid_apis_common_v1alpha1_ClaimLabels(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ From a55c2525ca8439182200af9919977095da0a9b47 Mon Sep 17 00:00:00 2001 From: Wim Henderickx Date: Sun, 27 Oct 2024 20:05:02 +0100 Subject: [PATCH 10/23] added ipam --- SYNC.md | 24 + apis/all/all.go | 4 +- apis/backend/LabelKeys.go | 2 + apis/backend/as/register/register.go | 18 +- apis/backend/ipam/doc.go | 21 + apis/backend/ipam/ipam_types.go | 94 +++ apis/backend/ipam/ipclaim_helper.go | 42 ++ apis/backend/ipam/ipclaim_object.go | 230 ++++++ apis/backend/ipam/ipclaim_resource.go | 353 +++++++++ apis/backend/ipam/ipclaim_syntaxvalidator.go | 26 + ...ipclaim_syntaxvalidator_dynamic_address.go | 65 ++ .../ipclaim_syntaxvalidator_dynamic_prefix.go | 99 +++ .../ipclaim_syntaxvalidator_static_address.go | 98 +++ .../ipclaim_syntaxvalidator_static_prefix.go | 111 +++ .../ipclaim_syntaxvalidator_static_range.go | 90 +++ apis/backend/ipam/ipclaim_types.go | 121 +++ apis/backend/ipam/ipentry_object.go | 185 +++++ apis/backend/ipam/ipentry_resource.go | 321 ++++++++ apis/backend/ipam/ipentry_types.go | 88 +++ apis/backend/ipam/ipindex_helper.go | 42 ++ apis/backend/ipam/ipindex_object.go | 117 +++ apis/backend/ipam/ipindex_resource.go | 331 +++++++++ apis/backend/ipam/ipindex_types.go | 83 +++ apis/backend/ipam/register.go | 52 ++ apis/backend/ipam/register/register.go | 108 +++ apis/backend/ipam/v1alpha1/doc.go | 28 + apis/backend/ipam/v1alpha1/ipam_types.go | 94 +++ .../backend/ipam/v1alpha1/ipclaim_resource.go | 80 ++ apis/backend/ipam/v1alpha1/ipclaim_types.go | 121 +++ .../backend/ipam/v1alpha1/ipentry_resource.go | 80 ++ apis/backend/ipam/v1alpha1/ipentry_types.go | 88 +++ .../backend/ipam/v1alpha1/ipindex_resource.go | 80 ++ apis/backend/ipam/v1alpha1/ipindex_types.go | 83 +++ apis/backend/ipam/v1alpha1/register.go | 67 ++ .../ipam/v1alpha1/zz_generated.conversion.go | 647 ++++++++++++++++ .../ipam/v1alpha1/zz_generated.deepcopy.go | 431 +++++++++++ .../ipam/v1alpha1/zz_generated.defaults.go | 32 + apis/backend/ipam/zz_generated.deepcopy.go | 479 ++++++++++++ apis/infra/v1alpha1/conversion.go | 130 ++++ .../infra/v1alpha1/zz_generated.conversion.go | 233 ++---- .../address-dynamic-fromnetwork-net1-1.yaml | 2 +- .../address-dynamic-fromnetwork-net1-2.yaml | 2 +- .../address-dynamic-frompool-pool1-1.yaml | 2 +- .../address-dynamic-frompool-pool1-2.yaml | 2 +- .../address-dynamic-fromrange-range1-1.yaml | 2 +- .../address-dynamic-fromrange-range1-2.yaml | 2 +- .../ipam/address-static-frompool-pool1.yaml | 2 +- .../ipam/address-static-fromrange-range1.yaml | 2 +- examples/ipam/ni-vpc.yaml | 1 + examples/ipam/prefix-dynamic.yaml | 1 + examples/ipam/prefix-pool-172.0.0.0-16.yaml | 1 + examples/ipam/range-10.0.0.10-10.0.0.20.yaml | 1 + go.mod | 8 +- go.sum | 28 +- main.go | 2 +- pkg/backend/astest/as_index_test.go | 78 -- pkg/backend/backend_interface.go | 7 +- pkg/backend/context.go | 6 +- pkg/backend/generic/backend.go | 33 +- pkg/backend/generic/backend_store.go | 30 +- pkg/backend/invoker.go | 18 +- pkg/backend/ipam/applicator.go | 457 ++++++++++++ .../ipam/applicator_dynamic_address.go | 238 ++++++ pkg/backend/ipam/applicator_dynamic_prefix.go | 134 ++++ pkg/backend/ipam/applicator_static_address.go | 204 +++++ pkg/backend/ipam/applicator_static_prefix.go | 193 +++++ pkg/backend/ipam/applicator_static_range.go | 162 ++++ pkg/backend/ipam/applicator_util.go | 59 ++ pkg/backend/ipam/backend.go | 236 ++++++ pkg/backend/ipam/backend_store.go | 493 ++++++++++++ pkg/backend/ipam/cache_instance.go | 45 ++ pkg/backend/ipam/context.go | 79 ++ .../{astest => testas}/as_claim_test.go | 121 +-- .../{astest => testas}/as_helpers_test.go | 94 ++- pkg/backend/testas/as_index_test.go | 78 ++ .../testipam/ipam_dynamic_address_test.go | 81 ++ .../testipam/ipam_dynamic_prefix_test.go | 43 ++ pkg/backend/testipam/ipam_index_test.go | 65 ++ .../testipam/ipam_static_address_test.go | 158 ++++ .../testipam/ipam_static_prefix_test.go | 127 ++++ .../testipam/ipam_static_range_test.go | 84 +++ pkg/backend/testipam/ipam_test_helpers.go | 383 ++++++++++ pkg/config/config.go | 3 +- .../clientset/versioned/clientset.go | 13 + .../versioned/fake/clientset_generated.go | 7 + .../clientset/versioned/fake/register.go | 2 + .../clientset/versioned/scheme/register.go | 2 + .../versioned/typed/ipam/v1alpha1/doc.go | 19 + .../versioned/typed/ipam/v1alpha1/fake/doc.go | 19 + .../ipam/v1alpha1/fake/fake_ipam_client.go | 47 ++ .../typed/ipam/v1alpha1/fake/fake_ipclaim.go | 146 ++++ .../typed/ipam/v1alpha1/fake/fake_ipentry.go | 146 ++++ .../typed/ipam/v1alpha1/fake/fake_ipindex.go | 146 ++++ .../ipam/v1alpha1/generated_expansion.go | 24 + .../typed/ipam/v1alpha1/ipam_client.go | 116 +++ .../versioned/typed/ipam/v1alpha1/ipclaim.go | 68 ++ .../versioned/typed/ipam/v1alpha1/ipentry.go | 68 ++ .../versioned/typed/ipam/v1alpha1/ipindex.go | 68 ++ .../informers/externalversions/factory.go | 6 + .../informers/externalversions/generic.go | 9 + .../externalversions/ipam/interface.go | 45 ++ .../ipam/v1alpha1/interface.go | 58 ++ .../externalversions/ipam/v1alpha1/ipclaim.go | 89 +++ .../externalversions/ipam/v1alpha1/ipentry.go | 89 +++ .../externalversions/ipam/v1alpha1/ipindex.go | 89 +++ .../ipam/v1alpha1/expansion_generated.go | 42 ++ .../listers/ipam/v1alpha1/ipclaim.go | 69 ++ .../listers/ipam/v1alpha1/ipentry.go | 69 ++ .../listers/ipam/v1alpha1/ipindex.go | 69 ++ pkg/generated/openapi/zz_generated.openapi.go | 702 ++++++++++++++++++ pkg/registry/generic/strategy_resource.go | 14 +- pkg/registry/generic/strategy_status.go | 2 +- pkg/registry/options/options.go | 6 +- 113 files changed, 11007 insertions(+), 407 deletions(-) create mode 100644 SYNC.md create mode 100644 apis/backend/ipam/doc.go create mode 100644 apis/backend/ipam/ipam_types.go create mode 100644 apis/backend/ipam/ipclaim_helper.go create mode 100644 apis/backend/ipam/ipclaim_object.go create mode 100644 apis/backend/ipam/ipclaim_resource.go create mode 100644 apis/backend/ipam/ipclaim_syntaxvalidator.go create mode 100644 apis/backend/ipam/ipclaim_syntaxvalidator_dynamic_address.go create mode 100644 apis/backend/ipam/ipclaim_syntaxvalidator_dynamic_prefix.go create mode 100644 apis/backend/ipam/ipclaim_syntaxvalidator_static_address.go create mode 100644 apis/backend/ipam/ipclaim_syntaxvalidator_static_prefix.go create mode 100644 apis/backend/ipam/ipclaim_syntaxvalidator_static_range.go create mode 100644 apis/backend/ipam/ipclaim_types.go create mode 100644 apis/backend/ipam/ipentry_object.go create mode 100644 apis/backend/ipam/ipentry_resource.go create mode 100644 apis/backend/ipam/ipentry_types.go create mode 100644 apis/backend/ipam/ipindex_helper.go create mode 100644 apis/backend/ipam/ipindex_object.go create mode 100644 apis/backend/ipam/ipindex_resource.go create mode 100644 apis/backend/ipam/ipindex_types.go create mode 100644 apis/backend/ipam/register.go create mode 100644 apis/backend/ipam/register/register.go create mode 100644 apis/backend/ipam/v1alpha1/doc.go create mode 100644 apis/backend/ipam/v1alpha1/ipam_types.go create mode 100644 apis/backend/ipam/v1alpha1/ipclaim_resource.go create mode 100644 apis/backend/ipam/v1alpha1/ipclaim_types.go create mode 100644 apis/backend/ipam/v1alpha1/ipentry_resource.go create mode 100644 apis/backend/ipam/v1alpha1/ipentry_types.go create mode 100644 apis/backend/ipam/v1alpha1/ipindex_resource.go create mode 100644 apis/backend/ipam/v1alpha1/ipindex_types.go create mode 100644 apis/backend/ipam/v1alpha1/register.go create mode 100644 apis/backend/ipam/v1alpha1/zz_generated.conversion.go create mode 100644 apis/backend/ipam/v1alpha1/zz_generated.deepcopy.go create mode 100644 apis/backend/ipam/v1alpha1/zz_generated.defaults.go create mode 100644 apis/backend/ipam/zz_generated.deepcopy.go delete mode 100644 pkg/backend/astest/as_index_test.go create mode 100644 pkg/backend/ipam/applicator.go create mode 100644 pkg/backend/ipam/applicator_dynamic_address.go create mode 100644 pkg/backend/ipam/applicator_dynamic_prefix.go create mode 100644 pkg/backend/ipam/applicator_static_address.go create mode 100644 pkg/backend/ipam/applicator_static_prefix.go create mode 100644 pkg/backend/ipam/applicator_static_range.go create mode 100644 pkg/backend/ipam/applicator_util.go create mode 100644 pkg/backend/ipam/backend.go create mode 100644 pkg/backend/ipam/backend_store.go create mode 100644 pkg/backend/ipam/cache_instance.go create mode 100644 pkg/backend/ipam/context.go rename pkg/backend/{astest => testas}/as_claim_test.go (66%) rename pkg/backend/{astest => testas}/as_helpers_test.go (50%) create mode 100644 pkg/backend/testas/as_index_test.go create mode 100644 pkg/backend/testipam/ipam_dynamic_address_test.go create mode 100644 pkg/backend/testipam/ipam_dynamic_prefix_test.go create mode 100644 pkg/backend/testipam/ipam_index_test.go create mode 100644 pkg/backend/testipam/ipam_static_address_test.go create mode 100644 pkg/backend/testipam/ipam_static_prefix_test.go create mode 100644 pkg/backend/testipam/ipam_static_range_test.go create mode 100644 pkg/backend/testipam/ipam_test_helpers.go create mode 100644 pkg/generated/clientset/versioned/typed/ipam/v1alpha1/doc.go create mode 100644 pkg/generated/clientset/versioned/typed/ipam/v1alpha1/fake/doc.go create mode 100644 pkg/generated/clientset/versioned/typed/ipam/v1alpha1/fake/fake_ipam_client.go create mode 100644 pkg/generated/clientset/versioned/typed/ipam/v1alpha1/fake/fake_ipclaim.go create mode 100644 pkg/generated/clientset/versioned/typed/ipam/v1alpha1/fake/fake_ipentry.go create mode 100644 pkg/generated/clientset/versioned/typed/ipam/v1alpha1/fake/fake_ipindex.go create mode 100644 pkg/generated/clientset/versioned/typed/ipam/v1alpha1/generated_expansion.go create mode 100644 pkg/generated/clientset/versioned/typed/ipam/v1alpha1/ipam_client.go create mode 100644 pkg/generated/clientset/versioned/typed/ipam/v1alpha1/ipclaim.go create mode 100644 pkg/generated/clientset/versioned/typed/ipam/v1alpha1/ipentry.go create mode 100644 pkg/generated/clientset/versioned/typed/ipam/v1alpha1/ipindex.go create mode 100644 pkg/generated/informers/externalversions/ipam/interface.go create mode 100644 pkg/generated/informers/externalversions/ipam/v1alpha1/interface.go create mode 100644 pkg/generated/informers/externalversions/ipam/v1alpha1/ipclaim.go create mode 100644 pkg/generated/informers/externalversions/ipam/v1alpha1/ipentry.go create mode 100644 pkg/generated/informers/externalversions/ipam/v1alpha1/ipindex.go create mode 100644 pkg/generated/listers/ipam/v1alpha1/expansion_generated.go create mode 100644 pkg/generated/listers/ipam/v1alpha1/ipclaim.go create mode 100644 pkg/generated/listers/ipam/v1alpha1/ipentry.go create mode 100644 pkg/generated/listers/ipam/v1alpha1/ipindex.go diff --git a/SYNC.md b/SYNC.md new file mode 100644 index 0000000..ffdbf05 --- /dev/null +++ b/SYNC.md @@ -0,0 +1,24 @@ +# sync startegy + +- create/delete index lock/unlock + - when creating/deleting an index -> claims are called which cause a lock issue + - we have a single lock on index create/delete and claim create/delete + - we introduce a special dryrin flag since the delete has very few options if []string{"recursion"} is set we treat this as a special behavior + +## differences + +1. deleteIndex +- sync: claims and entries get deleted +- async: claims from index get deleted, but other not -> reconciler should trigger the status + +2. restart app -> restore +- sync/async: create index need to be triggered (reconciler needed) + +3. status of index +- sync/async: reconciler update status with status subresource (reconciler needed) + +4. order is important +- sync: when something fails the client need to handle this +- async: reconciler tries to recover + +5. \ No newline at end of file diff --git a/apis/all/all.go b/apis/all/all.go index 3230b86..59e880e 100644 --- a/apis/all/all.go +++ b/apis/all/all.go @@ -18,13 +18,11 @@ package all import ( _ "github.com/kuidio/kuid/apis/backend/as/register" + _ "github.com/kuidio/kuid/apis/backend/ipam/register" _ "github.com/kuidio/kuid/apis/backend/vlan/register" _ "github.com/kuidio/kuid/apis/infra/register" ) -//infrabev1alpha1.AddToScheme, -//ipambev1alpha1.AddToScheme, -//vlanbev1alpha1.AddToScheme, //vxlanbev1alpha1.AddToScheme, //extcommbev1alpha1.AddToScheme, //genidbev1alpha1.AddToScheme, diff --git a/apis/backend/LabelKeys.go b/apis/backend/LabelKeys.go index e73380f..0161e8e 100644 --- a/apis/backend/LabelKeys.go +++ b/apis/backend/LabelKeys.go @@ -28,6 +28,7 @@ const ( KuidClaimNameKey = "be.kuid.dev/claim-name" KuidClaimUIDKey = "be.kuid.dev/claim-uid" KuidClaimTypeKey = "be.kuid.dev/claim-type" + KuidIndexEntryKey = "be.kuid.dev/index-entry" // system defined ipam KuidIPAMIPPrefixTypeKey = "ipam.be.kuid.dev/ipprefix-type" KuidIPAMClaimSummaryTypeKey = "ipam.be.kuid.dev/claim-summary-type" // used for easy lookup @@ -71,6 +72,7 @@ var BackendSystemKeys = sets.New[string]( KuidClaimUIDKey, KuidOwnerKindKey, KuidClaimTypeKey, + KuidIndexEntryKey, ) // BackendIPAMSystemKeys defined the system IPAM keys diff --git a/apis/backend/as/register/register.go b/apis/backend/as/register/register.go index 4d2685b..170f4ed 100644 --- a/apis/backend/as/register/register.go +++ b/apis/backend/as/register/register.go @@ -86,7 +86,7 @@ func ApplyStorageToBackend(ctx context.Context, be bebackend.Backend, apiServer Resource: as.ASClaimPlural, }] - claimStorage, err := claimStorageProvider.Get(ctx, apiServer.Schemes[0], &ClaimGetter{}) + claimStorage, err := claimStorageProvider.Get(ctx, apiServer.Schemes[0], &Getter{}) if err != nil { return err } @@ -96,7 +96,7 @@ func ApplyStorageToBackend(ctx context.Context, be bebackend.Backend, apiServer Resource: as.ASEntryPlural, }] - entryStorage, err := entryStorageProvider.Get(ctx, apiServer.Schemes[0], &EntryGetter{}) + entryStorage, err := entryStorageProvider.Get(ctx, apiServer.Schemes[0], &Getter{}) if err != nil { return err } @@ -104,18 +104,10 @@ func ApplyStorageToBackend(ctx context.Context, be bebackend.Backend, apiServer return be.AddStorage(entryStorage, claimStorage) } -var _ generic.RESTOptionsGetter = &ClaimGetter{} +var _ generic.RESTOptionsGetter = &Getter{} -type ClaimGetter struct{} +type Getter struct{} -func (r *ClaimGetter) GetRESTOptions(resource schema.GroupResource, example runtime.Object) (generic.RESTOptions, error) { - return generic.RESTOptions{}, nil -} - -var _ generic.RESTOptionsGetter = &EntryGetter{} - -type EntryGetter struct{} - -func (r *EntryGetter) GetRESTOptions(resource schema.GroupResource, example runtime.Object) (generic.RESTOptions, error) { +func (r *Getter) GetRESTOptions(resource schema.GroupResource, example runtime.Object) (generic.RESTOptions, error) { return generic.RESTOptions{}, nil } diff --git a/apis/backend/ipam/doc.go b/apis/backend/ipam/doc.go new file mode 100644 index 0000000..87d1f14 --- /dev/null +++ b/apis/backend/ipam/doc.go @@ -0,0 +1,21 @@ +/* +Copyright 2024 Nokia. + +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. +*/ + +// +k8s:deepcopy-gen=package,register +// +groupName=ipam.be.kuid.dev + +// Package vlan is the internal version of the API. +package ipam // import "github.com/kuidio/kuid/apis/backend/ipam" diff --git a/apis/backend/ipam/ipam_types.go b/apis/backend/ipam/ipam_types.go new file mode 100644 index 0000000..9ecdd17 --- /dev/null +++ b/apis/backend/ipam/ipam_types.go @@ -0,0 +1,94 @@ +/* +Copyright 2024 Nokia. + +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 ipam + +import ( + "k8s.io/utils/ptr" +) + +type IPClaimType string + +const ( + IPClaimType_Invalid IPClaimType = "invalid" + IPClaimType_StaticAddress IPClaimType = "staticAddress" + IPClaimType_StaticPrefix IPClaimType = "staticPrefix" + IPClaimType_StaticRange IPClaimType = "staticRange" + IPClaimType_DynamicAddress IPClaimType = "dynamicAddress" + IPClaimType_DynamicPrefix IPClaimType = "dynamicPrefix" +) + +func GetIPClaimTypeFromString(s string) IPClaimType { + switch s { + case string(IPClaimType_StaticAddress): + return IPClaimType_StaticAddress + case string(IPClaimType_StaticPrefix): + return IPClaimType_StaticPrefix + case string(IPClaimType_StaticRange): + return IPClaimType_StaticRange + case string(IPClaimType_DynamicAddress): + return IPClaimType_DynamicAddress + case string(IPClaimType_DynamicPrefix): + return IPClaimType_DynamicPrefix + default: + return IPClaimType_Invalid + } +} + +type IPClaimSummaryType string + +const ( + IPClaimSummaryType_Prefix IPClaimSummaryType = "prefix" + IPClaimSummaryType_Address IPClaimSummaryType = "address" + IPClaimSummaryType_Range IPClaimSummaryType = "range" + IPClaimSummaryType_Invalid IPClaimSummaryType = "invalid" +) + +func GetIPClaimSummaryTypeFromString(s string) IPClaimSummaryType { + switch s { + case string(IPClaimSummaryType_Prefix): + return IPClaimSummaryType_Prefix + case string(IPClaimSummaryType_Address): + return IPClaimSummaryType_Address + case string(IPClaimSummaryType_Range): + return IPClaimSummaryType_Range + default: + return IPClaimSummaryType_Invalid + } +} + +type IPPrefixType string + +const ( + IPPrefixType_Invalid IPPrefixType = "invalid" + IPPrefixType_Other IPPrefixType = "other" + IPPrefixType_Pool IPPrefixType = "pool" + IPPrefixType_Network IPPrefixType = "network" + IPPrefixType_Aggregate IPPrefixType = "aggregate" +) + +func GetIPPrefixTypeFromString(s string) *IPPrefixType { + switch s { + case string(IPPrefixType_Pool): + return ptr.To[IPPrefixType](IPPrefixType_Pool) + case string(IPPrefixType_Network): + return ptr.To[IPPrefixType](IPPrefixType_Network) + case string(IPPrefixType_Aggregate): + return ptr.To[IPPrefixType](IPPrefixType_Aggregate) + default: + return nil + } +} diff --git a/apis/backend/ipam/ipclaim_helper.go b/apis/backend/ipam/ipclaim_helper.go new file mode 100644 index 0000000..ec68d4d --- /dev/null +++ b/apis/backend/ipam/ipclaim_helper.go @@ -0,0 +1,42 @@ +/* +Copyright 2024 Nokia. + +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 ipam + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// BuildIPClaim returns a reource from a client Object a Spec/Status +func BuildIPClaim(meta metav1.ObjectMeta, spec *IPClaimSpec, status *IPClaimStatus) *IPClaim { + aspec := IPClaimSpec{} + if spec != nil { + aspec = *spec + } + astatus := IPClaimStatus{} + if status != nil { + astatus = *status + } + return &IPClaim{ + TypeMeta: metav1.TypeMeta{ + APIVersion: SchemeGroupVersion.Identifier(), + Kind: IPClaimKind, + }, + ObjectMeta: meta, + Spec: aspec, + Status: astatus, + } +} diff --git a/apis/backend/ipam/ipclaim_object.go b/apis/backend/ipam/ipclaim_object.go new file mode 100644 index 0000000..76fd709 --- /dev/null +++ b/apis/backend/ipam/ipclaim_object.go @@ -0,0 +1,230 @@ +/* +Copyright 2024 Nokia. + +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 "VLAN IS" BVLANIS, +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 ipam + +import ( + "fmt" + "strings" + + "github.com/henderiw/store" + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/backend" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +func (r *IPClaim) GetNamespacedName() types.NamespacedName { + return types.NamespacedName{ + Namespace: r.GetNamespace(), + Name: r.GetName(), + } +} + +func (r *IPClaim) GetKey() store.Key { + return store.KeyFromNSN(types.NamespacedName{Namespace: r.Namespace, Name: r.Spec.Index}) +} + +// GetCondition returns the condition based on the condition kind +func (r *IPClaim) GetCondition(t condition.ConditionType) condition.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *IPClaim) SetConditions(c ...condition.Condition) { + r.Status.SetConditions(c...) +} + +func (r *IPClaim) ValidateSyntax(s string) field.ErrorList { + var allErrs field.ErrorList + + ipClaimType, err := r.GetIPClaimType() + if err != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath(""), + r, + err.Error(), + )) + return allErrs + } + var v SyntaxValidator + switch ipClaimType { + case IPClaimType_StaticAddress: + v = &staticAddressSyntaxValidator{name: "staticIPAddress"} + case IPClaimType_StaticPrefix: + v = &staticPrefixSyntaxValidator{name: "staticIPprefix"} + case IPClaimType_StaticRange: + v = &staticRangeSyntaxValidator{name: "staticIPRange"} + case IPClaimType_DynamicAddress: + v = &dynamicAddressSyntaxValidator{name: "dynamicIPRange"} + case IPClaimType_DynamicPrefix: + v = &dynamicPrefixSyntaxValidator{name: "dynamicIPprefix"} + default: + return allErrs + } + return v.Validate(r) +} + +func (r *IPClaim) GetIPClaimType() (IPClaimType, error) { + claimType := IPClaimType_Invalid + var sb strings.Builder + count := 0 + if r.Spec.Address != nil { + sb.WriteString(fmt.Sprintf("address: %s", *r.Spec.Address)) + claimType = IPClaimType_StaticAddress + count++ + + } + if r.Spec.Prefix != nil { + if count > 0 { + sb.WriteString(", ") + } + sb.WriteString(fmt.Sprintf("prefix: %s", *r.Spec.Prefix)) + claimType = IPClaimType_StaticPrefix + count++ + + } + if r.Spec.Range != nil { + if count > 0 { + sb.WriteString(", ") + } + sb.WriteString(fmt.Sprintf("range: %s", *r.Spec.Range)) + claimType = IPClaimType_StaticRange + count++ + } + if count > 1 { + return IPClaimType_Invalid, fmt.Errorf("an ipclaim can only have 1 claimType, got %s", sb.String()) + } + if count == 0 { + if r.Spec.CreatePrefix != nil { + return IPClaimType_DynamicPrefix, nil + } else { + return IPClaimType_DynamicAddress, nil + } + } + return claimType, nil +} + +func (r *IPClaim) GetIPClaimSummaryType() IPClaimSummaryType { + ipClaimType, err := r.GetIPClaimType() + if err != nil { + return IPClaimSummaryType_Invalid + } + switch ipClaimType { + case IPClaimType_DynamicAddress, IPClaimType_StaticAddress: + return IPClaimSummaryType_Address + case IPClaimType_DynamicPrefix, IPClaimType_StaticPrefix: + return IPClaimSummaryType_Prefix + case IPClaimType_StaticRange: + return IPClaimSummaryType_Range + default: + return IPClaimSummaryType_Invalid + } +} + +func (r *IPClaim) GetIPPrefixType() IPPrefixType { + if r.Spec.PrefixType == nil { + return IPPrefixType_Other + } + switch *r.Spec.PrefixType { + case IPPrefixType_Aggregate, IPPrefixType_Network, IPPrefixType_Pool: + return *r.Spec.PrefixType + default: + return IPPrefixType_Invalid + } +} + +func (r *IPClaim) GetIndex() string { return r.Spec.Index } + +func (r *IPClaim) GetSelector() *metav1.LabelSelector { return r.Spec.Selector } + +// GetOwnerSelector selects the route based on the name of the claim +func (r *IPClaim) GetOwnerSelector() (labels.Selector, error) { + l := map[string]string{ + backend.KuidClaimNameKey: r.Name, + backend.KuidClaimUIDKey: string(r.UID), + } + + fullselector := labels.NewSelector() + for k, v := range l { + req, err := labels.NewRequirement(k, selection.Equals, []string{v}) + if err != nil { + return nil, err + } + fullselector = fullselector.Add(*req) + } + return fullselector, nil +} + +func (r *IPClaim) GetLabelSelector() (labels.Selector, error) { return r.Spec.GetLabelSelector() } + +func (r *IPClaim) GetClaimLabels() labels.Set { + labels := r.Spec.GetUserDefinedLabels() + + // system defined labels + labels[backend.KuidClaimTypeKey] = string(r.GetIPClaimSummaryType()) + labels[backend.KuidIPAMIPPrefixTypeKey] = string(r.GetIPPrefixType()) + labels[backend.KuidClaimNameKey] = r.Name + labels[backend.KuidClaimUIDKey] = string(r.UID) + return labels +} + +// GetGatewayLabelSelector returns a label selector to select the gateway of the claim in the backend +func (r *IPClaim) GetDefaultGatewayLabelSelector(subnetString string) (labels.Selector, error) { + l := map[string]string{ + backend.KuidIPAMDefaultGatewayKey: "true", + backend.KuidIPAMSubnetKey: subnetString, + } + fullselector := labels.NewSelector() + for k, v := range l { + req, err := labels.NewRequirement(k, selection.Equals, []string{v}) + if err != nil { + return nil, err + } + fullselector = fullselector.Add(*req) + } + return fullselector, nil +} + +func (r *IPClaim) ValidateOwner(labels labels.Set) error { + routeClaimName := labels[backend.KuidClaimNameKey] + routeClaimUID := labels[backend.KuidClaimUIDKey] + + if string(r.UID) != routeClaimUID && r.Name != routeClaimName { + return fmt.Errorf("route owned by different claim got name %s/%s uid %s/%s", + r.Name, + routeClaimName, + string(r.UID), + routeClaimUID, + ) + } + return nil +} + +// IsOwnedByIPIndex returns true if the owner is the IPIndex +func (r *IPClaim) IsOwnedByIPIndex() bool { + for _, ownerRef := range r.OwnerReferences { + if strings.HasPrefix(ownerRef.APIVersion, SchemeGroupVersion.Group) && + ownerRef.Kind == IPIndexKind { + return true + } + } + return false +} diff --git a/apis/backend/ipam/ipclaim_resource.go b/apis/backend/ipam/ipclaim_resource.go new file mode 100644 index 0000000..2ffdc68 --- /dev/null +++ b/apis/backend/ipam/ipclaim_resource.go @@ -0,0 +1,353 @@ +/* +Copyright 2024 Nokia. + +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 "VLAN IS" BVLANIS, +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 ipam + +import ( + "context" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/kform-dev/choreo/apis/condition" + apiequality "k8s.io/apimachinery/pkg/api/equality" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/util/validation/field" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +const ( + IPClaimPlural = "ipclaims" + IPClaimSingular = "ipclaim" +) + +var ( + IPClaimShortNames = []string{} + IPClaimCategories = []string{"kuid", "knet"} +) + +// +k8s:deepcopy-gen=false +var _ resource.InternalObject = &IPClaim{} +var _ resource.ObjectList = &IPClaimList{} +var _ resource.ObjectWithStatusSubResource = &IPClaim{} +var _ resource.StatusSubResource = &IPClaimStatus{} + +func (IPClaim) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: IPClaimPlural, + } +} + +// IsStorageVersion returns true -- Config is used VLAN the internal version. +// IsStorageVersion implements resource.Object +func (IPClaim) IsStorageVersion() bool { + return true +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (IPClaim) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *IPClaim) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// GetSingularName returns the singular name of the resource +// GetSingularName implements resource.Object +func (IPClaim) GetSingularName() string { + return IPClaimSingular +} + +// GetShortNames returns the shortnames for the resource +// GetShortNames implements resource.Object +func (IPClaim) GetShortNames() []string { + return IPClaimShortNames +} + +// GetCategories return the categories of the resource +// GetCategories implements resource.Object +func (IPClaim) GetCategories() []string { + return IPClaimCategories +} + +// New return an empty resource +// New implements resource.Object +func (IPClaim) New() runtime.Object { + return &IPClaim{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (IPClaim) NewList() runtime.Object { + return &IPClaimList{} +} + +// IsEqual returns a bool indicating if the desired state of both resources is equal or not +func (r *IPClaim) IsEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*IPClaim) + oldobj := old.(*IPClaim) + + if !apiequality.Semantic.DeepEqual(oldobj.ObjectMeta, newobj.ObjectMeta) { + return false + } + // if equal we also test the spec + return apiequality.Semantic.DeepEqual(oldobj.Spec, newobj.Spec) +} + +// GetStatus return the resource.StatusSubResource interface +func (r *IPClaim) GetStatus() resource.StatusSubResource { + return r.Status +} + +// IsStatusEqual returns a bool indicating if the status of both resources is equal or not +func (r *IPClaim) IsStatusEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*IPClaim) + oldobj := old.(*IPClaim) + return apiequality.Semantic.DeepEqual(oldobj.Status, newobj.Status) +} + +// PrepareForStatusUpdate prepares the status update +func (r *IPClaim) PrepareForStatusUpdate(ctx context.Context, obj, old runtime.Object) { + newObj := obj.(*IPClaim) + oldObj := old.(*IPClaim) + newObj.Spec = oldObj.Spec + + // Status updates are for only for updating status, not objectmeta. + metav1.ResetObjectMetaForStatus(&newObj.ObjectMeta, &newObj.ObjectMeta) +} + +// ValidateStatusUpdate validates status updates +func (r *IPClaim) ValidateStatusUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +// SubResourceName resturns the name of the subresource +// SubResourceName implements the resource.StatusSubResource +func (IPClaimStatus) SubResourceName() string { + return fmt.Sprintf("%s/%s", IPClaimPlural, "status") +} + +// CopyTo copies the content of the status subresource to a parent resource. +// CopyTo implements the resource.StatusSubResource +func (r IPClaimStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { + parent, ok := obj.(*IPClaim) + if ok { + parent.Status = r + } +} + +// GetListMeta returns the ListMeta +// GetListMeta implements the resource.ObjectList +func (r *IPClaimList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +func (r *IPClaim) GetClaimRequest() string { + // we assume validation is already done when calling this + if r.Spec.Address != nil { + return *r.Spec.Address + } + if r.Spec.Prefix != nil { + return *r.Spec.Prefix + } + if r.Spec.Range != nil { + return *r.Spec.Range + } + return "" +} + +func (r *IPClaim) GetClaimResponse() string { + // we assume validation is already done when calling this + if r.Status.Address != nil { + return *r.Status.Address + } + if r.Status.Prefix != nil { + return *r.Status.Prefix + } + if r.Status.Range != nil { + return *r.Status.Range + } + return "" +} + +// TableConvertor return the table format of the resource +func (r *IPClaim) TableConvertor() func(gr schema.GroupResource) rest.TableConvertor { + return func(gr schema.GroupResource) rest.TableConvertor { + return registry.NewTableConverter( + gr, + func(obj runtime.Object) []interface{} { + ipclaim, ok := obj.(*IPClaim) + if !ok { + return nil + } + ipClaimType, _ := ipclaim.GetIPClaimType() + return []interface{}{ + ipclaim.Name, + ipclaim.GetCondition(condition.ConditionTypeReady).Status, + ipclaim.Spec.Index, + string(ipClaimType), + string(ipclaim.GetIPPrefixType()), + ipclaim.GetClaimRequest(), + ipclaim.GetClaimResponse(), + ipclaim.Status.DefaultGateway, + } + }, + []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + {Name: "Ready", Type: "string"}, + {Name: "Index", Type: "string"}, + {Name: "ClaimType", Type: "string"}, + {Name: "PrefixType", Type: "string"}, + {Name: "ClaimReq", Type: "string"}, + {Name: "ClaimRsp", Type: "string"}, + {Name: "DefaultGateway", Type: "string"}, + }, + ) + } +} + +// FieldLabelConversion is the schema conversion function for normalizing the FieldSelector for the resource +func (r *IPClaim) FieldLabelConversion() runtime.FieldLabelConversionFunc { + return func(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } + } +} + +func (r *IPClaim) FieldSelector() func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + return func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + var filter *IPClaimFilter + + // add the namespace to the list + namespace, ok := genericapirequest.NamespaceFrom(ctx) + if fieldSelector == nil { + if ok { + return &IPClaimFilter{Namespace: namespace}, nil + } + return filter, nil + } + requirements := fieldSelector.Requirements() + for _, requirement := range requirements { + filter = &IPClaimFilter{} + switch requirement.Operator { + case selection.Equals, selection.DoesNotExist: + if requirement.Value == "" { + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) + } + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) + } + + switch requirement.Field { + case "metadata.name": + filter.Name = requirement.Value + case "metadata.namespace": + filter.Namespace = requirement.Value + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) + } + } + // add namespace to the filter selector if specified + if ok { + if filter != nil { + filter.Namespace = namespace + } else { + filter = &IPClaimFilter{Namespace: namespace} + } + return filter, nil + } + + return &IPClaimFilter{}, nil + } + +} + +type IPClaimFilter struct { + // Name filters by the name of the objects + Name string `protobuf:"bytes,1,opt,name=name"` + + // Namespace filters by the namespace of the objects + Namespace string `protobuf:"bytes,2,opt,name=namespace"` +} + +func (r *IPClaimFilter) Filter(ctx context.Context, obj runtime.Object) bool { + f := false // result of the previous filter + o, ok := obj.(*IPClaim) + if !ok { + return f + } + if r == nil { + return false + } + if r.Name != "" { + if o.GetName() == r.Name { + f = false + } else { + f = true + } + } + if r.Namespace != "" { + if o.GetNamespace() == r.Namespace { + f = false + } else { + f = true + } + } + return f +} + +func (r *IPClaim) PrepareForCreate(ctx context.Context, obj runtime.Object) { + // status cannot be set upon create -> reset it + newobj := obj.(*IPClaim) + newobj.Status = IPClaimStatus{} +} + +// ValidateCreate statically validates +func (r *IPClaim) ValidateCreate(ctx context.Context, obj runtime.Object) field.ErrorList { + newobj := obj.(*IPClaim) + return newobj.ValidateSyntax("") +} + +func (r *IPClaim) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { + // ensure the status dont get updated + newobj := obj.(*IPClaim) + oldObj := old.(*IPClaim) + newobj.Status = oldObj.Status +} + +func (r *IPClaim) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + newobj := obj.(*IPClaim) + return newobj.ValidateSyntax("") +} diff --git a/apis/backend/ipam/ipclaim_syntaxvalidator.go b/apis/backend/ipam/ipclaim_syntaxvalidator.go new file mode 100644 index 0000000..18b56fb --- /dev/null +++ b/apis/backend/ipam/ipclaim_syntaxvalidator.go @@ -0,0 +1,26 @@ +/* +Copyright 2024 Nokia. + +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 ipam + +import ( + "k8s.io/apimachinery/pkg/util/validation/field" +) + +// +kubebuilder:object:generate=false +type SyntaxValidator interface { + Validate(claim *IPClaim) field.ErrorList +} diff --git a/apis/backend/ipam/ipclaim_syntaxvalidator_dynamic_address.go b/apis/backend/ipam/ipclaim_syntaxvalidator_dynamic_address.go new file mode 100644 index 0000000..db068db --- /dev/null +++ b/apis/backend/ipam/ipclaim_syntaxvalidator_dynamic_address.go @@ -0,0 +1,65 @@ +/* +Copyright 2024 Nokia. + +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 ipam + +import ( + fmt "fmt" + + "k8s.io/apimachinery/pkg/util/validation/field" +) + +type dynamicAddressSyntaxValidator struct { + name string +} + +func (r *dynamicAddressSyntaxValidator) Validate(claim *IPClaim) field.ErrorList { + var allErrs field.ErrorList + + ipPrefixType := claim.GetIPPrefixType() + if ipPrefixType == IPPrefixType_Invalid { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.type"), + claim, + fmt.Errorf("%s, invalid claim type, got %s", r.name, string(ipPrefixType)).Error(), + )) + } + + if claim.Spec.DefaultGateway != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.defaultGateway"), + claim, + fmt.Errorf("%s cannot have a defaultGateway", r.name).Error(), + )) + + } + if claim.Spec.CreatePrefix != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.createPrefix"), + claim, + fmt.Errorf("%s cannot have a createPrefix", r.name).Error(), + )) + } + if claim.Spec.PrefixLength != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.prefixLength"), + claim, + fmt.Errorf("%s cannot have a prefixLength", r.name).Error(), + )) + } + + return allErrs +} diff --git a/apis/backend/ipam/ipclaim_syntaxvalidator_dynamic_prefix.go b/apis/backend/ipam/ipclaim_syntaxvalidator_dynamic_prefix.go new file mode 100644 index 0000000..3fc0dc5 --- /dev/null +++ b/apis/backend/ipam/ipclaim_syntaxvalidator_dynamic_prefix.go @@ -0,0 +1,99 @@ +/* +Copyright 2024 Nokia. + +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 ipam + +import ( + fmt "fmt" + + "k8s.io/apimachinery/pkg/util/validation/field" +) + +type dynamicPrefixSyntaxValidator struct { + name string +} + +func (r *dynamicPrefixSyntaxValidator) Validate(claim *IPClaim) field.ErrorList { + var allErrs field.ErrorList + + ipPrefixType := claim.GetIPPrefixType() + if ipPrefixType == IPPrefixType_Invalid { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.type"), + claim, + fmt.Errorf("%s, invalid claim type, got %s", r.name, string(ipPrefixType)).Error(), + )) + } + + if claim.Spec.DefaultGateway != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.defaultGateway"), + claim, + fmt.Errorf("%s cannot have a defaultGateway", r.name).Error(), + )) + + } + if claim.Spec.CreatePrefix == nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.createPrefix"), + claim, + fmt.Errorf("%s must have a createPrefix", r.name).Error(), + )) + } + if claim.Spec.PrefixLength == nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.prefixLength"), + claim, + fmt.Errorf("%s must have a prefixLength", r.name).Error(), + )) + } + + return allErrs +} + +/* +func (r *dynamicClaimSyntaxValidator) ValidateSyntax(_ context.Context, claim *ipambev1alpha1.IPClaim) field.ErrorList { + var allErrs field.ErrorList + // dynamic entries with aggregate prefix kind not supported + if claim.Spec.Kind == ipambev1alpha1.PrefixKindAggregate { + allErrs = append(allErrs, field.Invalid( + field.NewPath(""), + claim, + fmt.Sprintf("a dynamic prefix claim is not supported for: %s", claim.Spec.Kind), + )) + return allErrs + } + // a dynamic prefix claim has to set the prefixLength + if claim.Spec.CreatePrefix != nil && claim.Spec.PrefixLength == nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.prefixLength"), + claim, + "a dynamic prefix claim has to specify the prefixLength", + )) + return allErrs + } + if claim.Spec.PrefixLength != nil && claim.Spec.CreatePrefix == nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.createPrefix"), + claim, + "a dynamic prefix with prefixLength set has to also set a createPrefix", + )) + return allErrs + } + // TODO Pool + return allErrs +} +*/ diff --git a/apis/backend/ipam/ipclaim_syntaxvalidator_static_address.go b/apis/backend/ipam/ipclaim_syntaxvalidator_static_address.go new file mode 100644 index 0000000..d2dfd79 --- /dev/null +++ b/apis/backend/ipam/ipclaim_syntaxvalidator_static_address.go @@ -0,0 +1,98 @@ +/* +Copyright 2024 Nokia. + +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 ipam + +import ( + fmt "fmt" + + "github.com/henderiw/iputil" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +type staticAddressSyntaxValidator struct { + name string +} + +func (r *staticAddressSyntaxValidator) Validate(claim *IPClaim) field.ErrorList { + var allErrs field.ErrorList + if claim.Spec.Address == nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.address"), + claim, + fmt.Errorf("%s requires a address", r.name).Error(), + )) + } + pi, err := iputil.New(*claim.Spec.Address) + if err != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.address"), + claim, + fmt.Errorf("%s invalid prefix; err %s", r.name, err.Error()).Error(), + )) + } + if pi.IsAddressPrefix() { // + if claim.Spec.DefaultGateway != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.defaultGateway"), + claim, + fmt.Errorf("%s cannot have a defaultGateway on a prefix which is not a network type", r.name).Error(), + )) + } + + } else { + if !((pi.GetAddressFamily() == iputil.AddressFamilyIpv4 && pi.GetPrefixLength().Int() == 31) || + (pi.GetAddressFamily() == iputil.AddressFamilyIpv6 && pi.GetPrefixLength().Int() == 127)) { + if !pi.IsNorLastNorFirst() { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.prefix"), + claim, + fmt.Errorf("%s cannot have a address that is the first or last address in a prefix based address", r.name).Error(), + )) + } + } + } + + if claim.Spec.CreatePrefix != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.createPrefix"), + claim, + fmt.Errorf("%s cannot have a createPrefix", r.name).Error(), + )) + } + if claim.Spec.PrefixLength != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.prefixLength"), + claim, + fmt.Errorf("%s cannot have a prefixLength", r.name).Error(), + )) + } + if claim.Spec.AddressFamily != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.addressFamily"), + claim, + fmt.Errorf("%s cannot have a addressFamily", r.name).Error(), + )) + } + if claim.Spec.Idx != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.index"), + claim, + fmt.Errorf("%s cannot have a index", r.name).Error(), + )) + } + return allErrs +} diff --git a/apis/backend/ipam/ipclaim_syntaxvalidator_static_prefix.go b/apis/backend/ipam/ipclaim_syntaxvalidator_static_prefix.go new file mode 100644 index 0000000..14146fc --- /dev/null +++ b/apis/backend/ipam/ipclaim_syntaxvalidator_static_prefix.go @@ -0,0 +1,111 @@ +/* +Copyright 2024 Nokia. + +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 ipam + +import ( + fmt "fmt" + + "github.com/henderiw/iputil" + "k8s.io/apimachinery/pkg/util/validation/field" + "k8s.io/utils/ptr" +) + +type staticPrefixSyntaxValidator struct { + name string +} + +func (r *staticPrefixSyntaxValidator) Validate(claim *IPClaim) field.ErrorList { + var allErrs field.ErrorList + if claim.Spec.Prefix == nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.prefix"), + claim, + fmt.Errorf("%s requires a prefix", r.name).Error(), + )) + } + pi, err := iputil.New(*claim.Spec.Prefix) + if err != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.prefix"), + claim, + fmt.Errorf("%s invalid prefix; err %s", r.name, err.Error()).Error(), + )) + } + // this is for user convenience + if claim.Spec.CreatePrefix == nil { + claim.Spec.CreatePrefix = ptr.To[bool](true) + } + if claim.Spec.PrefixLength == nil { + claim.Spec.PrefixLength = ptr.To[uint32](uint32(pi.GetPrefixLength())) + } + if pi.IsAddressPrefix() { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.prefix"), + claim, + fmt.Sprintf("%s invalid prefix, no /32 for ipv4 or /128 for ipv6 notationallowed, got %s", r.name, *claim.Spec.Prefix), + )) + } + ipPrefixType := claim.GetIPPrefixType() + if ipPrefixType == IPPrefixType_Invalid { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.type"), + claim, + fmt.Errorf("%s, invalid claim type, got %s", r.name, string(ipPrefixType)).Error(), + )) + } + if ipPrefixType != IPPrefixType_Network { + if pi.GetIPSubnet().String() != pi.GetIPPrefix().String() { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.prefix"), + claim, + fmt.Sprintf("%s, invalid prefix net <> address is not allowed for claimType: %s", r.name, string(ipPrefixType)), + )) + } + } + + if claim.Spec.DefaultGateway != nil { + if ipPrefixType != IPPrefixType_Network { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.type"), + claim, + fmt.Errorf("%s cannot have a defaultGateway on a prefix which is not a network type", r.name).Error(), + )) + } + if !pi.IsNorLastNorFirst() { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.prefix"), + claim, + fmt.Errorf("%s cannot have a defaultGateway on a prefix which is the first or last ip in the prefix", r.name).Error(), + )) + } + } + if claim.Spec.AddressFamily != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.addressFamily"), + claim, + fmt.Errorf("%s cannot have a addressFamily", r.name).Error(), + )) + } + if claim.Spec.Idx != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.index"), + claim, + fmt.Errorf("%s cannot have a index", r.name).Error(), + )) + } + return allErrs +} diff --git a/apis/backend/ipam/ipclaim_syntaxvalidator_static_range.go b/apis/backend/ipam/ipclaim_syntaxvalidator_static_range.go new file mode 100644 index 0000000..55b8a8c --- /dev/null +++ b/apis/backend/ipam/ipclaim_syntaxvalidator_static_range.go @@ -0,0 +1,90 @@ +/* +Copyright 2024 Nokia. + +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 ipam + +import ( + "fmt" + + "go4.org/netipx" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +type staticRangeSyntaxValidator struct { + name string +} + +func (r *staticRangeSyntaxValidator) Validate(claim *IPClaim) field.ErrorList { + var allErrs field.ErrorList + if claim.Spec.Range == nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.range"), + claim, + fmt.Errorf("%s requires a range", r.name).Error(), + )) + } + if _, err := netipx.ParseIPRange(*claim.Spec.Range); err != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.range"), + claim, + fmt.Errorf("%s invalid range; err %s", r.name, err.Error()).Error(), + )) + } + ipPrefixType := claim.GetIPPrefixType() + if ipPrefixType != IPPrefixType_Other { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.type"), + claim, + fmt.Errorf("%s invalid claim, expecting %s, got %s", r.name, string(IPPrefixType_Other), string(ipPrefixType)).Error(), + )) + } + if claim.Spec.DefaultGateway != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.defaultGateway"), + claim, + fmt.Errorf("%s cannot have a defaultGateway", r.name).Error(), + )) + } + if claim.Spec.CreatePrefix != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.createPrefix"), + claim, + fmt.Errorf("%s cannot have a createPrefix", r.name).Error(), + )) + } + if claim.Spec.PrefixLength != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.prefixLength"), + claim, + fmt.Errorf("%s cannot have a prefixLength", r.name).Error(), + )) + } + if claim.Spec.AddressFamily != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.addressFamily"), + claim, + fmt.Errorf("%s cannot have a addressFamily", r.name).Error(), + )) + } + if claim.Spec.Idx != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.index"), + claim, + fmt.Errorf("%s cannot have a index", r.name).Error(), + )) + } + return allErrs +} diff --git a/apis/backend/ipam/ipclaim_types.go b/apis/backend/ipam/ipclaim_types.go new file mode 100644 index 0000000..0755755 --- /dev/null +++ b/apis/backend/ipam/ipclaim_types.go @@ -0,0 +1,121 @@ +/* +Copyright 2024 Nokia. + +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 "VLAN IS" BVLANIS, +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 ipam + +import ( + "reflect" + + "github.com/henderiw/iputil" + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// IPClaimSpec defines the desired state of IPClaim +type IPClaimSpec struct { + // Index defines the index for the IP Entry + Index string `json:"index" yaml:"index" protobuf:"bytes,1,opt,name=index"` + // PrefixType defines the prefixtype of IPEntry; for address and range claims this is not relevant + // - network kind is used for physical, virtual nics on a device + // - pool kind is used for allocating dedicated IP addresses + // - aggregate kind is used for claiming an aggregate prefix; only used for networkInstance prefixes + // +kubebuilder:validation:Enum=`network`;`aggregate`;`pool`; + // +optional + PrefixType *IPPrefixType `json:"prefixType,omitempty" yaml:"prefixType,omitempty" protobuf:"bytes,2,opt,name=prefixType"` + // Prefix defines the prefix for the IP claim + // +optional + Prefix *string `json:"prefix,omitempty" yaml:"prefix,omitempty" protobuf:"bytes,3,opt,name=prefix"` + // Address defines the address for the IP claim + // +optional + Address *string `json:"address,omitempty" yaml:"address,omitempty" protobuf:"bytes,4,opt,name=address"` + // Range defines the range for the IP claim + // +optional + Range *string `json:"range,omitempty" yaml:"range,omitempty" protobuf:"bytes,5,opt,name=range"` + // DefaultGateway defines if the address acts as a default gateway + // +optional + DefaultGateway *bool `json:"defaultGateway,omitempty" yaml:"defaultGateway,omitempty" protobuf:"varint,6,opt,name=defaultGateway"` + // CreatePrefix defines if this prefix must be created. Only used for dynamic prefixes + // e.g. non /32 ipv4 and non /128 ipv6 prefixes + // +optional + CreatePrefix *bool `json:"createPrefix,omitempty" yaml:"createPrefix,omitempty" protobuf:"varint,7,opt,name=createPrefix"` + // PrefixLength defines the prefix length for the IP Claim, Must be set when CreatePrefic is set + // If not present we use assume /32 for ipv4 and /128 for ipv6 + // +optional + PrefixLength *uint32 `json:"prefixLength,omitempty" yaml:"prefixLength,omitempty" protobuf:"varint,8,opt,name=prefixLength"` + // AddressFamily defines the address family for the IP claim + // +kubebuilder:validation:Enum=`ipv4`;`ipv6` + // +kubebuilder:validation:Optional + // +optional + AddressFamily *iputil.AddressFamily `json:"addressFamily,omitempty" yaml:"addressFamily,omitempty" protobuf:"bytes,9,opt,name=addressFamily"` + // Index defines the index of the IP Claim, used to get a deterministic IP from a prefix + // If not present we claim a random prefix from a prefix + // +kubebuilder:validation:Optional + // +optional + Idx *uint32 `json:"idx,omitempty" yaml:"idx,omitempty" protobuf:"varint,10,opt,name=idx"` + // ClaimLabels define the user defined labels and selector labels used + // in resource claim + common.ClaimLabels `json:",inline" yaml:",inline" protobuf:"bytes,11,opt,name=claimLabels"` +} + +// IPClaimStatus defines the observed state of IPClaim +type IPClaimStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condition.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` + // Range defines the range, claimed through the IPAM backend + // +optional + Range *string `json:"range,omitempty" yaml:"range,omitempty" protobuf:"bytes,2,opt,name=range"` + // Address defines the address, claimed through the IPAM backend + // +optional + Address *string `json:"address,omitempty" yaml:"address,omitempty" protobuf:"bytes,3,opt,name=address"` + // Prefix defines the prefix, claimed through the IPAM backend + // +optional + Prefix *string `json:"prefix,omitempty" yaml:"prefix,omitempty" protobuf:"bytes,4,opt,name=prefix"` + // DefaultGateway defines the default gateway IP for the claimed prefix + // DefaultGateway is only relevant for prefix kind = network + // +optional + DefaultGateway *string `json:"defaultGateway,omitempty" yaml:"defaultGateway,omitempty" protobuf:"bytes,5,opt,name=defaultGateway"` + // ExpiryTime defines when the claim expires + // +kubebuilder:validation:Optional + // +optional + ExpiryTime *string `json:"expiryTime,omitempty" yaml:"expiryTime,omitempty" protobuf:"bytes,6,opt,name=expiryTime"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// IPClaim is the Schema for the ipclaim API +type IPClaim struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec IPClaimSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status IPClaimStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// IPClaimList contains a list of IPClaims +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type IPClaimList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []IPClaim `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + IPClaimKind = reflect.TypeOf(IPClaim{}).Name() + IPClaimListKind = reflect.TypeOf(IPClaimList{}).Name() +) diff --git a/apis/backend/ipam/ipentry_object.go b/apis/backend/ipam/ipentry_object.go new file mode 100644 index 0000000..37423c4 --- /dev/null +++ b/apis/backend/ipam/ipentry_object.go @@ -0,0 +1,185 @@ +/* +Copyright 2024 Nokia. + +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 ipam + +import ( + "context" + "errors" + "fmt" + "net/netip" + + "github.com/henderiw/iputil" + "github.com/henderiw/logger/log" + "github.com/henderiw/store" + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/backend" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/validation/field" + "k8s.io/utils/ptr" +) + +func (r *IPEntry) GetNamespacedName() types.NamespacedName { + return types.NamespacedName{ + Namespace: r.GetNamespace(), + Name: r.GetName(), + } +} +func (r *IPEntry) GetKey() store.Key { + return store.KeyFromNSN(types.NamespacedName{Namespace: r.Namespace, Name: r.Spec.Index}) +} + +// GetCondition returns the condition based on the condition kind +func (r *IPEntry) GetCondition(t condition.ConditionType) condition.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *IPEntry) SetConditions(c ...condition.Condition) { + r.Status.SetConditions(c...) +} + +func (r *IPEntry) ValidateSyntax(s string) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +func (r *IPEntry) GetClaimSummaryType() IPClaimSummaryType { + switch r.Spec.ClaimType { + case IPClaimType_DynamicAddress, IPClaimType_StaticAddress: + return IPClaimSummaryType_Address + case IPClaimType_DynamicPrefix, IPClaimType_StaticPrefix: + return IPClaimSummaryType_Prefix + case IPClaimType_StaticRange: + return IPClaimSummaryType_Range + default: + return IPClaimSummaryType_Invalid + } +} + +func (r *IPEntry) GetIPPrefixType() IPPrefixType { + if r.Spec.PrefixType == nil { + return IPPrefixType_Other + } + switch *r.Spec.PrefixType { + case IPPrefixType_Aggregate, IPPrefixType_Network, IPPrefixType_Pool: + return *r.Spec.PrefixType + default: + return IPPrefixType_Invalid + } +} + +func (r *IPEntry) GetIndex() string { + return r.Spec.Index +} + +func (r *IPEntry) GetIPPrefix() string { + return r.Spec.Prefix +} + +func (r *IPEntry) GetSpecID() string { + return r.Spec.Prefix +} + +func IPEntryFromRuntime(ru runtime.Object) (*IPEntry, error) { + entry, ok := ru.(*IPEntry) + if !ok { + return nil, errors.New("runtime object not ASIndex") + } + return entry, nil +} + +func GetIPEntry(ctx context.Context, k store.Key, rangeName string, prefix netip.Prefix, labels map[string]string) *IPEntry { + log := log.FromContext(ctx) + log.Info("get ipEntry from iptables", "key", k.String(), "range", rangeName, "prefix", prefix, "labels", labels) + + pi := iputil.NewPrefixInfo(prefix) + + index := k.Name + ns := k.Namespace + + // indicates if the IP entry is originated from the ip index + indexEntry := false + if labels[backend.KuidIndexEntryKey] == "true" { + indexEntry = true + } + + spec := &IPEntrySpec{ + Index: index, + IndexEntry: indexEntry, + PrefixType: GetIPPrefixTypeFromString(labels[backend.KuidIPAMIPPrefixTypeKey]), + ClaimType: GetIPClaimTypeFromString(labels[backend.KuidClaimTypeKey]), + Prefix: pi.String(), + AddressFamily: ptr.To(pi.GetAddressFamily()), + } + if _, ok := labels[backend.KuidIPAMDefaultGatewayKey]; ok { + spec.DefaultGateway = ptr.To[bool](true) + } + // filter the system defined labels from the labels to prepare for the user defined labels + udLabels := map[string]string{} + for k, v := range labels { + if !backend.BackendSystemKeys.Has(k) && !backend.BackendIPAMSystemKeys.Has(k) { + udLabels[k] = v + } + } + spec.UserDefinedLabels.Labels = udLabels + + name := fmt.Sprintf("%s.%s.%s", ns, index, pi.GetSubnetName()) + if rangeName != "" { + name = fmt.Sprintf("%s.%s.%s.%s", ns, index, rangeName, pi.GetSubnetName()) + } + return BuildIPEntry( + metav1.ObjectMeta{ + Name: name, + Namespace: ns, + OwnerReferences: []metav1.OwnerReference{ + { + APIVersion: schema.GroupVersion{Group: SchemeGroupVersion.Group, Version: "v1alpha1"}.Identifier(), + Kind: labels[backend.KuidOwnerKindKey], + Name: labels[backend.KuidClaimNameKey], + UID: types.UID(labels[backend.KuidClaimUIDKey]), + }, + }, + }, + spec, + nil, + ) +} + +// BuildIPEntry returns a reource from a client Object a Spec/Status +func BuildIPEntry(meta metav1.ObjectMeta, spec *IPEntrySpec, status *IPEntryStatus) *IPEntry { + aspec := IPEntrySpec{} + if spec != nil { + aspec = *spec + } + astatus := IPEntryStatus{} + if status != nil { + astatus = *status + } + return &IPEntry{ + TypeMeta: metav1.TypeMeta{ + APIVersion: SchemeGroupVersion.Identifier(), + Kind: IPEntryKind, + }, + ObjectMeta: meta, + Spec: aspec, + Status: astatus, + } +} diff --git a/apis/backend/ipam/ipentry_resource.go b/apis/backend/ipam/ipentry_resource.go new file mode 100644 index 0000000..471fc1a --- /dev/null +++ b/apis/backend/ipam/ipentry_resource.go @@ -0,0 +1,321 @@ +/* +Copyright 2024 Nokia. + +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 ipam + +import ( + "context" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + apiequality "k8s.io/apimachinery/pkg/api/equality" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/util/validation/field" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +const ( + IPEntryPlural = "ipentries" + IPEntrySingular = "ipentry" +) + +var ( + IPEntryShortNames = []string{} + IPEntryCategories = []string{"kuid", "knet"} +) + +// +k8s:deepcopy-gen=false +var _ resource.InternalObject = &IPEntry{} +var _ resource.ObjectList = &IPEntryList{} +var _ resource.ObjectWithStatusSubResource = &IPEntry{} +var _ resource.StatusSubResource = &IPEntryStatus{} + +func (IPEntry) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: IPEntryPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (IPEntry) IsStorageVersion() bool { + return true +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (IPEntry) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *IPEntry) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// GetSingularName returns the singular name of the resource +// GetSingularName implements resource.Object +func (IPEntry) GetSingularName() string { + return IPEntrySingular +} + +// GetShortNames returns the shortnames for the resource +// GetShortNames implements resource.Object +func (IPEntry) GetShortNames() []string { + return IPEntryShortNames +} + +// GetCategories return the categories of the resource +// GetCategories implements resource.Object +func (IPEntry) GetCategories() []string { + return IPEntryCategories +} + +// New return an empty resource +// New implements resource.Object +func (IPEntry) New() runtime.Object { + return &IPEntry{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (IPEntry) NewList() runtime.Object { + return &IPEntryList{} +} + +// IsEqual returns a bool indicating if the desired state of both resources is equal or not +func (r *IPEntry) IsEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*IPEntry) + oldobj := old.(*IPEntry) + + if !apiequality.Semantic.DeepEqual(oldobj.ObjectMeta, newobj.ObjectMeta) { + return false + } + // if equal we also test the spec + return apiequality.Semantic.DeepEqual(oldobj.Spec, newobj.Spec) +} + +// GetStatus return the resource.StatusSubResource interface +func (r *IPEntry) GetStatus() resource.StatusSubResource { + return r.Status +} + +// IsStatusEqual returns a bool indicating if the status of both resources is equal or not +func (r *IPEntry) IsStatusEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*IPEntry) + oldobj := old.(*IPEntry) + return apiequality.Semantic.DeepEqual(oldobj.Status, newobj.Status) +} + +// PrepareForStatusUpdate prepares the status update +func (r *IPEntry) PrepareForStatusUpdate(ctx context.Context, obj, old runtime.Object) { + newObj := obj.(*IPEntry) + oldObj := old.(*IPEntry) + newObj.Spec = oldObj.Spec + + // Status updates are for only for updating status, not objectmeta. + metav1.ResetObjectMetaForStatus(&newObj.ObjectMeta, &newObj.ObjectMeta) +} + +// ValidateStatusUpdate validates status updates +func (r *IPEntry) ValidateStatusUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +// SubResourceName resturns the name of the subresource +// SubResourceName implements the resource.StatusSubResource +func (IPEntryStatus) SubResourceName() string { + return fmt.Sprintf("%s/%s", IPEntryPlural, "status") +} + +// CopyTo copies the content of the status subresource to a parent resource. +// CopyTo implements the resource.StatusSubResource +func (r IPEntryStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { + parent, ok := obj.(*IPEntry) + if ok { + parent.Status = r + } +} + +// GetListMeta returns the ListMeta +// GetListMeta implements the resource.ObjectList +func (r *IPEntryList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// TableConvertor return the table format of the resource +func (r *IPEntry) TableConvertor() func(gr schema.GroupResource) rest.TableConvertor { + return func(gr schema.GroupResource) rest.TableConvertor { + return registry.NewTableConverter( + gr, + func(obj runtime.Object) []interface{} { + entry, ok := obj.(*IPEntry) + if !ok { + return nil + } + return []interface{}{ + entry.Name, + //entry.GetCondition(condition.ConditionTypeReady).Status, + entry.Spec.Index, + entry.Spec.ClaimType, + string(entry.GetIPPrefixType()), + entry.GetIPPrefix(), + entry.Spec.DefaultGateway, + } + }, + []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + //{Name: "Ready", Type: "string"}, + {Name: "NetworkInstance", Type: "string"}, + {Name: "ClaimType", Type: "string"}, + {Name: "PrefixType", Type: "string"}, + {Name: "Prefix", Type: "string"}, + {Name: "DefaultGateway", Type: "string"}, + }, + ) + } +} + +// FieldLabelConversion is the schema conversion function for normalizing the FieldSelector for the resource +func (r *IPEntry) FieldLabelConversion() runtime.FieldLabelConversionFunc { + return func(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } + } +} + +func (r *IPEntry) FieldSelector() func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + return func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + var filter *IPEntryFilter + + // add the namespace to the list + namespace, ok := genericapirequest.NamespaceFrom(ctx) + if fieldSelector == nil { + if ok { + return &IPEntryFilter{Namespace: namespace}, nil + } + return filter, nil + } + requirements := fieldSelector.Requirements() + for _, requirement := range requirements { + filter = &IPEntryFilter{} + switch requirement.Operator { + case selection.Equals, selection.DoesNotExist: + if requirement.Value == "" { + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) + } + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) + } + + switch requirement.Field { + case "metadata.name": + filter.Name = requirement.Value + case "metadata.namespace": + filter.Namespace = requirement.Value + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) + } + } + // add namespace to the filter selector if specified + if ok { + if filter != nil { + filter.Namespace = namespace + } else { + filter = &IPEntryFilter{Namespace: namespace} + } + return filter, nil + } + + return &IPEntryFilter{}, nil + } + +} + +type IPEntryFilter struct { + // Name filters by the name of the objects + Name string `protobuf:"bytes,1,opt,name=name"` + + // Namespace filters by the namespace of the objects + Namespace string `protobuf:"bytes,2,opt,name=namespace"` +} + +func (r *IPEntryFilter) Filter(ctx context.Context, obj runtime.Object) bool { + f := false // result of the previous filter + o, ok := obj.(*IPEntry) + if !ok { + return f + } + if r == nil { + return false + } + if r.Name != "" { + if o.GetName() == r.Name { + f = false + } else { + f = true + } + } + if r.Namespace != "" { + if o.GetNamespace() == r.Namespace { + f = false + } else { + f = true + } + } + return f +} + +func (r *IPEntry) PrepareForCreate(ctx context.Context, obj runtime.Object) { + // status cannot be set upon create -> reset it + newobj := obj.(*IPEntry) + newobj.Status = IPEntryStatus{} +} + +// ValidateCreate statically validates +func (r *IPEntry) ValidateCreate(ctx context.Context, obj runtime.Object) field.ErrorList { + newobj := obj.(*IPEntry) + return newobj.ValidateSyntax("") +} + +func (r *IPEntry) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { + // ensure the sttaus dont get updated + newobj := obj.(*IPEntry) + oldObj := old.(*IPEntry) + newobj.Status = oldObj.Status +} + +func (r *IPEntry) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + newobj := obj.(*IPEntry) + return newobj.ValidateSyntax("") +} diff --git a/apis/backend/ipam/ipentry_types.go b/apis/backend/ipam/ipentry_types.go new file mode 100644 index 0000000..9053562 --- /dev/null +++ b/apis/backend/ipam/ipentry_types.go @@ -0,0 +1,88 @@ +/* +Copyright 2024 Nokia. + +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 ipam + +import ( + "reflect" + + "github.com/henderiw/iputil" + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// IPEntrySpec defines the desired state of IPEntry +type IPEntrySpec struct { + // Index defines the index for the IP Entry + Index string `json:"index" yaml:"index" protobuf:"bytes,1,opt,name=index"` + // IndexEntry identifies if the entry is originated from an IP Index + IndexEntry bool `json:"indexEntry" yaml:"indexEntry" protobuf:"bytes,2,opt,name=indexEntry"` + // PrefixType defines the prefixtype of IPEntry; for address and range claims this is not relevant + // - network kind is used for physical, virtual nics on a device + // - pool kind is used for allocating dedicated IP addresses + // - aggregate kind is used for claiming an aggregate prefix; only used for networkInstance prefixes + // +kubebuilder:validation:Enum=`network`;`aggregate`;`pool`; + // +optional + PrefixType *IPPrefixType `json:"prefixType,omitempty" yaml:"prefixType,omitempty" protobuf:"bytes,3,opt,name=prefixType"` + // ClaimType defines the claimType of the IP Entry + // +kubebuilder:validation:Enum=`staticAddress`;`staticPrefix`;`staticRange`;`dynamicPrefix`;`dynamicAddress`; + ClaimType IPClaimType `json:"claimType,omitempty" yaml:"claimType,omitempty" protobuf:"bytes,4,opt,name=claimType"` + // Prefix defines the prefix for the IP entry; which can be an expanded prefix from the prefix, range or address + Prefix string `json:"prefix" yaml:"prefix" protobuf:"bytes,5,opt,name=prefix"` + // DefaultGateway defines if the address acts as a default gateway + // +optional + DefaultGateway *bool `json:"defaultGateway,omitempty" yaml:"defaultGateway,omitempty" protobuf:"varint,6,opt,name=defaultGateway"` + // AddressFamily defines the address family for the IP claim + // +kubebuilder:validation:Enum=`ipv4`;`ipv6` + // +kubebuilder:validation:Optional + // +optional + AddressFamily *iputil.AddressFamily `json:"addressFamily,omitempty" yaml:"addressFamily,omitempty" protobuf:"bytes,7,opt,name=addressFamily"` + // UserDefinedLabels define the user defined labels + common.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,8,opt,name=userDefinedLabels"` +} + +// IPEntryStatus defines the observed state of IPEntry +type IPEntryStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condition.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// IPEntry is the Schema for the ipentry API +type IPEntry struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec IPEntrySpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status IPEntryStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// IPEntryList contains a list of IPEntries +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type IPEntryList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []IPEntry `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + IPEntryKind = reflect.TypeOf(IPEntry{}).Name() + IPEntryListKind = reflect.TypeOf(IPEntryList{}).Name() +) diff --git a/apis/backend/ipam/ipindex_helper.go b/apis/backend/ipam/ipindex_helper.go new file mode 100644 index 0000000..78e9ef7 --- /dev/null +++ b/apis/backend/ipam/ipindex_helper.go @@ -0,0 +1,42 @@ +/* +Copyright 2024 Nokia. + +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 ipam + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// BuildIPClaim returns a reource from a client Object a Spec/Status +func BuildIPIndex(meta metav1.ObjectMeta, spec *IPIndexSpec, status *IPIndexStatus) *IPIndex { + aspec := IPIndexSpec{} + if spec != nil { + aspec = *spec + } + astatus := IPIndexStatus{} + if status != nil { + astatus = *status + } + return &IPIndex{ + TypeMeta: metav1.TypeMeta{ + APIVersion: SchemeGroupVersion.Identifier(), + Kind: IPIndexKind, + }, + ObjectMeta: meta, + Spec: aspec, + Status: astatus, + } +} diff --git a/apis/backend/ipam/ipindex_object.go b/apis/backend/ipam/ipindex_object.go new file mode 100644 index 0000000..0685c97 --- /dev/null +++ b/apis/backend/ipam/ipindex_object.go @@ -0,0 +1,117 @@ +/* +Copyright 2024 Nokia. + +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 ipam + +import ( + "errors" + "fmt" + + "github.com/henderiw/iputil" + "github.com/henderiw/store" + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/validation/field" + "k8s.io/utils/ptr" +) + +func (r *IPIndex) GetKey() store.Key { + return store.KeyFromNSN(r.GetNamespacedName()) +} + +func (r *IPIndex) GetNamespacedName() types.NamespacedName { + return types.NamespacedName{ + Namespace: r.GetNamespace(), + Name: r.GetName(), + } +} + +// GetCondition returns the condition based on the condition kind +func (r *IPIndex) GetCondition(t condition.ConditionType) condition.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *IPIndex) SetConditions(c ...condition.Condition) { + r.Status.SetConditions(c...) +} + +func (r *IPIndex) ValidateSyntax(s string) field.ErrorList { + var allErrs field.ErrorList + + if len(r.Spec.Prefixes) == 0 { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.prefixes"), + r, + fmt.Errorf("a ipindex needs a prefix").Error(), + )) + + } + + return allErrs +} + +func (r *IPIndex) GetClaims() ([]*IPClaim, error) { + ipclaims := make([]*IPClaim, len(r.Spec.Prefixes)) + var errm, err error + for i, prefix := range r.Spec.Prefixes { + ipclaims[i], err = r.GetClaim(prefix) + if err != nil { + errm = errors.Join(errm, err) + } + } + if errm != nil { + return nil, errm + } + return ipclaims, nil +} + +func (r *IPIndex) GetClaim(prefix Prefix) (*IPClaim, error) { + pi, err := iputil.New(prefix.Prefix) + if err != nil { + return nil, err + } + + return BuildIPClaim( + metav1.ObjectMeta{ + Namespace: r.GetNamespace(), + Name: fmt.Sprintf("%s.%s", r.Name, pi.GetSubnetName()), + OwnerReferences: []metav1.OwnerReference{ + { + APIVersion: schema.GroupVersion{Group: SchemeGroupVersion.Group, Version: "v1alpah1"}.Identifier(), + Kind: IPIndexKind, + Name: r.Name, + UID: r.UID, + }, + }, + }, + &IPClaimSpec{ + Index: r.Name, + PrefixType: prefix.PrefixType, + Prefix: ptr.To(prefix.Prefix), + PrefixLength: ptr.To(uint32(pi.GetPrefixLength())), + CreatePrefix: ptr.To(true), + ClaimLabels: common.ClaimLabels{ + UserDefinedLabels: prefix.UserDefinedLabels, + }, + }, + nil, + ), nil +} diff --git a/apis/backend/ipam/ipindex_resource.go b/apis/backend/ipam/ipindex_resource.go new file mode 100644 index 0000000..258d621 --- /dev/null +++ b/apis/backend/ipam/ipindex_resource.go @@ -0,0 +1,331 @@ +/* +Copyright 2024 Nokia. + +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 ipam + +import ( + "context" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/kform-dev/choreo/apis/condition" + apiequality "k8s.io/apimachinery/pkg/api/equality" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/util/validation/field" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +const ( + IPIndexPlural = "ipindices" + IPIndexSingular = "ipindex" +) + +var ( + IPIndexShortNames = []string{} + IPIndexCategories = []string{"kuid", "knet"} +) + +// +k8s:deepcopy-gen=false +var _ resource.InternalObject = &IPIndex{} +var _ resource.ObjectList = &IPIndexList{} +var _ resource.ObjectWithStatusSubResource = &IPIndex{} +var _ resource.StatusSubResource = &IPIndexStatus{} + +func (IPIndex) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: IPIndexPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (IPIndex) IsStorageVersion() bool { + return true +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (IPIndex) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *IPIndex) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// GetSingularName returns the singular name of the resource +// GetSingularName implements resource.Object +func (IPIndex) GetSingularName() string { + return IPIndexSingular +} + +// GetShortNames returns the shortnames for the resource +// GetShortNames implements resource.Object +func (IPIndex) GetShortNames() []string { + return IPIndexShortNames +} + +// GetCategories return the categories of the resource +// GetCategories implements resource.Object +func (IPIndex) GetCategories() []string { + return IPIndexCategories +} + +// New return an empty resource +// New implements resource.Object +func (IPIndex) New() runtime.Object { + return &IPIndex{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (IPIndex) NewList() runtime.Object { + return &IPIndexList{} +} + +// IsEqual returns a bool indicating if the desired state of both resources is equal or not +func (r *IPIndex) IsEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*IPIndex) + oldobj := old.(*IPIndex) + + if !apiequality.Semantic.DeepEqual(oldobj.ObjectMeta, newobj.ObjectMeta) { + return false + } + // if equal we also test the spec + return apiequality.Semantic.DeepEqual(oldobj.Spec, newobj.Spec) +} + +// GetStatus return the resource.StatusSubResource interface +func (r *IPIndex) GetStatus() resource.StatusSubResource { + return r.Status +} + +// IsStatusEqual returns a bool indicating if the status of both resources is equal or not +func (r *IPIndex) IsStatusEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*IPIndex) + oldobj := old.(*IPIndex) + return apiequality.Semantic.DeepEqual(oldobj.Status, newobj.Status) +} + +// PrepareForStatusUpdate prepares the status update +func (r *IPIndex) PrepareForStatusUpdate(ctx context.Context, obj, old runtime.Object) { + newObj := obj.(*IPIndex) + oldObj := old.(*IPIndex) + newObj.Spec = oldObj.Spec + + // Status updates are for only for updating status, not objectmeta. + metav1.ResetObjectMetaForStatus(&newObj.ObjectMeta, &newObj.ObjectMeta) +} + +// ValidateStatusUpdate validates status updates +func (r *IPIndex) ValidateStatusUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +// SubResourceName resturns the name of the subresource +// SubResourceName implements the resource.StatusSubResource +func (IPIndexStatus) SubResourceName() string { + return fmt.Sprintf("%s/%s", IPIndexPlural, "status") +} + +// CopyTo copies the content of the status subresource to a parent resource. +// CopyTo implements the resource.StatusSubResource +func (r IPIndexStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { + parent, ok := obj.(*IPIndex) + if ok { + parent.Status = r + } +} + +// GetListMeta returns the ListMeta +// GetListMeta implements the resource.ObjectList +func (r *IPIndexList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// TableConvertor return the table format of the resource +func (r *IPIndex) TableConvertor() func(gr schema.GroupResource) rest.TableConvertor { + return func(gr schema.GroupResource) rest.TableConvertor { + return registry.NewTableConverter( + gr, + func(obj runtime.Object) []interface{} { + index, ok := obj.(*IPIndex) + if !ok { + return nil + } + + prefixes := make([]string, 5) + for i, prefix := range index.Spec.Prefixes { + if i >= 5 { + break + } + prefixes[i] = prefix.Prefix + } + + return []interface{}{ + index.Name, + index.GetCondition(condition.ConditionTypeReady).Status, + prefixes[0], + prefixes[1], + prefixes[2], + prefixes[3], + prefixes[4], + } + }, + []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + {Name: "Ready", Type: "string"}, + {Name: "Prefix0", Type: "string"}, + {Name: "Prefix1", Type: "string"}, + {Name: "Prefix2", Type: "string"}, + {Name: "Prefix3", Type: "string"}, + {Name: "Prefix4", Type: "string"}, + }, + ) + } +} + +// FieldLabelConversion is the schema conversion function for normalizing the FieldSelector for the resource +func (r *IPIndex) FieldLabelConversion() runtime.FieldLabelConversionFunc { + return func(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } + } +} + +func (r *IPIndex) FieldSelector() func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + return func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + var filter *IPIndexFilter + + // add the namespace to the list + namespace, ok := genericapirequest.NamespaceFrom(ctx) + if fieldSelector == nil { + if ok { + return &IPIndexFilter{Namespace: namespace}, nil + } + return filter, nil + } + requirements := fieldSelector.Requirements() + for _, requirement := range requirements { + filter = &IPIndexFilter{} + switch requirement.Operator { + case selection.Equals, selection.DoesNotExist: + if requirement.Value == "" { + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) + } + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) + } + + switch requirement.Field { + case "metadata.name": + filter.Name = requirement.Value + case "metadata.namespace": + filter.Namespace = requirement.Value + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) + } + } + // add namespace to the filter selector if specified + if ok { + if filter != nil { + filter.Namespace = namespace + } else { + filter = &IPIndexFilter{Namespace: namespace} + } + return filter, nil + } + + return &IPIndexFilter{}, nil + } + +} + +type IPIndexFilter struct { + // Name filters by the name of the objects + Name string `protobuf:"bytes,1,opt,name=name"` + + // Namespace filters by the namespace of the objects + Namespace string `protobuf:"bytes,2,opt,name=namespace"` +} + +func (r *IPIndexFilter) Filter(ctx context.Context, obj runtime.Object) bool { + f := false // result of the previous filter + o, ok := obj.(*IPIndex) + if !ok { + return f + } + if r == nil { + return false + } + if r.Name != "" { + if o.GetName() == r.Name { + f = false + } else { + f = true + } + } + if r.Namespace != "" { + if o.GetNamespace() == r.Namespace { + f = false + } else { + f = true + } + } + return f +} + +func (r *IPIndex) PrepareForCreate(ctx context.Context, obj runtime.Object) { + // status cannot be set upon create -> reset it + newobj := obj.(*IPIndex) + newobj.Status = IPIndexStatus{} +} + +// ValidateCreate statically validates +func (r *IPIndex) ValidateCreate(ctx context.Context, obj runtime.Object) field.ErrorList { + newobj := obj.(*IPIndex) + return newobj.ValidateSyntax("") +} + +func (r *IPIndex) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { + // ensure the sttaus dont get updated + newobj := obj.(*IPIndex) + oldObj := old.(*IPIndex) + newobj.Status = oldObj.Status +} + +func (r *IPIndex) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + newobj := obj.(*IPIndex) + return newobj.ValidateSyntax("") +} diff --git a/apis/backend/ipam/ipindex_types.go b/apis/backend/ipam/ipindex_types.go new file mode 100644 index 0000000..f728ade --- /dev/null +++ b/apis/backend/ipam/ipindex_types.go @@ -0,0 +1,83 @@ +/* +Copyright 2024 Nokia. + +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 "VLAN IS" BVLANIS, +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 ipam + +import ( + "reflect" + + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// IPIndexSpec defines the desired state of IPIndex +type IPIndexSpec struct { + // Prefixes define the aggregate prefixes for the network instance + // A Network instance needs at least 1 prefix to be defined to become operational + Prefixes []Prefix `json:"prefixes" yaml:"prefixes" protobuf:"bytes,1,opt,name=prefixes"` +} + +type Prefix struct { + // Prefix defines the ip cidr in prefix notation. + // +kubebuilder:validation:Pattern=`(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))|((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))` + Prefix string `json:"prefix" yaml:"prefix" protobuf:"bytes,1,opt,name=prefix"` + // PrefixType defines the prefixtype of IPIndex; + // - network kind is used for physical, virtual nics on a device + // - pool kind is used for allocating dedicated IP addresses + // - aggregate kind is used for claiming an aggregate prefix; only used for networkInstance prefixes + // +kubebuilder:validation:Enum=network;aggregate;pool; + // +kubebuilder:default:=aggregate + // +optional + PrefixType *IPPrefixType `json:"prefixType,omitempty" yaml:"prefixType,omitempty" protobuf:"bytes,2,opt,name=prefixType"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + common.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,2,opt,name=userDefinedLabels"` +} + +// IPIndexStatus defines the observed state of IPIndex +type IPIndexStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condition.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` + // Prefixes defines the prefixes, claimed through the IPAM backend + Prefixes []Prefix `json:"prefixes,omitempty" yaml:"prefixes,omitempty" protobuf:"bytes,2,rep,name=prefixes"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// IPIndex is the Schema for the IPIndex API +type IPIndex struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec IPIndexSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status IPIndexStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// IPIndexList contains a list of IPIndexs +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type IPIndexList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []IPIndex `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + IPIndexKind = reflect.TypeOf(IPIndex{}).Name() + IPIndexListKind = reflect.TypeOf(IPIndexList{}).Name() +) diff --git a/apis/backend/ipam/register.go b/apis/backend/ipam/register.go new file mode 100644 index 0000000..5fd1ae0 --- /dev/null +++ b/apis/backend/ipam/register.go @@ -0,0 +1,52 @@ +// Copyright 2022 The kpt 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. + +package ipam + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +const ( + GroupName = "ipam.be.kuid.dev" + Version = runtime.APIVersionInternal +) + +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: Version} + +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme +) + +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &IPIndex{}, + &IPIndexList{}, + &IPClaim{}, + &IPClaimList{}, + &IPEntry{}, + &IPEntryList{}, + ) + return nil +} diff --git a/apis/backend/ipam/register/register.go b/apis/backend/ipam/register/register.go new file mode 100644 index 0000000..5dae5c9 --- /dev/null +++ b/apis/backend/ipam/register/register.go @@ -0,0 +1,108 @@ +/* +Copyright 2024 Nokia. + +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 register + +import ( + "context" + + "github.com/henderiw/apiserver-builder/pkg/builder" + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-builder/pkg/builder/rest" + "github.com/kuidio/kuid/apis/backend/ipam" + ipambev1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" + bebackend "github.com/kuidio/kuid/pkg/backend" + ipambe "github.com/kuidio/kuid/pkg/backend/ipam" + "github.com/kuidio/kuid/pkg/config" + genericregistry "github.com/kuidio/kuid/pkg/registry/generic" + "github.com/kuidio/kuid/pkg/registry/options" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apiserver/pkg/registry/generic" +) + +func init() { + config.Register( + ipam.SchemeGroupVersion.Group, + ipambev1alpha1.AddToScheme, + NewBackend, + ApplyStorageToBackend, + []*config.ResourceConfig{ + {StorageProviderFn: NewIndexStorageProvider, Internal: &ipam.IPIndex{}, ResourceVersions: []resource.Object{&ipam.IPIndex{}, &ipambev1alpha1.IPIndex{}}}, + {StorageProviderFn: NewClaimStorageProvider, Internal: &ipam.IPClaim{}, ResourceVersions: []resource.Object{&ipam.IPClaim{}, &ipambev1alpha1.IPClaim{}}}, + {StorageProviderFn: NewStorageProvider, Internal: &ipam.IPEntry{}, ResourceVersions: []resource.Object{&ipam.IPEntry{}, &ipambev1alpha1.IPEntry{}}}, + }, + ) +} + +func NewBackend() bebackend.Backend { + return ipambe.New() +} + +func NewIndexStorageProvider(ctx context.Context, obj resource.InternalObject, be bebackend.Backend, sync bool, options *options.Options) *rest.StorageProvider { + opts := *options + if sync { + opts.BackendInvoker = bebackend.NewIndexInvoker(be) + return genericregistry.NewStorageProvider(ctx, obj, &opts) + } + return genericregistry.NewStorageProvider(ctx, obj, &opts) +} + +func NewClaimStorageProvider(ctx context.Context, obj resource.InternalObject, be bebackend.Backend, sync bool, options *options.Options) *rest.StorageProvider { + opts := *options + if sync { + opts.BackendInvoker = bebackend.NewClaimInvoker(be) + return genericregistry.NewStorageProvider(ctx, obj, &opts) + } + return genericregistry.NewStorageProvider(ctx, obj, &opts) +} + +func NewStorageProvider(ctx context.Context, obj resource.InternalObject, be bebackend.Backend, sync bool, options *options.Options) *rest.StorageProvider { + return genericregistry.NewStorageProvider(ctx, obj, options) +} + +func ApplyStorageToBackend(ctx context.Context, be bebackend.Backend, apiServer *builder.Server) error { + claimStorageProvider := apiServer.StorageProvider[schema.GroupResource{ + Group: ipam.SchemeGroupVersion.Group, + Resource: ipam.IPClaimPlural, + }] + + claimStorage, err := claimStorageProvider.Get(ctx, apiServer.Schemes[0], &Getter{}) + if err != nil { + return err + } + + entryStorageProvider := apiServer.StorageProvider[schema.GroupResource{ + Group: ipam.SchemeGroupVersion.Group, + Resource: ipam.IPEntryPlural, + }] + + entryStorage, err := entryStorageProvider.Get(ctx, apiServer.Schemes[0], &Getter{}) + if err != nil { + return err + } + + return be.AddStorage(entryStorage, claimStorage) +} + +var _ generic.RESTOptionsGetter = &Getter{} + +type Getter struct{} + +func (r *Getter) GetRESTOptions(resource schema.GroupResource, example runtime.Object) (generic.RESTOptions, error) { + return generic.RESTOptions{}, nil +} + diff --git a/apis/backend/ipam/v1alpha1/doc.go b/apis/backend/ipam/v1alpha1/doc.go new file mode 100644 index 0000000..7fc3a32 --- /dev/null +++ b/apis/backend/ipam/v1alpha1/doc.go @@ -0,0 +1,28 @@ +/* +Copyright 2024 Nokia. + +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. +*/ + +//go:generate deepcopy-gen -O zz_generated.deepcopy -i . -h ../../../../boilerplate.go.txt +//go:generate defaulter-gen -O zz_generated.defaults -i . -h ../../../../boilerplate.go.txt +//go:generate conversion-gen -O zz_generated.conversion -i . -h ../../../../boilerplate.go.txt + +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen=package,register +// +k8s:conversion-gen=github.com/kuidio/kuid/apis/backend/ipam +// +k8s:defaulter-gen=TypeMeta +// +groupName=ipam.be.kuid.dev + +// v1alpha1 is the v1alpha1 version of the API. +package v1alpha1 diff --git a/apis/backend/ipam/v1alpha1/ipam_types.go b/apis/backend/ipam/v1alpha1/ipam_types.go new file mode 100644 index 0000000..d6c9b07 --- /dev/null +++ b/apis/backend/ipam/v1alpha1/ipam_types.go @@ -0,0 +1,94 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "k8s.io/utils/ptr" +) + +type IPClaimType string + +const ( + IPClaimType_Invalid IPClaimType = "invalid" + IPClaimType_StaticAddress IPClaimType = "staticAddress" + IPClaimType_StaticPrefix IPClaimType = "staticPrefix" + IPClaimType_StaticRange IPClaimType = "staticRange" + IPClaimType_DynamicAddress IPClaimType = "dynamicAddress" + IPClaimType_DynamicPrefix IPClaimType = "dynamicPrefix" +) + +func GetIPClaimTypeFromString(s string) IPClaimType { + switch s { + case string(IPClaimType_StaticAddress): + return IPClaimType_StaticAddress + case string(IPClaimType_StaticPrefix): + return IPClaimType_StaticPrefix + case string(IPClaimType_StaticRange): + return IPClaimType_StaticRange + case string(IPClaimType_DynamicAddress): + return IPClaimType_DynamicAddress + case string(IPClaimType_DynamicPrefix): + return IPClaimType_DynamicPrefix + default: + return IPClaimType_Invalid + } +} + +type IPClaimSummaryType string + +const ( + IPClaimSummaryType_Prefix IPClaimSummaryType = "prefix" + IPClaimSummaryType_Address IPClaimSummaryType = "address" + IPClaimSummaryType_Range IPClaimSummaryType = "range" + IPClaimSummaryType_Invalid IPClaimSummaryType = "invalid" +) + +func GetIPClaimSummaryTypeFromString(s string) IPClaimSummaryType { + switch s { + case string(IPClaimSummaryType_Prefix): + return IPClaimSummaryType_Prefix + case string(IPClaimSummaryType_Address): + return IPClaimSummaryType_Address + case string(IPClaimSummaryType_Range): + return IPClaimSummaryType_Range + default: + return IPClaimSummaryType_Invalid + } +} + +type IPPrefixType string + +const ( + IPPrefixType_Invalid IPPrefixType = "invalid" + IPPrefixType_Other IPPrefixType = "other" + IPPrefixType_Pool IPPrefixType = "pool" + IPPrefixType_Network IPPrefixType = "network" + IPPrefixType_Aggregate IPPrefixType = "aggregate" +) + +func GetIPPrefixTypeFromString(s string) *IPPrefixType { + switch s { + case string(IPPrefixType_Pool): + return ptr.To[IPPrefixType](IPPrefixType_Pool) + case string(IPPrefixType_Network): + return ptr.To[IPPrefixType](IPPrefixType_Network) + case string(IPPrefixType_Aggregate): + return ptr.To[IPPrefixType](IPPrefixType_Aggregate) + default: + return nil + } +} diff --git a/apis/backend/ipam/v1alpha1/ipclaim_resource.go b/apis/backend/ipam/v1alpha1/ipclaim_resource.go new file mode 100644 index 0000000..ba5ef91 --- /dev/null +++ b/apis/backend/ipam/v1alpha1/ipclaim_resource.go @@ -0,0 +1,80 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/kuidio/kuid/apis/backend/ipam" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +k8s:deepcopy-gen=false +var _ resource.Object = &IPClaim{} +var _ resource.ObjectList = &IPClaimList{} +var _ resource.MultiVersionObject = &IPClaim{} + +func (IPClaim) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: ipam.IPClaimPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (IPClaim) IsStorageVersion() bool { + return false +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (IPClaim) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *IPClaim) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// New return an empty resource +// New implements resource.Object +func (IPClaim) New() runtime.Object { + return &IPClaim{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (IPClaim) NewList() runtime.Object { + return &IPClaimList{} +} + +// GetListMeta returns the ListMeta +// GetListMeta implements resource.ObjectList +func (r *IPClaimList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// RegisterConversions registers the conversions. +// RegisterConversions implements resource.MultiVersionObject +func (IPClaim) RegisterConversions() func(s *runtime.Scheme) error { + return RegisterConversions +} diff --git a/apis/backend/ipam/v1alpha1/ipclaim_types.go b/apis/backend/ipam/v1alpha1/ipclaim_types.go new file mode 100644 index 0000000..83d88a3 --- /dev/null +++ b/apis/backend/ipam/v1alpha1/ipclaim_types.go @@ -0,0 +1,121 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "reflect" + + "github.com/henderiw/iputil" + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// IPClaimSpec defines the desired state of IPClaim +type IPClaimSpec struct { + // Index defines the index for the IP Entry + Index string `json:"index" yaml:"index" protobuf:"bytes,1,opt,name=index"` + // PrefixType defines the prefixtype of IPEntry; for address and range claims this is not relevant + // - network kind is used for physical, virtual nics on a device + // - pool kind is used for allocating dedicated IP addresses + // - aggregate kind is used for claiming an aggregate prefix; only used for networkInstance prefixes + // +kubebuilder:validation:Enum=`network`;`aggregate`;`pool`; + // +optional + PrefixType *IPPrefixType `json:"prefixType,omitempty" yaml:"prefixType,omitempty" protobuf:"bytes,2,opt,name=prefixType"` + // Prefix defines the prefix for the IP claim + // +optional + Prefix *string `json:"prefix,omitempty" yaml:"prefix,omitempty" protobuf:"bytes,3,opt,name=prefix"` + // Address defines the address for the IP claim + // +optional + Address *string `json:"address,omitempty" yaml:"address,omitempty" protobuf:"bytes,4,opt,name=address"` + // Range defines the range for the IP claim + // +optional + Range *string `json:"range,omitempty" yaml:"range,omitempty" protobuf:"bytes,5,opt,name=range"` + // DefaultGateway defines if the address acts as a default gateway + // +optional + DefaultGateway *bool `json:"defaultGateway,omitempty" yaml:"defaultGateway,omitempty" protobuf:"varint,6,opt,name=defaultGateway"` + // CreatePrefix defines if this prefix must be created. Only used for dynamic prefixes + // e.g. non /32 ipv4 and non /128 ipv6 prefixes + // +optional + CreatePrefix *bool `json:"createPrefix,omitempty" yaml:"createPrefix,omitempty" protobuf:"varint,7,opt,name=createPrefix"` + // PrefixLength defines the prefix length for the IP Claim, Must be set when CreatePrefic is set + // If not present we use assume /32 for ipv4 and /128 for ipv6 + // +optional + PrefixLength *uint32 `json:"prefixLength,omitempty" yaml:"prefixLength,omitempty" protobuf:"varint,8,opt,name=prefixLength"` + // AddressFamily defines the address family for the IP claim + // +kubebuilder:validation:Enum=`ipv4`;`ipv6` + // +kubebuilder:validation:Optional + // +optional + AddressFamily *iputil.AddressFamily `json:"addressFamily,omitempty" yaml:"addressFamily,omitempty" protobuf:"bytes,9,opt,name=addressFamily"` + // Index defines the index of the IP Claim, used to get a deterministic IP from a prefix + // If not present we claim a random prefix from a prefix + // +kubebuilder:validation:Optional + // +optional + Idx *uint32 `json:"idx,omitempty" yaml:"idx,omitempty" protobuf:"varint,10,opt,name=idx"` + // ClaimLabels define the user defined labels and selector labels used + // in resource claim + commonv1alpha1.ClaimLabels `json:",inline" yaml:",inline" protobuf:"bytes,11,opt,name=claimLabels"` +} + +// IPClaimStatus defines the observed state of IPClaim +type IPClaimStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` + // Range defines the range, claimed through the IPAM backend + // +optional + Range *string `json:"range,omitempty" yaml:"range,omitempty" protobuf:"bytes,2,opt,name=range"` + // Address defines the address, claimed through the IPAM backend + // +optional + Address *string `json:"address,omitempty" yaml:"address,omitempty" protobuf:"bytes,3,opt,name=address"` + // Prefix defines the prefix, claimed through the IPAM backend + // +optional + Prefix *string `json:"prefix,omitempty" yaml:"prefix,omitempty" protobuf:"bytes,4,opt,name=prefix"` + // DefaultGateway defines the default gateway IP for the claimed prefix + // DefaultGateway is only relevant for prefix kind = network + // +optional + DefaultGateway *string `json:"defaultGateway,omitempty" yaml:"defaultGateway,omitempty" protobuf:"bytes,5,opt,name=defaultGateway"` + // ExpiryTime defines when the claim expires + // +kubebuilder:validation:Optional + // +optional + ExpiryTime *string `json:"expiryTime,omitempty" yaml:"expiryTime,omitempty" protobuf:"bytes,6,opt,name=expiryTime"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// IPClaim is the Schema for the ipclaim API +type IPClaim struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec IPClaimSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status IPClaimStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// IPClaimList contains a list of IPClaims +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type IPClaimList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []IPClaim `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + IPClaimKind = reflect.TypeOf(IPClaim{}).Name() + IPClaimListKind = reflect.TypeOf(IPClaimList{}).Name() +) diff --git a/apis/backend/ipam/v1alpha1/ipentry_resource.go b/apis/backend/ipam/v1alpha1/ipentry_resource.go new file mode 100644 index 0000000..5a0f19c --- /dev/null +++ b/apis/backend/ipam/v1alpha1/ipentry_resource.go @@ -0,0 +1,80 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/kuidio/kuid/apis/backend/ipam" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +k8s:deepcopy-gen=false +var _ resource.Object = &IPEntry{} +var _ resource.ObjectList = &IPEntryList{} +var _ resource.MultiVersionObject = &IPEntry{} + +func (IPEntry) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: ipam.IPEntryPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (IPEntry) IsStorageVersion() bool { + return false +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (IPEntry) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *IPEntry) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// New return an empty resource +// New implements resource.Object +func (IPEntry) New() runtime.Object { + return &IPEntry{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (IPEntry) NewList() runtime.Object { + return &IPEntryList{} +} + +// GetListMeta returns the ListMeta +// GetListMeta implements resource.ObjectList +func (r *IPEntryList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// RegisterConversions registers the conversions. +// RegisterConversions implements resource.MultiVersionObject +func (IPEntry) RegisterConversions() func(s *runtime.Scheme) error { + return RegisterConversions +} diff --git a/apis/backend/ipam/v1alpha1/ipentry_types.go b/apis/backend/ipam/v1alpha1/ipentry_types.go new file mode 100644 index 0000000..d817173 --- /dev/null +++ b/apis/backend/ipam/v1alpha1/ipentry_types.go @@ -0,0 +1,88 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "reflect" + + "github.com/henderiw/iputil" + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// IPEntrySpec defines the desired state of IPEntry +type IPEntrySpec struct { + // Index defines the index for the IP Entry + Index string `json:"index" yaml:"index" protobuf:"bytes,1,opt,name=index"` + // IndexEntry identifies if the entry is originated from an IP Index + IndexEntry bool `json:"indexEntry" yaml:"indexEntry" protobuf:"bytes,2,opt,name=indexEntry"` + // PrefixType defines the prefixtype of IPEntry; for address and range claims this is not relevant + // - network kind is used for physical, virtual nics on a device + // - pool kind is used for allocating dedicated IP addresses + // - aggregate kind is used for claiming an aggregate prefix; only used for networkInstance prefixes + // +kubebuilder:validation:Enum=`network`;`aggregate`;`pool`; + // +optional + PrefixType *IPPrefixType `json:"prefixType,omitempty" yaml:"prefixType,omitempty" protobuf:"bytes,3,opt,name=prefixType"` + // ClaimType defines the claimType of the IP Entry + // +kubebuilder:validation:Enum=`staticAddress`;`staticPrefix`;`staticRange`;`dynamicPrefix`;`dynamicAddress`; + ClaimType IPClaimType `json:"claimType,omitempty" yaml:"claimType,omitempty" protobuf:"bytes,4,opt,name=claimType"` + // Prefix defines the prefix for the IP entry; which can be an expanded prefix from the prefix, range or address + Prefix string `json:"prefix" yaml:"prefix" protobuf:"bytes,5,opt,name=prefix"` + // DefaultGateway defines if the address acts as a default gateway + // +optional + DefaultGateway *bool `json:"defaultGateway,omitempty" yaml:"defaultGateway,omitempty" protobuf:"varint,6,opt,name=defaultGateway"` + // AddressFamily defines the address family for the IP claim + // +kubebuilder:validation:Enum=`ipv4`;`ipv6` + // +kubebuilder:validation:Optional + // +optional + AddressFamily *iputil.AddressFamily `json:"addressFamily,omitempty" yaml:"addressFamily,omitempty" protobuf:"bytes,7,opt,name=addressFamily"` + // UserDefinedLabels define the user defined labels + commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,8,opt,name=userDefinedLabels"` +} + +// IPEntryStatus defines the observed state of IPEntry +type IPEntryStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// IPEntry is the Schema for the ipentry API +type IPEntry struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec IPEntrySpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status IPEntryStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// IPEntryList contains a list of IPEntries +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type IPEntryList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []IPEntry `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + IPEntryKind = reflect.TypeOf(IPEntry{}).Name() + IPEntryListKind = reflect.TypeOf(IPEntryList{}).Name() +) diff --git a/apis/backend/ipam/v1alpha1/ipindex_resource.go b/apis/backend/ipam/v1alpha1/ipindex_resource.go new file mode 100644 index 0000000..dd5b9f3 --- /dev/null +++ b/apis/backend/ipam/v1alpha1/ipindex_resource.go @@ -0,0 +1,80 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/kuidio/kuid/apis/backend/ipam" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +k8s:deepcopy-gen=false +var _ resource.Object = &IPIndex{} +var _ resource.ObjectList = &IPIndexList{} +var _ resource.MultiVersionObject = &IPIndex{} + +func (IPIndex) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: ipam.IPIndexPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (IPIndex) IsStorageVersion() bool { + return false +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (IPIndex) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *IPIndex) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// New return an empty resource +// New implements resource.Object +func (IPIndex) New() runtime.Object { + return &IPIndex{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (IPIndex) NewList() runtime.Object { + return &IPIndexList{} +} + +// GetListMeta returns the ListMeta +// GetListMeta implements resource.ObjectList +func (r *IPIndexList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// RegisterConversions registers the conversions. +// RegisterConversions implements resource.MultiVersionObject +func (IPIndex) RegisterConversions() func(s *runtime.Scheme) error { + return RegisterConversions +} diff --git a/apis/backend/ipam/v1alpha1/ipindex_types.go b/apis/backend/ipam/v1alpha1/ipindex_types.go new file mode 100644 index 0000000..a2d5cce --- /dev/null +++ b/apis/backend/ipam/v1alpha1/ipindex_types.go @@ -0,0 +1,83 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "reflect" + + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// IPIndexSpec defines the desired state of IPIndex +type IPIndexSpec struct { + // Prefixes define the aggregate prefixes for the network instance + // A Network instance needs at least 1 prefix to be defined to become operational + Prefixes []Prefix `json:"prefixes" yaml:"prefixes" protobuf:"bytes,1,opt,name=prefixes"` +} + +type Prefix struct { + // Prefix defines the ip cidr in prefix notation. + // +kubebuilder:validation:Pattern=`(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))|((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))` + Prefix string `json:"prefix" yaml:"prefix" protobuf:"bytes,1,opt,name=prefix"` + // PrefixType defines the prefixtype of IPIndex; + // - network kind is used for physical, virtual nics on a device + // - pool kind is used for allocating dedicated IP addresses + // - aggregate kind is used for claiming an aggregate prefix; only used for networkInstance prefixes + // +kubebuilder:validation:Enum=network;aggregate;pool; + // +kubebuilder:default:=aggregate + // +optional + PrefixType *IPPrefixType `json:"prefixType,omitempty" yaml:"prefixType,omitempty" protobuf:"bytes,2,opt,name=prefixType"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,2,opt,name=userDefinedLabels"` +} + +// IPIndexStatus defines the observed state of IPIndex +type IPIndexStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` + // Prefixes defines the prefixes, claimed through the IPAM backend + Prefixes []Prefix `json:"prefixes,omitempty" yaml:"prefixes,omitempty" protobuf:"bytes,2,rep,name=prefixes"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// IPIndex is the Schema for the IPIndex API +type IPIndex struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec IPIndexSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status IPIndexStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// IPIndexList contains a list of IPIndexs +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type IPIndexList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []IPIndex `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + IPIndexKind = reflect.TypeOf(IPIndex{}).Name() + IPIndexListKind = reflect.TypeOf(IPIndexList{}).Name() +) diff --git a/apis/backend/ipam/v1alpha1/register.go b/apis/backend/ipam/v1alpha1/register.go new file mode 100644 index 0000000..b2dcdc5 --- /dev/null +++ b/apis/backend/ipam/v1alpha1/register.go @@ -0,0 +1,67 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +const ( + Group = "ipam.be.kuid.dev" + Version = "v1alpha1" +) + +var ( + // SchemeGroupVersion contains the API group and version information for the types in this package. + SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version} + // AddToScheme applies all the stored functions to the scheme. A non-nil error + // indicates that one function failed and the attempt was abandoned. + //AddToScheme = (&runtime.SchemeBuilder{}).AddToScheme + AddToScheme = localSchemeBuilder.AddToScheme + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + schemeBuilder runtime.SchemeBuilder + localSchemeBuilder = &schemeBuilder +) + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +func init() { + localSchemeBuilder.Register(addKnownTypes) +} + +// Adds the list of known types to the given scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + // +kubebuilder:scaffold:install + + scheme.AddKnownTypes(SchemeGroupVersion, + &IPIndex{}, + &IPIndexList{}, + &IPClaim{}, + &IPClaimList{}, + &IPEntry{}, + &IPEntryList{}, + ) + + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/apis/backend/ipam/v1alpha1/zz_generated.conversion.go b/apis/backend/ipam/v1alpha1/zz_generated.conversion.go new file mode 100644 index 0000000..70ef382 --- /dev/null +++ b/apis/backend/ipam/v1alpha1/zz_generated.conversion.go @@ -0,0 +1,647 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2024 Nokia. + +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 conversion-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + unsafe "unsafe" + + iputil "github.com/henderiw/iputil" + asv1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" + ipam "github.com/kuidio/kuid/apis/backend/ipam" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +func init() { + localSchemeBuilder.Register(RegisterConversions) +} + +// RegisterConversions adds conversion functions to the given scheme. +// Public to allow building arbitrary schemes. +func RegisterConversions(s *runtime.Scheme) error { + if err := s.AddGeneratedConversionFunc((*IPClaim)(nil), (*ipam.IPClaim)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_IPClaim_To_ipam_IPClaim(a.(*IPClaim), b.(*ipam.IPClaim), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ipam.IPClaim)(nil), (*IPClaim)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_ipam_IPClaim_To_v1alpha1_IPClaim(a.(*ipam.IPClaim), b.(*IPClaim), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*IPClaimList)(nil), (*ipam.IPClaimList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_IPClaimList_To_ipam_IPClaimList(a.(*IPClaimList), b.(*ipam.IPClaimList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ipam.IPClaimList)(nil), (*IPClaimList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_ipam_IPClaimList_To_v1alpha1_IPClaimList(a.(*ipam.IPClaimList), b.(*IPClaimList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*IPClaimSpec)(nil), (*ipam.IPClaimSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_IPClaimSpec_To_ipam_IPClaimSpec(a.(*IPClaimSpec), b.(*ipam.IPClaimSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ipam.IPClaimSpec)(nil), (*IPClaimSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_ipam_IPClaimSpec_To_v1alpha1_IPClaimSpec(a.(*ipam.IPClaimSpec), b.(*IPClaimSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*IPClaimStatus)(nil), (*ipam.IPClaimStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_IPClaimStatus_To_ipam_IPClaimStatus(a.(*IPClaimStatus), b.(*ipam.IPClaimStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ipam.IPClaimStatus)(nil), (*IPClaimStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_ipam_IPClaimStatus_To_v1alpha1_IPClaimStatus(a.(*ipam.IPClaimStatus), b.(*IPClaimStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*IPEntry)(nil), (*ipam.IPEntry)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_IPEntry_To_ipam_IPEntry(a.(*IPEntry), b.(*ipam.IPEntry), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ipam.IPEntry)(nil), (*IPEntry)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_ipam_IPEntry_To_v1alpha1_IPEntry(a.(*ipam.IPEntry), b.(*IPEntry), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*IPEntryList)(nil), (*ipam.IPEntryList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_IPEntryList_To_ipam_IPEntryList(a.(*IPEntryList), b.(*ipam.IPEntryList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ipam.IPEntryList)(nil), (*IPEntryList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_ipam_IPEntryList_To_v1alpha1_IPEntryList(a.(*ipam.IPEntryList), b.(*IPEntryList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*IPEntrySpec)(nil), (*ipam.IPEntrySpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_IPEntrySpec_To_ipam_IPEntrySpec(a.(*IPEntrySpec), b.(*ipam.IPEntrySpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ipam.IPEntrySpec)(nil), (*IPEntrySpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_ipam_IPEntrySpec_To_v1alpha1_IPEntrySpec(a.(*ipam.IPEntrySpec), b.(*IPEntrySpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*IPEntryStatus)(nil), (*ipam.IPEntryStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_IPEntryStatus_To_ipam_IPEntryStatus(a.(*IPEntryStatus), b.(*ipam.IPEntryStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ipam.IPEntryStatus)(nil), (*IPEntryStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_ipam_IPEntryStatus_To_v1alpha1_IPEntryStatus(a.(*ipam.IPEntryStatus), b.(*IPEntryStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*IPIndex)(nil), (*ipam.IPIndex)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_IPIndex_To_ipam_IPIndex(a.(*IPIndex), b.(*ipam.IPIndex), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ipam.IPIndex)(nil), (*IPIndex)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_ipam_IPIndex_To_v1alpha1_IPIndex(a.(*ipam.IPIndex), b.(*IPIndex), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*IPIndexList)(nil), (*ipam.IPIndexList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_IPIndexList_To_ipam_IPIndexList(a.(*IPIndexList), b.(*ipam.IPIndexList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ipam.IPIndexList)(nil), (*IPIndexList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_ipam_IPIndexList_To_v1alpha1_IPIndexList(a.(*ipam.IPIndexList), b.(*IPIndexList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*IPIndexSpec)(nil), (*ipam.IPIndexSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_IPIndexSpec_To_ipam_IPIndexSpec(a.(*IPIndexSpec), b.(*ipam.IPIndexSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ipam.IPIndexSpec)(nil), (*IPIndexSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_ipam_IPIndexSpec_To_v1alpha1_IPIndexSpec(a.(*ipam.IPIndexSpec), b.(*IPIndexSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*IPIndexStatus)(nil), (*ipam.IPIndexStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_IPIndexStatus_To_ipam_IPIndexStatus(a.(*IPIndexStatus), b.(*ipam.IPIndexStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ipam.IPIndexStatus)(nil), (*IPIndexStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_ipam_IPIndexStatus_To_v1alpha1_IPIndexStatus(a.(*ipam.IPIndexStatus), b.(*IPIndexStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Prefix)(nil), (*ipam.Prefix)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Prefix_To_ipam_Prefix(a.(*Prefix), b.(*ipam.Prefix), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ipam.Prefix)(nil), (*Prefix)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_ipam_Prefix_To_v1alpha1_Prefix(a.(*ipam.Prefix), b.(*Prefix), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1alpha1_IPClaim_To_ipam_IPClaim(in *IPClaim, out *ipam.IPClaim, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_IPClaimSpec_To_ipam_IPClaimSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_IPClaimStatus_To_ipam_IPClaimStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_IPClaim_To_ipam_IPClaim is an autogenerated conversion function. +func Convert_v1alpha1_IPClaim_To_ipam_IPClaim(in *IPClaim, out *ipam.IPClaim, s conversion.Scope) error { + return autoConvert_v1alpha1_IPClaim_To_ipam_IPClaim(in, out, s) +} + +func autoConvert_ipam_IPClaim_To_v1alpha1_IPClaim(in *ipam.IPClaim, out *IPClaim, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_ipam_IPClaimSpec_To_v1alpha1_IPClaimSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_ipam_IPClaimStatus_To_v1alpha1_IPClaimStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_ipam_IPClaim_To_v1alpha1_IPClaim is an autogenerated conversion function. +func Convert_ipam_IPClaim_To_v1alpha1_IPClaim(in *ipam.IPClaim, out *IPClaim, s conversion.Scope) error { + return autoConvert_ipam_IPClaim_To_v1alpha1_IPClaim(in, out, s) +} + +func autoConvert_v1alpha1_IPClaimList_To_ipam_IPClaimList(in *IPClaimList, out *ipam.IPClaimList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ipam.IPClaim, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_IPClaim_To_ipam_IPClaim(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_IPClaimList_To_ipam_IPClaimList is an autogenerated conversion function. +func Convert_v1alpha1_IPClaimList_To_ipam_IPClaimList(in *IPClaimList, out *ipam.IPClaimList, s conversion.Scope) error { + return autoConvert_v1alpha1_IPClaimList_To_ipam_IPClaimList(in, out, s) +} + +func autoConvert_ipam_IPClaimList_To_v1alpha1_IPClaimList(in *ipam.IPClaimList, out *IPClaimList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]IPClaim, len(*in)) + for i := range *in { + if err := Convert_ipam_IPClaim_To_v1alpha1_IPClaim(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_ipam_IPClaimList_To_v1alpha1_IPClaimList is an autogenerated conversion function. +func Convert_ipam_IPClaimList_To_v1alpha1_IPClaimList(in *ipam.IPClaimList, out *IPClaimList, s conversion.Scope) error { + return autoConvert_ipam_IPClaimList_To_v1alpha1_IPClaimList(in, out, s) +} + +func autoConvert_v1alpha1_IPClaimSpec_To_ipam_IPClaimSpec(in *IPClaimSpec, out *ipam.IPClaimSpec, s conversion.Scope) error { + out.Index = in.Index + out.PrefixType = (*ipam.IPPrefixType)(unsafe.Pointer(in.PrefixType)) + out.Prefix = (*string)(unsafe.Pointer(in.Prefix)) + out.Address = (*string)(unsafe.Pointer(in.Address)) + out.Range = (*string)(unsafe.Pointer(in.Range)) + out.DefaultGateway = (*bool)(unsafe.Pointer(in.DefaultGateway)) + out.CreatePrefix = (*bool)(unsafe.Pointer(in.CreatePrefix)) + out.PrefixLength = (*uint32)(unsafe.Pointer(in.PrefixLength)) + out.AddressFamily = (*iputil.AddressFamily)(unsafe.Pointer(in.AddressFamily)) + out.Idx = (*uint32)(unsafe.Pointer(in.Idx)) + if err := asv1alpha1.Convert_v1alpha1_ClaimLabels_To_common_ClaimLabels(&in.ClaimLabels, &out.ClaimLabels, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_IPClaimSpec_To_ipam_IPClaimSpec is an autogenerated conversion function. +func Convert_v1alpha1_IPClaimSpec_To_ipam_IPClaimSpec(in *IPClaimSpec, out *ipam.IPClaimSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_IPClaimSpec_To_ipam_IPClaimSpec(in, out, s) +} + +func autoConvert_ipam_IPClaimSpec_To_v1alpha1_IPClaimSpec(in *ipam.IPClaimSpec, out *IPClaimSpec, s conversion.Scope) error { + out.Index = in.Index + out.PrefixType = (*IPPrefixType)(unsafe.Pointer(in.PrefixType)) + out.Prefix = (*string)(unsafe.Pointer(in.Prefix)) + out.Address = (*string)(unsafe.Pointer(in.Address)) + out.Range = (*string)(unsafe.Pointer(in.Range)) + out.DefaultGateway = (*bool)(unsafe.Pointer(in.DefaultGateway)) + out.CreatePrefix = (*bool)(unsafe.Pointer(in.CreatePrefix)) + out.PrefixLength = (*uint32)(unsafe.Pointer(in.PrefixLength)) + out.AddressFamily = (*iputil.AddressFamily)(unsafe.Pointer(in.AddressFamily)) + out.Idx = (*uint32)(unsafe.Pointer(in.Idx)) + if err := asv1alpha1.Convert_common_ClaimLabels_To_v1alpha1_ClaimLabels(&in.ClaimLabels, &out.ClaimLabels, s); err != nil { + return err + } + return nil +} + +// Convert_ipam_IPClaimSpec_To_v1alpha1_IPClaimSpec is an autogenerated conversion function. +func Convert_ipam_IPClaimSpec_To_v1alpha1_IPClaimSpec(in *ipam.IPClaimSpec, out *IPClaimSpec, s conversion.Scope) error { + return autoConvert_ipam_IPClaimSpec_To_v1alpha1_IPClaimSpec(in, out, s) +} + +func autoConvert_v1alpha1_IPClaimStatus_To_ipam_IPClaimStatus(in *IPClaimStatus, out *ipam.IPClaimStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + out.Range = (*string)(unsafe.Pointer(in.Range)) + out.Address = (*string)(unsafe.Pointer(in.Address)) + out.Prefix = (*string)(unsafe.Pointer(in.Prefix)) + out.DefaultGateway = (*string)(unsafe.Pointer(in.DefaultGateway)) + out.ExpiryTime = (*string)(unsafe.Pointer(in.ExpiryTime)) + return nil +} + +// Convert_v1alpha1_IPClaimStatus_To_ipam_IPClaimStatus is an autogenerated conversion function. +func Convert_v1alpha1_IPClaimStatus_To_ipam_IPClaimStatus(in *IPClaimStatus, out *ipam.IPClaimStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_IPClaimStatus_To_ipam_IPClaimStatus(in, out, s) +} + +func autoConvert_ipam_IPClaimStatus_To_v1alpha1_IPClaimStatus(in *ipam.IPClaimStatus, out *IPClaimStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + out.Range = (*string)(unsafe.Pointer(in.Range)) + out.Address = (*string)(unsafe.Pointer(in.Address)) + out.Prefix = (*string)(unsafe.Pointer(in.Prefix)) + out.DefaultGateway = (*string)(unsafe.Pointer(in.DefaultGateway)) + out.ExpiryTime = (*string)(unsafe.Pointer(in.ExpiryTime)) + return nil +} + +// Convert_ipam_IPClaimStatus_To_v1alpha1_IPClaimStatus is an autogenerated conversion function. +func Convert_ipam_IPClaimStatus_To_v1alpha1_IPClaimStatus(in *ipam.IPClaimStatus, out *IPClaimStatus, s conversion.Scope) error { + return autoConvert_ipam_IPClaimStatus_To_v1alpha1_IPClaimStatus(in, out, s) +} + +func autoConvert_v1alpha1_IPEntry_To_ipam_IPEntry(in *IPEntry, out *ipam.IPEntry, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_IPEntrySpec_To_ipam_IPEntrySpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_IPEntryStatus_To_ipam_IPEntryStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_IPEntry_To_ipam_IPEntry is an autogenerated conversion function. +func Convert_v1alpha1_IPEntry_To_ipam_IPEntry(in *IPEntry, out *ipam.IPEntry, s conversion.Scope) error { + return autoConvert_v1alpha1_IPEntry_To_ipam_IPEntry(in, out, s) +} + +func autoConvert_ipam_IPEntry_To_v1alpha1_IPEntry(in *ipam.IPEntry, out *IPEntry, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_ipam_IPEntrySpec_To_v1alpha1_IPEntrySpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_ipam_IPEntryStatus_To_v1alpha1_IPEntryStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_ipam_IPEntry_To_v1alpha1_IPEntry is an autogenerated conversion function. +func Convert_ipam_IPEntry_To_v1alpha1_IPEntry(in *ipam.IPEntry, out *IPEntry, s conversion.Scope) error { + return autoConvert_ipam_IPEntry_To_v1alpha1_IPEntry(in, out, s) +} + +func autoConvert_v1alpha1_IPEntryList_To_ipam_IPEntryList(in *IPEntryList, out *ipam.IPEntryList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ipam.IPEntry, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_IPEntry_To_ipam_IPEntry(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_IPEntryList_To_ipam_IPEntryList is an autogenerated conversion function. +func Convert_v1alpha1_IPEntryList_To_ipam_IPEntryList(in *IPEntryList, out *ipam.IPEntryList, s conversion.Scope) error { + return autoConvert_v1alpha1_IPEntryList_To_ipam_IPEntryList(in, out, s) +} + +func autoConvert_ipam_IPEntryList_To_v1alpha1_IPEntryList(in *ipam.IPEntryList, out *IPEntryList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]IPEntry, len(*in)) + for i := range *in { + if err := Convert_ipam_IPEntry_To_v1alpha1_IPEntry(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_ipam_IPEntryList_To_v1alpha1_IPEntryList is an autogenerated conversion function. +func Convert_ipam_IPEntryList_To_v1alpha1_IPEntryList(in *ipam.IPEntryList, out *IPEntryList, s conversion.Scope) error { + return autoConvert_ipam_IPEntryList_To_v1alpha1_IPEntryList(in, out, s) +} + +func autoConvert_v1alpha1_IPEntrySpec_To_ipam_IPEntrySpec(in *IPEntrySpec, out *ipam.IPEntrySpec, s conversion.Scope) error { + out.Index = in.Index + out.IndexEntry = in.IndexEntry + out.PrefixType = (*ipam.IPPrefixType)(unsafe.Pointer(in.PrefixType)) + out.ClaimType = ipam.IPClaimType(in.ClaimType) + out.Prefix = in.Prefix + out.DefaultGateway = (*bool)(unsafe.Pointer(in.DefaultGateway)) + out.AddressFamily = (*iputil.AddressFamily)(unsafe.Pointer(in.AddressFamily)) + if err := asv1alpha1.Convert_v1alpha1_UserDefinedLabels_To_common_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_IPEntrySpec_To_ipam_IPEntrySpec is an autogenerated conversion function. +func Convert_v1alpha1_IPEntrySpec_To_ipam_IPEntrySpec(in *IPEntrySpec, out *ipam.IPEntrySpec, s conversion.Scope) error { + return autoConvert_v1alpha1_IPEntrySpec_To_ipam_IPEntrySpec(in, out, s) +} + +func autoConvert_ipam_IPEntrySpec_To_v1alpha1_IPEntrySpec(in *ipam.IPEntrySpec, out *IPEntrySpec, s conversion.Scope) error { + out.Index = in.Index + out.IndexEntry = in.IndexEntry + out.PrefixType = (*IPPrefixType)(unsafe.Pointer(in.PrefixType)) + out.ClaimType = IPClaimType(in.ClaimType) + out.Prefix = in.Prefix + out.DefaultGateway = (*bool)(unsafe.Pointer(in.DefaultGateway)) + out.AddressFamily = (*iputil.AddressFamily)(unsafe.Pointer(in.AddressFamily)) + if err := asv1alpha1.Convert_common_UserDefinedLabels_To_v1alpha1_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_ipam_IPEntrySpec_To_v1alpha1_IPEntrySpec is an autogenerated conversion function. +func Convert_ipam_IPEntrySpec_To_v1alpha1_IPEntrySpec(in *ipam.IPEntrySpec, out *IPEntrySpec, s conversion.Scope) error { + return autoConvert_ipam_IPEntrySpec_To_v1alpha1_IPEntrySpec(in, out, s) +} + +func autoConvert_v1alpha1_IPEntryStatus_To_ipam_IPEntryStatus(in *IPEntryStatus, out *ipam.IPEntryStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_IPEntryStatus_To_ipam_IPEntryStatus is an autogenerated conversion function. +func Convert_v1alpha1_IPEntryStatus_To_ipam_IPEntryStatus(in *IPEntryStatus, out *ipam.IPEntryStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_IPEntryStatus_To_ipam_IPEntryStatus(in, out, s) +} + +func autoConvert_ipam_IPEntryStatus_To_v1alpha1_IPEntryStatus(in *ipam.IPEntryStatus, out *IPEntryStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_ipam_IPEntryStatus_To_v1alpha1_IPEntryStatus is an autogenerated conversion function. +func Convert_ipam_IPEntryStatus_To_v1alpha1_IPEntryStatus(in *ipam.IPEntryStatus, out *IPEntryStatus, s conversion.Scope) error { + return autoConvert_ipam_IPEntryStatus_To_v1alpha1_IPEntryStatus(in, out, s) +} + +func autoConvert_v1alpha1_IPIndex_To_ipam_IPIndex(in *IPIndex, out *ipam.IPIndex, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_IPIndexSpec_To_ipam_IPIndexSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_IPIndexStatus_To_ipam_IPIndexStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_IPIndex_To_ipam_IPIndex is an autogenerated conversion function. +func Convert_v1alpha1_IPIndex_To_ipam_IPIndex(in *IPIndex, out *ipam.IPIndex, s conversion.Scope) error { + return autoConvert_v1alpha1_IPIndex_To_ipam_IPIndex(in, out, s) +} + +func autoConvert_ipam_IPIndex_To_v1alpha1_IPIndex(in *ipam.IPIndex, out *IPIndex, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_ipam_IPIndexSpec_To_v1alpha1_IPIndexSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_ipam_IPIndexStatus_To_v1alpha1_IPIndexStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_ipam_IPIndex_To_v1alpha1_IPIndex is an autogenerated conversion function. +func Convert_ipam_IPIndex_To_v1alpha1_IPIndex(in *ipam.IPIndex, out *IPIndex, s conversion.Scope) error { + return autoConvert_ipam_IPIndex_To_v1alpha1_IPIndex(in, out, s) +} + +func autoConvert_v1alpha1_IPIndexList_To_ipam_IPIndexList(in *IPIndexList, out *ipam.IPIndexList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ipam.IPIndex, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_IPIndex_To_ipam_IPIndex(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_IPIndexList_To_ipam_IPIndexList is an autogenerated conversion function. +func Convert_v1alpha1_IPIndexList_To_ipam_IPIndexList(in *IPIndexList, out *ipam.IPIndexList, s conversion.Scope) error { + return autoConvert_v1alpha1_IPIndexList_To_ipam_IPIndexList(in, out, s) +} + +func autoConvert_ipam_IPIndexList_To_v1alpha1_IPIndexList(in *ipam.IPIndexList, out *IPIndexList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]IPIndex, len(*in)) + for i := range *in { + if err := Convert_ipam_IPIndex_To_v1alpha1_IPIndex(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_ipam_IPIndexList_To_v1alpha1_IPIndexList is an autogenerated conversion function. +func Convert_ipam_IPIndexList_To_v1alpha1_IPIndexList(in *ipam.IPIndexList, out *IPIndexList, s conversion.Scope) error { + return autoConvert_ipam_IPIndexList_To_v1alpha1_IPIndexList(in, out, s) +} + +func autoConvert_v1alpha1_IPIndexSpec_To_ipam_IPIndexSpec(in *IPIndexSpec, out *ipam.IPIndexSpec, s conversion.Scope) error { + if in.Prefixes != nil { + in, out := &in.Prefixes, &out.Prefixes + *out = make([]ipam.Prefix, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_Prefix_To_ipam_Prefix(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Prefixes = nil + } + return nil +} + +// Convert_v1alpha1_IPIndexSpec_To_ipam_IPIndexSpec is an autogenerated conversion function. +func Convert_v1alpha1_IPIndexSpec_To_ipam_IPIndexSpec(in *IPIndexSpec, out *ipam.IPIndexSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_IPIndexSpec_To_ipam_IPIndexSpec(in, out, s) +} + +func autoConvert_ipam_IPIndexSpec_To_v1alpha1_IPIndexSpec(in *ipam.IPIndexSpec, out *IPIndexSpec, s conversion.Scope) error { + if in.Prefixes != nil { + in, out := &in.Prefixes, &out.Prefixes + *out = make([]Prefix, len(*in)) + for i := range *in { + if err := Convert_ipam_Prefix_To_v1alpha1_Prefix(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Prefixes = nil + } + return nil +} + +// Convert_ipam_IPIndexSpec_To_v1alpha1_IPIndexSpec is an autogenerated conversion function. +func Convert_ipam_IPIndexSpec_To_v1alpha1_IPIndexSpec(in *ipam.IPIndexSpec, out *IPIndexSpec, s conversion.Scope) error { + return autoConvert_ipam_IPIndexSpec_To_v1alpha1_IPIndexSpec(in, out, s) +} + +func autoConvert_v1alpha1_IPIndexStatus_To_ipam_IPIndexStatus(in *IPIndexStatus, out *ipam.IPIndexStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + if in.Prefixes != nil { + in, out := &in.Prefixes, &out.Prefixes + *out = make([]ipam.Prefix, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_Prefix_To_ipam_Prefix(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Prefixes = nil + } + return nil +} + +// Convert_v1alpha1_IPIndexStatus_To_ipam_IPIndexStatus is an autogenerated conversion function. +func Convert_v1alpha1_IPIndexStatus_To_ipam_IPIndexStatus(in *IPIndexStatus, out *ipam.IPIndexStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_IPIndexStatus_To_ipam_IPIndexStatus(in, out, s) +} + +func autoConvert_ipam_IPIndexStatus_To_v1alpha1_IPIndexStatus(in *ipam.IPIndexStatus, out *IPIndexStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + if in.Prefixes != nil { + in, out := &in.Prefixes, &out.Prefixes + *out = make([]Prefix, len(*in)) + for i := range *in { + if err := Convert_ipam_Prefix_To_v1alpha1_Prefix(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Prefixes = nil + } + return nil +} + +// Convert_ipam_IPIndexStatus_To_v1alpha1_IPIndexStatus is an autogenerated conversion function. +func Convert_ipam_IPIndexStatus_To_v1alpha1_IPIndexStatus(in *ipam.IPIndexStatus, out *IPIndexStatus, s conversion.Scope) error { + return autoConvert_ipam_IPIndexStatus_To_v1alpha1_IPIndexStatus(in, out, s) +} + +func autoConvert_v1alpha1_Prefix_To_ipam_Prefix(in *Prefix, out *ipam.Prefix, s conversion.Scope) error { + out.Prefix = in.Prefix + out.PrefixType = (*ipam.IPPrefixType)(unsafe.Pointer(in.PrefixType)) + if err := asv1alpha1.Convert_v1alpha1_UserDefinedLabels_To_common_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_Prefix_To_ipam_Prefix is an autogenerated conversion function. +func Convert_v1alpha1_Prefix_To_ipam_Prefix(in *Prefix, out *ipam.Prefix, s conversion.Scope) error { + return autoConvert_v1alpha1_Prefix_To_ipam_Prefix(in, out, s) +} + +func autoConvert_ipam_Prefix_To_v1alpha1_Prefix(in *ipam.Prefix, out *Prefix, s conversion.Scope) error { + out.Prefix = in.Prefix + out.PrefixType = (*IPPrefixType)(unsafe.Pointer(in.PrefixType)) + if err := asv1alpha1.Convert_common_UserDefinedLabels_To_v1alpha1_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_ipam_Prefix_To_v1alpha1_Prefix is an autogenerated conversion function. +func Convert_ipam_Prefix_To_v1alpha1_Prefix(in *ipam.Prefix, out *Prefix, s conversion.Scope) error { + return autoConvert_ipam_Prefix_To_v1alpha1_Prefix(in, out, s) +} diff --git a/apis/backend/ipam/v1alpha1/zz_generated.deepcopy.go b/apis/backend/ipam/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 0000000..a842a07 --- /dev/null +++ b/apis/backend/ipam/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,431 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + iputil "github.com/henderiw/iputil" + 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 *IPClaim) DeepCopyInto(out *IPClaim) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPClaim. +func (in *IPClaim) DeepCopy() *IPClaim { + if in == nil { + return nil + } + out := new(IPClaim) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *IPClaim) 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 *IPClaimList) DeepCopyInto(out *IPClaimList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]IPClaim, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPClaimList. +func (in *IPClaimList) DeepCopy() *IPClaimList { + if in == nil { + return nil + } + out := new(IPClaimList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *IPClaimList) 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 *IPClaimSpec) DeepCopyInto(out *IPClaimSpec) { + *out = *in + if in.PrefixType != nil { + in, out := &in.PrefixType, &out.PrefixType + *out = new(IPPrefixType) + **out = **in + } + if in.Prefix != nil { + in, out := &in.Prefix, &out.Prefix + *out = new(string) + **out = **in + } + if in.Address != nil { + in, out := &in.Address, &out.Address + *out = new(string) + **out = **in + } + if in.Range != nil { + in, out := &in.Range, &out.Range + *out = new(string) + **out = **in + } + if in.DefaultGateway != nil { + in, out := &in.DefaultGateway, &out.DefaultGateway + *out = new(bool) + **out = **in + } + if in.CreatePrefix != nil { + in, out := &in.CreatePrefix, &out.CreatePrefix + *out = new(bool) + **out = **in + } + if in.PrefixLength != nil { + in, out := &in.PrefixLength, &out.PrefixLength + *out = new(uint32) + **out = **in + } + if in.AddressFamily != nil { + in, out := &in.AddressFamily, &out.AddressFamily + *out = new(iputil.AddressFamily) + **out = **in + } + if in.Idx != nil { + in, out := &in.Idx, &out.Idx + *out = new(uint32) + **out = **in + } + in.ClaimLabels.DeepCopyInto(&out.ClaimLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPClaimSpec. +func (in *IPClaimSpec) DeepCopy() *IPClaimSpec { + if in == nil { + return nil + } + out := new(IPClaimSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPClaimStatus) DeepCopyInto(out *IPClaimStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + if in.Range != nil { + in, out := &in.Range, &out.Range + *out = new(string) + **out = **in + } + if in.Address != nil { + in, out := &in.Address, &out.Address + *out = new(string) + **out = **in + } + if in.Prefix != nil { + in, out := &in.Prefix, &out.Prefix + *out = new(string) + **out = **in + } + if in.DefaultGateway != nil { + in, out := &in.DefaultGateway, &out.DefaultGateway + *out = new(string) + **out = **in + } + if in.ExpiryTime != nil { + in, out := &in.ExpiryTime, &out.ExpiryTime + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPClaimStatus. +func (in *IPClaimStatus) DeepCopy() *IPClaimStatus { + if in == nil { + return nil + } + out := new(IPClaimStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPEntry) DeepCopyInto(out *IPEntry) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPEntry. +func (in *IPEntry) DeepCopy() *IPEntry { + if in == nil { + return nil + } + out := new(IPEntry) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *IPEntry) 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 *IPEntryList) DeepCopyInto(out *IPEntryList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]IPEntry, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPEntryList. +func (in *IPEntryList) DeepCopy() *IPEntryList { + if in == nil { + return nil + } + out := new(IPEntryList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *IPEntryList) 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 *IPEntrySpec) DeepCopyInto(out *IPEntrySpec) { + *out = *in + if in.PrefixType != nil { + in, out := &in.PrefixType, &out.PrefixType + *out = new(IPPrefixType) + **out = **in + } + if in.DefaultGateway != nil { + in, out := &in.DefaultGateway, &out.DefaultGateway + *out = new(bool) + **out = **in + } + if in.AddressFamily != nil { + in, out := &in.AddressFamily, &out.AddressFamily + *out = new(iputil.AddressFamily) + **out = **in + } + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPEntrySpec. +func (in *IPEntrySpec) DeepCopy() *IPEntrySpec { + if in == nil { + return nil + } + out := new(IPEntrySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPEntryStatus) DeepCopyInto(out *IPEntryStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPEntryStatus. +func (in *IPEntryStatus) DeepCopy() *IPEntryStatus { + if in == nil { + return nil + } + out := new(IPEntryStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPIndex) DeepCopyInto(out *IPIndex) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPIndex. +func (in *IPIndex) DeepCopy() *IPIndex { + if in == nil { + return nil + } + out := new(IPIndex) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *IPIndex) 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 *IPIndexList) DeepCopyInto(out *IPIndexList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]IPIndex, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPIndexList. +func (in *IPIndexList) DeepCopy() *IPIndexList { + if in == nil { + return nil + } + out := new(IPIndexList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *IPIndexList) 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 *IPIndexSpec) DeepCopyInto(out *IPIndexSpec) { + *out = *in + if in.Prefixes != nil { + in, out := &in.Prefixes, &out.Prefixes + *out = make([]Prefix, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPIndexSpec. +func (in *IPIndexSpec) DeepCopy() *IPIndexSpec { + if in == nil { + return nil + } + out := new(IPIndexSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPIndexStatus) DeepCopyInto(out *IPIndexStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + if in.Prefixes != nil { + in, out := &in.Prefixes, &out.Prefixes + *out = make([]Prefix, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPIndexStatus. +func (in *IPIndexStatus) DeepCopy() *IPIndexStatus { + if in == nil { + return nil + } + out := new(IPIndexStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Prefix) DeepCopyInto(out *Prefix) { + *out = *in + if in.PrefixType != nil { + in, out := &in.PrefixType, &out.PrefixType + *out = new(IPPrefixType) + **out = **in + } + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Prefix. +func (in *Prefix) DeepCopy() *Prefix { + if in == nil { + return nil + } + out := new(Prefix) + in.DeepCopyInto(out) + return out +} diff --git a/apis/backend/ipam/v1alpha1/zz_generated.defaults.go b/apis/backend/ipam/v1alpha1/zz_generated.defaults.go new file mode 100644 index 0000000..c38f9bb --- /dev/null +++ b/apis/backend/ipam/v1alpha1/zz_generated.defaults.go @@ -0,0 +1,32 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2024 Nokia. + +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 defaulter-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// RegisterDefaults adds defaulters functions to the given scheme. +// Public to allow building arbitrary schemes. +// All generated defaulters are covering - they call all nested defaulters. +func RegisterDefaults(scheme *runtime.Scheme) error { + return nil +} diff --git a/apis/backend/ipam/zz_generated.deepcopy.go b/apis/backend/ipam/zz_generated.deepcopy.go new file mode 100644 index 0000000..796d31e --- /dev/null +++ b/apis/backend/ipam/zz_generated.deepcopy.go @@ -0,0 +1,479 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2024 Nokia. + +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 ipam + +import ( + iputil "github.com/henderiw/iputil" + 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 *IPClaim) DeepCopyInto(out *IPClaim) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPClaim. +func (in *IPClaim) DeepCopy() *IPClaim { + if in == nil { + return nil + } + out := new(IPClaim) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *IPClaim) 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 *IPClaimFilter) DeepCopyInto(out *IPClaimFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPClaimFilter. +func (in *IPClaimFilter) DeepCopy() *IPClaimFilter { + if in == nil { + return nil + } + out := new(IPClaimFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPClaimList) DeepCopyInto(out *IPClaimList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]IPClaim, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPClaimList. +func (in *IPClaimList) DeepCopy() *IPClaimList { + if in == nil { + return nil + } + out := new(IPClaimList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *IPClaimList) 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 *IPClaimSpec) DeepCopyInto(out *IPClaimSpec) { + *out = *in + if in.PrefixType != nil { + in, out := &in.PrefixType, &out.PrefixType + *out = new(IPPrefixType) + **out = **in + } + if in.Prefix != nil { + in, out := &in.Prefix, &out.Prefix + *out = new(string) + **out = **in + } + if in.Address != nil { + in, out := &in.Address, &out.Address + *out = new(string) + **out = **in + } + if in.Range != nil { + in, out := &in.Range, &out.Range + *out = new(string) + **out = **in + } + if in.DefaultGateway != nil { + in, out := &in.DefaultGateway, &out.DefaultGateway + *out = new(bool) + **out = **in + } + if in.CreatePrefix != nil { + in, out := &in.CreatePrefix, &out.CreatePrefix + *out = new(bool) + **out = **in + } + if in.PrefixLength != nil { + in, out := &in.PrefixLength, &out.PrefixLength + *out = new(uint32) + **out = **in + } + if in.AddressFamily != nil { + in, out := &in.AddressFamily, &out.AddressFamily + *out = new(iputil.AddressFamily) + **out = **in + } + if in.Idx != nil { + in, out := &in.Idx, &out.Idx + *out = new(uint32) + **out = **in + } + in.ClaimLabels.DeepCopyInto(&out.ClaimLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPClaimSpec. +func (in *IPClaimSpec) DeepCopy() *IPClaimSpec { + if in == nil { + return nil + } + out := new(IPClaimSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPClaimStatus) DeepCopyInto(out *IPClaimStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + if in.Range != nil { + in, out := &in.Range, &out.Range + *out = new(string) + **out = **in + } + if in.Address != nil { + in, out := &in.Address, &out.Address + *out = new(string) + **out = **in + } + if in.Prefix != nil { + in, out := &in.Prefix, &out.Prefix + *out = new(string) + **out = **in + } + if in.DefaultGateway != nil { + in, out := &in.DefaultGateway, &out.DefaultGateway + *out = new(string) + **out = **in + } + if in.ExpiryTime != nil { + in, out := &in.ExpiryTime, &out.ExpiryTime + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPClaimStatus. +func (in *IPClaimStatus) DeepCopy() *IPClaimStatus { + if in == nil { + return nil + } + out := new(IPClaimStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPEntry) DeepCopyInto(out *IPEntry) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPEntry. +func (in *IPEntry) DeepCopy() *IPEntry { + if in == nil { + return nil + } + out := new(IPEntry) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *IPEntry) 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 *IPEntryFilter) DeepCopyInto(out *IPEntryFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPEntryFilter. +func (in *IPEntryFilter) DeepCopy() *IPEntryFilter { + if in == nil { + return nil + } + out := new(IPEntryFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPEntryList) DeepCopyInto(out *IPEntryList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]IPEntry, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPEntryList. +func (in *IPEntryList) DeepCopy() *IPEntryList { + if in == nil { + return nil + } + out := new(IPEntryList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *IPEntryList) 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 *IPEntrySpec) DeepCopyInto(out *IPEntrySpec) { + *out = *in + if in.PrefixType != nil { + in, out := &in.PrefixType, &out.PrefixType + *out = new(IPPrefixType) + **out = **in + } + if in.DefaultGateway != nil { + in, out := &in.DefaultGateway, &out.DefaultGateway + *out = new(bool) + **out = **in + } + if in.AddressFamily != nil { + in, out := &in.AddressFamily, &out.AddressFamily + *out = new(iputil.AddressFamily) + **out = **in + } + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPEntrySpec. +func (in *IPEntrySpec) DeepCopy() *IPEntrySpec { + if in == nil { + return nil + } + out := new(IPEntrySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPEntryStatus) DeepCopyInto(out *IPEntryStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPEntryStatus. +func (in *IPEntryStatus) DeepCopy() *IPEntryStatus { + if in == nil { + return nil + } + out := new(IPEntryStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPIndex) DeepCopyInto(out *IPIndex) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPIndex. +func (in *IPIndex) DeepCopy() *IPIndex { + if in == nil { + return nil + } + out := new(IPIndex) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *IPIndex) 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 *IPIndexFilter) DeepCopyInto(out *IPIndexFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPIndexFilter. +func (in *IPIndexFilter) DeepCopy() *IPIndexFilter { + if in == nil { + return nil + } + out := new(IPIndexFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPIndexList) DeepCopyInto(out *IPIndexList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]IPIndex, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPIndexList. +func (in *IPIndexList) DeepCopy() *IPIndexList { + if in == nil { + return nil + } + out := new(IPIndexList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *IPIndexList) 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 *IPIndexSpec) DeepCopyInto(out *IPIndexSpec) { + *out = *in + if in.Prefixes != nil { + in, out := &in.Prefixes, &out.Prefixes + *out = make([]Prefix, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPIndexSpec. +func (in *IPIndexSpec) DeepCopy() *IPIndexSpec { + if in == nil { + return nil + } + out := new(IPIndexSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPIndexStatus) DeepCopyInto(out *IPIndexStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + if in.Prefixes != nil { + in, out := &in.Prefixes, &out.Prefixes + *out = make([]Prefix, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPIndexStatus. +func (in *IPIndexStatus) DeepCopy() *IPIndexStatus { + if in == nil { + return nil + } + out := new(IPIndexStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Prefix) DeepCopyInto(out *Prefix) { + *out = *in + if in.PrefixType != nil { + in, out := &in.PrefixType, &out.PrefixType + *out = new(IPPrefixType) + **out = **in + } + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Prefix. +func (in *Prefix) DeepCopy() *Prefix { + if in == nil { + return nil + } + out := new(Prefix) + in.DeepCopyInto(out) + return out +} diff --git a/apis/infra/v1alpha1/conversion.go b/apis/infra/v1alpha1/conversion.go index 3ecb89c..a86aa0c 100644 --- a/apis/infra/v1alpha1/conversion.go +++ b/apis/infra/v1alpha1/conversion.go @@ -19,8 +19,10 @@ package v1alpha1 import ( unsafe "unsafe" + asv1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" id "github.com/kuidio/kuid/apis/id" idv1alpha1 "github.com/kuidio/kuid/apis/id/v1alpha1" + "github.com/kuidio/kuid/apis/infra" conversion "k8s.io/apimachinery/pkg/conversion" ) @@ -321,3 +323,131 @@ func autoConvert_id_SiteID_To_v1alpha1_SiteID(in *id.SiteID, out *idv1alpha1.Sit out.Site = in.Site return nil } + +func autoConvert_v1alpha1_EndpointSetSpec_To_infra_EndpointSetSpec(in *EndpointSetSpec, out *infra.EndpointSetSpec, s conversion.Scope) error { + if in.Endpoints != nil { + in, out := &in.Endpoints, &out.Endpoints + *out = make([]*id.PartitionEndpointID, len(*in)) + for i := range *in { + autoConvert_v1alpha1_PartitionEndpointID_To_id_PartitionEndpointID((*in)[i], (*out)[i], s) + } + } else { + out.Endpoints = nil + } + out.Lacp = (*bool)(unsafe.Pointer(in.Lacp)) + if err := asv1alpha1.Convert_v1alpha1_UserDefinedLabels_To_common_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_EndpointSetSpec_To_infra_EndpointSetSpec is an autogenerated conversion function. +func Convert_v1alpha1_EndpointSetSpec_To_infra_EndpointSetSpec(in *EndpointSetSpec, out *infra.EndpointSetSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_EndpointSetSpec_To_infra_EndpointSetSpec(in, out, s) +} + +func autoConvert_infra_EndpointSetSpec_To_v1alpha1_EndpointSetSpec(in *infra.EndpointSetSpec, out *EndpointSetSpec, s conversion.Scope) error { + if in.Endpoints != nil { + in, out := &in.Endpoints, &out.Endpoints + *out = make([]*idv1alpha1.PartitionEndpointID, len(*in)) + for i := range *in { + autoConvert_id_PartitionEndpointID_To_v1alpha1_PartitionEndpointID((*in)[i], (*out)[i], s) + } + } else { + out.Endpoints = nil + } + out.Lacp = (*bool)(unsafe.Pointer(in.Lacp)) + if err := asv1alpha1.Convert_common_UserDefinedLabels_To_v1alpha1_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_infra_EndpointSetSpec_To_v1alpha1_EndpointSetSpec is an autogenerated conversion function. +func Convert_infra_EndpointSetSpec_To_v1alpha1_EndpointSetSpec(in *infra.EndpointSetSpec, out *EndpointSetSpec, s conversion.Scope) error { + return autoConvert_infra_EndpointSetSpec_To_v1alpha1_EndpointSetSpec(in, out, s) +} + +func autoConvert_v1alpha1_LinkSetSpec_To_infra_LinkSetSpec(in *LinkSetSpec, out *infra.LinkSetSpec, s conversion.Scope) error { + if in.Endpoints != nil { + in, out := &in.Endpoints, &out.Endpoints + *out = make([]*id.PartitionEndpointID, len(*in)) + for i := range *in { + autoConvert_v1alpha1_PartitionEndpointID_To_id_PartitionEndpointID((*in)[i], (*out)[i], s) + } + } else { + out.Endpoints = nil + } + if err := asv1alpha1.Convert_v1alpha1_UserDefinedLabels_To_common_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_LinkSetSpec_To_infra_LinkSetSpec is an autogenerated conversion function. +func Convert_v1alpha1_LinkSetSpec_To_infra_LinkSetSpec(in *LinkSetSpec, out *infra.LinkSetSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_LinkSetSpec_To_infra_LinkSetSpec(in, out, s) +} + +func autoConvert_infra_LinkSetSpec_To_v1alpha1_LinkSetSpec(in *infra.LinkSetSpec, out *LinkSetSpec, s conversion.Scope) error { + if in.Endpoints != nil { + in, out := &in.Endpoints, &out.Endpoints + *out = make([]*idv1alpha1.PartitionEndpointID, len(*in)) + for i := range *in { + autoConvert_id_PartitionEndpointID_To_v1alpha1_PartitionEndpointID((*in)[i], (*out)[i], s) + } + } else { + out.Endpoints = nil + } + if err := asv1alpha1.Convert_common_UserDefinedLabels_To_v1alpha1_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_infra_LinkSetSpec_To_v1alpha1_LinkSetSpec is an autogenerated conversion function. +func Convert_infra_LinkSetSpec_To_v1alpha1_LinkSetSpec(in *infra.LinkSetSpec, out *LinkSetSpec, s conversion.Scope) error { + return autoConvert_infra_LinkSetSpec_To_v1alpha1_LinkSetSpec(in, out, s) +} + +func autoConvert_infra_LinkSpec_To_v1alpha1_LinkSpec(in *infra.LinkSpec, out *LinkSpec, s conversion.Scope) error { + if in.Endpoints != nil { + in, out := &in.Endpoints, &out.Endpoints + *out = make([]*idv1alpha1.PartitionEndpointID, len(*in)) + for i := range *in { + autoConvert_id_PartitionEndpointID_To_v1alpha1_PartitionEndpointID((*in)[i], (*out)[i], s) + } + } else { + out.Endpoints = nil + } + if err := asv1alpha1.Convert_common_UserDefinedLabels_To_v1alpha1_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_infra_LinkSpec_To_v1alpha1_LinkSpec is an autogenerated conversion function. +func Convert_infra_LinkSpec_To_v1alpha1_LinkSpec(in *infra.LinkSpec, out *LinkSpec, s conversion.Scope) error { + return autoConvert_infra_LinkSpec_To_v1alpha1_LinkSpec(in, out, s) +} + +func autoConvert_v1alpha1_LinkSpec_To_infra_LinkSpec(in *LinkSpec, out *infra.LinkSpec, s conversion.Scope) error { + if in.Endpoints != nil { + in, out := &in.Endpoints, &out.Endpoints + *out = make([]*id.PartitionEndpointID, len(*in)) + for i := range *in { + autoConvert_v1alpha1_PartitionEndpointID_To_id_PartitionEndpointID((*in)[i], (*out)[i], s) + } + } else { + out.Endpoints = nil + } + if err := asv1alpha1.Convert_v1alpha1_UserDefinedLabels_To_common_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_LinkSpec_To_infra_LinkSpec is an autogenerated conversion function. +func Convert_v1alpha1_LinkSpec_To_infra_LinkSpec(in *LinkSpec, out *infra.LinkSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_LinkSpec_To_infra_LinkSpec(in, out, s) +} \ No newline at end of file diff --git a/apis/infra/v1alpha1/zz_generated.conversion.go b/apis/infra/v1alpha1/zz_generated.conversion.go index d694766..608b6a8 100644 --- a/apis/infra/v1alpha1/zz_generated.conversion.go +++ b/apis/infra/v1alpha1/zz_generated.conversion.go @@ -118,16 +118,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*EndpointSetSpec)(nil), (*infra.EndpointSetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha1_EndpointSetSpec_To_infra_EndpointSetSpec(a.(*EndpointSetSpec), b.(*infra.EndpointSetSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*infra.EndpointSetSpec)(nil), (*EndpointSetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_infra_EndpointSetSpec_To_v1alpha1_EndpointSetSpec(a.(*infra.EndpointSetSpec), b.(*EndpointSetSpec), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*EndpointSetStatus)(nil), (*infra.EndpointSetStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_EndpointSetStatus_To_infra_EndpointSetStatus(a.(*EndpointSetStatus), b.(*infra.EndpointSetStatus), scope) }); err != nil { @@ -198,16 +188,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*LinkSetSpec)(nil), (*infra.LinkSetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha1_LinkSetSpec_To_infra_LinkSetSpec(a.(*LinkSetSpec), b.(*infra.LinkSetSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*infra.LinkSetSpec)(nil), (*LinkSetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_infra_LinkSetSpec_To_v1alpha1_LinkSetSpec(a.(*infra.LinkSetSpec), b.(*LinkSetSpec), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*LinkSetStatus)(nil), (*infra.LinkSetStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_LinkSetStatus_To_infra_LinkSetStatus(a.(*LinkSetStatus), b.(*infra.LinkSetStatus), scope) }); err != nil { @@ -218,23 +198,23 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*LinkSpec)(nil), (*infra.LinkSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha1_LinkSpec_To_infra_LinkSpec(a.(*LinkSpec), b.(*infra.LinkSpec), scope) + if err := s.AddGeneratedConversionFunc((*LinkStatus)(nil), (*infra.LinkStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LinkStatus_To_infra_LinkStatus(a.(*LinkStatus), b.(*infra.LinkStatus), scope) }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*infra.LinkSpec)(nil), (*LinkSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_infra_LinkSpec_To_v1alpha1_LinkSpec(a.(*infra.LinkSpec), b.(*LinkSpec), scope) + if err := s.AddGeneratedConversionFunc((*infra.LinkStatus)(nil), (*LinkStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_LinkStatus_To_v1alpha1_LinkStatus(a.(*infra.LinkStatus), b.(*LinkStatus), scope) }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*LinkStatus)(nil), (*infra.LinkStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha1_LinkStatus_To_infra_LinkStatus(a.(*LinkStatus), b.(*infra.LinkStatus), scope) + if err := s.AddGeneratedConversionFunc((*Location)(nil), (*infra.Location)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Location_To_infra_Location(a.(*Location), b.(*infra.Location), scope) }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*infra.LinkStatus)(nil), (*LinkStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_infra_LinkStatus_To_v1alpha1_LinkStatus(a.(*infra.LinkStatus), b.(*LinkStatus), scope) + if err := s.AddGeneratedConversionFunc((*infra.Location)(nil), (*Location)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_Location_To_v1alpha1_Location(a.(*infra.Location), b.(*Location), scope) }); err != nil { return err } @@ -648,6 +628,21 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*infra.EndpointSetSpec)(nil), (*EndpointSetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_EndpointSetSpec_To_v1alpha1_EndpointSetSpec(a.(*infra.EndpointSetSpec), b.(*EndpointSetSpec), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*infra.LinkSetSpec)(nil), (*LinkSetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_LinkSetSpec_To_v1alpha1_LinkSetSpec(a.(*infra.LinkSetSpec), b.(*LinkSetSpec), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*infra.LinkSpec)(nil), (*LinkSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_LinkSpec_To_v1alpha1_LinkSpec(a.(*infra.LinkSpec), b.(*LinkSpec), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*idv1alpha1.AdaptorID)(nil), (*id.AdaptorID)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_AdaptorID_To_id_AdaptorID(a.(*idv1alpha1.AdaptorID), b.(*id.AdaptorID), scope) }); err != nil { @@ -663,6 +658,21 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*EndpointSetSpec)(nil), (*infra.EndpointSetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_EndpointSetSpec_To_infra_EndpointSetSpec(a.(*EndpointSetSpec), b.(*infra.EndpointSetSpec), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*LinkSetSpec)(nil), (*infra.LinkSetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LinkSetSpec_To_infra_LinkSetSpec(a.(*LinkSetSpec), b.(*infra.LinkSetSpec), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*LinkSpec)(nil), (*infra.LinkSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LinkSpec_To_infra_LinkSpec(a.(*LinkSpec), b.(*infra.LinkSpec), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*idv1alpha1.NodeID)(nil), (*id.NodeID)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_NodeID_To_id_NodeID(a.(*idv1alpha1.NodeID), b.(*id.NodeID), scope) }); err != nil { @@ -981,55 +991,6 @@ func Convert_infra_EndpointSetList_To_v1alpha1_EndpointSetList(in *infra.Endpoin return autoConvert_infra_EndpointSetList_To_v1alpha1_EndpointSetList(in, out, s) } -func autoConvert_v1alpha1_EndpointSetSpec_To_infra_EndpointSetSpec(in *EndpointSetSpec, out *infra.EndpointSetSpec, s conversion.Scope) error { - if in.Endpoints != nil { - in, out := &in.Endpoints, &out.Endpoints - *out = make([]*id.PartitionEndpointID, len(*in)) - for i := range *in { - // FIXME: Provide conversion function to convert *idv1alpha1.PartitionEndpointID to *id.PartitionEndpointID - if err := Convert_v1alpha1_PartitionEndpointID_To_id_PartitionEndpointID((*in)[i], (*out)[i], s); err != nil { - return err - } - } - } else { - out.Endpoints = nil - } - out.Lacp = (*bool)(unsafe.Pointer(in.Lacp)) - if err := asv1alpha1.Convert_v1alpha1_UserDefinedLabels_To_common_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha1_EndpointSetSpec_To_infra_EndpointSetSpec is an autogenerated conversion function. -func Convert_v1alpha1_EndpointSetSpec_To_infra_EndpointSetSpec(in *EndpointSetSpec, out *infra.EndpointSetSpec, s conversion.Scope) error { - return autoConvert_v1alpha1_EndpointSetSpec_To_infra_EndpointSetSpec(in, out, s) -} - -func autoConvert_infra_EndpointSetSpec_To_v1alpha1_EndpointSetSpec(in *infra.EndpointSetSpec, out *EndpointSetSpec, s conversion.Scope) error { - if in.Endpoints != nil { - in, out := &in.Endpoints, &out.Endpoints - *out = make([]*idv1alpha1.PartitionEndpointID, len(*in)) - for i := range *in { - // FIXME: Provide conversion function to convert *id.PartitionEndpointID to *idv1alpha1.PartitionEndpointID - if err := Convert_id_PartitionEndpointID_To_v1alpha1_PartitionEndpointID((*in)[i], (*out)[i], s); err != nil { - return err - } - } - } else { - out.Endpoints = nil - } - out.Lacp = (*bool)(unsafe.Pointer(in.Lacp)) - if err := asv1alpha1.Convert_common_UserDefinedLabels_To_v1alpha1_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { - return err - } - return nil -} - -// Convert_infra_EndpointSetSpec_To_v1alpha1_EndpointSetSpec is an autogenerated conversion function. -func Convert_infra_EndpointSetSpec_To_v1alpha1_EndpointSetSpec(in *infra.EndpointSetSpec, out *EndpointSetSpec, s conversion.Scope) error { - return autoConvert_infra_EndpointSetSpec_To_v1alpha1_EndpointSetSpec(in, out, s) -} func autoConvert_v1alpha1_EndpointSetStatus_To_infra_EndpointSetStatus(in *EndpointSetStatus, out *infra.EndpointSetStatus, s conversion.Scope) error { if err := asv1alpha1.Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { @@ -1265,54 +1226,6 @@ func Convert_infra_LinkSetList_To_v1alpha1_LinkSetList(in *infra.LinkSetList, ou return autoConvert_infra_LinkSetList_To_v1alpha1_LinkSetList(in, out, s) } -func autoConvert_v1alpha1_LinkSetSpec_To_infra_LinkSetSpec(in *LinkSetSpec, out *infra.LinkSetSpec, s conversion.Scope) error { - if in.Endpoints != nil { - in, out := &in.Endpoints, &out.Endpoints - *out = make([]*id.PartitionEndpointID, len(*in)) - for i := range *in { - // FIXME: Provide conversion function to convert *idv1alpha1.PartitionEndpointID to *id.PartitionEndpointID - if err := Convert_v1alpha1_PartitionEndpointID_To_id_PartitionEndpointID((*in)[i], (*out)[i], s); err != nil { - return err - } - } - } else { - out.Endpoints = nil - } - if err := asv1alpha1.Convert_v1alpha1_UserDefinedLabels_To_common_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha1_LinkSetSpec_To_infra_LinkSetSpec is an autogenerated conversion function. -func Convert_v1alpha1_LinkSetSpec_To_infra_LinkSetSpec(in *LinkSetSpec, out *infra.LinkSetSpec, s conversion.Scope) error { - return autoConvert_v1alpha1_LinkSetSpec_To_infra_LinkSetSpec(in, out, s) -} - -func autoConvert_infra_LinkSetSpec_To_v1alpha1_LinkSetSpec(in *infra.LinkSetSpec, out *LinkSetSpec, s conversion.Scope) error { - if in.Endpoints != nil { - in, out := &in.Endpoints, &out.Endpoints - *out = make([]*idv1alpha1.PartitionEndpointID, len(*in)) - for i := range *in { - // FIXME: Provide conversion function to convert *id.PartitionEndpointID to *idv1alpha1.PartitionEndpointID - if err := Convert_id_PartitionEndpointID_To_v1alpha1_PartitionEndpointID((*in)[i], (*out)[i], s); err != nil { - return err - } - } - } else { - out.Endpoints = nil - } - if err := asv1alpha1.Convert_common_UserDefinedLabels_To_v1alpha1_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { - return err - } - return nil -} - -// Convert_infra_LinkSetSpec_To_v1alpha1_LinkSetSpec is an autogenerated conversion function. -func Convert_infra_LinkSetSpec_To_v1alpha1_LinkSetSpec(in *infra.LinkSetSpec, out *LinkSetSpec, s conversion.Scope) error { - return autoConvert_infra_LinkSetSpec_To_v1alpha1_LinkSetSpec(in, out, s) -} - func autoConvert_v1alpha1_LinkSetStatus_To_infra_LinkSetStatus(in *LinkSetStatus, out *infra.LinkSetStatus, s conversion.Scope) error { if err := asv1alpha1.Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { return err @@ -1341,54 +1254,6 @@ func Convert_infra_LinkSetStatus_To_v1alpha1_LinkSetStatus(in *infra.LinkSetStat return autoConvert_infra_LinkSetStatus_To_v1alpha1_LinkSetStatus(in, out, s) } -func autoConvert_v1alpha1_LinkSpec_To_infra_LinkSpec(in *LinkSpec, out *infra.LinkSpec, s conversion.Scope) error { - if in.Endpoints != nil { - in, out := &in.Endpoints, &out.Endpoints - *out = make([]*id.PartitionEndpointID, len(*in)) - for i := range *in { - // FIXME: Provide conversion function to convert *idv1alpha1.PartitionEndpointID to *id.PartitionEndpointID - if err := Convert_v1alpha1_PartitionEndpointID_To_id_PartitionEndpointID((*in)[i], (*out)[i], s); err != nil { - return err - } - } - } else { - out.Endpoints = nil - } - if err := asv1alpha1.Convert_v1alpha1_UserDefinedLabels_To_common_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha1_LinkSpec_To_infra_LinkSpec is an autogenerated conversion function. -func Convert_v1alpha1_LinkSpec_To_infra_LinkSpec(in *LinkSpec, out *infra.LinkSpec, s conversion.Scope) error { - return autoConvert_v1alpha1_LinkSpec_To_infra_LinkSpec(in, out, s) -} - -func autoConvert_infra_LinkSpec_To_v1alpha1_LinkSpec(in *infra.LinkSpec, out *LinkSpec, s conversion.Scope) error { - if in.Endpoints != nil { - in, out := &in.Endpoints, &out.Endpoints - *out = make([]*idv1alpha1.PartitionEndpointID, len(*in)) - for i := range *in { - // FIXME: Provide conversion function to convert *id.PartitionEndpointID to *idv1alpha1.PartitionEndpointID - if err := Convert_id_PartitionEndpointID_To_v1alpha1_PartitionEndpointID((*in)[i], (*out)[i], s); err != nil { - return err - } - } - } else { - out.Endpoints = nil - } - if err := asv1alpha1.Convert_common_UserDefinedLabels_To_v1alpha1_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { - return err - } - return nil -} - -// Convert_infra_LinkSpec_To_v1alpha1_LinkSpec is an autogenerated conversion function. -func Convert_infra_LinkSpec_To_v1alpha1_LinkSpec(in *infra.LinkSpec, out *LinkSpec, s conversion.Scope) error { - return autoConvert_infra_LinkSpec_To_v1alpha1_LinkSpec(in, out, s) -} - func autoConvert_v1alpha1_LinkStatus_To_infra_LinkStatus(in *LinkStatus, out *infra.LinkStatus, s conversion.Scope) error { if err := asv1alpha1.Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { return err @@ -1413,6 +1278,28 @@ func Convert_infra_LinkStatus_To_v1alpha1_LinkStatus(in *infra.LinkStatus, out * return autoConvert_infra_LinkStatus_To_v1alpha1_LinkStatus(in, out, s) } +func autoConvert_v1alpha1_Location_To_infra_Location(in *Location, out *infra.Location, s conversion.Scope) error { + out.Latitude = in.Latitude + out.Longitude = in.Longitude + return nil +} + +// Convert_v1alpha1_Location_To_infra_Location is an autogenerated conversion function. +func Convert_v1alpha1_Location_To_infra_Location(in *Location, out *infra.Location, s conversion.Scope) error { + return autoConvert_v1alpha1_Location_To_infra_Location(in, out, s) +} + +func autoConvert_infra_Location_To_v1alpha1_Location(in *infra.Location, out *Location, s conversion.Scope) error { + out.Latitude = in.Latitude + out.Longitude = in.Longitude + return nil +} + +// Convert_infra_Location_To_v1alpha1_Location is an autogenerated conversion function. +func Convert_infra_Location_To_v1alpha1_Location(in *infra.Location, out *Location, s conversion.Scope) error { + return autoConvert_infra_Location_To_v1alpha1_Location(in, out, s) +} + func autoConvert_v1alpha1_Module_To_infra_Module(in *Module, out *infra.Module, s conversion.Scope) error { out.ObjectMeta = in.ObjectMeta if err := Convert_v1alpha1_ModuleSpec_To_infra_ModuleSpec(&in.Spec, &out.Spec, s); err != nil { diff --git a/examples/ipam/address-dynamic-fromnetwork-net1-1.yaml b/examples/ipam/address-dynamic-fromnetwork-net1-1.yaml index 6da29a5..68a1a19 100644 --- a/examples/ipam/address-dynamic-fromnetwork-net1-1.yaml +++ b/examples/ipam/address-dynamic-fromnetwork-net1-1.yaml @@ -3,7 +3,7 @@ kind: IPClaim metadata: name: net1-claim1 spec: - networkInstance: vpc1 + index: vpc1 selector: matchLabels: inv.kuid.dev/network: net1 diff --git a/examples/ipam/address-dynamic-fromnetwork-net1-2.yaml b/examples/ipam/address-dynamic-fromnetwork-net1-2.yaml index 9054deb..c7beca5 100644 --- a/examples/ipam/address-dynamic-fromnetwork-net1-2.yaml +++ b/examples/ipam/address-dynamic-fromnetwork-net1-2.yaml @@ -3,7 +3,7 @@ kind: IPClaim metadata: name: net1-claim2 spec: - networkInstance: vpc1 + index: vpc1 selector: matchLabels: inv.kuid.dev/network: net1 diff --git a/examples/ipam/address-dynamic-frompool-pool1-1.yaml b/examples/ipam/address-dynamic-frompool-pool1-1.yaml index a0d0622..b4a1bd3 100644 --- a/examples/ipam/address-dynamic-frompool-pool1-1.yaml +++ b/examples/ipam/address-dynamic-frompool-pool1-1.yaml @@ -3,7 +3,7 @@ kind: IPClaim metadata: name: pool1-claim1 spec: - networkInstance: vpc1 + index: vpc1 selector: matchLabels: inv.kuid.dev/pool: pool1 diff --git a/examples/ipam/address-dynamic-frompool-pool1-2.yaml b/examples/ipam/address-dynamic-frompool-pool1-2.yaml index 95a8dc4..cfc9579 100644 --- a/examples/ipam/address-dynamic-frompool-pool1-2.yaml +++ b/examples/ipam/address-dynamic-frompool-pool1-2.yaml @@ -3,7 +3,7 @@ kind: IPClaim metadata: name: pool1-claim2 spec: - networkInstance: vpc1 + index: vpc1 selector: matchLabels: inv.kuid.dev/pool: pool1 diff --git a/examples/ipam/address-dynamic-fromrange-range1-1.yaml b/examples/ipam/address-dynamic-fromrange-range1-1.yaml index d176282..fe34616 100644 --- a/examples/ipam/address-dynamic-fromrange-range1-1.yaml +++ b/examples/ipam/address-dynamic-fromrange-range1-1.yaml @@ -3,7 +3,7 @@ kind: IPClaim metadata: name: range1-claim1 spec: - networkInstance: vpc1 + index: vpc1 selector: matchLabels: be.kuid.dev/claim-name: vpc1.10.0.0.10-10.0.0.19 diff --git a/examples/ipam/address-dynamic-fromrange-range1-2.yaml b/examples/ipam/address-dynamic-fromrange-range1-2.yaml index 06b2248..167af6e 100644 --- a/examples/ipam/address-dynamic-fromrange-range1-2.yaml +++ b/examples/ipam/address-dynamic-fromrange-range1-2.yaml @@ -3,7 +3,7 @@ kind: IPClaim metadata: name: range1-claim2 spec: - networkInstance: vpc1 + index: vpc1 selector: matchLabels: be.kuid.dev/claim-name: vpc1.10.0.0.10-10.0.0.19 diff --git a/examples/ipam/address-static-frompool-pool1.yaml b/examples/ipam/address-static-frompool-pool1.yaml index 2d75f55..f03a942 100644 --- a/examples/ipam/address-static-frompool-pool1.yaml +++ b/examples/ipam/address-static-frompool-pool1.yaml @@ -3,6 +3,6 @@ kind: IPClaim metadata: name: vpc1.172-0-199-199-32 spec: - networkInstance: vpc1 + index: vpc1 address: 172.0.199.199/32 \ No newline at end of file diff --git a/examples/ipam/address-static-fromrange-range1.yaml b/examples/ipam/address-static-fromrange-range1.yaml index a53b87e..60d96f2 100644 --- a/examples/ipam/address-static-fromrange-range1.yaml +++ b/examples/ipam/address-static-fromrange-range1.yaml @@ -3,6 +3,6 @@ kind: IPClaim metadata: name: vpc1.10.0.0.10-32 spec: - networkInstance: vpc1 + index: vpc1 address: 10.0.0.10/32 \ No newline at end of file diff --git a/examples/ipam/ni-vpc.yaml b/examples/ipam/ni-vpc.yaml index ef15a19..d96c262 100644 --- a/examples/ipam/ni-vpc.yaml +++ b/examples/ipam/ni-vpc.yaml @@ -2,6 +2,7 @@ apiVersion: ipam.be.kuid.dev/v1alpha1 kind: IPIndex metadata: name: vpc1 + namespace: default spec: prefixes: - prefix: 10.0.0.0/8 diff --git a/examples/ipam/prefix-dynamic.yaml b/examples/ipam/prefix-dynamic.yaml index aa6196f..33a3518 100644 --- a/examples/ipam/prefix-dynamic.yaml +++ b/examples/ipam/prefix-dynamic.yaml @@ -2,6 +2,7 @@ apiVersion: ipam.be.kuid.dev/v1alpha1 kind: IPClaim metadata: name: vpc1.prefix-claim1 + namespace: default spec: index: vpc1 prefixType: network diff --git a/examples/ipam/prefix-pool-172.0.0.0-16.yaml b/examples/ipam/prefix-pool-172.0.0.0-16.yaml index 72939f8..456ba1a 100644 --- a/examples/ipam/prefix-pool-172.0.0.0-16.yaml +++ b/examples/ipam/prefix-pool-172.0.0.0-16.yaml @@ -2,6 +2,7 @@ apiVersion: ipam.be.kuid.dev/v1alpha1 kind: IPClaim metadata: name: vpc1.172.0.0.0-16 + namespace: default spec: index: vpc1 prefixType: pool diff --git a/examples/ipam/range-10.0.0.10-10.0.0.20.yaml b/examples/ipam/range-10.0.0.10-10.0.0.20.yaml index 3facc79..dd23d5f 100644 --- a/examples/ipam/range-10.0.0.10-10.0.0.20.yaml +++ b/examples/ipam/range-10.0.0.10-10.0.0.20.yaml @@ -2,6 +2,7 @@ apiVersion: ipam.be.kuid.dev/v1alpha1 kind: IPClaim metadata: name: vpc1.10.0.0.10-10.0.0.19 + namespace: default spec: index: vpc1 range: 10.0.0.10-10.0.0.19 diff --git a/go.mod b/go.mod index 8d08707..0c05114 100644 --- a/go.mod +++ b/go.mod @@ -10,9 +10,11 @@ require ( github.com/dgraph-io/badger/v4 v4.3.0 github.com/google/go-cmp v0.6.0 github.com/google/uuid v1.6.0 - github.com/henderiw/apiserver-builder v0.0.4-0.20241024124759-f780409e1b2f - github.com/henderiw/apiserver-store v0.0.3-0.20241022143604-0995425b3d06 + github.com/hansthienpondt/nipam v0.0.5 + github.com/henderiw/apiserver-builder v0.0.4-0.20241027084658-10d7f9d97252 + github.com/henderiw/apiserver-store v0.0.3-0.20241027163114-c382e2d133b7 github.com/henderiw/idxtable v0.0.0-20241021085446-f8d804551342 + github.com/henderiw/iputil v0.0.0-20231218081610-37f78ad9c81c github.com/henderiw/logger v0.0.0-20230911123436-8655829b1abe github.com/henderiw/store v0.0.2-0.20241020093537-5a92d3e14a02 github.com/kform-dev/choreo v0.0.14-0.20241022144122-dcc4abf0f562 @@ -21,6 +23,7 @@ require ( github.com/stretchr/testify v1.9.0 go.opentelemetry.io/otel v1.28.0 go.uber.org/zap v1.27.0 + go4.org/netipx v0.0.0-20231129151722-fdeea329fbba golang.org/x/mod v0.21.0 golang.org/x/sync v0.8.0 k8s.io/api v0.31.1 @@ -81,6 +84,7 @@ require ( github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/kentik/patricia v1.2.0 // indirect github.com/klauspost/compress v1.17.9 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect diff --git a/go.sum b/go.sum index 4986848..93a47e1 100644 --- a/go.sum +++ b/go.sum @@ -143,22 +143,22 @@ github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4 github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0= github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k= -github.com/henderiw/apiserver-builder v0.0.4-0.20241023220418-f1bacfdbb4da h1:vAG0d1ZYB7+KS7V6YehDFJ9FMicNoBlxLM7/b4tZ/bk= -github.com/henderiw/apiserver-builder v0.0.4-0.20241023220418-f1bacfdbb4da/go.mod h1:LfJu1JURnxHwnFa8CVb2XPw50TwdU1xQvuUNxpaSOlE= -github.com/henderiw/apiserver-builder v0.0.4-0.20241024082441-d93c947488cc h1:fF9JSus7Tdd1nMputDiOxO7GX5wSaSQub8HB5VP4bko= -github.com/henderiw/apiserver-builder v0.0.4-0.20241024082441-d93c947488cc/go.mod h1:LfJu1JURnxHwnFa8CVb2XPw50TwdU1xQvuUNxpaSOlE= -github.com/henderiw/apiserver-builder v0.0.4-0.20241024083714-4b01a6506b20 h1:7KXAkd2pbh0x4fDF3P6+T5i9Tr13X/1h21TjZUsL++Q= -github.com/henderiw/apiserver-builder v0.0.4-0.20241024083714-4b01a6506b20/go.mod h1:LfJu1JURnxHwnFa8CVb2XPw50TwdU1xQvuUNxpaSOlE= -github.com/henderiw/apiserver-builder v0.0.4-0.20241024084215-939617b3b6a8 h1:nf+UrluqIGptmmEaPDxcAMWwNrEGrWpqEIEpOLyNbXg= -github.com/henderiw/apiserver-builder v0.0.4-0.20241024084215-939617b3b6a8/go.mod h1:LfJu1JURnxHwnFa8CVb2XPw50TwdU1xQvuUNxpaSOlE= -github.com/henderiw/apiserver-builder v0.0.4-0.20241024085036-d72069d078f8 h1:EoPSG8cO3eZdOfPR3Ih+dLwEcPkMGkXiecxKG9L07YQ= -github.com/henderiw/apiserver-builder v0.0.4-0.20241024085036-d72069d078f8/go.mod h1:LfJu1JURnxHwnFa8CVb2XPw50TwdU1xQvuUNxpaSOlE= -github.com/henderiw/apiserver-builder v0.0.4-0.20241024124759-f780409e1b2f h1:7bYTVY2xFvVh06bQkGDXVue9FutcQ7dguDvGaYAd0Ns= -github.com/henderiw/apiserver-builder v0.0.4-0.20241024124759-f780409e1b2f/go.mod h1:LfJu1JURnxHwnFa8CVb2XPw50TwdU1xQvuUNxpaSOlE= +github.com/hansthienpondt/nipam v0.0.5 h1:83Mdwdgx3l9tvio8u8ufan97MWx49n38IJwgSBgATEc= +github.com/hansthienpondt/nipam v0.0.5/go.mod h1:dJI5FdzV6iaQyaOH4htGqJNs6wGieJeX3lhPj1Ah19U= +github.com/henderiw/apiserver-builder v0.0.4-0.20241027084658-10d7f9d97252 h1:+I3bHSWCKCKLoUZHRSMCxs5Q7DMFFgdE+DfhOsOOGko= +github.com/henderiw/apiserver-builder v0.0.4-0.20241027084658-10d7f9d97252/go.mod h1:LfJu1JURnxHwnFa8CVb2XPw50TwdU1xQvuUNxpaSOlE= github.com/henderiw/apiserver-store v0.0.3-0.20241022143604-0995425b3d06 h1:1RVj1x0ykpmuxynrLww0oHgs5TdkciwJZr996SmGDf0= github.com/henderiw/apiserver-store v0.0.3-0.20241022143604-0995425b3d06/go.mod h1:VVkUptd3MTyREmpo+C/t6l+mJAwo3A1UWvHi0QSH0yE= +github.com/henderiw/apiserver-store v0.0.3-0.20241027161332-ea9aa2ddc2c2 h1:DhBwOL+tAxHGIPaESQy0GDj2TTTRbFzmTUl/nE2Dz98= +github.com/henderiw/apiserver-store v0.0.3-0.20241027161332-ea9aa2ddc2c2/go.mod h1:VVkUptd3MTyREmpo+C/t6l+mJAwo3A1UWvHi0QSH0yE= +github.com/henderiw/apiserver-store v0.0.3-0.20241027162826-7a30b5bfc5ff h1:iEFyzjBUqNviHT4/Evp8EnlDP4Bw7vYH+S9EbCwOSEs= +github.com/henderiw/apiserver-store v0.0.3-0.20241027162826-7a30b5bfc5ff/go.mod h1:VVkUptd3MTyREmpo+C/t6l+mJAwo3A1UWvHi0QSH0yE= +github.com/henderiw/apiserver-store v0.0.3-0.20241027163114-c382e2d133b7 h1:gqpv6oJ0XN9H8/pXq2B7sXFdXH+YmjE05ivs/ffNAq0= +github.com/henderiw/apiserver-store v0.0.3-0.20241027163114-c382e2d133b7/go.mod h1:VVkUptd3MTyREmpo+C/t6l+mJAwo3A1UWvHi0QSH0yE= github.com/henderiw/idxtable v0.0.0-20241021085446-f8d804551342 h1:gkdOvjxM6rNTkcyoykZLjAfPjn06/MEY4o8cy+3uj2g= github.com/henderiw/idxtable v0.0.0-20241021085446-f8d804551342/go.mod h1:EPdUFZyKA2IORzohdu67+xBbfDmkHEDUaMN0BBsk8eY= +github.com/henderiw/iputil v0.0.0-20231218081610-37f78ad9c81c h1:nFnCNyRV1Ej/zqV/gn8UnFESkoPUXhwpUCZyhSYGSYA= +github.com/henderiw/iputil v0.0.0-20231218081610-37f78ad9c81c/go.mod h1:PrPJdVAwtl5tL323wykHZ5L/b7tfJJsjhegza/wq4fQ= github.com/henderiw/logger v0.0.0-20230911123436-8655829b1abe h1:+R53KH7fW+pmqlfSYVTCGPn8pj6gqBGcQ0nq7L1h8+g= github.com/henderiw/logger v0.0.0-20230911123436-8655829b1abe/go.mod h1:KNMXpSG8v0BAfIh5rZL4hgow3pBWNbkmmb28x9C5s+Y= github.com/henderiw/store v0.0.2-0.20241020093537-5a92d3e14a02 h1:AyDjgCG9+s+ci3HNU++YZ3o3p4nxngWWhAmwU64YPs8= @@ -175,6 +175,8 @@ github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8Hm github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kentik/patricia v1.2.0 h1:WZcp8V8GQhsya0bMZuXktEH/Wz+aBlhiMle4tExkj6M= +github.com/kentik/patricia v1.2.0/go.mod h1:6jY40ESetsbfi04/S12iJlsiS6DYL2B2W+WAcqoDHtw= github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kform-dev/choreo v0.0.14-0.20241022144122-dcc4abf0f562 h1:PA3AyYfHpHQhMCYnaflPvZ7T1kmYr6O9zJN8smKo5DE= @@ -301,6 +303,8 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +go4.org/netipx v0.0.0-20231129151722-fdeea329fbba h1:0b9z3AuHCjxk0x/opv64kcgZLBseWJUpBw5I82+2U4M= +go4.org/netipx v0.0.0-20231129151722-fdeea329fbba/go.mod h1:PLyyIXexvUFg3Owu6p/WfdlivPbZJsZdgWZlrGope/Y= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= diff --git a/main.go b/main.go index 8742dc8..d16b0cf 100644 --- a/main.go +++ b/main.go @@ -82,7 +82,7 @@ func main() { // apiserver is only relevant when not using etcd var apiserver *builder.Server if kuidConfig.Storage != config.StorageType_Etcd { - apiserver = builder.APIServer. + apiserver = builder.NewAPIServer(). WithServerName("kuid-api-server"). WithOpenAPIDefinitions("Config", "v1alpha1", openapi.GetOpenAPIDefinitions). WithoutEtcd() diff --git a/pkg/backend/astest/as_index_test.go b/pkg/backend/astest/as_index_test.go deleted file mode 100644 index bcacc23..0000000 --- a/pkg/backend/astest/as_index_test.go +++ /dev/null @@ -1,78 +0,0 @@ -package astest - -import ( - "context" - "testing" - - "github.com/henderiw/apiserver-builder/pkg/builder" - "github.com/henderiw/apiserver-builder/pkg/builder/resource" - "github.com/kuidio/kuid/apis/backend/as" - "github.com/kuidio/kuid/apis/backend/as/register" - asbev1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" - "github.com/kuidio/kuid/pkg/config" - "github.com/kuidio/kuid/pkg/generated/openapi" - "github.com/kuidio/kuid/pkg/registry/options" - "github.com/stretchr/testify/assert" -) - -func TestIndex(t *testing.T) { - tests := map[string]struct { - index string - testType string - }{ - //"CreateDelete": { - // index: "a", - // testType: "", - //}, - } - - for name, tc := range tests { - t.Run(name, func(t *testing.T) { - - ctx := context.Background() - apiserver := builder.APIServer. - WithServerName("kuid-api-server"). - WithOpenAPIDefinitions("Config", "v1alpha1", openapi.GetOpenAPIDefinitions). - WithoutEtcd() - - groupConfig := config.GroupConfig{ - BackendFn: register.NewBackend, - ApplyStorageToBackendFn: register.ApplyStorageToBackend, - Resources: []*config.ResourceConfig{ - {StorageProviderFn: register.NewIndexStorageProvider, Internal: &as.ASIndex{},ResourceVersions: []resource.Object{&as.ASIndex{}, &asbev1alpha1.ASIndex{}}}, - {StorageProviderFn: register.NewClaimStorageProvider, Internal: &as.ASClaim{}, ResourceVersions: []resource.Object{&as.ASClaim{}, &asbev1alpha1.ASClaim{}}}, - {StorageProviderFn: register.NewStorageProvider, Internal: &as.ASEntry{}, ResourceVersions: []resource.Object{&as.ASEntry{}, &asbev1alpha1.ASEntry{}}}, - }, - } - - be := groupConfig.BackendFn() - for _, resource := range groupConfig.Resources { - storageProvider := resource.StorageProviderFn(ctx,resource.Internal, be, true, &options.Options{ - Type: options.StorageType_Memory, - }) - for _, resourceVersion := range resource.ResourceVersions { - apiserver.WithResourceAndHandler(resourceVersion, storageProvider) - } - } - - if _, err := apiserver.Build(ctx); err != nil { - panic(err) - } - if err := groupConfig.ApplyStorageToBackendFn(ctx, be, apiserver); err != nil { - panic(err) - } - - index, err := getIndex(tc.index, tc.testType) - assert.NoError(t, err) - if err := be.CreateIndex(ctx, index); err != nil { - assert.Error(t, err) - } - if err := be.DeleteIndex(ctx, index); err != nil { - assert.Error(t, err) - } - if err := be.DeleteIndex(ctx, index); err != nil { - assert.Error(t, err) - } - }) - } -} diff --git a/pkg/backend/backend_interface.go b/pkg/backend/backend_interface.go index 2e1b53e..5e8b0b6 100644 --- a/pkg/backend/backend_interface.go +++ b/pkg/backend/backend_interface.go @@ -19,7 +19,6 @@ package backend import ( "context" - "github.com/henderiw/apiserver-store/pkg/generic/registry" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apiserver/pkg/registry/rest" ) @@ -31,11 +30,9 @@ type Backend interface { // DeleteIndex deletes a backend index DeleteIndex(ctx context.Context, obj runtime.Object) error // Claim claims an entry in the backend index - Claim(ctx context.Context, obj runtime.Object) error + Claim(ctx context.Context, obj runtime.Object, recursion bool) error // Release a claim in the backend - Release(ctx context.Context, obj runtime.Object) error + Release(ctx context.Context, obj runtime.Object, recursion bool) error // PrintEntries prints the entries of the cache PrintEntries(ctx context.Context, index string) - - GetClaimStorage() *registry.Store } diff --git a/pkg/backend/context.go b/pkg/backend/context.go index ec24d50..4c43d9c 100644 --- a/pkg/backend/context.go +++ b/pkg/backend/context.go @@ -23,14 +23,16 @@ import ( "github.com/henderiw/logger/log" "github.com/kuidio/kuid/apis/backend" + "k8s.io/apimachinery/pkg/types" + "sigs.k8s.io/controller-runtime/pkg/client" ) -func InitIndexContext(ctx context.Context, op string, idx backend.IndexObject) context.Context { +func InitIndexContext(ctx context.Context, op string, idx client.Object) context.Context { l := log.FromContext(ctx). With( "op", fmt.Sprintf("%s index", op), "gvk", idx.GetObjectKind().GroupVersionKind().String(), - "nsn", idx.GetNamespacedName().String(), + "nsn", types.NamespacedName{Namespace: idx.GetNamespace(), Name: idx.GetName()}.String(), ) return log.IntoContext(ctx, l) } diff --git a/pkg/backend/generic/backend.go b/pkg/backend/generic/backend.go index fec15eb..11fb568 100644 --- a/pkg/backend/generic/backend.go +++ b/pkg/backend/generic/backend.go @@ -2,8 +2,8 @@ package generic import ( "context" - "errors" "fmt" + "reflect" "sync" "github.com/henderiw/apiserver-store/pkg/generic/registry" @@ -18,9 +18,6 @@ import ( func New( claimKind string, - //indexGVK schema.GroupVersionKind, - //claimGVK schema.GroupVersionKind, - //entryGVK schema.GroupVersionKind, indexObjectFn func(runtime.Object) (backend.IndexObject, error), claimObjectFn func(runtime.Object) (backend.ClaimObject, error), entryObjectFn func(runtime.Object) (backend.EntryObject, error), @@ -30,11 +27,8 @@ func New( cache := bebackend.NewCache[*CacheInstanceContext]() return &be{ - cache: cache, - claimKind: claimKind, - //indexGVK: indexGVK, - //claimGVK: claimGVK, - //entryGVK: entryGVK, + cache: cache, + claimKind: claimKind, indexObjectFn: indexObjectFn, claimObjectFn: claimObjectFn, entryObjectFn: entryObjectFn, @@ -43,12 +37,9 @@ func New( } type be struct { - cache bebackend.Cache[*CacheInstanceContext] - m sync.RWMutex - claimKind string - //indexGVK schema.GroupVersionKind - //claimGVK schema.GroupVersionKind - //entryGVK schema.GroupVersionKind + cache bebackend.Cache[*CacheInstanceContext] + m sync.RWMutex + claimKind string indexObjectFn func(runtime.Object) (backend.IndexObject, error) claimObjectFn func(runtime.Object) (backend.ClaimObject, error) entryObjectFn func(runtime.Object) (backend.EntryObject, error) @@ -69,12 +60,12 @@ func (r *be) PrintEntries(ctx context.Context, index string) { func (r *be) AddStorage(entryStorage, claimStorage rest.Storage) error { entrystore, ok := entryStorage.(*registry.Store) if !ok { - return errors.New("entry store is not a *registry.Store") + return fmt.Errorf("entry store is not a *registry.Store, got: %v", reflect.TypeOf(claimStorage).Name()) } r.entryStorage = entrystore claimstore, ok := claimStorage.(*registry.Store) if !ok { - return errors.New("claim store is not a *registry.Store") + return fmt.Errorf("claim store is not a *registry.Store, got: %v", reflect.TypeOf(claimStorage).Name()) } r.claimStorage = claimstore return nil @@ -86,8 +77,8 @@ func (r *be) GetClaimStorage() *registry.Store { // CreateIndex creates a backend index func (r *be) CreateIndex(ctx context.Context, obj runtime.Object) error { - //r.m.Lock() - //defer r.m.Unlock() + r.m.Lock() + defer r.m.Unlock() index, err := r.indexObjectFn(obj) if err != nil { return err @@ -146,7 +137,7 @@ func (r *be) DeleteIndex(ctx context.Context, obj runtime.Object) error { return nil } -func (r *be) Claim(ctx context.Context, obj runtime.Object) error { +func (r *be) Claim(ctx context.Context, obj runtime.Object, recursion bool) error { r.m.Lock() defer r.m.Unlock() claim, err := r.claimObjectFn(obj) @@ -184,7 +175,7 @@ func (r *be) Claim(ctx context.Context, obj runtime.Object) error { return nil } -func (r *be) Release(ctx context.Context, obj runtime.Object) error { +func (r *be) Release(ctx context.Context, obj runtime.Object, recursion bool) error { r.m.Lock() defer r.m.Unlock() claim, err := r.claimObjectFn(obj) diff --git a/pkg/backend/generic/backend_store.go b/pkg/backend/generic/backend_store.go index 71312a1..27f2dd4 100644 --- a/pkg/backend/generic/backend_store.go +++ b/pkg/backend/generic/backend_store.go @@ -24,7 +24,6 @@ import ( func (r *be) restore(ctx context.Context, index backend.IndexObject) error { log := log.FromContext(ctx) - k := index.GetKey() cacheInstanceCtx, err := r.cache.Get(ctx, k) @@ -105,7 +104,7 @@ func (r *be) saveAll(ctx context.Context, k store.Key) error { continue } - defaultObjInfo := rest.DefaultUpdatedObjectInfo(oldEntry, entryTransformer) + defaultObjInfo := rest.DefaultUpdatedObjectInfo(oldEntry, EntryTransformer) if _, _, err := r.entryStorage.Update(ctx, oldEntry.GetName(), defaultObjInfo, nil, nil, false, &metav1.UpdateOptions{ FieldManager: "backend", }); err != nil { @@ -248,7 +247,10 @@ func (r *be) listClaims(ctx context.Context, k store.Key) (map[string]backend.Cl errm = errors.Join(errm, err) continue } - claimMap[claimObj.GetNamespacedName().String()] = claimObj + if claimObj.GetIndex() == k.Name { + claimMap[claimObj.GetNamespacedName().String()] = claimObj + } + } return claimMap, errm } @@ -350,8 +352,7 @@ func (r *be) restoreClaim(ctx context.Context, cacheInstanceCtx *CacheInstanceCo return nil } - -func entryTransformer(_ context.Context, newObj runtime.Object, oldObj runtime.Object) (runtime.Object, error) { +func EntryTransformer(_ context.Context, newObj runtime.Object, oldObj runtime.Object) (runtime.Object, error) { // Type assertion to specific object types, assuming we are working with a type that has Spec and Status fields new, ok := newObj.(backend.EntryObject) if !ok { @@ -366,4 +367,21 @@ func entryTransformer(_ context.Context, newObj runtime.Object, oldObj runtime.O new.SetUID(old.GetUID()) return new, nil -} \ No newline at end of file +} + +func ClaimTransformer(_ context.Context, newObj runtime.Object, oldObj runtime.Object) (runtime.Object, error) { + // Type assertion to specific object types, assuming we are working with a type that has Spec and Status fields + new, ok := newObj.(backend.ClaimObject) + if !ok { + return nil, fmt.Errorf("newObj is not of type ClaimObject, got: %v", reflect.TypeOf(newObj).Name()) + } + old, ok := oldObj.(backend.ClaimObject) + if !ok { + return nil, fmt.Errorf("oldObj is not of type ClaimObject, got: %v", reflect.TypeOf(newObj).Name()) + } + + new.SetResourceVersion(old.GetResourceVersion()) + new.SetUID(old.GetUID()) + + return new, nil +} diff --git a/pkg/backend/invoker.go b/pkg/backend/invoker.go index 20df0a3..cb76c46 100644 --- a/pkg/backend/invoker.go +++ b/pkg/backend/invoker.go @@ -33,16 +33,16 @@ type claimInvoker struct { be Backend } -func (r *claimInvoker) InvokeCreate(ctx context.Context, obj runtime.Object) error { - return r.be.Claim(ctx, obj) +func (r *claimInvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error { + return r.be.Claim(ctx, obj, recursion) } -func (r *claimInvoker) InvokeUpdate(ctx context.Context, obj, old runtime.Object) error { - return r.be.Claim(ctx, obj) +func (r *claimInvoker) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error { + return r.be.Claim(ctx, obj, recursion) } -func (r *claimInvoker) InvokeDelete(ctx context.Context, obj runtime.Object) error { - return r.be.Release(ctx, obj) +func (r *claimInvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error { + return r.be.Release(ctx, obj, recursion) } func NewIndexInvoker(be Backend) options.BackendInvoker { @@ -55,14 +55,14 @@ type indexPreparator struct { be Backend } -func (r *indexPreparator) InvokeCreate(ctx context.Context, obj runtime.Object) error { +func (r *indexPreparator) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error { return r.be.CreateIndex(ctx, obj) } -func (r *indexPreparator) InvokeUpdate(ctx context.Context, obj, old runtime.Object) error { +func (r *indexPreparator) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error { return r.be.CreateIndex(ctx, obj) } -func (r *indexPreparator) InvokeDelete(ctx context.Context, obj runtime.Object) error { +func (r *indexPreparator) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error { return r.be.DeleteIndex(ctx, obj) } diff --git a/pkg/backend/ipam/applicator.go b/pkg/backend/ipam/applicator.go new file mode 100644 index 0000000..a26b4bf --- /dev/null +++ b/pkg/backend/ipam/applicator.go @@ -0,0 +1,457 @@ +/* +Copyright 2024 Nokia. + +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 ipam + +import ( + "context" + "errors" + "fmt" + "strings" + + "github.com/hansthienpondt/nipam/pkg/table" + "github.com/henderiw/idxtable/pkg/iptable" + "github.com/henderiw/iputil" + "github.com/henderiw/logger/log" + "github.com/henderiw/store" + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/backend" + "github.com/kuidio/kuid/apis/backend/ipam" + "go4.org/netipx" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/utils/ptr" +) + +type Applicator interface { + Validate(ctx context.Context, claim *ipam.IPClaim) error + Apply(ctx context.Context, claim *ipam.IPClaim) error + Delete(ctx context.Context, claim *ipam.IPClaim) error +} + +type applicator struct { + cacheInstanceCtx *CacheInstanceContext +} + +func (r *applicator) getRoutesByOwner(_ context.Context, claim *ipam.IPClaim) (map[string]table.Routes, error) { + ribRoutes := map[string]table.Routes{} + // check if the prefix/claim already exists in the routing table + // based on the owner and the name of the claim + ownerSelector, err := claim.GetOwnerSelector() + if err != nil { + return ribRoutes, err + } + + claimSummaryType := claim.GetIPClaimSummaryType() + claimPrefixType := claim.GetIPPrefixType() + + ribRoutes[""] = r.cacheInstanceCtx.rib.GetByLabel(ownerSelector) + + // ranges and prefixes using network type can have multiple prefixes + if claimSummaryType == ipam.IPClaimSummaryType_Range || + (claimSummaryType == ipam.IPClaimSummaryType_Prefix && claimPrefixType == ipam.IPPrefixType_Network) { + // multiple routes can exist for this + return ribRoutes, nil + } + + if len(ribRoutes[""]) != 0 && len(ribRoutes[""]) > 1 { + return ribRoutes, fmt.Errorf("multiple prefixes match the owner, %v", ribRoutes[""]) + } + // add the search in the iptable for addresses + if claimSummaryType == ipam.IPClaimSummaryType_Address { + var errm error + r.cacheInstanceCtx.ranges.List(func(k store.Key, ipTable iptable.IPTable) { + ribRoutes[k.Name] = ipTable.GetByLabel(ownerSelector) + if len(ribRoutes[k.Name]) > 1 { + errm = errors.Join(errm, fmt.Errorf("multiple address match the owner, %v", ribRoutes[k.Name])) + return + } + }) + if errm != nil { + return ribRoutes, errm + } + } + return ribRoutes, nil +} + +// apply only works on the main rib +func (r *applicator) apply(ctx context.Context, claim *ipam.IPClaim, pis []*iputil.Prefix, networkParent bool, parentLabels map[string]string) error { + log := log.FromContext(ctx) + // check if the prefix/claim already exists in the routing table + // based on the name of the claim + existingRoutes, err := r.getRoutesByOwner(ctx, claim) + if err != nil { + return err + } + // get the new routes from claim and claimed prefix + // for network prefixes the routes can get expanded + newRoutes := table.Routes{} + for _, pi := range pis { + pi := pi + newRoutes = append(newRoutes, getRoutesFromClaim(ctx, claim, pi, networkParent, parentLabels)...) + + } + for _, newRoute := range newRoutes { + newRoute := newRoute + exists := false + var curRoute table.Route + for i, existingRoute := range existingRoutes[""] { + if existingRoute.Prefix().String() == newRoute.Prefix().String() { + // remove the route from the existing route list as we will delete the remaining + // existing routes later on + existingRoutes[""] = append(existingRoutes[""][:i], existingRoutes[""][i+1:]...) + exists = true + curRoute = existingRoute + } + } + log.Debug("apply route", "newRoute", newRoute.Prefix().String(), "exists", exists, "existsingRoutes", getExistingRoutes(existingRoutes[""])) + if exists { + // update + if err := r.updateRib(ctx, newRoute, curRoute); err != nil { + return err + } + } else { + // add + if err := r.addRib(ctx, newRoute); err != nil { + return err + } + } + } + for _, existingRoute := range existingRoutes[""] { + log.Debug("delete existsingRoute", "route", existingRoute.Prefix().String()) + if err := r.cacheInstanceCtx.rib.Delete(existingRoute); err != nil { + log.Error("cannot delete route from rib", "route", existingRoute, "error", err.Error()) + } + } + return nil +} + +func (r *applicator) applyAddressInRange(ctx context.Context, claim *ipam.IPClaim, pi *iputil.Prefix, rangeName string, labels map[string]string) error { + k := store.ToKey(rangeName) + ipTable, err := r.cacheInstanceCtx.ranges.Get(k) + if err != nil { + return err + } + routes := getRoutesFromClaim(ctx, claim, pi, false, labels) + addr := pi.Addr().String() + route, err := ipTable.Get(addr) + if err != nil { + ipTable.Claim(pi.Addr().String(), routes[0]) + return nil + } + if err := claim.ValidateOwner(route.Labels()); err != nil { + return err + } + return ipTable.Update(addr, routes[0]) +} + +func (r *applicator) applyRange(_ context.Context, claim *ipam.IPClaim, ipRange netipx.IPRange) error { + k := store.ToKey(claim.Name) + if _, err := r.cacheInstanceCtx.ranges.Get(k); err != nil { + ipTable := iptable.New(ipRange.From(), ipRange.To()) + if err := r.cacheInstanceCtx.ranges.Create(k, ipTable); err != nil { + return err + } + } + return nil +} + +func (r *applicator) updateClaimPrefixStatus(ctx context.Context, claim *ipam.IPClaim, pi *iputil.Prefix) { + claim.Status.Prefix = ptr.To[string](pi.String()) + if claim.GetIPPrefixType() == ipam.IPPrefixType_Network { + defaultGateway := r.getDefaultGateway(ctx, claim, pi) + if defaultGateway != "" { + claim.Status.DefaultGateway = ptr.To[string](defaultGateway) + } + } + claim.SetConditions(condition.Ready()) +} + +func (r *applicator) updateClaimAddressStatus(ctx context.Context, claim *ipam.IPClaim, pi *iputil.Prefix, networkParent bool) { + claim.Status.Address = ptr.To[string](pi.String()) + if claim.GetIPPrefixType() == ipam.IPPrefixType_Network || networkParent { + defaultGateway := r.getDefaultGateway(ctx, claim, pi) + if defaultGateway != "" { + claim.Status.DefaultGateway = ptr.To[string](defaultGateway) + } + } + claim.SetConditions(condition.Ready()) +} + +func (r *applicator) updateClaimRangeStatus(_ context.Context, claim *ipam.IPClaim) { + claim.Status.Range = claim.Spec.Range + claim.SetConditions(condition.Ready()) +} + +func (r *applicator) getDefaultGateway(ctx context.Context, claim *ipam.IPClaim, pi *iputil.Prefix) string { + log := log.FromContext(ctx) + defaultGatewaySelector, err := claim.GetDefaultGatewayLabelSelector(string(pi.GetSubnetName())) + if err != nil { + log.Error("cannot get gateway label selector", "error", err.Error()) + return "" + } + log.Debug("defaultGateway", "defaultGatewaySelector", defaultGatewaySelector) + routes := r.cacheInstanceCtx.rib.GetByLabel(defaultGatewaySelector) + if len(routes) > 0 { + log.Debug("defaultGateway", "routes", routes) + return routes[0].Prefix().Addr().String() + } + return "" +} + +// getRoutesFromClaim return the reoutes with the assocated labels from the claim +// for network based prefixes multiple routes can be returned as they might get expanded +func getRoutesFromClaim(_ context.Context, claim *ipam.IPClaim, pi *iputil.Prefix, networkParent bool, parentLabels map[string]string) []table.Route { + routes := []table.Route{} + + labels := claim.Spec.GetUserDefinedLabels() + for k, v := range parentLabels { + labels[k] = v + } + // for ipclaims originated from the ipindex (aggregate prefixes) the uid, claimName, kind + ipIndexClaim := "false" + for _, ownerref := range claim.GetOwnerReferences() { + if ownerref.Kind == ipam.IPIndexKind { + ipIndexClaim = "true" + } + } + + // system defined labels + ipClaimType, _ := claim.GetIPClaimType() + labels[backend.KuidIPAMClaimSummaryTypeKey] = string(claim.GetIPClaimSummaryType()) + labels[backend.KuidClaimTypeKey] = string(ipClaimType) + labels[backend.KuidIPAMIPPrefixTypeKey] = string(claim.GetIPPrefixType()) + labels[backend.KuidOwnerKindKey] = ipam.IPClaimKind + labels[backend.KuidClaimNameKey] = claim.Name + labels[backend.KuidClaimUIDKey] = string(claim.UID) + labels[backend.KuidIPAMddressFamilyKey] = string(pi.GetAddressFamily()) + labels[backend.KuidIPAMSubnetKey] = pi.GetSubnetName() + labels[backend.KuidIndexEntryKey] = ipIndexClaim + + if claim.Spec.DefaultGateway != nil && *claim.Spec.DefaultGateway { + labels[backend.KuidIPAMDefaultGatewayKey] = "true" + } + + prefix := pi.GetIPPrefix() + // networkParent is there for dynamic addresses as we dont know ahead of time + // if the dynamic address matches a network or other parent prefix + if claim.GetIPPrefixType() == ipam.IPPrefixType_Network || networkParent { + if claim.GetIPClaimSummaryType() == ipam.IPClaimSummaryType_Prefix { + switch { + case pi.GetAddressFamily() == iputil.AddressFamilyIpv4 && pi.GetPrefixLength().Int() == 31, + pi.GetAddressFamily() == iputil.AddressFamilyIpv6 && pi.GetPrefixLength().Int() == 127: + routes = append(routes, getNetworkNetRoute(labels, pi)) + case pi.IsNorLastNorFirst(): + routes = append(routes, getNetworkNetRoute(labels, pi)) + routes = append(routes, getNetworIPAddressRoute(labels, pi)) + routes = append(routes, getNetworFirstAddressRoute(labels, pi)) + routes = append(routes, getNetworLastAddressRoute(labels, pi)) + case pi.IsFirst(): + routes = append(routes, getNetworkNetRoute(labels, pi)) + routes = append(routes, getNetworIPAddressRoute(labels, pi)) + routes = append(routes, getNetworLastAddressRoute(labels, pi)) + case pi.IsLast(): + routes = append(routes, getNetworkNetRoute(labels, pi)) + routes = append(routes, getNetworIPAddressRoute(labels, pi)) + routes = append(routes, getNetworFirstAddressRoute(labels, pi)) + } + return routes + } else { + // return address + prefix = pi.GetIPAddressPrefix() + } + } + routes = append(routes, table.NewRoute(prefix, labels, map[string]any{})) + return routes +} + +func getNetworkNetRoute(l map[string]string, pi *iputil.Prefix) table.Route { + labels := map[string]string{} + for k, v := range l { + labels[k] = v + } + delete(labels, backend.KuidIPAMDefaultGatewayKey) + delete(labels, backend.KuidINVEndpointKey) + return table.NewRoute(pi.GetIPSubnet(), labels, map[string]any{}) +} + +func getNetworIPAddressRoute(l map[string]string, pi *iputil.Prefix) table.Route { + labels := map[string]string{} + for k, v := range l { + labels[k] = v + } + if pi.IsFirst() || pi.IsLast() { + delete(labels, backend.KuidIPAMDefaultGatewayKey) + } + return table.NewRoute(pi.GetIPAddressPrefix(), labels, map[string]any{}) +} + +func getNetworFirstAddressRoute(l map[string]string, pi *iputil.Prefix) table.Route { + labels := map[string]string{} + for k, v := range l { + labels[k] = v + } + delete(labels, backend.KuidIPAMDefaultGatewayKey) + delete(labels, backend.KuidINVEndpointKey) + return table.NewRoute(pi.GetFirstIPPrefix(), labels, map[string]any{}) +} + +func getNetworLastAddressRoute(l map[string]string, pi *iputil.Prefix) table.Route { + labels := map[string]string{} + for k, v := range l { + labels[k] = v + } + delete(labels, backend.KuidIPAMDefaultGatewayKey) + delete(labels, backend.KuidINVEndpointKey) + return table.NewRoute(pi.GetLastIPPrefix(), labels, map[string]any{}) +} + +func (r *applicator) addRib(ctx context.Context, route table.Route) error { + log := log.FromContext(ctx) + if err := r.cacheInstanceCtx.rib.Add(route); err != nil { + if !strings.Contains(err.Error(), "already exists") { + log.Error("cannot add prefix") + return fmt.Errorf("cannot add prefix, err: %s", err.Error()) + } + } + return nil +} + +func (r *applicator) updateRib(ctx context.Context, newRoute, existingRoute table.Route) error { + log := log.FromContext(ctx) + // check if the labels changed + // if changed inform the owner GVKs through the watch + if !labels.Equals(newRoute.Labels(), existingRoute.Labels()) { + // workaround -> should become an atomic update + //route = route.DeleteLabels() + //route = route.UpdateLabel(lbls) + log.Debug("update rib with new label info", "route prefix", newRoute.Prefix().String(), "newRoute labels", newRoute.Labels(), "existsingRoute labels", existingRoute.Labels()) + if err := r.cacheInstanceCtx.rib.Set(newRoute); err != nil { + if !strings.Contains(err.Error(), "already exists") { + log.Error("cannot update prefix", "error", err.Error()) + return fmt.Errorf("cannot update prefix, err: %s", err.Error()) + } + } + // this is an update where the labels changed + // only update when not initializing + // only update when the prefix is a non /32 or /128 + pi := iputil.NewPrefixInfo(newRoute.Prefix()) + if pi != nil && !pi.IsAddressPrefix() { + log.Debug("inform children of the change/update", "existingRoute", existingRoute.Prefix().String(), "labels", newRoute.Labels()) + // delete the children from the rib + // update the once that have a nsn different from the origin + childRoutesToBeUpdated := []table.Route{} + for _, childRoute := range existingRoute.Children(r.cacheInstanceCtx.rib) { + log.Debug("inform children of the change/update", "existingRoute", existingRoute.Prefix().String(), "child route", childRoute) + if childRoute.Labels()[backend.KuidClaimNameKey] != newRoute.Labels()[backend.KuidClaimNameKey] { + childRoutesToBeUpdated = append(childRoutesToBeUpdated, childRoute) + if err := r.cacheInstanceCtx.rib.Delete(childRoute); err != nil { + log.Error("cannot delete route from rib", "route", childRoute, "error", err.Error()) + continue + } + } + } + // handler watch update to the source owner controller + log.Debug("inform children of the change/update", "existingRoute", existingRoute.Prefix().String(), "child routes", childRoutesToBeUpdated) + } + } + return nil +} + +// Delete deletes the claimation based on the ownerslector and deletes all prefixes associated with the ownerseelctor +// if no prefixes are found, no error is returned +func (r *applicator) delete(ctx context.Context, claim *ipam.IPClaim) error { + log := log.FromContext(ctx) + log.Debug("delete") + + existingRoutes, err := r.getRoutesByOwner(ctx, claim) + if err != nil { + return err + } + + for ribName, existingRoutes := range existingRoutes { + if ribName == "" { + for _, existingRoute := range existingRoutes { + log = log.With("route prefix", existingRoute.Prefix()) + // this is a delete + // only update when not initializing + // only update when the prefix is a non /32 or /128 + // only update when the parent is a create prefix type + pi := iputil.NewPrefixInfo(existingRoute.Prefix()) + if pi != nil && !pi.IsAddressPrefix() { + log.Debug("inform children of the delete", "existingRoute", existingRoute.Prefix().String(), "labels", existingRoute.Labels()) + // delete the children from the rib + // update the once that have a nsn different from the origin + childRoutesToBeUpdated := []table.Route{} + for _, childRoute := range existingRoute.Children(r.cacheInstanceCtx.rib) { + log.Debug("route exists", "handle delete for route", existingRoute, "child route", childRoute) + if childRoute.Labels()[backend.KuidClaimNameKey] != claim.Name { + childRoutesToBeUpdated = append(childRoutesToBeUpdated, childRoute) + if err := r.cacheInstanceCtx.rib.Delete(childRoute); err != nil { + log.Error("cannot delete route from rib", "route", childRoute, "error", err.Error()) + } + } + } + // handler watch update to the source owner controller + log.Debug("route exists", "handle update for route", existingRoute, "child routes", childRoutesToBeUpdated) + } + + if err := r.cacheInstanceCtx.rib.Delete(existingRoute); err != nil { + return err + } + + // check if the route was a range -> if so delete the range table + routeLabels := existingRoute.Labels() + parentClaimSummaryType := ipam.GetIPClaimSummaryTypeFromString(routeLabels[backend.KuidIPAMClaimSummaryTypeKey]) + parentClaimName := routeLabels[backend.KuidClaimNameKey] + + if parentClaimSummaryType == ipam.IPClaimSummaryType_Range { + k := store.ToKey(parentClaimName) // this is the name of the range + if _, err := r.cacheInstanceCtx.ranges.Get(k); err == nil { + // the table exists -> delete it + if err := r.cacheInstanceCtx.ranges.Delete(k); err != nil { + return err + } + } + } + } + } else { + k := store.ToKey(ribName) + if len(existingRoutes) > 0 { + if ipTable, err := r.cacheInstanceCtx.ranges.Get(k); err == nil { + // the table exists + for _, existingRoute := range existingRoutes { + if _, err := ipTable.Get(existingRoute.Prefix().Addr().String()); err == nil { + if err := ipTable.Release(existingRoute.Prefix().Addr().String()); err != nil { + return err + } + } + } + } + } + } + } + return nil +} + +func (r *applicator) getRoutesByLabel(ctx context.Context, claim *ipam.IPClaim) table.Routes { + log := log.FromContext(ctx) + labelSelector, err := claim.GetLabelSelector() + if err != nil { + log.Error("cannot get label selector", "error", err.Error()) + return []table.Route{} + } + return r.cacheInstanceCtx.rib.GetByLabel(labelSelector) +} diff --git a/pkg/backend/ipam/applicator_dynamic_address.go b/pkg/backend/ipam/applicator_dynamic_address.go new file mode 100644 index 0000000..6203871 --- /dev/null +++ b/pkg/backend/ipam/applicator_dynamic_address.go @@ -0,0 +1,238 @@ +/* +Copyright 2024 Nokia. + +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 ipam + +import ( + "context" + "fmt" + "net/netip" + + "github.com/hansthienpondt/nipam/pkg/table" + "github.com/henderiw/iputil" + "github.com/henderiw/logger/log" + "github.com/henderiw/store" + "github.com/kuidio/kuid/apis/backend" + "github.com/kuidio/kuid/apis/backend/ipam" +) + +type dynamicAddressApplicator struct { + name string + applicator + parentClaimSummaryType ipam.IPClaimSummaryType + parentRangeName string + parentNetwork bool + parentLabels map[string]string +} + +func (r *dynamicAddressApplicator) Validate(ctx context.Context, claim *ipam.IPClaim) error { + return nil +} + +func (r *dynamicAddressApplicator) Apply(ctx context.Context, claim *ipam.IPClaim) error { + log := log.FromContext(ctx) + log.Debug("apply") + + pi, err := r.validateExists(ctx, claim) + if err != nil { + return err + } + if pi == nil { + // we need to claim an ip address + pi, err = r.claimIP(ctx, claim) + if err != nil { + return err + } + } + + if r.parentClaimSummaryType == ipam.IPClaimSummaryType_Range { + if err := r.applyAddressInRange(ctx, claim, pi, r.parentRangeName, r.parentLabels); err != nil { + return err + } + } else { + // the claimType is coming from the parent for addresses + if err := r.apply(ctx, claim, []*iputil.Prefix{pi}, r.parentNetwork, r.parentLabels); err != nil { + return err + } + } + r.updateClaimAddressStatus(ctx, claim, pi, r.parentNetwork) + return nil +} + +func (r *dynamicAddressApplicator) validateExists(ctx context.Context, claim *ipam.IPClaim) (*iputil.Prefix, error) { + existingRoutes, err := r.getRoutesByOwner(ctx, claim) + if err != nil { + return nil, err + } + + for ribName, existingRoutes := range existingRoutes { + if len(existingRoutes) > 1 { + return nil, fmt.Errorf("cannot have multiple routes for an address entry") + } + // Now we have only 1 route + if ribName == "" { + for _, existingRoute := range existingRoutes { + // + if claim.Status.Address != nil { + spi, err := iputil.New(*claim.Status.Address) + if err != nil { + return nil, err + } + // since network based addresses return the parent prefixlength + // we need to return the same address from the status iso the one + // in the rib + // e.g. 10.0.0.1/24 is in the rib 10.0.0.1/32 but the status reflects + // 10.0.0.1/24 + if spi.Addr().String() == existingRoute.Prefix().Addr().String() { + if spi.GetPrefixLength() != spi.GetAddressPrefixLength() { + r.parentLabels = getUserDefinedLabels(findMostSpecificParent(existingRoute.Parents(r.cacheInstanceCtx.rib)).Labels()) + r.parentNetwork = true + } + return spi, nil + } + } + // we delete the route if the claim status is empty or does not match + // and reallocate + if err := r.cacheInstanceCtx.rib.Delete(existingRoutes[0]); err != nil { + return nil, err + } + } + } else { + k := store.ToKey(ribName) + if len(existingRoutes) > 0 { + if ipTable, err := r.cacheInstanceCtx.ranges.Get(k); err == nil { + // the table exists + for _, existingRoute := range existingRoutes { + r.parentRangeName = ribName + r.parentClaimSummaryType = ipam.IPClaimSummaryType_Range + if claim.Status.Address != nil { + spi, err := iputil.New(*claim.Status.Address) + if err != nil { + return nil, err + } + if spi.Addr().String() == existingRoute.Prefix().Addr().String() { + return spi, nil + } + } + // we delete the route if the claim status is empty or does not match + // and reallocate + if err := ipTable.Release(existingRoute.Prefix().Addr().String()); err != nil { + return nil, err + } + } + } + } + } + } + return nil, nil +} + +func (r *dynamicAddressApplicator) claimIP(ctx context.Context, claim *ipam.IPClaim) (*iputil.Prefix, error) { + // if not claimed, try to claim an address + parentRoutes := r.getRoutesByLabel(ctx, claim) + if len(parentRoutes) == 0 { + return nil, fmt.Errorf("dynamic claim: no available routes based on the selector labels %v", claim.Spec.GetSelectorLabels()) + } + return r.selectAddress(ctx, claim, parentRoutes) +} + +func (r *dynamicAddressApplicator) selectAddress(_ context.Context, claim *ipam.IPClaim, parentRoutes table.Routes) (*iputil.Prefix, error) { + routes := make([]string, 0, len(parentRoutes)) + for _, parentRoute := range parentRoutes { + routes = append(routes, parentRoute.Prefix().String()) + routeLabels := parentRoute.Labels() + parentIPPrefixType := ipam.GetIPPrefixTypeFromString(routeLabels[backend.KuidIPAMIPPrefixTypeKey]) + parentClaimSummaryType := ipam.GetIPClaimSummaryTypeFromString(routeLabels[backend.KuidIPAMClaimSummaryTypeKey]) + parentClaimName := routeLabels[backend.KuidClaimNameKey] + // update the context such that the applicator can use this information to apply the IP + r.parentClaimSummaryType = parentClaimSummaryType + r.parentRangeName = parentClaimName + r.parentLabels = getUserDefinedLabels(routeLabels) + if parentIPPrefixType != nil && *parentIPPrefixType == ipam.IPPrefixType_Network { + r.parentNetwork = true + } + + pi := iputil.NewPrefixInfo(parentRoute.Prefix()) + + switch parentClaimSummaryType { + case ipam.IPClaimSummaryType_Range: + // lookup range -> try to claim an ip from the range + k := store.ToKey(parentClaimName) + ipTable, err := r.cacheInstanceCtx.ranges.Get(k) + if err != nil { + return nil, fmt.Errorf("selectAddress range does not have corresponding range table: err: %s", err.Error()) + } + + if claim.Status.Address != nil { + statuspi, err := iputil.New(*claim.Status.Address) + if err != nil { + return nil, err + } + + route, err := ipTable.Get(statuspi.GetIPAddress().String()) + if err == nil { // error means found + if err := claim.ValidateOwner(route.Labels()); err == nil { + return statuspi, nil // route already exists + } + } + } + addr, err := ipTable.FindFree() + if err != nil { + return nil, err + } + return iputil.NewPrefixInfo(netip.PrefixFrom(addr, int(pi.GetAddressPrefixLength()))), nil + + case ipam.IPClaimSummaryType_Prefix: + if parentIPPrefixType != nil && (*parentIPPrefixType == ipam.IPPrefixType_Network || *parentIPPrefixType == ipam.IPPrefixType_Pool) { + parentpi := iputil.NewPrefixInfo(parentRoute.Prefix()) + if claim.Status.Address != nil { + statuspi, err := iputil.New(*claim.Status.Address) + if err != nil { + return nil, err + } + // check if the route is free in the rib + prefixLength := pi.GetAddressPrefixLength() + if _, ok := r.cacheInstanceCtx.rib.Get(netip.PrefixFrom(statuspi.Addr(), prefixLength.Int())); !ok { + return statuspi, nil + } + } + + // gather the prefixLength - use address based prefixLength /32 or /128 to validate the rib + // for netowork allocations use the parent prefixLength + prefixLength := pi.GetAddressPrefixLength() + if isParentRouteSelectable(parentRoute, uint8(prefixLength)) { + p := r.cacheInstanceCtx.rib.GetAvailablePrefixByBitLen(pi.GetIPPrefix(), uint8(prefixLength.Int())) + if p.IsValid() { + // success, parentClaimType was already checked for non nil + if *parentIPPrefixType == ipam.IPPrefixType_Network { + return iputil.NewPrefixInfo(netip.PrefixFrom(p.Addr(), int(parentpi.GetPrefixLength()))), nil + } else { + return iputil.NewPrefixInfo(p), nil + } + } + } + } + default: + } + } + return nil, fmt.Errorf("no free addresses found in routes: %v", routes) +} + +func (r *dynamicAddressApplicator) Delete(ctx context.Context, claim *ipam.IPClaim) error { + log := log.FromContext(ctx) + log.Debug("delete") + return r.delete(ctx, claim) +} diff --git a/pkg/backend/ipam/applicator_dynamic_prefix.go b/pkg/backend/ipam/applicator_dynamic_prefix.go new file mode 100644 index 0000000..0f77fa7 --- /dev/null +++ b/pkg/backend/ipam/applicator_dynamic_prefix.go @@ -0,0 +1,134 @@ +/* +Copyright 2024 Nokia. + +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 ipam + +import ( + "context" + "errors" + "fmt" + + "github.com/henderiw/iputil" + "github.com/henderiw/logger/log" + "github.com/kuidio/kuid/apis/backend/ipam" +) + +type dynamicPrefixApplicator struct { + name string + applicator +} + +func (r *dynamicPrefixApplicator) Validate(ctx context.Context, claim *ipam.IPClaim) error { + return nil +} + +func (r *dynamicPrefixApplicator) Apply(ctx context.Context, claim *ipam.IPClaim) error { + log := log.FromContext(ctx) + log.Debug("apply") + + pi, err := r.validateExists(ctx, claim) + if err != nil { + return err + } + if pi == nil { + // we need to claim an ip address + pi, err = r.claimPrefix(ctx, claim) + if err != nil { + return err + } + } + + // the claimType is coming from the parent for addresses + if err := r.apply(ctx, claim, []*iputil.Prefix{pi}, false, map[string]string{}); err != nil { + return err + } + + r.updateClaimPrefixStatus(ctx, claim, pi) + return nil +} + +func (r *dynamicPrefixApplicator) validateExists(ctx context.Context, claim *ipam.IPClaim) (*iputil.Prefix, error) { + existingRoutes, err := r.getRoutesByOwner(ctx, claim) + if err != nil { + return nil, err + } + for _, existingRoute := range existingRoutes[""] { + // validate if the existing prefix/address is in the routing + // table -> if so we return -> apply takes care of the cleanup + if claim.Status.Prefix != nil { + spi, err := iputil.New(*claim.Status.Prefix) + if err != nil { + return nil, err + } + epi := iputil.NewPrefixInfo(existingRoute.Prefix()) + if spi.GetIPAddress() == epi.GetIPAddress() { + return spi, nil + } + } + } + return nil, nil +} + +func (r *dynamicPrefixApplicator) claimPrefix(ctx context.Context, claim *ipam.IPClaim) (*iputil.Prefix, error) { + log := log.FromContext(ctx) + // if not claimed, try to claim an address + parentRoutes := r.getRoutesByLabel(ctx, claim) + if len(parentRoutes) == 0 { + return nil, fmt.Errorf("dynamic claim: no available routes based on the selector labels %v", claim.Spec.GetSelectorLabels()) + } + // try to reclaim the prefix if the prefix was already claimed + if claim.Status.Prefix != nil { + pi, err := iputil.New(*claim.Status.Prefix) + if err != nil { + return nil, err + } + log.Debug("refresh claimed prefix", + "claimedPrefix", claim.Status.Prefix, + "prefixlength", pi.GetPrefixLength()) + + // check if the prefix is available + p := r.cacheInstanceCtx.rib.GetAvailablePrefixByBitLen(pi.GetIPPrefix(), uint8(pi.GetPrefixLength())) + if p.IsValid() { + log.Debug("refresh claimed prefix finished", + "claimedPrefix", claim.Status.Prefix) + // previously claimed prefix is available and reassigned + return iputil.NewPrefixInfo(p), nil + } + log.Debug("refresh claim prefix not available", + "claimedPrefix", claim.Status.Prefix, + "prefixlength", pi.GetPrefixLength()) + } + + // A prefix claim always need a prefix length + prefixLength := iputil.PrefixLength(*claim.Spec.PrefixLength) + for _, parentRoute := range parentRoutes { + if isParentRouteSelectable(parentRoute, uint8(prefixLength)) { + pi := iputil.NewPrefixInfo(parentRoute.Prefix()) + p := r.cacheInstanceCtx.rib.GetAvailablePrefixByBitLen(pi.GetIPPrefix(), uint8(prefixLength.Int())) + if p.IsValid() { + // success + return iputil.NewPrefixInfo(p), nil + } + } + } + return nil, errors.New("no free prefix found") +} + +func (r *dynamicPrefixApplicator) Delete(ctx context.Context, claim *ipam.IPClaim) error { + log := log.FromContext(ctx) + log.Debug("delete") + return r.delete(ctx, claim) +} diff --git a/pkg/backend/ipam/applicator_static_address.go b/pkg/backend/ipam/applicator_static_address.go new file mode 100644 index 0000000..ca3bdfb --- /dev/null +++ b/pkg/backend/ipam/applicator_static_address.go @@ -0,0 +1,204 @@ +/* +Copyright 2024 Nokia. + +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 ipam + +import ( + "context" + "fmt" + + "github.com/hansthienpondt/nipam/pkg/table" + "github.com/henderiw/iputil" + "github.com/henderiw/logger/log" + "github.com/henderiw/store" + "github.com/kuidio/kuid/apis/backend" + "github.com/kuidio/kuid/apis/backend/ipam" +) + +type staticAddressApplicator struct { + name string + applicator + exists bool + parentClaimSummaryType ipam.IPClaimSummaryType + parentRangeName string + parentNetwork bool + parentLabels map[string]string +} + +func (r *staticAddressApplicator) Validate(ctx context.Context, claim *ipam.IPClaim) error { + log := log.FromContext(ctx) + log.Debug("validate") + if claim.Spec.Address == nil { + return fmt.Errorf("cannot claim a static ip address without an address") + } + exists, err := r.validateExists(ctx, claim) + if err != nil { + return err + } + if exists { + // we can return since we trust the previous insertion in the tree + r.exists = exists + return nil + } + + if err := r.validateParents(ctx, claim); err != nil { + return err + } + + if err := r.validateChildren(ctx, claim); err != nil { + return err + } + return nil + +} + +func (r *staticAddressApplicator) validateExists(_ context.Context, claim *ipam.IPClaim) (bool, error) { + pi, err := iputil.New(*claim.Spec.Address) + if err != nil { + return false, err + } + + // There is 2 scenario's: + // an address with /32 or /128 prefixLength: 10.0.0.1/32 -> address prefix + // an address with a dedicated prefixLength: 10.0.0.1/24 (only allowed for network) + // check the /32 or /128 equivalent in the rib + route, ok := r.cacheInstanceCtx.rib.Get(pi.GetIPAddressPrefix()) + if ok { + // if the route exists validate the owner + routeLabels := route.Labels() + // a range is an exception as it can overlap with an address in the main rib + if routeLabels[backend.KuidIPAMClaimSummaryTypeKey] == string(ipam.IPClaimSummaryType_Range) { + r.parentClaimSummaryType = ipam.IPClaimSummaryType_Range + r.parentRangeName = routeLabels[backend.KuidClaimNameKey] + return true, nil + } else { + if err := claim.ValidateOwner(routeLabels); err != nil { + return false, err + } + return true, nil + } + } + // address does not exist + return false, nil +} + +func (r *staticAddressApplicator) validateParents(ctx context.Context, claim *ipam.IPClaim) error { + pi, err := iputil.New(*claim.Spec.Address) + if err != nil { + return err + } + + parentRoutes := r.cacheInstanceCtx.rib.Parents(pi.GetIPAddressPrefix()) + if len(parentRoutes) == 0 { + return fmt.Errorf("a prefix range always needs a parent") + } + + // the library returns all parent routes, but we need to most specific + parentRoute := findMostSpecificParent(parentRoutes) + if err := r.validateParent(ctx, parentRoute, claim); err != nil { + return err + } + return nil +} + +func (r *staticAddressApplicator) validateParent(_ context.Context, route table.Route, claim *ipam.IPClaim) error { + pi, err := iputil.New(*claim.Spec.Address) + if err != nil { + return err + } + + routeLabels := route.Labels() + parentIPPrefixType := ipam.GetIPPrefixTypeFromString(routeLabels[backend.KuidIPAMIPPrefixTypeKey]) + parentClaimSummaryType := ipam.GetIPClaimSummaryTypeFromString(routeLabels[backend.KuidIPAMClaimSummaryTypeKey]) + parentClaimName := routeLabels[backend.KuidClaimNameKey] + // update the context such that the applicator can use this information to apply the IP + r.parentClaimSummaryType = parentClaimSummaryType + r.parentRangeName = parentClaimName + r.parentLabels = getUserDefinedLabels(routeLabels) + + if pi.IsAddressPrefix() { + // 32 or /128 -> cannot be claimed in a network or aggregate + if parentIPPrefixType != nil && + (*parentIPPrefixType == ipam.IPPrefixType_Network) { + return fmt.Errorf("a /32 or /128 address is not possible with a parent of type %s", *parentIPPrefixType) + } + if parentClaimSummaryType == ipam.IPClaimSummaryType_Range { + k := store.ToKey(parentClaimName) + ipTable, err := r.applicator.cacheInstanceCtx.ranges.Get(k) + if err != nil { + return err + } + route, err := ipTable.Get(pi.GetIPAddress().String()) + if err == nil { // error means not found + if err := claim.ValidateOwner(route.Labels()); err != nil { + return fmt.Errorf("address is already allocated in range %s, err: %s", parentClaimName, err.Error()) + } + } + return nil + } + } else { + // an address with a dedicated prefixLength is only possible for network prefix parents + if parentIPPrefixType != nil && *parentIPPrefixType != ipam.IPPrefixType_Network { + return fmt.Errorf("a prefix based address is not possible with a parent of type %s", *parentIPPrefixType) + } + if parentClaimSummaryType == ipam.IPClaimSummaryType_Range { + return fmt.Errorf("a prefix based address is not possible for a %v", parentIPPrefixType) + } + r.parentNetwork = true + } + return nil +} + +func (r *staticAddressApplicator) validateChildren(_ context.Context, claim *ipam.IPClaim) error { + pi, err := iputil.New(*claim.Spec.Address) + if err != nil { + return err + } + childRoutes := r.cacheInstanceCtx.rib.Children(pi.GetIPAddressPrefix()) + if len(childRoutes) > 0 { + return fmt.Errorf("an address based prefix %s cannot have children", *claim.Spec.Address) + } + + return nil +} + +func (r *staticAddressApplicator) Apply(ctx context.Context, claim *ipam.IPClaim) error { + log := log.FromContext(ctx) + log.Debug("apply") + + pi, err := iputil.New(*claim.Spec.Address) + if err != nil { + return err + } + if r.parentClaimSummaryType == ipam.IPClaimSummaryType_Range { + if err := r.applyAddressInRange(ctx, claim, pi, r.parentRangeName, r.parentLabels); err != nil { + return err + } + } else { + if err := r.apply(ctx, claim, []*iputil.Prefix{pi}, false, r.parentLabels); err != nil { + return err + } + } + + r.updateClaimAddressStatus(ctx, claim, pi, r.parentNetwork) + return nil +} + +func (r *staticAddressApplicator) Delete(ctx context.Context, claim *ipam.IPClaim) error { + log := log.FromContext(ctx) + log.Debug("delete") + return r.delete(ctx, claim) +} diff --git a/pkg/backend/ipam/applicator_static_prefix.go b/pkg/backend/ipam/applicator_static_prefix.go new file mode 100644 index 0000000..4b0c859 --- /dev/null +++ b/pkg/backend/ipam/applicator_static_prefix.go @@ -0,0 +1,193 @@ +/* +Copyright 2024 Nokia. + +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 ipam + +import ( + "context" + "fmt" + + "github.com/hansthienpondt/nipam/pkg/table" + "github.com/henderiw/iputil" + "github.com/henderiw/logger/log" + "github.com/kform-dev/choreo/apis/kuid/backend" + "github.com/kuidio/kuid/apis/backend/ipam" +) + +type staticPrefixApplicator struct { + name string + applicator + exists bool +} + +func (r *staticPrefixApplicator) Validate(ctx context.Context, claim *ipam.IPClaim) error { + log := log.FromContext(ctx) + log.Debug("validate") + if claim.Spec.Prefix == nil { + return fmt.Errorf("cannot claim a static ip prefix without a prefix") + } + + exists, err := r.validateExists(ctx, claim) + if err != nil { + return err + } + if exists { + // we can return since we trust the previous insertion in the tree + r.exists = exists + return nil + } + + if err := r.validateParents(ctx, claim); err != nil { + return err + } + + if err := r.validateChildren(ctx, claim); err != nil { + return err + } + return nil + +} + +func (r *staticPrefixApplicator) validateExists(_ context.Context, claim *ipam.IPClaim) (bool, error) { + pi, err := iputil.New(*claim.Spec.Prefix) + if err != nil { + return false, err + } + + // There is 2 scenario's: + // a regular prefix w/o address: 10.0.0.0/24 + // an address based prefix (only allowed for claimType network): 10.0.0.1/24 + // to accomodate for both scenario;s we check the subnet prefix 10.0.0.0/24 for either scenario + route, ok := r.cacheInstanceCtx.rib.Get(pi.GetIPSubnet()) + if ok { + // entry exists; validate the owner to see if someone else owns this prefix + labels := route.Labels() + if err := claim.ValidateOwner(labels); err != nil { + return false, err + } + return true, nil + } + return false, nil +} + +func (r *staticPrefixApplicator) validateParents(ctx context.Context, claim *ipam.IPClaim) error { + pi, err := iputil.New(*claim.Spec.Prefix) + if err != nil { + return err + } + + parentRoutes := r.cacheInstanceCtx.rib.Parents(pi.GetIPSubnet()) + if len(parentRoutes) == 0 { + // a parent route is always required unless you are an aggregate route owned + // by an IP Index + if !claim.IsOwnedByIPIndex() { + return fmt.Errorf("no parent found, only possible for routes owned by IPIndex") + } + return nil + } + parentRoute := findMostSpecificParent(parentRoutes) + if err := r.validateParent(ctx, parentRoute, claim); err != nil { + return err + } + return nil + +} + +func (r *staticPrefixApplicator) validateParent(_ context.Context, route table.Route, claim *ipam.IPClaim) error { + prefixType := claim.GetIPPrefixType() + + routeLabels := route.Labels() + parentClaimSummaryType := routeLabels[backend.KuidIPAMClaimSummaryTypeKey] + parentClaimPrefixType := routeLabels[backend.KuidIPAMIPPrefixTypeKey] + switch prefixType { + case ipam.IPPrefixType_Aggregate: + // aggregates can be aggregated by aggregates + return nil + case ipam.IPPrefixType_Network, ipam.IPPrefixType_Pool: + // we only allow range and addresses -> these dont have a claimType + if parentClaimSummaryType == string(ipam.IPClaimSummaryType_Address) || + parentClaimSummaryType == string(ipam.IPClaimSummaryType_Range) { + return fmt.Errorf("parent %s not allowed in claim of type %s", parentClaimSummaryType, prefixType) + } + if parentClaimPrefixType == string(ipam.IPPrefixType_Network) || + parentClaimPrefixType == string(ipam.IPPrefixType_Pool) { + return fmt.Errorf("parent %s/%s nesting %s/%s is not possible", route.Prefix().String(), *claim.Spec.Prefix, parentClaimPrefixType, prefixType) + } + default: + return fmt.Errorf("invalid prefixType: %s", prefixType) + } + return nil +} + +func (r *staticPrefixApplicator) validateChildren(_ context.Context, claim *ipam.IPClaim) error { + // network, aggregate, pool + prefixType := claim.GetIPPrefixType() + pi, err := iputil.New(*claim.Spec.Prefix) + if err != nil { + return err + } + + // There is 2 scenario's: + // a regular prefix w/o address: 10.0.0.0/24 + // an address based prefix (only allowed for claimType network): 10.0.0.1/24 + // to accomodate for both scenario;s we check the subnet prefix 10.0.0.0/24 for either scenario + childRoutes := r.cacheInstanceCtx.rib.Children(pi.GetIPSubnet()) + for _, childRoute := range childRoutes { + routeLabels := childRoute.Labels() + childClaimSummaryType := routeLabels[backend.KuidIPAMClaimSummaryTypeKey] + childPrefixType := routeLabels[backend.KuidIPAMIPPrefixTypeKey] + switch prefixType { + case ipam.IPPrefixType_Aggregate: // the claim is of type aggregate + // we only allow prefixes -> validate aggregate type + if childClaimSummaryType == string(ipam.IPClaimSummaryType_Address) || + childClaimSummaryType == string(ipam.IPClaimSummaryType_Range) { + return fmt.Errorf("child with addressing %s not allowed in claim of type %s", childClaimSummaryType, prefixType) + } + if childPrefixType == string(ipam.IPPrefixType_Aggregate) { + return fmt.Errorf("nesting %s is not possible", childPrefixType) + } + case ipam.IPPrefixType_Network, ipam.IPPrefixType_Pool: + // we only allow range and addresses -> these dont have a claimType + if childClaimSummaryType == string(ipam.IPClaimSummaryType_Prefix) { + return fmt.Errorf("child with addressing %s not allowed in claim of type %s", childClaimSummaryType, prefixType) + } + default: + return fmt.Errorf("invalid claimType: %s", prefixType) + } + } + return nil +} + +func (r *staticPrefixApplicator) Apply(ctx context.Context, claim *ipam.IPClaim) error { + log := log.FromContext(ctx) + log.Debug("apply") + pi, err := iputil.New(*claim.Spec.Prefix) + if err != nil { + return err + } + + if err := r.apply(ctx, claim, []*iputil.Prefix{pi}, false, map[string]string{}); err != nil { + return err + } + r.updateClaimPrefixStatus(ctx, claim, pi) + return nil +} + +func (r *staticPrefixApplicator) Delete(ctx context.Context, claim *ipam.IPClaim) error { + log := log.FromContext(ctx) + log.Info("delete") + return r.delete(ctx, claim) +} diff --git a/pkg/backend/ipam/applicator_static_range.go b/pkg/backend/ipam/applicator_static_range.go new file mode 100644 index 0000000..4e52655 --- /dev/null +++ b/pkg/backend/ipam/applicator_static_range.go @@ -0,0 +1,162 @@ +/* +Copyright 2024 Nokia. + +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 ipam + +import ( + "context" + "fmt" + + "github.com/hansthienpondt/nipam/pkg/table" + "github.com/henderiw/iputil" + "github.com/henderiw/logger/log" + "github.com/kform-dev/choreo/apis/kuid/backend" + "github.com/kuidio/kuid/apis/backend/ipam" + "go4.org/netipx" +) + +type staticRangeApplicator struct { + name string + applicator + exists bool +} + +func (r *staticRangeApplicator) Validate(ctx context.Context, claim *ipam.IPClaim) error { + log := log.FromContext(ctx) + log.Debug("validate") + + exists, err := r.validateExists(ctx, claim) + if err != nil { + return err + } + if exists { + // we can return since we trust the previous insertion in the tree + r.exists = exists + return nil + } + + if err := r.validateParents(ctx, claim); err != nil { + return err + } + + if err := r.validateChildren(ctx, claim); err != nil { + return err + } + + return nil +} + +func (r *staticRangeApplicator) validateExists(_ context.Context, claim *ipam.IPClaim) (bool, error) { + ipRange, err := netipx.ParseIPRange(*claim.Spec.Range) + if err != nil { + return false, err + } + exists := true + for _, prefix := range ipRange.Prefixes() { + route, ok := r.cacheInstanceCtx.rib.Get(prefix) + if ok { + // entry exists; validate the owner to see if someone else owns this prefix + labels := route.Labels() + if err := claim.ValidateOwner(labels); err != nil { + return exists, err + } + } else { + exists = false + } + } + return exists, nil +} + +func (r *staticRangeApplicator) validateParents(ctx context.Context, claim *ipam.IPClaim) error { + ipRange, err := netipx.ParseIPRange(*claim.Spec.Range) + if err != nil { + return err + } + + var singlParentPrefix string + for _, prefix := range ipRange.Prefixes() { + parentRoutes := r.cacheInstanceCtx.rib.Parents(prefix) + if len(parentRoutes) == 0 { + return fmt.Errorf("a prefix range always needs a parent") + } + + // the library returns all parent routes, but we need to most specific + parentRoute := findMostSpecificParent(parentRoutes) + if err := r.validateParent(ctx, parentRoute, claim); err != nil { + return err + } + + // check if the routes all belong to the same parent + if singlParentPrefix != "" { + if parentRoute.Prefix().String() != singlParentPrefix { + return fmt.Errorf("a range has to fit into a single parent prefix got %s and %s", singlParentPrefix, parentRoute.Prefix().String()) + } + } else { + singlParentPrefix = parentRoute.Prefix().String() + } + } + return nil +} + +func (r *staticRangeApplicator) validateParent(_ context.Context, route table.Route, _ *ipam.IPClaim) error { + routeLabels := route.Labels() + parentPrefixType := routeLabels[backend.KuidIPAMIPPrefixTypeKey] + + if parentPrefixType == string(ipam.IPPrefixType_Aggregate) { + //return fmt.Errorf("a range is not possible with a parent of type %s", parentPrefixType) + } + return nil +} + +func (r *staticRangeApplicator) validateChildren(_ context.Context, claim *ipam.IPClaim) error { + ipRange, err := netipx.ParseIPRange(*claim.Spec.Range) + if err != nil { + return err + } + for _, prefix := range ipRange.Prefixes() { + childRoutes := r.cacheInstanceCtx.rib.Children(prefix) + if len(childRoutes) > 0 { + return fmt.Errorf("cannot have children for a range %s", prefix) + } + } + return nil +} + +func (r *staticRangeApplicator) Apply(ctx context.Context, claim *ipam.IPClaim) error { + ipRange, err := netipx.ParseIPRange(*claim.Spec.Range) + if err != nil { + return err + } + + // add each prefix in the routing table -> we convey them all together + pis := make([]*iputil.Prefix, 0, len(ipRange.Prefixes())) + for _, prefix := range ipRange.Prefixes() { + pis = append(pis, iputil.NewPrefixInfo(prefix)) + } + if err := r.apply(ctx, claim, pis, false, map[string]string{}); err != nil { + return err + } + if err := r.applyRange(ctx, claim, ipRange); err != nil { + return err + } + + r.updateClaimRangeStatus(ctx, claim) + return nil +} + +func (r *staticRangeApplicator) Delete(ctx context.Context, claim *ipam.IPClaim) error { + return r.delete(ctx, claim) +} diff --git a/pkg/backend/ipam/applicator_util.go b/pkg/backend/ipam/applicator_util.go new file mode 100644 index 0000000..4da166e --- /dev/null +++ b/pkg/backend/ipam/applicator_util.go @@ -0,0 +1,59 @@ +/* +Copyright 2024 Nokia. + +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 ipam + +import ( + "github.com/hansthienpondt/nipam/pkg/table" + "github.com/kform-dev/choreo/apis/kuid/backend" +) + +func isParentRouteSelectable(route table.Route, prefixLength uint8) bool { + // return the first route that has a routes with the prefixlength available + return route.Prefix().Bits() < int(prefixLength) +} + +func findMostSpecificParent(routes table.Routes) table.Route { + parentRoute := routes[0] + for _, route := range routes { + if route.Prefix().Bits() > parentRoute.Prefix().Bits() { + parentRoute = route + } + } + return parentRoute +} + +func getUserDefinedLabels(labels map[string]string) map[string]string { + udmLabels := map[string]string{} + for k, v := range labels { + if backend.BackendIPAMSystemKeys.Has(k) { + continue + } + if backend.BackendSystemKeys.Has(k) { + continue + } + udmLabels[k] = v + } + return udmLabels +} + +func getExistingRoutes(existingRoutes table.Routes) []string { + routes := []string{} + for _, existingRoute := range existingRoutes { + routes = append(routes, existingRoute.Prefix().String()) + } + return routes +} diff --git a/pkg/backend/ipam/backend.go b/pkg/backend/ipam/backend.go new file mode 100644 index 0000000..0e65a6d --- /dev/null +++ b/pkg/backend/ipam/backend.go @@ -0,0 +1,236 @@ +/* +Copyright 2024 Nokia. + +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 ipam + +import ( + "context" + "errors" + "fmt" + "sync" + + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/henderiw/logger/log" + "github.com/henderiw/store" + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/backend/ipam" + bebackend "github.com/kuidio/kuid/pkg/backend" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apiserver/pkg/registry/rest" +) + +func New() bebackend.Backend { + cache := bebackend.NewCache[*CacheInstanceContext]() + return &be{ + cache: cache, + } +} + +type be struct { + cache bebackend.Cache[*CacheInstanceContext] + m sync.RWMutex + // added later + entryStorage *registry.Store + claimStorage *registry.Store +} + +func (r *be) PrintEntries(ctx context.Context, index string) { + entries, _ := r.listEntries(ctx, store.ToKey(index)) + for _, entry := range entries { + uobj, _ := runtime.DefaultUnstructuredConverter.ToUnstructured(entry) + fmt.Println("entry", uobj) + } +} + +func (r *be) AddStorage(entryStorage, claimStorage rest.Storage) error { + entrystore, ok := entryStorage.(*registry.Store) + if !ok { + return errors.New("entry store is not a *registry.Store") + } + r.entryStorage = entrystore + claimstore, ok := claimStorage.(*registry.Store) + if !ok { + return errors.New("claim store is not a *registry.Store") + } + r.claimStorage = claimstore + return nil +} + +// CreateIndex creates a backend index +func (r *be) CreateIndex(ctx context.Context, obj runtime.Object) error { + r.m.Lock() + defer r.m.Unlock() + index, ok := obj.(*ipam.IPIndex) + if !ok { + return errors.New("runtime object is not IPIndex") + } + + ctx = bebackend.InitIndexContext(ctx, "create", index) + log := log.FromContext(ctx) + key := index.GetKey() + + log.Debug("start", "isInitialized", r.cache.IsInitialized(ctx, key)) + // if the Cache is not initialized -> restore the cache + // this happens upon initialization or backend restart + if _, err := r.cache.Get(ctx, key); err != nil { + // if it does not exist create the cache + cacheInstanceCtx := NewCacheInstanceContext() + r.cache.Create(ctx, key, cacheInstanceCtx) + } + if !r.cache.IsInitialized(ctx, key) { + if err := r.restore(ctx, index); err != nil { + log.Error("cannot restore index", "error", err.Error()) + index.SetConditions(condition.Failed(err.Error())) + return err + } + log.Debug("restored") + index.SetConditions(condition.Ready()) + obj = index + + if err := r.cache.SetInitialized(ctx, key); err != nil { + return err + } + } + log.Debug("update IPIndex clains") + return r.updateIPIndexClaims(ctx, index) +} + +// DeleteIndex deletes a backend index +func (r *be) DeleteIndex(ctx context.Context, obj runtime.Object) error { + r.m.Lock() + defer r.m.Unlock() + index, ok := obj.(*ipam.IPIndex) + if !ok { + return errors.New("runtime object is not IPIndex") + } + + ctx = bebackend.InitIndexContext(ctx, "delete", index) + log := log.FromContext(ctx) + log.Debug("start") + key := index.GetKey() + + log.Debug("start", "isInitialized", r.cache.IsInitialized(ctx, key)) + // delete the data from the backend + if err := r.destroy(ctx, key); err != nil { + log.Error("cannot delete Index", "error", err.Error()) + return err + } + log.Debug("destroyed") + r.cache.Delete(ctx, key) + + log.Debug("finished") + return nil +} + +func (r *be) Claim(ctx context.Context, obj runtime.Object, recursion bool) error { + // index delete/create can call the claim create/delete -> this avoid double locking + if !recursion { + r.m.Lock() + defer r.m.Unlock() + } + claim, ok := obj.(*ipam.IPClaim) + if !ok { + return errors.New("runtime object is not IPClaim") + } + + ctx = initClaimContext(ctx, "create", claim) + log := log.FromContext(ctx) + log.Debug("start") + + cacheCtx, err := r.cache.Get(ctx, claim.GetKey()) + if err != nil { + return err + } + if !r.cache.IsInitialized(ctx, claim.GetKey()) { + return fmt.Errorf("cache not initialized") + } + + a, err := getApplicator(ctx, cacheCtx, claim) + if err != nil { + return err + } + if err := a.Validate(ctx, claim); err != nil { + return err + } + if err := a.Apply(ctx, claim); err != nil { + return err + } + // store the resources in the backend + if err := r.saveAll(ctx, claim.GetKey()); err != nil { + return err + } + obj = claim + return nil + +} + +func (r *be) Release(ctx context.Context, obj runtime.Object, recursion bool) error { + // index delete/create can call the claim create/delete -> this avoid double locking + if !recursion { + r.m.Lock() + defer r.m.Unlock() + } + claim, ok := obj.(*ipam.IPClaim) + if !ok { + return errors.New("runtime object is not IPClaim") + } + + ctx = initClaimContext(ctx, "delete", claim) + log := log.FromContext(ctx) + log.Debug("start") + + cacheCtx, err := r.cache.Get(ctx, claim.GetKey()) + if err != nil { + return err + } + if !r.cache.IsInitialized(ctx, claim.GetKey()) { + return fmt.Errorf("cache not initialized") + } + + a, err := getApplicator(ctx, cacheCtx, claim) + if err != nil { + return err + } + if err := a.Delete(ctx, claim); err != nil { + return err + } + + return r.saveAll(ctx, claim.GetKey()) +} + +func getApplicator(_ context.Context, cacheInstanceCtx *CacheInstanceContext, claim *ipam.IPClaim) (Applicator, error) { + ipClaimType, err := claim.GetIPClaimType() + if err != nil { + return nil, err + } + var a Applicator + switch ipClaimType { + case ipam.IPClaimType_StaticAddress: + a = &staticAddressApplicator{name: string(ipam.IPClaimType_StaticAddress), applicator: applicator{cacheInstanceCtx: cacheInstanceCtx}} + case ipam.IPClaimType_StaticPrefix: + a = &staticPrefixApplicator{name: string(ipam.IPClaimType_StaticPrefix), applicator: applicator{cacheInstanceCtx: cacheInstanceCtx}} + case ipam.IPClaimType_StaticRange: + a = &staticRangeApplicator{name: string(ipam.IPClaimType_StaticRange), applicator: applicator{cacheInstanceCtx: cacheInstanceCtx}} + case ipam.IPClaimType_DynamicAddress: + a = &dynamicAddressApplicator{name: string(ipam.IPClaimType_DynamicAddress), applicator: applicator{cacheInstanceCtx: cacheInstanceCtx}} + case ipam.IPClaimType_DynamicPrefix: + a = &dynamicPrefixApplicator{name: string(ipam.IPClaimType_DynamicPrefix), applicator: applicator{cacheInstanceCtx: cacheInstanceCtx}} + default: + return nil, fmt.Errorf("invalid addressing, got: %s", string(ipClaimType)) + } + + return a, nil +} diff --git a/pkg/backend/ipam/backend_store.go b/pkg/backend/ipam/backend_store.go new file mode 100644 index 0000000..c7afd17 --- /dev/null +++ b/pkg/backend/ipam/backend_store.go @@ -0,0 +1,493 @@ +/* +Copyright 2024 Nokia. + +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 ipam + +import ( + "context" + "errors" + "fmt" + "reflect" + "sort" + + "github.com/henderiw/idxtable/pkg/iptable" + "github.com/henderiw/logger/log" + "github.com/henderiw/store" + "github.com/kuidio/kuid/apis/backend/ipam" + "k8s.io/apimachinery/pkg/api/meta" + "k8s.io/apimachinery/pkg/apis/meta/internalversion" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +func (r *be) restore(ctx context.Context, index *ipam.IPIndex) error { + log := log.FromContext(ctx) + k := index.GetKey() + + cacheInstanceCtx, err := r.cache.Get(ctx, k) + if err != nil { + log.Error("cannot get index", "error", err.Error()) + return err + } + + // Fetch the current entries that were stored + curEntries, err := r.listEntries(ctx, k) + if err != nil { + return err + } + + claimmap, err := r.listClaims(ctx, k) + if err != nil { + return nil + } + + /* + prefixes := make(map[string]ipamv1alpha1.Prefix) + for _, prefix := range index.Spec.Prefixes { + prefixes[prefix.Prefix] = prefix + } + */ + + /* + if err := r.restoreIndexPrefixes(ctx, cacheInstanceCtx, curEntries, index, prefixes); err != nil { + return err + } + */ + if err := r.restoreClaims(ctx, cacheInstanceCtx, curEntries, ipam.IPIndexKind, ipam.IPClaimType_StaticPrefix, claimmap); err != nil { + return err + } + if err := r.restoreClaims(ctx, cacheInstanceCtx, curEntries, ipam.IPClaimKind, ipam.IPClaimType_StaticPrefix, claimmap); err != nil { + return err + } + if err := r.restoreClaims(ctx, cacheInstanceCtx, curEntries, ipam.IPClaimKind, ipam.IPClaimType_StaticRange, claimmap); err != nil { + return err + } + if err := r.restoreClaims(ctx, cacheInstanceCtx, curEntries, ipam.IPClaimKind, ipam.IPClaimType_DynamicPrefix, claimmap); err != nil { + return err + } + if err := r.restoreClaims(ctx, cacheInstanceCtx, curEntries, ipam.IPClaimKind, ipam.IPClaimType_StaticAddress, claimmap); err != nil { + return err + } + if err := r.restoreClaims(ctx, cacheInstanceCtx, curEntries, ipam.IPClaimKind, ipam.IPClaimType_DynamicAddress, claimmap); err != nil { + return err + } + log.Debug("restore prefixes entries left", "items", len(curEntries)) + + return nil +} + +func (r *be) saveAll(ctx context.Context, k store.Key) error { + log := log.FromContext(ctx) + log.Debug("SaveAll", "key", k.String()) + + // entries from the memory cache + newEntries, err := r.getEntriesFromCache(ctx, k) + if err != nil { + return err + } + // entries in the apiserver + curEntries, err := r.listEntries(ctx, k) + if err != nil { + return err + } + + news := []string{} + for _, newEntry := range newEntries { + news = append(news, newEntry.Name) + } + curs := []string{} + for _, curEntry := range curEntries { + curs = append(curs, curEntry.Name) + } + sort.Strings(news) + sort.Strings(curs) + + for _, newEntry := range newEntries { + log.Debug("SaveAll", "newIPEntry", newEntry.GetNamespacedName()) + newEntry := newEntry + found := false + var oldEntry *ipam.IPEntry + for idx, curEntry := range curEntries { + log.Debug("SaveAll", "curEntry", *curEntry) + idx := idx + curEntry := curEntry + if curEntry.GetNamespace() == newEntry.GetNamespace() && + curEntry.GetName() == newEntry.GetName() { + curEntries = append(curEntries[:idx], curEntries[idx+1:]...) + found = true + oldEntry = curEntry + break + } + } + + ctx = genericapirequest.WithNamespace(ctx, newEntry.GetNamespace()) + if !found { + if _, err := r.entryStorage.Create(ctx, newEntry, nil, &metav1.CreateOptions{ + FieldManager: "backend", + }); err != nil { + log.Error("saveAll create failed", "name", newEntry.GetName(), "error", err.Error()) + return err + } + continue + } + + defaultObjInfo := rest.DefaultUpdatedObjectInfo(oldEntry, EntryTransformer) + if _, _, err := r.entryStorage.Update(ctx, oldEntry.GetName(), defaultObjInfo, nil, nil, false, &metav1.UpdateOptions{ + FieldManager: "backend", + }); err != nil { + fmt.Println("update err", err) + return err + } + } + for _, curEntry := range curEntries { + ctx = genericapirequest.WithNamespace(ctx, curEntry.GetNamespace()) + if _, _, err := r.entryStorage.Delete(ctx, curEntry.GetName(), nil, &metav1.DeleteOptions{}); err != nil { + return err + } + } + return nil +} + +// Destroy removes the store db +func (r *be) destroy(ctx context.Context, k store.Key) error { + // TBD: what do we do when deleting the index in async mode + if err := r.deleteClaims(ctx, k); err != nil { + return err + } + return r.deleteEntries(ctx, k) +} + +func (r *be) getEntriesFromCache(ctx context.Context, k store.Key) ([]*ipam.IPEntry, error) { + //log := log.FromContext(ctx).With("key", k.String()) + cacheInstanceCtx, err := r.cache.Get(ctx, k) + if err != nil { + return nil, fmt.Errorf("cache index not initialized") + } + + entries := make([]*ipam.IPEntry, 0, cacheInstanceCtx.Size()) + // add the main rib entry + for _, route := range cacheInstanceCtx.rib.GetTable() { + route := route + entries = append(entries, ipam.GetIPEntry(ctx, k, "", route.Prefix(), route.Labels())) + } + // add all the range entries + cacheInstanceCtx.ranges.List(func(key store.Key, t iptable.IPTable) { + for _, route := range t.GetAll() { + route := route + entries = append(entries, ipam.GetIPEntry(ctx, k, key.Name, route.Prefix(), route.Labels())) + } + }) + + return entries, nil +} + +func (r *be) deleteEntries(ctx context.Context, k store.Key) error { + log := log.FromContext(ctx) + + entries, err := r.listEntries(ctx, k) + if err != nil { + log.Error("cannot list entries", "error", err) + return err + } + + var errm error + for _, entry := range entries { + ctx = genericapirequest.WithNamespace(ctx, entry.GetNamespace()) + if _, _, err := r.entryStorage.Delete(ctx, entry.GetName(), nil, &metav1.DeleteOptions{}); err != nil { + log.Error("cannot delete entry", "error", err) + errm = errors.Join(errm, err) + continue + } + } + return errm +} + +func (r *be) deleteClaims(ctx context.Context, k store.Key) error { + log := log.FromContext(ctx) + + log.Debug("deleteClaims list") + claims, err := r.listClaims(ctx, k) + if err != nil { + log.Error("cannot list claims", "error", err) + return err + } + + var errm error + for _, claim := range claims { + log.Debug("deleteClaim from storage", "claim", claim.GetName()) + ctx = genericapirequest.WithNamespace(ctx, claim.GetNamespace()) + if _, _, err := r.claimStorage.Delete(ctx, claim.GetName(), nil, &metav1.DeleteOptions{ + DryRun: []string{"recursion"}, + }); err != nil { + log.Error("cannot delete claim", "error", err) + errm = errors.Join(errm, err) + continue + } + } + return errm +} + +func (r *be) listEntries(ctx context.Context, k store.Key) ([]*ipam.IPEntry, error) { + log := log.FromContext(ctx).With("key", k.String()) + /* + selector, err := selector.ExprSelectorAsSelector( + &selectorv1alpha1.ExpressionSelector{ + Match: map[string]string{ + "spec.index": k.Name, + }, + }, + ) + if err != nil { + return nil, err + } + */ + log.Debug("list entries from storage") + list, err := r.entryStorage.List(ctx, &internalversion.ListOptions{}) + if err != nil { + return nil, err + } + items, err := meta.ExtractList(list) + if err != nil { + return nil, err + } + entryList := make([]*ipam.IPEntry, 0) + var errm error + for _, obj := range items { + entryObj, ok := obj.(*ipam.IPEntry) + if !ok { + log.Error("obj is not an IPEntry", "obj", reflect.TypeOf(obj).Name()) + errm = errors.Join(errm, err) + continue + } + if entryObj.GetIndex() == k.Name { + entryList = append(entryList, entryObj) + } + } + return entryList, nil +} + +func (r *be) listClaims(ctx context.Context, k store.Key) (map[string]*ipam.IPClaim, error) { + log := log.FromContext(ctx).With("key", k.String()) + /* + selector, err := selector.ExprSelectorAsSelector( + &selectorv1alpha1.ExpressionSelector{ + Match: match, + }, + ) + if err != nil { + return nil, err + } + */ + log.Debug("list claims from storage") + list, err := r.claimStorage.List(ctx, &internalversion.ListOptions{}) + if err != nil { + return nil, err + } + items, err := meta.ExtractList(list) + if err != nil { + return nil, err + } + claimMap := map[string]*ipam.IPClaim{} + var errm error + for _, obj := range items { + claimObj, ok := obj.(*ipam.IPClaim) + if !ok { + log.Error("obj is not an IPClaim", "obj", reflect.TypeOf(obj).Name()) + errm = errors.Join(errm, err) + continue + } + claimMap[claimObj.GetNamespacedName().String()] = claimObj + } + return claimMap, errm +} + +func (r *be) restoreClaims(ctx context.Context, cacheInstanceCtx *CacheInstanceContext, entries []*ipam.IPEntry, kind string, claimType ipam.IPClaimType, ipclaimmap map[string]*ipam.IPClaim) error { + log := log.FromContext(ctx) + for i := len(entries) - 1; i >= 0; i-- { + entry := entries[i] + if (kind == ipam.IPIndexKind && entry.Spec.IndexEntry && claimType == entry.Spec.ClaimType) || + (kind != ipam.IPIndexKind && !entry.Spec.IndexEntry && claimType == entry.Spec.ClaimType) { + claimName := "" + if len(entry.OwnerReferences) > 0 { + claimName = entry.OwnerReferences[0].Name + } + + nsn := types.NamespacedName{Namespace: entry.GetNamespace(), Name: claimName} + claim, ok := ipclaimmap[nsn.String()] + if ok { + log.Debug("restore claim", "kind", kind, "claimType", claimType, "claim", claim) + if err := r.restoreClaim(ctx, cacheInstanceCtx, claim); err != nil { + return err + } + // remove the entry since it is processed + entries = append(entries[:i], entries[i+1:]...) + delete(ipclaimmap, nsn.String()) // delete the entry to optimize + } + } + + } + return nil +} + +func (r *be) restoreClaim(ctx context.Context, cacheInstanceCtx *CacheInstanceContext, claim *ipam.IPClaim) error { + ctx = initClaimContext(ctx, "restore", claim) + log := log.FromContext(ctx) + a, err := getApplicator(ctx, cacheInstanceCtx, claim) + if err != nil { + return err + } + // validate is needed, mainly for addresses since the parent route determines + // e.g. the fact the address belongs to a range or not + errList := claim.ValidateSyntax("") // needed to expand the createPrefix/prefixLength and owner + if len(errList) != 0 { + return fmt.Errorf("invalid syntax %v", errList) + } + if err := a.Validate(ctx, claim); err != nil { + log.Error("failed to validate claim", "error", err) + return err + } + if err := a.Apply(ctx, claim); err != nil { + log.Error("failed to apply claim", "error", err) + return err + } + return nil +} + +func (r *be) updateIPIndexClaims(ctx context.Context, index *ipam.IPIndex) error { + log := log.FromContext(ctx) + log.Debug("updateIPIndexClaims", "key", index.GetKey().String()) + key := index.GetKey() + + newClaims, err := index.GetClaims() + if err != nil { + return err + } + + existingClaims, err := r.listIndexClaims(ctx, key) + if err != nil { + return err + } + + var errm error + for _, newClaim := range newClaims { + ctx = genericapirequest.WithNamespace(ctx, newClaim.GetNamespace()) + oldClaim, exists := existingClaims[newClaim.GetNamespacedName().String()] + if !exists { + if _, err := r.claimStorage.Create(ctx, newClaim, nil, &metav1.CreateOptions{ + FieldManager: "backend", + DryRun: []string{"recursion"}, + }); err != nil { + log.Error("updateIPIndexClaims create failed", "name", newClaim.GetName(), "error", err.Error()) + errm = errors.Join(errm, err) + continue + } + continue + + } + defaultObjInfo := rest.DefaultUpdatedObjectInfo(oldClaim, ClaimTransformer) + if _, _, err := r.claimStorage.Update(ctx, oldClaim.GetName(), defaultObjInfo, nil, nil, false, &metav1.UpdateOptions{ + FieldManager: "backend", + DryRun: []string{"recursion"}, + }); err != nil { + log.Error("updateIPIndexClaims update failed", "name", newClaim.GetName(), "error", err.Error()) + errm = errors.Join(errm, err) + continue + } + delete(existingClaims, newClaim.GetNamespacedName().String()) + } + for _, claim := range existingClaims { + ctx = genericapirequest.WithNamespace(ctx, claim.GetNamespace()) + if _, _, err := r.entryStorage.Delete(ctx, claim.GetName(), nil, &metav1.DeleteOptions{}); err != nil { + log.Error("updateIPIndexClaims delete failed", "name", claim.GetName(), "error", err.Error()) + errm = errors.Join(errm, err) + continue + } + } + + if errm != nil { + return errm + } + + return r.saveAll(ctx, key) +} + +func EntryTransformer(_ context.Context, newObj runtime.Object, oldObj runtime.Object) (runtime.Object, error) { + // Type assertion to specific object types, assuming we are working with a type that has Spec and Status fields + new, ok := newObj.(*ipam.IPEntry) + if !ok { + return nil, fmt.Errorf("newObj is not of type IPEntry, got: %s", reflect.TypeOf(newObj).Name()) + } + old, ok := oldObj.(*ipam.IPEntry) + if !ok { + return nil, fmt.Errorf("oldObj is not of type IPEntry, got: %s", reflect.TypeOf(oldObj).Name()) + } + + new.SetResourceVersion(old.GetResourceVersion()) + new.SetUID(old.GetUID()) + + return new, nil +} + +func ClaimTransformer(_ context.Context, newObj runtime.Object, oldObj runtime.Object) (runtime.Object, error) { + // Type assertion to specific object types, assuming we are working with a type that has Spec and Status fields + new, ok := newObj.(*ipam.IPClaim) + if !ok { + return nil, fmt.Errorf("newObj is not of type IPClaim, got: %s", reflect.TypeOf(newObj).Name()) + } + old, ok := oldObj.(*ipam.IPClaim) + if !ok { + return nil, fmt.Errorf("oldObj is not of type IPClaim, got: %s", reflect.TypeOf(oldObj).Name()) + } + + new.SetResourceVersion(old.GetResourceVersion()) + new.SetUID(old.GetUID()) + + return new, nil +} + +func (r *be) listIndexClaims(ctx context.Context, k store.Key) (map[string]*ipam.IPClaim, error) { + log := log.FromContext(ctx).With("key", k.String()) + list, err := r.claimStorage.List(ctx, &internalversion.ListOptions{}) + if err != nil { + return nil, err + } + items, err := meta.ExtractList(list) + if err != nil { + return nil, err + } + claimMap := map[string]*ipam.IPClaim{} + var errm error + for _, obj := range items { + claim, ok := obj.(*ipam.IPClaim) + if !ok { + log.Error("obj is not an IPClaim", "obj", reflect.TypeOf(obj).Name()) + errm = errors.Join(errm, err) + continue + } + if claim.GetIndex() == k.Name { + fmt.Println("listIndexClaims", claim.Name, claim.OwnerReferences) + for _, ownerRef := range claim.OwnerReferences { + if ownerRef.Kind == ipam.IPIndexKind { + claimMap[claim.GetNamespacedName().String()] = claim + } + } + } + } + return claimMap, errm +} diff --git a/pkg/backend/ipam/cache_instance.go b/pkg/backend/ipam/cache_instance.go new file mode 100644 index 0000000..2fc7116 --- /dev/null +++ b/pkg/backend/ipam/cache_instance.go @@ -0,0 +1,45 @@ +/* +Copyright 2024 Nokia. + +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 ipam + +import ( + "github.com/hansthienpondt/nipam/pkg/table" + "github.com/henderiw/idxtable/pkg/iptable" + "github.com/henderiw/store" + "github.com/henderiw/store/memory" +) + +type CacheInstanceContext struct { + rib *table.RIB + ranges store.Storer[iptable.IPTable] +} + +func NewCacheInstanceContext() *CacheInstanceContext { + return &CacheInstanceContext{ + rib: table.NewRIB(), + ranges: memory.NewStore[iptable.IPTable](nil), + } +} + +func (r *CacheInstanceContext) Size() int { + var size int + size += r.rib.Size() + r.ranges.List(func(k store.Key, i iptable.IPTable) { + size += i.Size() + }) + return size +} diff --git a/pkg/backend/ipam/context.go b/pkg/backend/ipam/context.go new file mode 100644 index 0000000..fbddd36 --- /dev/null +++ b/pkg/backend/ipam/context.go @@ -0,0 +1,79 @@ +/* +Copyright 2024 Nokia. + +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 ipam + +import ( + "context" + "fmt" + "log/slog" + + "github.com/henderiw/logger/log" + "github.com/kuidio/kuid/apis/backend/ipam" +) + +// this is implemented locally since the ip claim does not follow the backend.ClaimObject structure +func initClaimContext(ctx context.Context, op string, claim *ipam.IPClaim) context.Context { + var l *slog.Logger + + ipClaimType, err := claim.GetIPClaimType() + if err != nil { + return ctx + } + switch ipClaimType { + case ipam.IPClaimType_DynamicAddress: + l = log.FromContext(ctx). + With( + "op", fmt.Sprintf("%s dynamic address claim", op), + "nsn", claim.GetNamespacedName().String(), + "index", claim.Spec.Index, + ) + case ipam.IPClaimType_DynamicPrefix: + l = log.FromContext(ctx). + With( + "op", fmt.Sprintf("%s dynamic prefix claim", op), + "nsn", claim.GetNamespacedName().String(), + "index", claim.Spec.Index, + "prefixType", claim.GetIPPrefixType(), + ) + case ipam.IPClaimType_StaticAddress: + l = log.FromContext(ctx). + With( + "op", fmt.Sprintf("%s static address claim", op), + "nsn", claim.GetNamespacedName().String(), + "index", claim.Spec.Idx, + "address", *claim.Spec.Address, + ) + case ipam.IPClaimType_StaticPrefix: + l = log.FromContext(ctx). + With( + "op", fmt.Sprintf("%s static prefix claim", op), + "nsn", claim.GetNamespacedName().String(), + "index", claim.Spec.Index, + "prefix", *claim.Spec.Prefix, + "prefixType", claim.GetIPPrefixType(), + ) + case ipam.IPClaimType_StaticRange: + l = log.FromContext(ctx). + With( + "op", fmt.Sprintf("%s static range claim", op), + "nsn", claim.GetNamespacedName().String(), + "index", claim.Spec.Index, + "range", *claim.Spec.Range, + ) + } + return log.IntoContext(ctx, l) +} diff --git a/pkg/backend/astest/as_claim_test.go b/pkg/backend/testas/as_claim_test.go similarity index 66% rename from pkg/backend/astest/as_claim_test.go rename to pkg/backend/testas/as_claim_test.go index 58e0e3c..0175ffd 100644 --- a/pkg/backend/astest/as_claim_test.go +++ b/pkg/backend/testas/as_claim_test.go @@ -1,22 +1,34 @@ -package astest +/* +Copyright 2024 Nokia. + +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 testas import ( "context" "fmt" + "reflect" "testing" - "github.com/henderiw/apiserver-builder/pkg/builder" - "github.com/henderiw/apiserver-builder/pkg/builder/resource" "github.com/kuidio/kuid/apis/backend" "github.com/kuidio/kuid/apis/backend/as" - "github.com/kuidio/kuid/apis/backend/as/register" - asbev1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" - "github.com/kuidio/kuid/pkg/config" - "github.com/kuidio/kuid/pkg/generated/openapi" - "github.com/kuidio/kuid/pkg/registry/options" + genericbe "github.com/kuidio/kuid/pkg/backend/generic" "github.com/stretchr/testify/assert" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" genericapirequest "k8s.io/apiserver/pkg/endpoints/request" "k8s.io/apiserver/pkg/registry/rest" "k8s.io/utils/ptr" @@ -65,46 +77,35 @@ func Test(t *testing.T) { t.Run(name, func(t *testing.T) { ctx := context.Background() - apiserver := builder.APIServer. - WithServerName("kuid-api-server"). - WithOpenAPIDefinitions("Config", "v1alpha1", openapi.GetOpenAPIDefinitions). - WithoutEtcd() - - groupConfig := config.GroupConfig{ - BackendFn: register.NewBackend, - ApplyStorageToBackendFn: register.ApplyStorageToBackend, - Resources: []*config.ResourceConfig{ - {StorageProviderFn: register.NewIndexStorageProvider, Internal: &as.ASIndex{},ResourceVersions: []resource.Object{&as.ASIndex{}, &asbev1alpha1.ASIndex{}}}, - {StorageProviderFn: register.NewClaimStorageProvider, Internal: &as.ASClaim{}, ResourceVersions: []resource.Object{&as.ASClaim{}, &asbev1alpha1.ASClaim{}}}, - {StorageProviderFn: register.NewStorageProvider, Internal: &as.ASEntry{}, ResourceVersions: []resource.Object{&as.ASEntry{}, &asbev1alpha1.ASEntry{}}}, - }, + apiserver := apiServer() + _, err := initBackend(ctx, apiserver) + if err != nil { + t.Errorf("cannot get backend, err: %v", err) } - be := groupConfig.BackendFn() - for _, resource := range groupConfig.Resources { - storageProvider := resource.StorageProviderFn(ctx,resource.Internal, be, true, &options.Options{ - Type: options.StorageType_Memory, - }) - for _, resourceVersion := range resource.ResourceVersions { - apiserver.WithResourceAndHandler(resourceVersion, storageProvider) - } + indexStorage, err := getStorage(ctx, apiserver, schema.GroupResource{ + Group: as.SchemeGroupVersion.Group, + Resource: as.ASIndexPlural, + }) + if err != nil { + t.Errorf("cannot get index storage, err: %v", err) } - if _, err := apiserver.Build(ctx); err != nil { - panic(err) - } - if err := groupConfig.ApplyStorageToBackendFn(ctx, be, apiserver); err != nil { - panic(err) + claimStorage, err := getStorage(ctx, apiserver, schema.GroupResource{ + Group: as.SchemeGroupVersion.Group, + Resource: as.ASClaimPlural, + }) + if err != nil { + t.Errorf("cannot get claim storage, err: %v", err) } - - claimStorage := be.GetClaimStorage() - if tc.index != "" { - index, err := getIndex(tc.index, testType) - assert.NoError(t, err) - err = be.CreateIndex(ctx, index) - assert.NoError(t, err) - } + index, err := getIndex(tc.index, testType) + assert.NoError(t, err) + ctx = genericapirequest.WithNamespace(ctx, index.GetNamespace()) + _, err = indexStorage.Create(ctx, index, nil, &metav1.CreateOptions{ + FieldManager: "backend", + }) + assert.NoError(t, err) for _, v := range tc.ctxs { v := v @@ -125,8 +126,6 @@ func Test(t *testing.T) { return } - ctx = genericapirequest.WithNamespace(ctx, claim.GetNamespace()) - exists := true if _, err := claimStorage.Get(ctx, claim.GetName(), &metav1.GetOptions{}); err != nil { exists = false @@ -136,7 +135,7 @@ func Test(t *testing.T) { newClaim, err = claimStorage.Create(ctx, claim, nil, &metav1.CreateOptions{FieldManager: "test"}) } else { - defaultObjInfo := rest.DefaultUpdatedObjectInfo(claim, transformer) + defaultObjInfo := rest.DefaultUpdatedObjectInfo(claim, genericbe.ClaimTransformer) newClaim, _, err = claimStorage.Update(ctx, claim.GetName(), defaultObjInfo, nil, nil, false, &metav1.UpdateOptions{ FieldManager: "backend", }) @@ -145,25 +144,31 @@ func Test(t *testing.T) { if v.expectedError { assert.Error(t, err) continue - } else { + } + if err != nil { assert.NoError(t, err) + continue } - //fmt.Println("newCLaim", newClaim, err) - //fmt.Println("newClaim", newClaim) - uobj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(newClaim) - if err != nil { - assert.Error(t, err) + asClaim, ok := newClaim.(*as.ASClaim) + if !ok { + t.Errorf("expecting ipClaim, got: %v", reflect.TypeOf(newClaim).Name()) continue } + + //uobj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(newClaim) + //if err != nil { + // assert.Error(t, err) + // continue + //} //u := &unstructured.Unstructured{ // Object: uobj, //} - status := uobj["status"] - statusObj, ok := status.(map[string]any) - if !ok { - t.Errorf("expecting status id got nil") - } + //status := uobj["status"] + //statusObj, ok := status.(map[string]any) + //if !ok { + // t.Errorf("expecting status id got nil") + //} switch v.claimType { case staticClaim, dynamicClaim: @@ -171,7 +176,7 @@ func Test(t *testing.T) { if v.expectedID != nil { expectedID = *v.expectedID } - fmt.Printf("expected/received %v/%v\n", expectedID, statusObj["id"]) + fmt.Printf("expected/received %v/%v\n", expectedID, asClaim.Status.ID) /* id, ok := statusObj["id"] if !ok { @@ -192,7 +197,7 @@ func Test(t *testing.T) { if v.expectedRange != nil { expectedRange = *v.expectedRange } - fmt.Printf("expected/received %v/%v\n", expectedRange, statusObj["range"]) + fmt.Printf("expected/received %v/%v\n", expectedRange, asClaim.Status.Range) /* if claim.Status.Range == nil { t.Errorf("expecting status id got nil") diff --git a/pkg/backend/astest/as_helpers_test.go b/pkg/backend/testas/as_helpers_test.go similarity index 50% rename from pkg/backend/astest/as_helpers_test.go rename to pkg/backend/testas/as_helpers_test.go index 9b5962d..c9cbfa8 100644 --- a/pkg/backend/astest/as_helpers_test.go +++ b/pkg/backend/testas/as_helpers_test.go @@ -1,15 +1,42 @@ -package astest +/* +Copyright 2024 Nokia. + +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 testas import ( "context" "fmt" "reflect" + "github.com/henderiw/apiserver-builder/pkg/builder" + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" "github.com/kuidio/kuid/apis/backend" "github.com/kuidio/kuid/apis/backend/as" + "github.com/kuidio/kuid/apis/backend/as/register" + asbev1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" "github.com/kuidio/kuid/apis/common" + bebackend "github.com/kuidio/kuid/pkg/backend" + "github.com/kuidio/kuid/pkg/config" + "github.com/kuidio/kuid/pkg/generated/openapi" + "github.com/kuidio/kuid/pkg/registry/options" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apiserver/pkg/registry/generic" "k8s.io/utils/ptr" ) @@ -33,6 +60,64 @@ const ( rangeClaim = backend.ClaimType_Range ) +func apiServer() *builder.Server { + return builder.NewAPIServer(). + WithServerName("kuid-api-server"). + WithOpenAPIDefinitions("Config", "v1alpha1", openapi.GetOpenAPIDefinitions). + WithoutEtcd() +} + +func initBackend(ctx context.Context, apiserver *builder.Server) (bebackend.Backend, error) { + groupConfig := config.GroupConfig{ + BackendFn: register.NewBackend, + ApplyStorageToBackendFn: register.ApplyStorageToBackend, + Resources: []*config.ResourceConfig{ + {StorageProviderFn: register.NewIndexStorageProvider, Internal: &as.ASIndex{}, ResourceVersions: []resource.Object{&as.ASIndex{}, &asbev1alpha1.ASIndex{}}}, + {StorageProviderFn: register.NewClaimStorageProvider, Internal: &as.ASClaim{}, ResourceVersions: []resource.Object{&as.ASClaim{}, &asbev1alpha1.ASClaim{}}}, + {StorageProviderFn: register.NewStorageProvider, Internal: &as.ASEntry{}, ResourceVersions: []resource.Object{&as.ASEntry{}, &asbev1alpha1.ASEntry{}}}, + }, + } + + be := groupConfig.BackendFn() + for _, resource := range groupConfig.Resources { + storageProvider := resource.StorageProviderFn(ctx, resource.Internal, be, true, &options.Options{ + Type: options.StorageType_Memory, + }) + for _, resourceVersion := range resource.ResourceVersions { + apiserver.WithResourceAndHandler(resourceVersion, storageProvider) + } + } + + if _, err := apiserver.Build(ctx); err != nil { + return nil, err + } + if err := groupConfig.ApplyStorageToBackendFn(ctx, be, apiserver); err != nil { + return nil, err + } + return be, nil +} + +func getStorage(ctx context.Context, apiServer *builder.Server, gr schema.GroupResource) (*registry.Store, error) { + storageProvider := apiServer.StorageProvider[gr] + storage, err := storageProvider.Get(ctx, apiServer.Schemes[0], &Getter{}) + if err != nil { + return nil, err + } + registryStore, ok := storage.(*registry.Store) + if !ok { + return nil, fmt.Errorf("index store is not a *registry.Store, got: %v", reflect.TypeOf(storage).Name()) + } + return registryStore, nil +} + +var _ generic.RESTOptionsGetter = &Getter{} + +type Getter struct{} + +func (r *Getter) GetRESTOptions(resource schema.GroupResource, example runtime.Object) (generic.RESTOptions, error) { + return generic.RESTOptions{}, nil +} + func getIndex(index, _ string) (*as.ASIndex, error) { idx := as.BuildASIndex( metav1.ObjectMeta{Namespace: namespace, Name: index}, @@ -106,6 +191,7 @@ func (r testCtx) getRangeClaim(index, testType string) (backend.ClaimObject, err return claim, nil } +/* func transformer(_ context.Context, newObj runtime.Object, oldObj runtime.Object) (runtime.Object, error) { // Type assertion to specific object types, assuming we are working with a type that has Spec and Status fields new, ok := newObj.(backend.ClaimObject) @@ -121,13 +207,13 @@ func transformer(_ context.Context, newObj runtime.Object, oldObj runtime.Object new.SetUID(old.GetUID()) if new.GetRange() != nil { - fmt.Println("transformer", "new", *new.GetRange() ) + fmt.Println("transformer", "new", *new.GetRange()) } if old.GetRange() != nil { - fmt.Println("transformer", "old", *old.GetRange() ) + fmt.Println("transformer", "old", *old.GetRange()) } - return new, nil } +*/ diff --git a/pkg/backend/testas/as_index_test.go b/pkg/backend/testas/as_index_test.go new file mode 100644 index 0000000..ef69d77 --- /dev/null +++ b/pkg/backend/testas/as_index_test.go @@ -0,0 +1,78 @@ +/* +Copyright 2024 Nokia. + +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 testas + +import ( + "context" + "testing" + + "github.com/kuidio/kuid/apis/backend/as" + "github.com/stretchr/testify/assert" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" +) + +func TestIndex(t *testing.T) { + tests := map[string]struct { + index string + testType string + }{ + "CreateDelete": { + index: "a", + testType: "", + }, + } + + for name, tc := range tests { + t.Run(name, func(t *testing.T) { + + ctx := context.Background() + apiserver := apiServer() + _, err := initBackend(ctx, apiserver) + if err != nil { + t.Errorf("cannot get backend, err: %v", err) + } + + indexStorage, err := getStorage(ctx, apiserver, schema.GroupResource{ + Group: as.SchemeGroupVersion.Group, + Resource: as.ASIndexPlural, + }) + if err != nil { + t.Errorf("cannot get index storage, err: %v", err) + } + + index, err := getIndex(tc.index, tc.testType) + assert.NoError(t, err) + ctx = genericapirequest.WithNamespace(ctx, index.GetNamespace()) + _, err = indexStorage.Create(ctx, index, nil, &metav1.CreateOptions{ + FieldManager: "backend", + }) + if err != nil { + assert.Error(t, err) + } + _, _, err = indexStorage.Delete(ctx, index.GetName(), nil, &metav1.DeleteOptions{}) + if err != nil { + assert.Error(t, err) + } + _, _, err = indexStorage.Delete(ctx, index.GetName(), nil, &metav1.DeleteOptions{}) + if err != nil { + assert.Error(t, err) + } + }) + } +} diff --git a/pkg/backend/testipam/ipam_dynamic_address_test.go b/pkg/backend/testipam/ipam_dynamic_address_test.go new file mode 100644 index 0000000..608527d --- /dev/null +++ b/pkg/backend/testipam/ipam_dynamic_address_test.go @@ -0,0 +1,81 @@ +package ipam + +import ( + "testing" + + "github.com/kuidio/kuid/apis/backend" + "github.com/kuidio/kuid/apis/backend/ipam" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +func TestIPAMDynamicAddress(t *testing.T) { + tests := map[string]prefixTest{ + "FromAggregate": { + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "10.0.0.0/8", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: dynamicAddress, name: "addrClaim1", expectedError: true}, + }, + }, + "FromNetwork": { + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "10.0.0.0/8", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: staticPrefix, ip: "10.0.0.0/24", prefixType: network, expectedError: false}, + {claimType: dynamicAddress, name: "addrClaim1", expectedError: false, expectedIP: "10.0.0.1/24"}, + {claimType: dynamicAddress, name: "addrClaim1", expectedError: false, expectedIP: "10.0.0.1/24"}, // we explicitly reclaim the same ip + {claimType: dynamicAddress, name: "addrClaim2", expectedError: false, expectedIP: "10.0.0.254/24"}, + {claimType: dynamicAddress, name: "addrClaim3", expectedError: false, expectedIP: "10.0.0.2/24"}, + {claimType: dynamicAddress, name: "addrClaim4", expectedError: false, expectedIP: "10.0.0.3/24"}, + {claimType: dynamicAddress, name: "addrClaim5", expectedError: false, expectedIP: "10.0.0.252/24"}, + }, + }, + "FromPool": { + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "10.0.0.0/8", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: staticPrefix, ip: "10.0.0.0/24", prefixType: pool, expectedError: false}, + {claimType: dynamicAddress, name: "addrClaim1", expectedError: false, expectedIP: "10.0.0.0/32"}, + {claimType: dynamicAddress, name: "addrClaim1", expectedError: false, expectedIP: "10.0.0.0/32"}, // we explicitly reclaim the same ip + {claimType: dynamicAddress, name: "addrClaim2", expectedError: false, expectedIP: "10.0.0.1/32"}, + {claimType: dynamicAddress, name: "addrClaim3", expectedError: false, expectedIP: "10.0.0.2/32"}, + {claimType: dynamicAddress, name: "addrClaim4", expectedError: false, expectedIP: "10.0.0.3/32"}, + {claimType: dynamicAddress, name: "addrClaim5", expectedError: false, expectedIP: "10.0.0.4/32"}, + }, + }, + "FromRange": { + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "10.0.0.0/8", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: staticPrefix, ip: "10.0.0.0/24", prefixType: aggregate, expectedError: false}, + {claimType: staticRange, name: "range1", ip: "10.0.0.10-10.0.0.100", expectedError: false}, + {claimType: dynamicAddress, name: "addrClaim1", expectedError: false, expectedIP: "10.0.0.10/32", selector: &metav1.LabelSelector{ + MatchLabels: map[string]string{backend.KuidClaimNameKey: "range1"}, + }}, + {claimType: dynamicAddress, name: "addrClaim1", expectedError: false, expectedIP: "10.0.0.10/32", selector: &metav1.LabelSelector{ + MatchLabels: map[string]string{backend.KuidClaimNameKey: "range1"}, // we explicitly reclaim the same ip + }}, + {claimType: dynamicAddress, name: "addrClaim2", expectedError: false, expectedIP: "10.0.0.11/32", selector: &metav1.LabelSelector{ + MatchLabels: map[string]string{backend.KuidClaimNameKey: "range1"}, + }}, + }, + }, + } + + for name, tc := range tests { + tc := tc + t.Run(name, func(t *testing.T) { + if err := prefixTestRun(name, tc); err != nil { + t.Errorf("test %s failed err: %v", name, err) + } + }) + } +} diff --git a/pkg/backend/testipam/ipam_dynamic_prefix_test.go b/pkg/backend/testipam/ipam_dynamic_prefix_test.go new file mode 100644 index 0000000..7f7f681 --- /dev/null +++ b/pkg/backend/testipam/ipam_dynamic_prefix_test.go @@ -0,0 +1,43 @@ +package ipam + +import ( + "testing" + + "github.com/kuidio/kuid/apis/backend/ipam" +) + +func TestIPAMDynamicPrefix(t *testing.T) { + tests := map[string]prefixTest{ + "Normal": { + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "10.0.0.0/8", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: dynamicPrefix, name: "prefix1", prefixLength: 24, expectedError: false, expectedIP: "10.0.0.0/24"}, + {claimType: dynamicPrefix, name: "prefix2", prefixLength: 24, prefixType: pool, expectedError: false, expectedIP: "10.0.1.0/24"}, + {claimType: dynamicPrefix, name: "prefix3", prefixLength: 24, prefixType: network, expectedError: false, expectedIP: "10.0.2.0/24"}, + {claimType: dynamicPrefix, name: "prefix4", prefixLength: 24, prefixType: network, expectedError: false, expectedIP: "10.0.3.0/24"}, + {claimType: dynamicPrefix, name: "prefix5", prefixLength: 24, expectedError: false, expectedIP: "10.0.4.0/24"}, + }, + }, + "NoAvailable": { + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "10.0.0.0/24", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: dynamicPrefix, name: "prefix1", prefixLength: 24, expectedError: true}, + }, + }, + } + + for name, tc := range tests { + tc := tc + t.Run(name, func(t *testing.T) { + if err := prefixTestRun(name, tc); err != nil { + t.Errorf("test %s failed err: %v", name, err) + } + }) + } +} diff --git a/pkg/backend/testipam/ipam_index_test.go b/pkg/backend/testipam/ipam_index_test.go new file mode 100644 index 0000000..72f2247 --- /dev/null +++ b/pkg/backend/testipam/ipam_index_test.go @@ -0,0 +1,65 @@ +package ipam + +import ( + "context" + "testing" + + "github.com/kuidio/kuid/apis/backend/ipam" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" +) + +func TestIPAMIndexNormal(t *testing.T) { + tests := map[string]struct { + index string + indexPrefixes []ipam.Prefix + }{ + "CreateDelete": { + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "172.0.0.0/8", PrefixType: aggregate}, + }, + }, + } + + for name, tc := range tests { + t.Run(name, func(t *testing.T) { + ctx := context.Background() + apiserver := apiServer() + _, err := initBackend(ctx, apiserver) + if err != nil { + t.Errorf("cannot get backend, err: %v", err) + } + + indexStorage, err := getStorage(ctx, apiserver, schema.GroupResource{ + Group: ipam.SchemeGroupVersion.Group, + Resource: ipam.IPIndexPlural, + }) + if err != nil { + t.Errorf("cannot get index storage, err: %v", err) + return + } + + index := getIndex(tc.index, tc.indexPrefixes) + ctx = genericapirequest.WithNamespace(ctx, index.GetNamespace()) + _, err = indexStorage.Create(ctx, index, nil, &metav1.CreateOptions{ + FieldManager: "backend", + }) + if err != nil { + t.Errorf("cannot create index, err: %v", err) + return + } + _, _, err = indexStorage.Delete(ctx, index.GetName(), nil, &metav1.DeleteOptions{}) + if err != nil { + t.Errorf("cannot delete index, err: %v", err) + return + } + _, _, err = indexStorage.Delete(ctx, index.GetName(), nil, &metav1.DeleteOptions{}) + if err == nil { + t.Errorf("cannot delete non existing index, err: %v", err) + return + } + }) + } +} diff --git a/pkg/backend/testipam/ipam_static_address_test.go b/pkg/backend/testipam/ipam_static_address_test.go new file mode 100644 index 0000000..dedd356 --- /dev/null +++ b/pkg/backend/testipam/ipam_static_address_test.go @@ -0,0 +1,158 @@ +package ipam + +import ( + "testing" + + "github.com/kuidio/kuid/apis/backend/ipam" + "k8s.io/utils/ptr" +) + +func TestIPAMStaticAddress(t *testing.T) { + tests := map[string]prefixTest{ + "NoParent": { + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "10.0.0.0/8", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: staticAddress, ip: "172.0.0.0/32", expectedError: true}, + }, + }, + "Address_AggregateParent": { + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "172.0.0.0/8", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: staticAddress, ip: "172.0.0.0/32", expectedError: false}, + }, + }, + "Address_NetworkParent_OwnerClash": { // since netwotk prefixes get expanded the address is clashing + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "172.0.0.0/8", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: network, expectedError: false}, + {claimType: staticAddress, ip: "172.0.0.0/32", expectedError: true}, + }, + }, + "Address_NetworkParent": { // 32 or /128 not possible in network Addresses + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "172.0.0.0/8", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: network, expectedError: false}, + {claimType: staticAddress, ip: "172.0.0.1/32", expectedError: true}, + }, + }, + "Address_First_PoolParent": { + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "172.0.0.0/8", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: pool, expectedError: false}, + {claimType: staticAddress, ip: "172.0.0.0/32", expectedError: false}, + }, + }, + "Address_PoolParent": { + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "172.0.0.0/8", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: pool, expectedError: false}, + {claimType: staticAddress, ip: "172.0.0.1/32", expectedError: false}, + }, + }, + "Address_First_OtherParent": { + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "172.0.0.0/8", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: staticPrefix, ip: "172.0.0.0/24", expectedError: true}, + {claimType: staticAddress, ip: "172.0.0.0/32", expectedError: false}, + }, + }, + "PrefixAddress_AggregateParent": { + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "172.0.0.0/8", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: staticAddress, ip: "172.0.0.1/24", expectedError: true}, + }, + }, + "PrefixAddress_NetworkParent_OwnerClash": { // since netwotk prefixes get expanded the address is clashing + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "172.0.0.0/8", PrefixType: ptr.To(ipam.IPPrefixType_Aggregate)}, + }, + prefixes: []testprefix{ + {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: network, expectedError: false}, + {claimType: staticAddress, ip: "172.0.0.0/32", expectedError: true}, + }, + }, + "PrefixAddress_NetworkParent": { + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "172.0.0.0/8", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: network, expectedError: false}, + {claimType: staticAddress, ip: "172.0.0.1/24", expectedError: false}, + }, + }, + "PrefixAddress_NetworkParentWithAddress": { + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "172.0.0.0/8", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: staticPrefix, ip: "172.0.0.1/24", prefixType: network, expectedError: false}, + {claimType: staticAddress, ip: "172.0.0.2/24", expectedError: false}, + }, + }, + "PrefixAddress_First_PoolParent": { + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "172.0.0.0/8", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: pool, expectedError: false}, + {claimType: staticAddress, ip: "172.0.0.0/32", expectedError: false}, + }, + }, + "PrefixAddress_PoolParent": { + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "172.0.0.0/8", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: pool, expectedError: false}, + {claimType: staticAddress, ip: "172.0.0.1/32", expectedError: false}, + }, + }, + "PrefixAddress_First_OtherParent": { + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "172.0.0.0/8", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: aggregate, expectedError: false}, + {claimType: staticAddress, ip: "172.0.0.1/24", prefixType: network, expectedError: true}, + }, + }, + } + + for name, tc := range tests { + t.Run(name, func(t *testing.T) { + if err := prefixTestRun(name, tc); err != nil { + t.Errorf("test %s failed err: %v", name, err) + } + }) + } +} diff --git a/pkg/backend/testipam/ipam_static_prefix_test.go b/pkg/backend/testipam/ipam_static_prefix_test.go new file mode 100644 index 0000000..c3d52cb --- /dev/null +++ b/pkg/backend/testipam/ipam_static_prefix_test.go @@ -0,0 +1,127 @@ +package ipam + +import ( + "testing" + + "github.com/kuidio/kuid/apis/backend/ipam" +) + +func TestIPAMStaticPrefix(t *testing.T) { + tests := map[string]prefixTest{ + /* + "NotReady": { + index: "", + prefixes: []testprefix{ + {claimType: staticPrefix, ip: "172.0.0.0/8", prefixType: aggregate, expectedError: true}, // rib not ready + }, + }, + */ + "AggregateNoParents": { + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "172.0.0.0/8", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: staticPrefix, ip: "10.0.0.0/8", prefixType: aggregate, expectedError: true}, + {claimType: staticPrefix, ip: "2000::/48", prefixType: aggregate, expectedError: true}, + }, + }, + "AggregateNoParentIPv6": { + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "172.0.0.0/8", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: staticPrefix, ip: "172.0.0.0/16", prefixType: aggregate, expectedError: false}, + {claimType: staticPrefix, ip: "2000::/48", prefixType: aggregate, expectedError: true}, + }, + }, + "AggregateNormalIPv6": { + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "2000::/32", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: staticPrefix, ip: "2000::/48", prefixType: aggregate, expectedError: false}, + }, + }, + "Normal2Pool": { + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "172.0.0.0/8", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: staticPrefix, ip: "172.0.0.0/16", prefixType: aggregate, expectedError: false}, + {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: aggregate, expectedError: false}, + {claimType: staticPrefix, ip: "172.0.0.0/27", prefixType: pool, expectedError: false}, + }, + }, + "NestingNetwork": { + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "172.0.0.0/8", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: staticPrefix, ip: "172.0.0.0/16", prefixType: aggregate, expectedError: false}, + {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: network, expectedError: false}, + {claimType: staticPrefix, ip: "172.0.0.0/27", prefixType: network, expectedError: true}, + }, + }, + "Network2Pool": { + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "172.0.0.0/8", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: pool, expectedError: false}, + {claimType: staticPrefix, ip: "172.0.0.0/27", prefixType: network, expectedError: true}, + }, + }, + "Pool2Network": { + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "172.0.0.0/8", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: network, expectedError: false}, + {claimType: staticPrefix, ip: "172.0.0.0/27", prefixType: pool, expectedError: true}, + }, + }, + "Pool2Pool": { + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "172.0.0.0/8", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: pool, expectedError: false}, + {claimType: staticPrefix, ip: "172.0.0.0/27", prefixType: pool, expectedError: true}, + }, + }, + "Pool2Aggregate": { + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "172.0.0.0/8", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: pool, expectedError: false}, + }, + }, + "Network2Aggregate": { + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "172.0.0.0/8", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: staticPrefix, ip: "172.0.0.0/24", prefixType: network, expectedError: false}, + }, + }, + } + + for name, tc := range tests { + t.Run(name, func(t *testing.T) { + if err := prefixTestRun(name, tc); err != nil { + t.Errorf("test %s failed err: %v", name, err) + } + }) + } +} diff --git a/pkg/backend/testipam/ipam_static_range_test.go b/pkg/backend/testipam/ipam_static_range_test.go new file mode 100644 index 0000000..4a2d058 --- /dev/null +++ b/pkg/backend/testipam/ipam_static_range_test.go @@ -0,0 +1,84 @@ +package ipam + +import ( + "testing" + + "github.com/kuidio/kuid/apis/backend/ipam" +) + +func TestIPAMStaticRange(t *testing.T) { + tests := map[string]prefixTest{ + "Normal": { + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "10.0.0.0/8", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: staticPrefix, ip: "10.0.0.0/24", prefixType: aggregate, expectedError: false}, + {claimType: staticRange, name: "range1", ip: "10.0.0.10-10.0.0.100", expectedError: false}, + {claimType: staticAddress, ip: "10.0.0.10/32", expectedError: false}, + {claimType: staticAddress, ip: "10.0.0.11/32", expectedError: false}, + {claimType: staticAddress, ip: "10.0.0.100/32", expectedError: false}, + }, + }, + /* + "Ranges": { + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "10.0.0.0/8", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: staticPrefix, ip: "10.0.0.0/24", prefixType: aggregate, expectedError: false}, + {claimType: staticRange, name: "range1", ip: "10.0.0.10-10.0.0.19", expectedError: false}, + {claimType: staticAddress, ip: "10.0.0.10/32", expectedError: false}, + {claimType: staticAddress, ip: "10.0.0.11/32", expectedError: false}, + {claimType: staticAddress, ip: "10.0.0.19/32", expectedError: false}, + {claimType: staticRange, name: "range2", ip: "10.0.0.20-10.0.0.29", expectedError: false}, + {claimType: staticAddress, ip: "10.0.0.20/32", expectedError: false}, + {claimType: staticAddress, ip: "10.0.0.21/32", expectedError: false}, + {claimType: staticAddress, ip: "10.0.0.29/32", expectedError: false}, + }, + }, + "Overlap": { + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "10.0.0.0/8", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: staticPrefix, ip: "10.0.0.0/24", prefixType: aggregate, expectedError: false}, + {claimType: staticRange, name: "range1", ip: "10.0.0.10-10.0.0.20", expectedError: false}, + {claimType: staticRange, name: "range2", ip: "10.0.0.20-10.0.0.29", expectedError: true}, + }, + }, + "Range2Network": { + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "10.0.0.0/8", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: staticPrefix, ip: "10.0.0.0/24", prefixType: network, expectedError: false}, + {claimType: staticRange, name: "range1", ip: "10.0.0.10-10.0.0.100", expectedError: false}, + }, + }, + "Range2Pool": { + index: "a", + indexPrefixes: []ipam.Prefix{ + {Prefix: "10.0.0.0/8", PrefixType: aggregate}, + }, + prefixes: []testprefix{ + {claimType: staticPrefix, ip: "10.0.0.0/24", prefixType: pool, expectedError: false}, + {claimType: staticRange, name: "range1", ip: "10.0.0.10-10.0.0.100", expectedError: false}, + }, + }, + */ + } + + for name, tc := range tests { + tc := tc + t.Run(name, func(t *testing.T) { + if err := prefixTestRun(name, tc); err != nil { + t.Errorf("test %s failed err: %v", name, err) + } + }) + } +} diff --git a/pkg/backend/testipam/ipam_test_helpers.go b/pkg/backend/testipam/ipam_test_helpers.go new file mode 100644 index 0000000..11b4b99 --- /dev/null +++ b/pkg/backend/testipam/ipam_test_helpers.go @@ -0,0 +1,383 @@ +package ipam + +import ( + "context" + "fmt" + "reflect" + + "github.com/henderiw/apiserver-builder/pkg/builder" + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/henderiw/iputil" + "github.com/kuidio/kuid/apis/backend/ipam" + "github.com/kuidio/kuid/apis/backend/ipam/register" + ipambev1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" + "github.com/kuidio/kuid/apis/common" + bebackend "github.com/kuidio/kuid/pkg/backend" + ipambe "github.com/kuidio/kuid/pkg/backend/ipam" + "github.com/kuidio/kuid/pkg/config" + "github.com/kuidio/kuid/pkg/generated/openapi" + "github.com/kuidio/kuid/pkg/registry/options" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/generic" + "k8s.io/apiserver/pkg/registry/rest" + "k8s.io/utils/ptr" +) + +type testprefix struct { + name string + claimType ipam.IPClaimType + prefixType *ipam.IPPrefixType + ip string + prefixLength uint32 + labels map[string]string + selector *metav1.LabelSelector + expectedError bool + expectedDG string + expectedIP string +} + +// alias +const ( + namespace = "dummy" + staticPrefix = ipam.IPClaimType_StaticPrefix + staticRange = ipam.IPClaimType_StaticRange + staticAddress = ipam.IPClaimType_StaticAddress + dynamicPrefix = ipam.IPClaimType_DynamicPrefix + dynamicAddress = ipam.IPClaimType_DynamicAddress +) + +var aggregate = ptr.To(ipam.IPPrefixType_Aggregate) +var network = ptr.To(ipam.IPPrefixType_Network) +var pool = ptr.To(ipam.IPPrefixType_Pool) + +//var other = ptr.To(ipam.IPPrefixType_Other) + +func apiServer() *builder.Server { + return builder.NewAPIServer(). + WithServerName("kuid-api-server"). + WithOpenAPIDefinitions("Config", "v1alpha1", openapi.GetOpenAPIDefinitions). + WithoutEtcd() +} + +func initBackend(ctx context.Context, apiserver *builder.Server) (bebackend.Backend, error) { + groupConfig := config.GroupConfig{ + BackendFn: register.NewBackend, + ApplyStorageToBackendFn: register.ApplyStorageToBackend, + Resources: []*config.ResourceConfig{ + {StorageProviderFn: register.NewIndexStorageProvider, Internal: &ipam.IPIndex{}, ResourceVersions: []resource.Object{&ipam.IPIndex{}, &ipambev1alpha1.IPIndex{}}}, + {StorageProviderFn: register.NewClaimStorageProvider, Internal: &ipam.IPClaim{}, ResourceVersions: []resource.Object{&ipam.IPClaim{}, &ipambev1alpha1.IPClaim{}}}, + {StorageProviderFn: register.NewStorageProvider, Internal: &ipam.IPEntry{}, ResourceVersions: []resource.Object{&ipam.IPEntry{}, &ipambev1alpha1.IPEntry{}}}, + }, + } + + be := groupConfig.BackendFn() + for _, resource := range groupConfig.Resources { + storageProvider := resource.StorageProviderFn(ctx, resource.Internal, be, true, &options.Options{ + Type: options.StorageType_Memory, + }) + for _, resourceVersion := range resource.ResourceVersions { + apiserver.WithResourceAndHandler(resourceVersion, storageProvider) + } + } + + if _, err := apiserver.Build(ctx); err != nil { + return nil, err + } + if err := groupConfig.ApplyStorageToBackendFn(ctx, be, apiserver); err != nil { + return nil, err + } + return be, nil +} + +func getStorage(ctx context.Context, apiServer *builder.Server, gr schema.GroupResource) (*registry.Store, error) { + storageProvider := apiServer.StorageProvider[gr] + storage, err := storageProvider.Get(ctx, apiServer.Schemes[0], &Getter{}) + if err != nil { + return nil, err + } + registryStore, ok := storage.(*registry.Store) + if !ok { + return nil, fmt.Errorf("index store is not a *registry.Store, got: %v", reflect.TypeOf(storage).Name()) + } + return registryStore, nil +} + +var _ generic.RESTOptionsGetter = &Getter{} + +type Getter struct{} + +func (r *Getter) GetRESTOptions(resource schema.GroupResource, example runtime.Object) (generic.RESTOptions, error) { + return generic.RESTOptions{}, nil +} + +func getIndex(index string, prefixes []ipam.Prefix) *ipam.IPIndex { + return ipam.BuildIPIndex( + metav1.ObjectMeta{Namespace: namespace, Name: index}, + &ipam.IPIndexSpec{ + Prefixes: prefixes, + }, + nil, + ) +} + +func (r testprefix) getStaticPrefixIPClaim(index string) (*ipam.IPClaim, error) { + pi, err := iputil.New(r.ip) + if err != nil { + return nil, err + } + ipClaim := ipam.BuildIPClaim( + metav1.ObjectMeta{Namespace: namespace, Name: pi.GetSubnetName()}, + &ipam.IPClaimSpec{ + Index: index, + PrefixType: r.prefixType, + Prefix: ptr.To(r.ip), + ClaimLabels: common.ClaimLabels{ + UserDefinedLabels: common.UserDefinedLabels{Labels: r.labels}, + }, + }, + nil, + ) + fielErrList := ipClaim.ValidateSyntax("") // this expands the ownerRef in the spec + if len(fielErrList) != 0 { + return nil, fmt.Errorf("invalid syntax %v", fielErrList) + } + return ipClaim, nil +} + +func (r testprefix) getDynamicPrefixIPClaim(index string) (*ipam.IPClaim, error) { + ipClaim := ipam.BuildIPClaim( + metav1.ObjectMeta{Namespace: namespace, Name: r.name}, + &ipam.IPClaimSpec{ + Index: index, + PrefixType: r.prefixType, + CreatePrefix: ptr.To[bool](true), + PrefixLength: ptr.To[uint32](r.prefixLength), + ClaimLabels: common.ClaimLabels{ + UserDefinedLabels: common.UserDefinedLabels{Labels: r.labels}, + Selector: r.selector, + }, + }, + nil, + ) + fielErrList := ipClaim.ValidateSyntax("") // this expands the ownerRef in the spec + if len(fielErrList) != 0 { + return nil, fmt.Errorf("invalid syntax %v", fielErrList) + } + return ipClaim, nil +} + +func (r testprefix) getStaticAddressIPClaim(index string) (*ipam.IPClaim, error) { + pi, err := iputil.New(r.ip) + if err != nil { + return nil, err + } + + pi = iputil.NewPrefixInfo(pi.GetIPAddressPrefix()) + + ipClaim := ipam.BuildIPClaim( + metav1.ObjectMeta{Namespace: namespace, Name: pi.GetSubnetName()}, + &ipam.IPClaimSpec{ + Index: index, + Address: ptr.To[string](r.ip), + ClaimLabels: common.ClaimLabels{ + UserDefinedLabels: common.UserDefinedLabels{Labels: r.labels}, + }, + }, + nil, + ) + fielErrList := ipClaim.ValidateSyntax("") // this expands the ownerRef in the spec + if len(fielErrList) != 0 { + return nil, fmt.Errorf("invalid syntax %v", fielErrList) + } + return ipClaim, nil +} + +func (r testprefix) getDynamicAddressIPClaim(index string) (*ipam.IPClaim, error) { + ipClaim := ipam.BuildIPClaim( + metav1.ObjectMeta{Namespace: namespace, Name: r.name}, + &ipam.IPClaimSpec{ + Index: index, + PrefixType: nil, + ClaimLabels: common.ClaimLabels{ + UserDefinedLabels: common.UserDefinedLabels{Labels: r.labels}, + Selector: r.selector, + }, + }, + nil, + ) + fielErrList := ipClaim.ValidateSyntax("") // this expands the ownerRef in the spec + if len(fielErrList) != 0 { + return nil, fmt.Errorf("invalid syntax %v", fielErrList) + } + return ipClaim, nil +} + +func (r testprefix) getStaticRangeIPClaim(index string) (*ipam.IPClaim, error) { + ipClaim := ipam.BuildIPClaim( + metav1.ObjectMeta{Namespace: namespace, Name: r.name}, + &ipam.IPClaimSpec{ + Index: index, + Range: ptr.To[string](r.ip), + ClaimLabels: common.ClaimLabels{ + UserDefinedLabels: common.UserDefinedLabels{Labels: r.labels}, + }, + }, + nil, + ) + fielErrList := ipClaim.ValidateSyntax("") // this expands the ownerRef in the spec + if len(fielErrList) != 0 { + return nil, fmt.Errorf("invalid syntax %v", fielErrList) + } + return ipClaim, nil +} + +type prefixTest struct { + index string + indexPrefixes []ipam.Prefix + prefixes []testprefix +} + +func prefixTestRun(name string, tc prefixTest) error { + ctx := context.Background() + apiserver := apiServer() + be, err := initBackend(ctx, apiserver) + if err != nil { + return fmt.Errorf("cannot get backend, err: %v", err) + } + + indexStorage, err := getStorage(ctx, apiserver, schema.GroupResource{ + Group: ipam.SchemeGroupVersion.Group, + Resource: ipam.IPIndexPlural, + }) + if err != nil { + return fmt.Errorf("cannot get index storage, err: %v", err) + } + + claimStorage, err := getStorage(ctx, apiserver, schema.GroupResource{ + Group: ipam.SchemeGroupVersion.Group, + Resource: ipam.IPClaimPlural, + }) + if err != nil { + return fmt.Errorf("cannot get claim storage, err: %v", err) + } + index := getIndex(tc.index, tc.indexPrefixes) + ctx = genericapirequest.WithNamespace(ctx, index.GetNamespace()) + newIndex, err := indexStorage.Create(ctx, index, nil, &metav1.CreateOptions{ + FieldManager: "backend", + }) + if err != nil { + return fmt.Errorf("cannot create index, err: %v", err) + } + index, ok := newIndex.(*ipam.IPIndex) + if !ok { + return fmt.Errorf("not an ip index, got: %s", reflect.TypeOf(index).Name()) + } + + for _, p := range tc.prefixes { + var claim *ipam.IPClaim + var err error + + switch p.claimType { + case staticPrefix: + claim, err = p.getStaticPrefixIPClaim(tc.index) + case staticRange: + claim, err = p.getStaticRangeIPClaim(tc.index) + case staticAddress: + claim, err = p.getStaticAddressIPClaim(tc.index) + case dynamicPrefix: + claim, err = p.getDynamicPrefixIPClaim(tc.index) + case dynamicAddress: + claim, err = p.getDynamicAddressIPClaim(tc.index) + } + if err != nil { + return fmt.Errorf("wrong prefix type, err: %v", err) + } + + ctx = genericapirequest.WithNamespace(ctx, claim.GetNamespace()) + + exists := true + oldClaim, err := claimStorage.Get(ctx, claim.GetName(), &metav1.GetOptions{}) + if err != nil { + exists = false + } + var newClaim runtime.Object + if !exists { + newClaim, err = claimStorage.Create(ctx, claim, nil, &metav1.CreateOptions{FieldManager: "test"}) + } else { + defaultObjInfo := rest.DefaultUpdatedObjectInfo(oldClaim, ipambe.ClaimTransformer) + newClaim, _, err = claimStorage.Update(ctx, claim.GetName(), defaultObjInfo, nil, nil, false, &metav1.UpdateOptions{ + FieldManager: "backend", + }) + } + if p.expectedError { + if err == nil { + return fmt.Errorf("expected error. got nil") + } + continue + } + if err != nil { + return fmt.Errorf("unexpected error, got: %v", err) + } + ipClaim, ok := newClaim.(*ipam.IPClaim) + if !ok { + return fmt.Errorf("expecting ipClaim, got: %v", reflect.TypeOf(newClaim).Name()) + } + + switch p.claimType { + case staticPrefix, dynamicPrefix: + if ipClaim.Status.Prefix == nil { + return fmt.Errorf("expecting prefix status got nil") + } else { + expectedIP := p.ip + if p.expectedIP != "" { + expectedIP = p.expectedIP + } + if *ipClaim.Status.Prefix != expectedIP { + return fmt.Errorf("expecting prefix got %s, want %s", *ipClaim.Status.Prefix, expectedIP) + } + } + case staticAddress, dynamicAddress: + if ipClaim.Status.Address == nil { + return fmt.Errorf("expecting address status got nil") + } else { + expectedIP := p.ip + if p.expectedIP != "" { + expectedIP = p.expectedIP + } + if *ipClaim.Status.Address != expectedIP { + return fmt.Errorf("expecting address got %s, want %s", *ipClaim.Status.Address, expectedIP) + } + } + if ipClaim.Status.DefaultGateway == nil { + if p.expectedDG != "" { + return fmt.Errorf("expecting defaultGateway %s got nil", p.expectedDG) + } + } else { + if p.expectedDG == "" { + return fmt.Errorf("unexpected defaultGateway got %s", *ipClaim.Status.DefaultGateway) + } + if *ipClaim.Status.DefaultGateway != p.expectedDG { + return fmt.Errorf("expecting defaultGateway got %s, want %s", *ipClaim.Status.DefaultGateway, p.expectedDG) + } + } + case staticRange: + if ipClaim.Status.Range == nil { + return fmt.Errorf("expecting range status got nil") + } else { + if *ipClaim.Status.Range != p.ip { + return fmt.Errorf("expecting prefix got %s, want %s", *ipClaim.Status.Range, p.ip) + } + } + } + } + if name == "" { + fmt.Println("###############") + be.PrintEntries(ctx, tc.index) + fmt.Println("###############") + } + return nil +} diff --git a/pkg/config/config.go b/pkg/config/config.go index 74555f9..6a2975c 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -70,9 +70,10 @@ func getDefaultConfig() *KuidConfig { return &KuidConfig{ Storage: StorageType_Badgerdb, Groups: []*KuidGroupConfig{ + {Group: "infra.kuid.dev", Enabled: true, Sync: true}, {Group: "as.be.kuid.dev", Enabled: true, Sync: true}, {Group: "vlan.be.kuid.dev", Enabled: true, Sync: true}, - {Group: "infra.kuid.dev", Enabled: true, Sync: true}, + {Group: "ipam.be.kuid.dev", Enabled: true, Sync: true}, }, } } diff --git a/pkg/generated/clientset/versioned/clientset.go b/pkg/generated/clientset/versioned/clientset.go index 6b95ed5..cab0c9a 100644 --- a/pkg/generated/clientset/versioned/clientset.go +++ b/pkg/generated/clientset/versioned/clientset.go @@ -23,6 +23,7 @@ import ( asv1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/as/v1alpha1" infrav1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/infra/v1alpha1" + ipamv1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/ipam/v1alpha1" vlanv1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/vlan/v1alpha1" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" @@ -33,6 +34,7 @@ type Interface interface { Discovery() discovery.DiscoveryInterface AsV1alpha1() asv1alpha1.AsV1alpha1Interface InfraV1alpha1() infrav1alpha1.InfraV1alpha1Interface + IpamV1alpha1() ipamv1alpha1.IpamV1alpha1Interface VlanV1alpha1() vlanv1alpha1.VlanV1alpha1Interface } @@ -41,6 +43,7 @@ type Clientset struct { *discovery.DiscoveryClient asV1alpha1 *asv1alpha1.AsV1alpha1Client infraV1alpha1 *infrav1alpha1.InfraV1alpha1Client + ipamV1alpha1 *ipamv1alpha1.IpamV1alpha1Client vlanV1alpha1 *vlanv1alpha1.VlanV1alpha1Client } @@ -54,6 +57,11 @@ func (c *Clientset) InfraV1alpha1() infrav1alpha1.InfraV1alpha1Interface { return c.infraV1alpha1 } +// IpamV1alpha1 retrieves the IpamV1alpha1Client +func (c *Clientset) IpamV1alpha1() ipamv1alpha1.IpamV1alpha1Interface { + return c.ipamV1alpha1 +} + // VlanV1alpha1 retrieves the VlanV1alpha1Client func (c *Clientset) VlanV1alpha1() vlanv1alpha1.VlanV1alpha1Interface { return c.vlanV1alpha1 @@ -111,6 +119,10 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, if err != nil { return nil, err } + cs.ipamV1alpha1, err = ipamv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } cs.vlanV1alpha1, err = vlanv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err @@ -138,6 +150,7 @@ func New(c rest.Interface) *Clientset { var cs Clientset cs.asV1alpha1 = asv1alpha1.New(c) cs.infraV1alpha1 = infrav1alpha1.New(c) + cs.ipamV1alpha1 = ipamv1alpha1.New(c) cs.vlanV1alpha1 = vlanv1alpha1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) diff --git a/pkg/generated/clientset/versioned/fake/clientset_generated.go b/pkg/generated/clientset/versioned/fake/clientset_generated.go index 80b9e2d..d37c69a 100644 --- a/pkg/generated/clientset/versioned/fake/clientset_generated.go +++ b/pkg/generated/clientset/versioned/fake/clientset_generated.go @@ -23,6 +23,8 @@ import ( fakeasv1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/as/v1alpha1/fake" infrav1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/infra/v1alpha1" fakeinfrav1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake" + ipamv1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/ipam/v1alpha1" + fakeipamv1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/ipam/v1alpha1/fake" vlanv1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/vlan/v1alpha1" fakevlanv1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/vlan/v1alpha1/fake" "k8s.io/apimachinery/pkg/runtime" @@ -96,6 +98,11 @@ func (c *Clientset) InfraV1alpha1() infrav1alpha1.InfraV1alpha1Interface { return &fakeinfrav1alpha1.FakeInfraV1alpha1{Fake: &c.Fake} } +// IpamV1alpha1 retrieves the IpamV1alpha1Client +func (c *Clientset) IpamV1alpha1() ipamv1alpha1.IpamV1alpha1Interface { + return &fakeipamv1alpha1.FakeIpamV1alpha1{Fake: &c.Fake} +} + // VlanV1alpha1 retrieves the VlanV1alpha1Client func (c *Clientset) VlanV1alpha1() vlanv1alpha1.VlanV1alpha1Interface { return &fakevlanv1alpha1.FakeVlanV1alpha1{Fake: &c.Fake} diff --git a/pkg/generated/clientset/versioned/fake/register.go b/pkg/generated/clientset/versioned/fake/register.go index 1f67be9..1846a9c 100644 --- a/pkg/generated/clientset/versioned/fake/register.go +++ b/pkg/generated/clientset/versioned/fake/register.go @@ -19,6 +19,7 @@ package fake import ( asv1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" + ipamv1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" vlanv1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" infrav1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -34,6 +35,7 @@ var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ asv1alpha1.AddToScheme, infrav1alpha1.AddToScheme, + ipamv1alpha1.AddToScheme, vlanv1alpha1.AddToScheme, } diff --git a/pkg/generated/clientset/versioned/scheme/register.go b/pkg/generated/clientset/versioned/scheme/register.go index 6dfd358..710000a 100644 --- a/pkg/generated/clientset/versioned/scheme/register.go +++ b/pkg/generated/clientset/versioned/scheme/register.go @@ -19,6 +19,7 @@ package scheme import ( asv1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" + ipamv1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" vlanv1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" infrav1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -34,6 +35,7 @@ var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ asv1alpha1.AddToScheme, infrav1alpha1.AddToScheme, + ipamv1alpha1.AddToScheme, vlanv1alpha1.AddToScheme, } diff --git a/pkg/generated/clientset/versioned/typed/ipam/v1alpha1/doc.go b/pkg/generated/clientset/versioned/typed/ipam/v1alpha1/doc.go new file mode 100644 index 0000000..cda7d5a --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/ipam/v1alpha1/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 diff --git a/pkg/generated/clientset/versioned/typed/ipam/v1alpha1/fake/doc.go b/pkg/generated/clientset/versioned/typed/ipam/v1alpha1/fake/doc.go new file mode 100644 index 0000000..d4601f1 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/ipam/v1alpha1/fake/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2024 Nokia. + +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/generated/clientset/versioned/typed/ipam/v1alpha1/fake/fake_ipam_client.go b/pkg/generated/clientset/versioned/typed/ipam/v1alpha1/fake/fake_ipam_client.go new file mode 100644 index 0000000..7b4363d --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/ipam/v1alpha1/fake/fake_ipam_client.go @@ -0,0 +1,47 @@ +/* +Copyright 2024 Nokia. + +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 ( + v1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/ipam/v1alpha1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeIpamV1alpha1 struct { + *testing.Fake +} + +func (c *FakeIpamV1alpha1) IPClaims(namespace string) v1alpha1.IPClaimInterface { + return &FakeIPClaims{c, namespace} +} + +func (c *FakeIpamV1alpha1) IPEntries(namespace string) v1alpha1.IPEntryInterface { + return &FakeIPEntries{c, namespace} +} + +func (c *FakeIpamV1alpha1) IPIndexes(namespace string) v1alpha1.IPIndexInterface { + return &FakeIPIndexes{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeIpamV1alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/generated/clientset/versioned/typed/ipam/v1alpha1/fake/fake_ipclaim.go b/pkg/generated/clientset/versioned/typed/ipam/v1alpha1/fake/fake_ipclaim.go new file mode 100644 index 0000000..d747cc0 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/ipam/v1alpha1/fake/fake_ipclaim.go @@ -0,0 +1,146 @@ +/* +Copyright 2024 Nokia. + +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" + + v1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" + v1 "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" +) + +// FakeIPClaims implements IPClaimInterface +type FakeIPClaims struct { + Fake *FakeIpamV1alpha1 + ns string +} + +var ipclaimsResource = v1alpha1.SchemeGroupVersion.WithResource("ipclaims") + +var ipclaimsKind = v1alpha1.SchemeGroupVersion.WithKind("IPClaim") + +// Get takes name of the iPClaim, and returns the corresponding iPClaim object, and an error if there is any. +func (c *FakeIPClaims) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.IPClaim, err error) { + emptyResult := &v1alpha1.IPClaim{} + obj, err := c.Fake. + Invokes(testing.NewGetActionWithOptions(ipclaimsResource, c.ns, name, options), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.IPClaim), err +} + +// List takes label and field selectors, and returns the list of IPClaims that match those selectors. +func (c *FakeIPClaims) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.IPClaimList, err error) { + emptyResult := &v1alpha1.IPClaimList{} + obj, err := c.Fake. + Invokes(testing.NewListActionWithOptions(ipclaimsResource, ipclaimsKind, c.ns, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.IPClaimList{ListMeta: obj.(*v1alpha1.IPClaimList).ListMeta} + for _, item := range obj.(*v1alpha1.IPClaimList).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 iPClaims. +func (c *FakeIPClaims) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchActionWithOptions(ipclaimsResource, c.ns, opts)) + +} + +// Create takes the representation of a iPClaim and creates it. Returns the server's representation of the iPClaim, and an error, if there is any. +func (c *FakeIPClaims) Create(ctx context.Context, iPClaim *v1alpha1.IPClaim, opts v1.CreateOptions) (result *v1alpha1.IPClaim, err error) { + emptyResult := &v1alpha1.IPClaim{} + obj, err := c.Fake. + Invokes(testing.NewCreateActionWithOptions(ipclaimsResource, c.ns, iPClaim, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.IPClaim), err +} + +// Update takes the representation of a iPClaim and updates it. Returns the server's representation of the iPClaim, and an error, if there is any. +func (c *FakeIPClaims) Update(ctx context.Context, iPClaim *v1alpha1.IPClaim, opts v1.UpdateOptions) (result *v1alpha1.IPClaim, err error) { + emptyResult := &v1alpha1.IPClaim{} + obj, err := c.Fake. + Invokes(testing.NewUpdateActionWithOptions(ipclaimsResource, c.ns, iPClaim, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.IPClaim), 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 *FakeIPClaims) UpdateStatus(ctx context.Context, iPClaim *v1alpha1.IPClaim, opts v1.UpdateOptions) (result *v1alpha1.IPClaim, err error) { + emptyResult := &v1alpha1.IPClaim{} + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceActionWithOptions(ipclaimsResource, "status", c.ns, iPClaim, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.IPClaim), err +} + +// Delete takes name of the iPClaim and deletes it. Returns an error if one occurs. +func (c *FakeIPClaims) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(ipclaimsResource, c.ns, name, opts), &v1alpha1.IPClaim{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeIPClaims) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(ipclaimsResource, c.ns, opts, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.IPClaimList{}) + return err +} + +// Patch applies the patch and returns the patched iPClaim. +func (c *FakeIPClaims) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IPClaim, err error) { + emptyResult := &v1alpha1.IPClaim{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(ipclaimsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.IPClaim), err +} diff --git a/pkg/generated/clientset/versioned/typed/ipam/v1alpha1/fake/fake_ipentry.go b/pkg/generated/clientset/versioned/typed/ipam/v1alpha1/fake/fake_ipentry.go new file mode 100644 index 0000000..3c1b07d --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/ipam/v1alpha1/fake/fake_ipentry.go @@ -0,0 +1,146 @@ +/* +Copyright 2024 Nokia. + +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" + + v1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" + v1 "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" +) + +// FakeIPEntries implements IPEntryInterface +type FakeIPEntries struct { + Fake *FakeIpamV1alpha1 + ns string +} + +var ipentriesResource = v1alpha1.SchemeGroupVersion.WithResource("ipentries") + +var ipentriesKind = v1alpha1.SchemeGroupVersion.WithKind("IPEntry") + +// Get takes name of the iPEntry, and returns the corresponding iPEntry object, and an error if there is any. +func (c *FakeIPEntries) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.IPEntry, err error) { + emptyResult := &v1alpha1.IPEntry{} + obj, err := c.Fake. + Invokes(testing.NewGetActionWithOptions(ipentriesResource, c.ns, name, options), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.IPEntry), err +} + +// List takes label and field selectors, and returns the list of IPEntries that match those selectors. +func (c *FakeIPEntries) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.IPEntryList, err error) { + emptyResult := &v1alpha1.IPEntryList{} + obj, err := c.Fake. + Invokes(testing.NewListActionWithOptions(ipentriesResource, ipentriesKind, c.ns, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.IPEntryList{ListMeta: obj.(*v1alpha1.IPEntryList).ListMeta} + for _, item := range obj.(*v1alpha1.IPEntryList).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 iPEntries. +func (c *FakeIPEntries) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchActionWithOptions(ipentriesResource, c.ns, opts)) + +} + +// Create takes the representation of a iPEntry and creates it. Returns the server's representation of the iPEntry, and an error, if there is any. +func (c *FakeIPEntries) Create(ctx context.Context, iPEntry *v1alpha1.IPEntry, opts v1.CreateOptions) (result *v1alpha1.IPEntry, err error) { + emptyResult := &v1alpha1.IPEntry{} + obj, err := c.Fake. + Invokes(testing.NewCreateActionWithOptions(ipentriesResource, c.ns, iPEntry, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.IPEntry), err +} + +// Update takes the representation of a iPEntry and updates it. Returns the server's representation of the iPEntry, and an error, if there is any. +func (c *FakeIPEntries) Update(ctx context.Context, iPEntry *v1alpha1.IPEntry, opts v1.UpdateOptions) (result *v1alpha1.IPEntry, err error) { + emptyResult := &v1alpha1.IPEntry{} + obj, err := c.Fake. + Invokes(testing.NewUpdateActionWithOptions(ipentriesResource, c.ns, iPEntry, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.IPEntry), 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 *FakeIPEntries) UpdateStatus(ctx context.Context, iPEntry *v1alpha1.IPEntry, opts v1.UpdateOptions) (result *v1alpha1.IPEntry, err error) { + emptyResult := &v1alpha1.IPEntry{} + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceActionWithOptions(ipentriesResource, "status", c.ns, iPEntry, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.IPEntry), err +} + +// Delete takes name of the iPEntry and deletes it. Returns an error if one occurs. +func (c *FakeIPEntries) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(ipentriesResource, c.ns, name, opts), &v1alpha1.IPEntry{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeIPEntries) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(ipentriesResource, c.ns, opts, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.IPEntryList{}) + return err +} + +// Patch applies the patch and returns the patched iPEntry. +func (c *FakeIPEntries) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IPEntry, err error) { + emptyResult := &v1alpha1.IPEntry{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(ipentriesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.IPEntry), err +} diff --git a/pkg/generated/clientset/versioned/typed/ipam/v1alpha1/fake/fake_ipindex.go b/pkg/generated/clientset/versioned/typed/ipam/v1alpha1/fake/fake_ipindex.go new file mode 100644 index 0000000..b2093e9 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/ipam/v1alpha1/fake/fake_ipindex.go @@ -0,0 +1,146 @@ +/* +Copyright 2024 Nokia. + +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" + + v1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" + v1 "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" +) + +// FakeIPIndexes implements IPIndexInterface +type FakeIPIndexes struct { + Fake *FakeIpamV1alpha1 + ns string +} + +var ipindexesResource = v1alpha1.SchemeGroupVersion.WithResource("ipindexes") + +var ipindexesKind = v1alpha1.SchemeGroupVersion.WithKind("IPIndex") + +// Get takes name of the iPIndex, and returns the corresponding iPIndex object, and an error if there is any. +func (c *FakeIPIndexes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.IPIndex, err error) { + emptyResult := &v1alpha1.IPIndex{} + obj, err := c.Fake. + Invokes(testing.NewGetActionWithOptions(ipindexesResource, c.ns, name, options), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.IPIndex), err +} + +// List takes label and field selectors, and returns the list of IPIndexes that match those selectors. +func (c *FakeIPIndexes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.IPIndexList, err error) { + emptyResult := &v1alpha1.IPIndexList{} + obj, err := c.Fake. + Invokes(testing.NewListActionWithOptions(ipindexesResource, ipindexesKind, c.ns, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.IPIndexList{ListMeta: obj.(*v1alpha1.IPIndexList).ListMeta} + for _, item := range obj.(*v1alpha1.IPIndexList).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 iPIndexes. +func (c *FakeIPIndexes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchActionWithOptions(ipindexesResource, c.ns, opts)) + +} + +// Create takes the representation of a iPIndex and creates it. Returns the server's representation of the iPIndex, and an error, if there is any. +func (c *FakeIPIndexes) Create(ctx context.Context, iPIndex *v1alpha1.IPIndex, opts v1.CreateOptions) (result *v1alpha1.IPIndex, err error) { + emptyResult := &v1alpha1.IPIndex{} + obj, err := c.Fake. + Invokes(testing.NewCreateActionWithOptions(ipindexesResource, c.ns, iPIndex, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.IPIndex), err +} + +// Update takes the representation of a iPIndex and updates it. Returns the server's representation of the iPIndex, and an error, if there is any. +func (c *FakeIPIndexes) Update(ctx context.Context, iPIndex *v1alpha1.IPIndex, opts v1.UpdateOptions) (result *v1alpha1.IPIndex, err error) { + emptyResult := &v1alpha1.IPIndex{} + obj, err := c.Fake. + Invokes(testing.NewUpdateActionWithOptions(ipindexesResource, c.ns, iPIndex, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.IPIndex), 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 *FakeIPIndexes) UpdateStatus(ctx context.Context, iPIndex *v1alpha1.IPIndex, opts v1.UpdateOptions) (result *v1alpha1.IPIndex, err error) { + emptyResult := &v1alpha1.IPIndex{} + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceActionWithOptions(ipindexesResource, "status", c.ns, iPIndex, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.IPIndex), err +} + +// Delete takes name of the iPIndex and deletes it. Returns an error if one occurs. +func (c *FakeIPIndexes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(ipindexesResource, c.ns, name, opts), &v1alpha1.IPIndex{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeIPIndexes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(ipindexesResource, c.ns, opts, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.IPIndexList{}) + return err +} + +// Patch applies the patch and returns the patched iPIndex. +func (c *FakeIPIndexes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IPIndex, err error) { + emptyResult := &v1alpha1.IPIndex{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(ipindexesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.IPIndex), err +} diff --git a/pkg/generated/clientset/versioned/typed/ipam/v1alpha1/generated_expansion.go b/pkg/generated/clientset/versioned/typed/ipam/v1alpha1/generated_expansion.go new file mode 100644 index 0000000..fbe21ea --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/ipam/v1alpha1/generated_expansion.go @@ -0,0 +1,24 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +type IPClaimExpansion interface{} + +type IPEntryExpansion interface{} + +type IPIndexExpansion interface{} diff --git a/pkg/generated/clientset/versioned/typed/ipam/v1alpha1/ipam_client.go b/pkg/generated/clientset/versioned/typed/ipam/v1alpha1/ipam_client.go new file mode 100644 index 0000000..2357364 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/ipam/v1alpha1/ipam_client.go @@ -0,0 +1,116 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "net/http" + + v1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" + "github.com/kuidio/kuid/pkg/generated/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" +) + +type IpamV1alpha1Interface interface { + RESTClient() rest.Interface + IPClaimsGetter + IPEntriesGetter + IPIndexesGetter +} + +// IpamV1alpha1Client is used to interact with features provided by the ipam.be.kuid.dev group. +type IpamV1alpha1Client struct { + restClient rest.Interface +} + +func (c *IpamV1alpha1Client) IPClaims(namespace string) IPClaimInterface { + return newIPClaims(c, namespace) +} + +func (c *IpamV1alpha1Client) IPEntries(namespace string) IPEntryInterface { + return newIPEntries(c, namespace) +} + +func (c *IpamV1alpha1Client) IPIndexes(namespace string) IPIndexInterface { + return newIPIndexes(c, namespace) +} + +// NewForConfig creates a new IpamV1alpha1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*IpamV1alpha1Client, 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 IpamV1alpha1Client 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) (*IpamV1alpha1Client, 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 &IpamV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new IpamV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *IpamV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new IpamV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *IpamV1alpha1Client { + return &IpamV1alpha1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha1.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 *IpamV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/generated/clientset/versioned/typed/ipam/v1alpha1/ipclaim.go b/pkg/generated/clientset/versioned/typed/ipam/v1alpha1/ipclaim.go new file mode 100644 index 0000000..dfadf70 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/ipam/v1alpha1/ipclaim.go @@ -0,0 +1,68 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + + v1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" + scheme "github.com/kuidio/kuid/pkg/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// IPClaimsGetter has a method to return a IPClaimInterface. +// A group's client should implement this interface. +type IPClaimsGetter interface { + IPClaims(namespace string) IPClaimInterface +} + +// IPClaimInterface has methods to work with IPClaim resources. +type IPClaimInterface interface { + Create(ctx context.Context, iPClaim *v1alpha1.IPClaim, opts v1.CreateOptions) (*v1alpha1.IPClaim, error) + Update(ctx context.Context, iPClaim *v1alpha1.IPClaim, opts v1.UpdateOptions) (*v1alpha1.IPClaim, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, iPClaim *v1alpha1.IPClaim, opts v1.UpdateOptions) (*v1alpha1.IPClaim, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.IPClaim, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.IPClaimList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IPClaim, err error) + IPClaimExpansion +} + +// iPClaims implements IPClaimInterface +type iPClaims struct { + *gentype.ClientWithList[*v1alpha1.IPClaim, *v1alpha1.IPClaimList] +} + +// newIPClaims returns a IPClaims +func newIPClaims(c *IpamV1alpha1Client, namespace string) *iPClaims { + return &iPClaims{ + gentype.NewClientWithList[*v1alpha1.IPClaim, *v1alpha1.IPClaimList]( + "ipclaims", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.IPClaim { return &v1alpha1.IPClaim{} }, + func() *v1alpha1.IPClaimList { return &v1alpha1.IPClaimList{} }), + } +} diff --git a/pkg/generated/clientset/versioned/typed/ipam/v1alpha1/ipentry.go b/pkg/generated/clientset/versioned/typed/ipam/v1alpha1/ipentry.go new file mode 100644 index 0000000..0d669bc --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/ipam/v1alpha1/ipentry.go @@ -0,0 +1,68 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + + v1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" + scheme "github.com/kuidio/kuid/pkg/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// IPEntriesGetter has a method to return a IPEntryInterface. +// A group's client should implement this interface. +type IPEntriesGetter interface { + IPEntries(namespace string) IPEntryInterface +} + +// IPEntryInterface has methods to work with IPEntry resources. +type IPEntryInterface interface { + Create(ctx context.Context, iPEntry *v1alpha1.IPEntry, opts v1.CreateOptions) (*v1alpha1.IPEntry, error) + Update(ctx context.Context, iPEntry *v1alpha1.IPEntry, opts v1.UpdateOptions) (*v1alpha1.IPEntry, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, iPEntry *v1alpha1.IPEntry, opts v1.UpdateOptions) (*v1alpha1.IPEntry, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.IPEntry, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.IPEntryList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IPEntry, err error) + IPEntryExpansion +} + +// iPEntries implements IPEntryInterface +type iPEntries struct { + *gentype.ClientWithList[*v1alpha1.IPEntry, *v1alpha1.IPEntryList] +} + +// newIPEntries returns a IPEntries +func newIPEntries(c *IpamV1alpha1Client, namespace string) *iPEntries { + return &iPEntries{ + gentype.NewClientWithList[*v1alpha1.IPEntry, *v1alpha1.IPEntryList]( + "ipentries", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.IPEntry { return &v1alpha1.IPEntry{} }, + func() *v1alpha1.IPEntryList { return &v1alpha1.IPEntryList{} }), + } +} diff --git a/pkg/generated/clientset/versioned/typed/ipam/v1alpha1/ipindex.go b/pkg/generated/clientset/versioned/typed/ipam/v1alpha1/ipindex.go new file mode 100644 index 0000000..9b28ed8 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/ipam/v1alpha1/ipindex.go @@ -0,0 +1,68 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + + v1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" + scheme "github.com/kuidio/kuid/pkg/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// IPIndexesGetter has a method to return a IPIndexInterface. +// A group's client should implement this interface. +type IPIndexesGetter interface { + IPIndexes(namespace string) IPIndexInterface +} + +// IPIndexInterface has methods to work with IPIndex resources. +type IPIndexInterface interface { + Create(ctx context.Context, iPIndex *v1alpha1.IPIndex, opts v1.CreateOptions) (*v1alpha1.IPIndex, error) + Update(ctx context.Context, iPIndex *v1alpha1.IPIndex, opts v1.UpdateOptions) (*v1alpha1.IPIndex, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, iPIndex *v1alpha1.IPIndex, opts v1.UpdateOptions) (*v1alpha1.IPIndex, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.IPIndex, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.IPIndexList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IPIndex, err error) + IPIndexExpansion +} + +// iPIndexes implements IPIndexInterface +type iPIndexes struct { + *gentype.ClientWithList[*v1alpha1.IPIndex, *v1alpha1.IPIndexList] +} + +// newIPIndexes returns a IPIndexes +func newIPIndexes(c *IpamV1alpha1Client, namespace string) *iPIndexes { + return &iPIndexes{ + gentype.NewClientWithList[*v1alpha1.IPIndex, *v1alpha1.IPIndexList]( + "ipindexes", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.IPIndex { return &v1alpha1.IPIndex{} }, + func() *v1alpha1.IPIndexList { return &v1alpha1.IPIndexList{} }), + } +} diff --git a/pkg/generated/informers/externalversions/factory.go b/pkg/generated/informers/externalversions/factory.go index 27fd74d..c54648a 100644 --- a/pkg/generated/informers/externalversions/factory.go +++ b/pkg/generated/informers/externalversions/factory.go @@ -26,6 +26,7 @@ import ( as "github.com/kuidio/kuid/pkg/generated/informers/externalversions/as" infra "github.com/kuidio/kuid/pkg/generated/informers/externalversions/infra" internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" + ipam "github.com/kuidio/kuid/pkg/generated/informers/externalversions/ipam" vlan "github.com/kuidio/kuid/pkg/generated/informers/externalversions/vlan" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" @@ -257,6 +258,7 @@ type SharedInformerFactory interface { As() as.Interface Infra() infra.Interface + Ipam() ipam.Interface Vlan() vlan.Interface } @@ -268,6 +270,10 @@ func (f *sharedInformerFactory) Infra() infra.Interface { return infra.New(f, f.namespace, f.tweakListOptions) } +func (f *sharedInformerFactory) Ipam() ipam.Interface { + return ipam.New(f, f.namespace, f.tweakListOptions) +} + func (f *sharedInformerFactory) Vlan() vlan.Interface { return vlan.New(f, f.namespace, f.tweakListOptions) } diff --git a/pkg/generated/informers/externalversions/generic.go b/pkg/generated/informers/externalversions/generic.go index 361d38c..044e866 100644 --- a/pkg/generated/informers/externalversions/generic.go +++ b/pkg/generated/informers/externalversions/generic.go @@ -21,6 +21,7 @@ import ( "fmt" v1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" + ipamv1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" vlanv1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" infrav1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -91,6 +92,14 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case infrav1alpha1.SchemeGroupVersion.WithResource("sites"): return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().Sites().Informer()}, nil + // Group=ipam.be.kuid.dev, Version=v1alpha1 + case ipamv1alpha1.SchemeGroupVersion.WithResource("ipclaims"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Ipam().V1alpha1().IPClaims().Informer()}, nil + case ipamv1alpha1.SchemeGroupVersion.WithResource("ipentries"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Ipam().V1alpha1().IPEntries().Informer()}, nil + case ipamv1alpha1.SchemeGroupVersion.WithResource("ipindexes"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Ipam().V1alpha1().IPIndexes().Informer()}, nil + // Group=vlan.be.kuid.dev, Version=v1alpha1 case vlanv1alpha1.SchemeGroupVersion.WithResource("vlanclaims"): return &genericInformer{resource: resource.GroupResource(), informer: f.Vlan().V1alpha1().VLANClaims().Informer()}, nil diff --git a/pkg/generated/informers/externalversions/ipam/interface.go b/pkg/generated/informers/externalversions/ipam/interface.go new file mode 100644 index 0000000..cfd8884 --- /dev/null +++ b/pkg/generated/informers/externalversions/ipam/interface.go @@ -0,0 +1,45 @@ +/* +Copyright 2024 Nokia. + +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 ipam + +import ( + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kuidio/kuid/pkg/generated/informers/externalversions/ipam/v1alpha1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() v1alpha1.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} +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/generated/informers/externalversions/ipam/v1alpha1/interface.go b/pkg/generated/informers/externalversions/ipam/v1alpha1/interface.go new file mode 100644 index 0000000..f459ec5 --- /dev/null +++ b/pkg/generated/informers/externalversions/ipam/v1alpha1/interface.go @@ -0,0 +1,58 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // IPClaims returns a IPClaimInformer. + IPClaims() IPClaimInformer + // IPEntries returns a IPEntryInformer. + IPEntries() IPEntryInformer + // IPIndexes returns a IPIndexInformer. + IPIndexes() IPIndexInformer +} + +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} +} + +// IPClaims returns a IPClaimInformer. +func (v *version) IPClaims() IPClaimInformer { + return &iPClaimInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// IPEntries returns a IPEntryInformer. +func (v *version) IPEntries() IPEntryInformer { + return &iPEntryInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// IPIndexes returns a IPIndexInformer. +func (v *version) IPIndexes() IPIndexInformer { + return &iPIndexInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/generated/informers/externalversions/ipam/v1alpha1/ipclaim.go b/pkg/generated/informers/externalversions/ipam/v1alpha1/ipclaim.go new file mode 100644 index 0000000..0657947 --- /dev/null +++ b/pkg/generated/informers/externalversions/ipam/v1alpha1/ipclaim.go @@ -0,0 +1,89 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + time "time" + + ipamv1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" + versioned "github.com/kuidio/kuid/pkg/generated/clientset/versioned" + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kuidio/kuid/pkg/generated/listers/ipam/v1alpha1" + v1 "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" +) + +// IPClaimInformer provides access to a shared informer and lister for +// IPClaims. +type IPClaimInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.IPClaimLister +} + +type iPClaimInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewIPClaimInformer constructs a new informer for IPClaim 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 NewIPClaimInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredIPClaimInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredIPClaimInformer constructs a new informer for IPClaim 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 NewFilteredIPClaimInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.IpamV1alpha1().IPClaims(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.IpamV1alpha1().IPClaims(namespace).Watch(context.TODO(), options) + }, + }, + &ipamv1alpha1.IPClaim{}, + resyncPeriod, + indexers, + ) +} + +func (f *iPClaimInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredIPClaimInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *iPClaimInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&ipamv1alpha1.IPClaim{}, f.defaultInformer) +} + +func (f *iPClaimInformer) Lister() v1alpha1.IPClaimLister { + return v1alpha1.NewIPClaimLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/informers/externalversions/ipam/v1alpha1/ipentry.go b/pkg/generated/informers/externalversions/ipam/v1alpha1/ipentry.go new file mode 100644 index 0000000..eeeadf7 --- /dev/null +++ b/pkg/generated/informers/externalversions/ipam/v1alpha1/ipentry.go @@ -0,0 +1,89 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + time "time" + + ipamv1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" + versioned "github.com/kuidio/kuid/pkg/generated/clientset/versioned" + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kuidio/kuid/pkg/generated/listers/ipam/v1alpha1" + v1 "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" +) + +// IPEntryInformer provides access to a shared informer and lister for +// IPEntries. +type IPEntryInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.IPEntryLister +} + +type iPEntryInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewIPEntryInformer constructs a new informer for IPEntry 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 NewIPEntryInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredIPEntryInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredIPEntryInformer constructs a new informer for IPEntry 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 NewFilteredIPEntryInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.IpamV1alpha1().IPEntries(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.IpamV1alpha1().IPEntries(namespace).Watch(context.TODO(), options) + }, + }, + &ipamv1alpha1.IPEntry{}, + resyncPeriod, + indexers, + ) +} + +func (f *iPEntryInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredIPEntryInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *iPEntryInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&ipamv1alpha1.IPEntry{}, f.defaultInformer) +} + +func (f *iPEntryInformer) Lister() v1alpha1.IPEntryLister { + return v1alpha1.NewIPEntryLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/informers/externalversions/ipam/v1alpha1/ipindex.go b/pkg/generated/informers/externalversions/ipam/v1alpha1/ipindex.go new file mode 100644 index 0000000..dd9af2d --- /dev/null +++ b/pkg/generated/informers/externalversions/ipam/v1alpha1/ipindex.go @@ -0,0 +1,89 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + time "time" + + ipamv1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" + versioned "github.com/kuidio/kuid/pkg/generated/clientset/versioned" + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kuidio/kuid/pkg/generated/listers/ipam/v1alpha1" + v1 "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" +) + +// IPIndexInformer provides access to a shared informer and lister for +// IPIndexes. +type IPIndexInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.IPIndexLister +} + +type iPIndexInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewIPIndexInformer constructs a new informer for IPIndex 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 NewIPIndexInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredIPIndexInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredIPIndexInformer constructs a new informer for IPIndex 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 NewFilteredIPIndexInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.IpamV1alpha1().IPIndexes(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.IpamV1alpha1().IPIndexes(namespace).Watch(context.TODO(), options) + }, + }, + &ipamv1alpha1.IPIndex{}, + resyncPeriod, + indexers, + ) +} + +func (f *iPIndexInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredIPIndexInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *iPIndexInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&ipamv1alpha1.IPIndex{}, f.defaultInformer) +} + +func (f *iPIndexInformer) Lister() v1alpha1.IPIndexLister { + return v1alpha1.NewIPIndexLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/listers/ipam/v1alpha1/expansion_generated.go b/pkg/generated/listers/ipam/v1alpha1/expansion_generated.go new file mode 100644 index 0000000..0ba39ed --- /dev/null +++ b/pkg/generated/listers/ipam/v1alpha1/expansion_generated.go @@ -0,0 +1,42 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +// IPClaimListerExpansion allows custom methods to be added to +// IPClaimLister. +type IPClaimListerExpansion interface{} + +// IPClaimNamespaceListerExpansion allows custom methods to be added to +// IPClaimNamespaceLister. +type IPClaimNamespaceListerExpansion interface{} + +// IPEntryListerExpansion allows custom methods to be added to +// IPEntryLister. +type IPEntryListerExpansion interface{} + +// IPEntryNamespaceListerExpansion allows custom methods to be added to +// IPEntryNamespaceLister. +type IPEntryNamespaceListerExpansion interface{} + +// IPIndexListerExpansion allows custom methods to be added to +// IPIndexLister. +type IPIndexListerExpansion interface{} + +// IPIndexNamespaceListerExpansion allows custom methods to be added to +// IPIndexNamespaceLister. +type IPIndexNamespaceListerExpansion interface{} diff --git a/pkg/generated/listers/ipam/v1alpha1/ipclaim.go b/pkg/generated/listers/ipam/v1alpha1/ipclaim.go new file mode 100644 index 0000000..c8843bf --- /dev/null +++ b/pkg/generated/listers/ipam/v1alpha1/ipclaim.go @@ -0,0 +1,69 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + v1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" + "k8s.io/client-go/tools/cache" +) + +// IPClaimLister helps list IPClaims. +// All objects returned here must be treated as read-only. +type IPClaimLister interface { + // List lists all IPClaims in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.IPClaim, err error) + // IPClaims returns an object that can list and get IPClaims. + IPClaims(namespace string) IPClaimNamespaceLister + IPClaimListerExpansion +} + +// iPClaimLister implements the IPClaimLister interface. +type iPClaimLister struct { + listers.ResourceIndexer[*v1alpha1.IPClaim] +} + +// NewIPClaimLister returns a new IPClaimLister. +func NewIPClaimLister(indexer cache.Indexer) IPClaimLister { + return &iPClaimLister{listers.New[*v1alpha1.IPClaim](indexer, v1alpha1.Resource("ipclaim"))} +} + +// IPClaims returns an object that can list and get IPClaims. +func (s *iPClaimLister) IPClaims(namespace string) IPClaimNamespaceLister { + return iPClaimNamespaceLister{listers.NewNamespaced[*v1alpha1.IPClaim](s.ResourceIndexer, namespace)} +} + +// IPClaimNamespaceLister helps list and get IPClaims. +// All objects returned here must be treated as read-only. +type IPClaimNamespaceLister interface { + // List lists all IPClaims in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.IPClaim, err error) + // Get retrieves the IPClaim from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.IPClaim, error) + IPClaimNamespaceListerExpansion +} + +// iPClaimNamespaceLister implements the IPClaimNamespaceLister +// interface. +type iPClaimNamespaceLister struct { + listers.ResourceIndexer[*v1alpha1.IPClaim] +} diff --git a/pkg/generated/listers/ipam/v1alpha1/ipentry.go b/pkg/generated/listers/ipam/v1alpha1/ipentry.go new file mode 100644 index 0000000..d47c0ac --- /dev/null +++ b/pkg/generated/listers/ipam/v1alpha1/ipentry.go @@ -0,0 +1,69 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + v1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" + "k8s.io/client-go/tools/cache" +) + +// IPEntryLister helps list IPEntries. +// All objects returned here must be treated as read-only. +type IPEntryLister interface { + // List lists all IPEntries in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.IPEntry, err error) + // IPEntries returns an object that can list and get IPEntries. + IPEntries(namespace string) IPEntryNamespaceLister + IPEntryListerExpansion +} + +// iPEntryLister implements the IPEntryLister interface. +type iPEntryLister struct { + listers.ResourceIndexer[*v1alpha1.IPEntry] +} + +// NewIPEntryLister returns a new IPEntryLister. +func NewIPEntryLister(indexer cache.Indexer) IPEntryLister { + return &iPEntryLister{listers.New[*v1alpha1.IPEntry](indexer, v1alpha1.Resource("ipentry"))} +} + +// IPEntries returns an object that can list and get IPEntries. +func (s *iPEntryLister) IPEntries(namespace string) IPEntryNamespaceLister { + return iPEntryNamespaceLister{listers.NewNamespaced[*v1alpha1.IPEntry](s.ResourceIndexer, namespace)} +} + +// IPEntryNamespaceLister helps list and get IPEntries. +// All objects returned here must be treated as read-only. +type IPEntryNamespaceLister interface { + // List lists all IPEntries in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.IPEntry, err error) + // Get retrieves the IPEntry from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.IPEntry, error) + IPEntryNamespaceListerExpansion +} + +// iPEntryNamespaceLister implements the IPEntryNamespaceLister +// interface. +type iPEntryNamespaceLister struct { + listers.ResourceIndexer[*v1alpha1.IPEntry] +} diff --git a/pkg/generated/listers/ipam/v1alpha1/ipindex.go b/pkg/generated/listers/ipam/v1alpha1/ipindex.go new file mode 100644 index 0000000..f3316ec --- /dev/null +++ b/pkg/generated/listers/ipam/v1alpha1/ipindex.go @@ -0,0 +1,69 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + v1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" + "k8s.io/client-go/tools/cache" +) + +// IPIndexLister helps list IPIndexes. +// All objects returned here must be treated as read-only. +type IPIndexLister interface { + // List lists all IPIndexes in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.IPIndex, err error) + // IPIndexes returns an object that can list and get IPIndexes. + IPIndexes(namespace string) IPIndexNamespaceLister + IPIndexListerExpansion +} + +// iPIndexLister implements the IPIndexLister interface. +type iPIndexLister struct { + listers.ResourceIndexer[*v1alpha1.IPIndex] +} + +// NewIPIndexLister returns a new IPIndexLister. +func NewIPIndexLister(indexer cache.Indexer) IPIndexLister { + return &iPIndexLister{listers.New[*v1alpha1.IPIndex](indexer, v1alpha1.Resource("ipindex"))} +} + +// IPIndexes returns an object that can list and get IPIndexes. +func (s *iPIndexLister) IPIndexes(namespace string) IPIndexNamespaceLister { + return iPIndexNamespaceLister{listers.NewNamespaced[*v1alpha1.IPIndex](s.ResourceIndexer, namespace)} +} + +// IPIndexNamespaceLister helps list and get IPIndexes. +// All objects returned here must be treated as read-only. +type IPIndexNamespaceLister interface { + // List lists all IPIndexes in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.IPIndex, err error) + // Get retrieves the IPIndex from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.IPIndex, error) + IPIndexNamespaceListerExpansion +} + +// iPIndexNamespaceLister implements the IPIndexNamespaceLister +// interface. +type iPIndexNamespaceLister struct { + listers.ResourceIndexer[*v1alpha1.IPIndex] +} diff --git a/pkg/generated/openapi/zz_generated.openapi.go b/pkg/generated/openapi/zz_generated.openapi.go index f79b108..42f2ee4 100644 --- a/pkg/generated/openapi/zz_generated.openapi.go +++ b/pkg/generated/openapi/zz_generated.openapi.go @@ -44,6 +44,19 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndexList": schema_apis_backend_as_v1alpha1_ASIndexList(ref), "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndexSpec": schema_apis_backend_as_v1alpha1_ASIndexSpec(ref), "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndexStatus": schema_apis_backend_as_v1alpha1_ASIndexStatus(ref), + "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPClaim": schema_apis_backend_ipam_v1alpha1_IPClaim(ref), + "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPClaimList": schema_apis_backend_ipam_v1alpha1_IPClaimList(ref), + "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPClaimSpec": schema_apis_backend_ipam_v1alpha1_IPClaimSpec(ref), + "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPClaimStatus": schema_apis_backend_ipam_v1alpha1_IPClaimStatus(ref), + "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPEntry": schema_apis_backend_ipam_v1alpha1_IPEntry(ref), + "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPEntryList": schema_apis_backend_ipam_v1alpha1_IPEntryList(ref), + "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPEntrySpec": schema_apis_backend_ipam_v1alpha1_IPEntrySpec(ref), + "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPEntryStatus": schema_apis_backend_ipam_v1alpha1_IPEntryStatus(ref), + "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPIndex": schema_apis_backend_ipam_v1alpha1_IPIndex(ref), + "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPIndexList": schema_apis_backend_ipam_v1alpha1_IPIndexList(ref), + "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPIndexSpec": schema_apis_backend_ipam_v1alpha1_IPIndexSpec(ref), + "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPIndexStatus": schema_apis_backend_ipam_v1alpha1_IPIndexStatus(ref), + "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.Prefix": schema_apis_backend_ipam_v1alpha1_Prefix(ref), "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANClaim": schema_apis_backend_vlan_v1alpha1_VLANClaim(ref), "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANClaimList": schema_apis_backend_vlan_v1alpha1_VLANClaimList(ref), "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANClaimSpec": schema_apis_backend_vlan_v1alpha1_VLANClaimSpec(ref), @@ -905,6 +918,695 @@ func schema_apis_backend_as_v1alpha1_ASIndexStatus(ref common.ReferenceCallback) } } +func schema_apis_backend_ipam_v1alpha1_IPClaim(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "IPClaim is the Schema for the ipclaim API", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPClaimSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPClaimStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPClaimSpec", "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPClaimStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_apis_backend_ipam_v1alpha1_IPClaimList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "IPClaimList contains a list of IPClaims", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPClaim"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPClaim", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_apis_backend_ipam_v1alpha1_IPClaimSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "IPClaimSpec defines the desired state of IPClaim", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "index": { + SchemaProps: spec.SchemaProps{ + Description: "Index defines the index for the IP Entry", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "prefixType": { + SchemaProps: spec.SchemaProps{ + Description: "PrefixType defines the prefixtype of IPEntry; for address and range claims this is not relevant - network kind is used for physical, virtual nics on a device - pool kind is used for allocating dedicated IP addresses - aggregate kind is used for claiming an aggregate prefix; only used for networkInstance prefixes", + Type: []string{"string"}, + Format: "", + }, + }, + "prefix": { + SchemaProps: spec.SchemaProps{ + Description: "Prefix defines the prefix for the IP claim", + Type: []string{"string"}, + Format: "", + }, + }, + "address": { + SchemaProps: spec.SchemaProps{ + Description: "Address defines the address for the IP claim", + Type: []string{"string"}, + Format: "", + }, + }, + "range": { + SchemaProps: spec.SchemaProps{ + Description: "Range defines the range for the IP claim", + Type: []string{"string"}, + Format: "", + }, + }, + "defaultGateway": { + SchemaProps: spec.SchemaProps{ + Description: "DefaultGateway defines if the address acts as a default gateway", + Type: []string{"boolean"}, + Format: "", + }, + }, + "createPrefix": { + SchemaProps: spec.SchemaProps{ + Description: "CreatePrefix defines if this prefix must be created. Only used for dynamic prefixes e.g. non /32 ipv4 and non /128 ipv6 prefixes", + Type: []string{"boolean"}, + Format: "", + }, + }, + "prefixLength": { + SchemaProps: spec.SchemaProps{ + Description: "PrefixLength defines the prefix length for the IP Claim, Must be set when CreatePrefic is set If not present we use assume /32 for ipv4 and /128 for ipv6", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "addressFamily": { + SchemaProps: spec.SchemaProps{ + Description: "AddressFamily defines the address family for the IP claim", + Type: []string{"string"}, + Format: "", + }, + }, + "idx": { + SchemaProps: spec.SchemaProps{ + Description: "Index defines the index of the IP Claim, used to get a deterministic IP from a prefix If not present we claim a random prefix from a prefix", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels as user defined labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "selector": { + SchemaProps: spec.SchemaProps{ + Description: "Selector defines the selector criterias", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), + }, + }, + }, + Required: []string{"index"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, + } +} + +func schema_apis_backend_ipam_v1alpha1_IPClaimStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "IPClaimStatus defines the observed state of IPClaim", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"), + }, + }, + }, + }, + }, + "range": { + SchemaProps: spec.SchemaProps{ + Description: "Range defines the range, claimed through the IPAM backend", + Type: []string{"string"}, + Format: "", + }, + }, + "address": { + SchemaProps: spec.SchemaProps{ + Description: "Address defines the address, claimed through the IPAM backend", + Type: []string{"string"}, + Format: "", + }, + }, + "prefix": { + SchemaProps: spec.SchemaProps{ + Description: "Prefix defines the prefix, claimed through the IPAM backend", + Type: []string{"string"}, + Format: "", + }, + }, + "defaultGateway": { + SchemaProps: spec.SchemaProps{ + Description: "DefaultGateway defines the default gateway IP for the claimed prefix DefaultGateway is only relevant for prefix kind = network", + Type: []string{"string"}, + Format: "", + }, + }, + "expiryTime": { + SchemaProps: spec.SchemaProps{ + Description: "ExpiryTime defines when the claim expires", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"}, + } +} + +func schema_apis_backend_ipam_v1alpha1_IPEntry(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "IPEntry is the Schema for the ipentry API", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPEntrySpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPEntryStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPEntrySpec", "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPEntryStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_apis_backend_ipam_v1alpha1_IPEntryList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "IPEntryList contains a list of IPEntries", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPEntry"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPEntry", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_apis_backend_ipam_v1alpha1_IPEntrySpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "IPEntrySpec defines the desired state of IPEntry", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "index": { + SchemaProps: spec.SchemaProps{ + Description: "Index defines the index for the IP Entry", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "indexEntry": { + SchemaProps: spec.SchemaProps{ + Description: "IndexEntry identifies if the entry is originated from an IP Index", + Default: false, + Type: []string{"boolean"}, + Format: "", + }, + }, + "prefixType": { + SchemaProps: spec.SchemaProps{ + Description: "PrefixType defines the prefixtype of IPEntry; for address and range claims this is not relevant - network kind is used for physical, virtual nics on a device - pool kind is used for allocating dedicated IP addresses - aggregate kind is used for claiming an aggregate prefix; only used for networkInstance prefixes", + Type: []string{"string"}, + Format: "", + }, + }, + "claimType": { + SchemaProps: spec.SchemaProps{ + Description: "ClaimType defines the claimType of the IP Entry", + Type: []string{"string"}, + Format: "", + }, + }, + "prefix": { + SchemaProps: spec.SchemaProps{ + Description: "Prefix defines the prefix for the IP entry; which can be an expanded prefix from the prefix, range or address", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "defaultGateway": { + SchemaProps: spec.SchemaProps{ + Description: "DefaultGateway defines if the address acts as a default gateway", + Type: []string{"boolean"}, + Format: "", + }, + }, + "addressFamily": { + SchemaProps: spec.SchemaProps{ + Description: "AddressFamily defines the address family for the IP claim", + Type: []string{"string"}, + Format: "", + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels as user defined labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"index", "indexEntry", "prefix"}, + }, + }, + } +} + +func schema_apis_backend_ipam_v1alpha1_IPEntryStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "IPEntryStatus defines the observed state of IPEntry", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"}, + } +} + +func schema_apis_backend_ipam_v1alpha1_IPIndex(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "IPIndex is the Schema for the IPIndex API", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPIndexSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPIndexStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPIndexSpec", "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPIndexStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_apis_backend_ipam_v1alpha1_IPIndexList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "IPIndexList contains a list of IPIndexs", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPIndex"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPIndex", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_apis_backend_ipam_v1alpha1_IPIndexSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "IPIndexSpec defines the desired state of IPIndex", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "prefixes": { + SchemaProps: spec.SchemaProps{ + Description: "Prefixes define the aggregate prefixes for the network instance A Network instance needs at least 1 prefix to be defined to become operational", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.Prefix"), + }, + }, + }, + }, + }, + }, + Required: []string{"prefixes"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.Prefix"}, + } +} + +func schema_apis_backend_ipam_v1alpha1_IPIndexStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "IPIndexStatus defines the observed state of IPIndex", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"), + }, + }, + }, + }, + }, + "prefixes": { + SchemaProps: spec.SchemaProps{ + Description: "Prefixes defines the prefixes, claimed through the IPAM backend", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.Prefix"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition", "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.Prefix"}, + } +} + +func schema_apis_backend_ipam_v1alpha1_Prefix(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "prefix": { + SchemaProps: spec.SchemaProps{ + Description: "Prefix defines the ip cidr in prefix notation.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "prefixType": { + SchemaProps: spec.SchemaProps{ + Description: "PrefixType defines the prefixtype of IPIndex; - network kind is used for physical, virtual nics on a device - pool kind is used for allocating dedicated IP addresses - aggregate kind is used for claiming an aggregate prefix; only used for networkInstance prefixes", + Type: []string{"string"}, + Format: "", + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels as user defined labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"prefix"}, + }, + }, + } +} + func schema_apis_backend_vlan_v1alpha1_VLANClaim(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/pkg/registry/generic/strategy_resource.go b/pkg/registry/generic/strategy_resource.go index f37fbb5..b169cbc 100644 --- a/pkg/registry/generic/strategy_resource.go +++ b/pkg/registry/generic/strategy_resource.go @@ -99,11 +99,11 @@ func (r *strategy) Validate(ctx context.Context, obj runtime.Object) field.Error return r.obj.ValidateCreate(ctx, obj) } -func (r *strategy) InvokeCreate(ctx context.Context, obj runtime.Object) error { +func (r *strategy) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error { if r.opts.BackendInvoker == nil { return nil } - return r.opts.BackendInvoker.InvokeCreate(ctx, obj) + return r.opts.BackendInvoker.InvokeCreate(ctx, obj, recursion) } func (r *strategy) Create(ctx context.Context, key types.NamespacedName, obj runtime.Object, dryrun bool) (runtime.Object, error) { @@ -141,11 +141,11 @@ func (r *strategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) return r.obj.ValidateUpdate(ctx, obj, old) } -func (r *strategy) InvokeUpdate(ctx context.Context, obj, old runtime.Object) error { +func (r *strategy) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error { if r.opts.BackendInvoker == nil { return nil } - return r.opts.BackendInvoker.InvokeUpdate(ctx, obj, old) + return r.opts.BackendInvoker.InvokeUpdate(ctx, obj, old, recursion) } func (r *strategy) Update(ctx context.Context, key types.NamespacedName, obj, old runtime.Object, dryrun bool) (runtime.Object, error) { @@ -180,15 +180,15 @@ func (r *strategy) WarningsOnUpdate(ctx context.Context, obj, old runtime.Object func (r *strategy) BeginDelete(ctx context.Context) error { log := log.FromContext(ctx) - log.Debug("BeginDelete strategy") + log.Info("BeginDelete strategy") return nil } -func (r *strategy) InvokeDelete(ctx context.Context, obj runtime.Object) error { +func (r *strategy) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error { if r.opts.BackendInvoker == nil { return nil } - return r.opts.BackendInvoker.InvokeDelete(ctx, obj) + return r.opts.BackendInvoker.InvokeDelete(ctx, obj, recursion) } func (r *strategy) Delete(ctx context.Context, key types.NamespacedName, obj runtime.Object, dryrun bool) (runtime.Object, error) { diff --git a/pkg/registry/generic/strategy_status.go b/pkg/registry/generic/strategy_status.go index fd24d8b..5008303 100644 --- a/pkg/registry/generic/strategy_status.go +++ b/pkg/registry/generic/strategy_status.go @@ -86,7 +86,7 @@ func (r *statusStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.Ob return r.obj.ValidateStatusUpdate(ctx, obj, old) } -func (r *statusStrategy) InvokeUpdate(ctx context.Context, obj, old runtime.Object) error { +func (r *statusStrategy) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error { return nil } diff --git a/pkg/registry/options/options.go b/pkg/registry/options/options.go index 0cbe7ed..5bf4cb1 100644 --- a/pkg/registry/options/options.go +++ b/pkg/registry/options/options.go @@ -52,7 +52,7 @@ type DryRunner interface { } type BackendInvoker interface { - InvokeCreate(ctx context.Context, obj runtime.Object) error - InvokeUpdate(ctx context.Context, obj, old runtime.Object) error - InvokeDelete(ctx context.Context, obj runtime.Object) error + InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error + InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error + InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error } From 0a891cb039aec299d23eb14ec8be5f79421bd37d Mon Sep 17 00:00:00 2001 From: Wim Henderickx Date: Mon, 28 Oct 2024 07:40:36 +0100 Subject: [PATCH 11/23] add ipam reconcilers --- SYNC.md | 2 +- apis/backend/ipam/ipclaim_resource.go | 2 +- apis/backend/ipam/ipentry_object.go | 2 +- apis/backend/ipam/v1alpha1/ipclaim_helpers.go | 45 +++ apis/backend/ipam/v1alpha1/ipindex_helpers.go | 45 +++ go.mod | 2 +- go.sum | 6 - main.go | 36 +- pkg/backend-orig/as/as_helpers_test.go | 105 ------ pkg/backend-orig/as/as_index_test.go | 43 --- pkg/backend-orig/as/as_test.go | 131 ------- pkg/backend-orig/backend/applicator.go | 155 -------- .../backend/applicator_dynamic_id.go | 162 --------- .../backend/applicator_static_id.go | 171 --------- .../backend/applicator_static_range.go | 174 --------- pkg/backend-orig/backend/be.go | 207 ----------- pkg/backend-orig/backend/cache_context.go | 80 ---- pkg/backend-orig/backend/cache_interface.go | 93 ----- pkg/backend-orig/backend/context.go | 70 ---- pkg/backend-orig/backend/store.go | 333 ----------------- pkg/backend-orig/backend/store_interface.go | 47 --- pkg/backend/ipam/backend_store.go | 1 - pkg/reconcilers/all/all.go | 4 +- pkg/reconcilers/ipclaim/reconciler.go | 184 ++++++++++ pkg/reconcilers/ipindex/reconciler.go | 271 ++++++++++++++ pkg/reconcilers/resource/api.go | 83 ----- pkg/reconcilers/resource/api_test.go | 160 -------- pkg/reconcilers/resource/applicator.go | 57 --- pkg/reconcilers/resource/error_test.go | 125 ------- pkg/reconcilers/resource/errors.go | 6 - pkg/reconcilers/resource/fake.go | 343 ------------------ pkg/reconcilers/resource/finalizer.go | 59 ++- pkg/reconcilers/resource/finalizer_test.go | 190 ---------- pkg/reconcilers/resource/object.go | 35 -- pkg/reconcilers/resource/unstructured.go | 52 --- pkg/registry/generic/strategy_status.go | 4 + 36 files changed, 619 insertions(+), 2866 deletions(-) create mode 100644 apis/backend/ipam/v1alpha1/ipclaim_helpers.go create mode 100644 apis/backend/ipam/v1alpha1/ipindex_helpers.go delete mode 100644 pkg/backend-orig/as/as_helpers_test.go delete mode 100644 pkg/backend-orig/as/as_index_test.go delete mode 100644 pkg/backend-orig/as/as_test.go delete mode 100644 pkg/backend-orig/backend/applicator.go delete mode 100644 pkg/backend-orig/backend/applicator_dynamic_id.go delete mode 100644 pkg/backend-orig/backend/applicator_static_id.go delete mode 100644 pkg/backend-orig/backend/applicator_static_range.go delete mode 100644 pkg/backend-orig/backend/be.go delete mode 100644 pkg/backend-orig/backend/cache_context.go delete mode 100644 pkg/backend-orig/backend/cache_interface.go delete mode 100644 pkg/backend-orig/backend/context.go delete mode 100644 pkg/backend-orig/backend/store.go delete mode 100644 pkg/backend-orig/backend/store_interface.go create mode 100644 pkg/reconcilers/ipclaim/reconciler.go create mode 100644 pkg/reconcilers/ipindex/reconciler.go delete mode 100644 pkg/reconcilers/resource/api.go delete mode 100644 pkg/reconcilers/resource/api_test.go delete mode 100644 pkg/reconcilers/resource/applicator.go delete mode 100644 pkg/reconcilers/resource/error_test.go delete mode 100644 pkg/reconcilers/resource/fake.go delete mode 100644 pkg/reconcilers/resource/finalizer_test.go delete mode 100644 pkg/reconcilers/resource/object.go delete mode 100644 pkg/reconcilers/resource/unstructured.go diff --git a/SYNC.md b/SYNC.md index ffdbf05..0e99b2c 100644 --- a/SYNC.md +++ b/SYNC.md @@ -18,7 +18,7 @@ - sync/async: reconciler update status with status subresource (reconciler needed) 4. order is important -- sync: when something fails the client need to handle this +- sync: when something fails the client need to handle this; once accepted it remains in the system - async: reconciler tries to recover 5. \ No newline at end of file diff --git a/apis/backend/ipam/ipclaim_resource.go b/apis/backend/ipam/ipclaim_resource.go index 2ffdc68..9c14b19 100644 --- a/apis/backend/ipam/ipclaim_resource.go +++ b/apis/backend/ipam/ipclaim_resource.go @@ -137,7 +137,7 @@ func (r *IPClaim) PrepareForStatusUpdate(ctx context.Context, obj, old runtime.O oldObj := old.(*IPClaim) newObj.Spec = oldObj.Spec - // Status updates are for only for updating status, not objectmeta. + // Status updates are only for updating status, not objectmeta. metav1.ResetObjectMetaForStatus(&newObj.ObjectMeta, &newObj.ObjectMeta) } diff --git a/apis/backend/ipam/ipentry_object.go b/apis/backend/ipam/ipentry_object.go index 37423c4..14bb24e 100644 --- a/apis/backend/ipam/ipentry_object.go +++ b/apis/backend/ipam/ipentry_object.go @@ -108,7 +108,7 @@ func IPEntryFromRuntime(ru runtime.Object) (*IPEntry, error) { func GetIPEntry(ctx context.Context, k store.Key, rangeName string, prefix netip.Prefix, labels map[string]string) *IPEntry { log := log.FromContext(ctx) - log.Info("get ipEntry from iptables", "key", k.String(), "range", rangeName, "prefix", prefix, "labels", labels) + log.Debug("get ipEntry from iptables", "key", k.String(), "range", rangeName, "prefix", prefix, "labels", labels) pi := iputil.NewPrefixInfo(prefix) diff --git a/apis/backend/ipam/v1alpha1/ipclaim_helpers.go b/apis/backend/ipam/v1alpha1/ipclaim_helpers.go new file mode 100644 index 0000000..6bb11e0 --- /dev/null +++ b/apis/backend/ipam/v1alpha1/ipclaim_helpers.go @@ -0,0 +1,45 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "github.com/henderiw/store" + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + "k8s.io/apimachinery/pkg/types" +) + +func (r *IPClaim) GetKey() store.Key { + return store.KeyFromNSN(r.GetNamespacedName()) +} + +func (r *IPClaim) GetNamespacedName() types.NamespacedName { + return types.NamespacedName{ + Namespace: r.GetNamespace(), + Name: r.GetName(), + } +} + +// GetCondition returns the condition based on the condition kind +func (r *IPClaim) GetCondition(t condv1alpha1.ConditionType) condv1alpha1.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *IPClaim) SetConditions(c ...condv1alpha1.Condition) { + r.Status.SetConditions(c...) +} diff --git a/apis/backend/ipam/v1alpha1/ipindex_helpers.go b/apis/backend/ipam/v1alpha1/ipindex_helpers.go new file mode 100644 index 0000000..cc73d2b --- /dev/null +++ b/apis/backend/ipam/v1alpha1/ipindex_helpers.go @@ -0,0 +1,45 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "github.com/henderiw/store" + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + "k8s.io/apimachinery/pkg/types" +) + +func (r *IPIndex) GetKey() store.Key { + return store.KeyFromNSN(r.GetNamespacedName()) +} + +func (r *IPIndex) GetNamespacedName() types.NamespacedName { + return types.NamespacedName{ + Namespace: r.GetNamespace(), + Name: r.GetName(), + } +} + +// GetCondition returns the condition based on the condition kind +func (r *IPIndex) GetCondition(t condv1alpha1.ConditionType) condv1alpha1.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *IPIndex) SetConditions(c ...condv1alpha1.Condition) { + r.Status.SetConditions(c...) +} diff --git a/go.mod b/go.mod index 0c05114..ba96335 100644 --- a/go.mod +++ b/go.mod @@ -36,7 +36,6 @@ require ( k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 sigs.k8s.io/controller-runtime v0.19.0 sigs.k8s.io/structured-merge-diff/v4 v4.4.1 - sigs.k8s.io/yaml v1.4.0 ) require ( @@ -139,4 +138,5 @@ require ( k8s.io/kms v0.31.1 // indirect sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3 // indirect sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect + sigs.k8s.io/yaml v1.4.0 // indirect ) diff --git a/go.sum b/go.sum index 93a47e1..1da2ff5 100644 --- a/go.sum +++ b/go.sum @@ -147,12 +147,6 @@ github.com/hansthienpondt/nipam v0.0.5 h1:83Mdwdgx3l9tvio8u8ufan97MWx49n38IJwgSB github.com/hansthienpondt/nipam v0.0.5/go.mod h1:dJI5FdzV6iaQyaOH4htGqJNs6wGieJeX3lhPj1Ah19U= github.com/henderiw/apiserver-builder v0.0.4-0.20241027084658-10d7f9d97252 h1:+I3bHSWCKCKLoUZHRSMCxs5Q7DMFFgdE+DfhOsOOGko= github.com/henderiw/apiserver-builder v0.0.4-0.20241027084658-10d7f9d97252/go.mod h1:LfJu1JURnxHwnFa8CVb2XPw50TwdU1xQvuUNxpaSOlE= -github.com/henderiw/apiserver-store v0.0.3-0.20241022143604-0995425b3d06 h1:1RVj1x0ykpmuxynrLww0oHgs5TdkciwJZr996SmGDf0= -github.com/henderiw/apiserver-store v0.0.3-0.20241022143604-0995425b3d06/go.mod h1:VVkUptd3MTyREmpo+C/t6l+mJAwo3A1UWvHi0QSH0yE= -github.com/henderiw/apiserver-store v0.0.3-0.20241027161332-ea9aa2ddc2c2 h1:DhBwOL+tAxHGIPaESQy0GDj2TTTRbFzmTUl/nE2Dz98= -github.com/henderiw/apiserver-store v0.0.3-0.20241027161332-ea9aa2ddc2c2/go.mod h1:VVkUptd3MTyREmpo+C/t6l+mJAwo3A1UWvHi0QSH0yE= -github.com/henderiw/apiserver-store v0.0.3-0.20241027162826-7a30b5bfc5ff h1:iEFyzjBUqNviHT4/Evp8EnlDP4Bw7vYH+S9EbCwOSEs= -github.com/henderiw/apiserver-store v0.0.3-0.20241027162826-7a30b5bfc5ff/go.mod h1:VVkUptd3MTyREmpo+C/t6l+mJAwo3A1UWvHi0QSH0yE= github.com/henderiw/apiserver-store v0.0.3-0.20241027163114-c382e2d133b7 h1:gqpv6oJ0XN9H8/pXq2B7sXFdXH+YmjE05ivs/ffNAq0= github.com/henderiw/apiserver-store v0.0.3-0.20241027163114-c382e2d133b7/go.mod h1:VVkUptd3MTyREmpo+C/t6l+mJAwo3A1UWvHi0QSH0yE= github.com/henderiw/idxtable v0.0.0-20241021085446-f8d804551342 h1:gkdOvjxM6rNTkcyoykZLjAfPjn06/MEY4o8cy+3uj2g= diff --git a/main.go b/main.go index d16b0cf..e3be46e 100644 --- a/main.go +++ b/main.go @@ -88,7 +88,6 @@ func main() { WithoutEtcd() } - backends := map[string]backend.Backend{} for _, kuidGroupConfig := range kuidConfig.Groups { group := kuidGroupConfig.Group log.Info("kuid group configured", "group", group, "enabled", kuidGroupConfig.Enabled, "sync", kuidGroupConfig.Sync) @@ -105,7 +104,7 @@ func main() { if kuidConfig.Storage != config.StorageType_Etcd { if groupConfig.BackendFn != nil { be := groupConfig.BackendFn() - backends[group] = be + ctrlCfg.Backends[group] = be for _, resource := range groupConfig.Resources { storageProvider := resource.StorageProviderFn(ctx, resource.Internal, be, kuidGroupConfig.Sync, registryOptions) for _, resourceVersion := range resource.ResourceVersions { @@ -122,19 +121,19 @@ func main() { } } - // reconcilers get registered when async operations are configured - if !kuidGroupConfig.Sync { - if recs, ok := reconcilers.ReconcilerGroups[group]; ok { - groupReconcilers[group] = &ReconcilerGroup{ - addToSchema: groupConfig.AddToScheme, - reconcilers: make([]reconcilers.Reconciler, 0, len(recs)), - } - for _, reconciler := range recs { - groupReconcilers[group].reconcilers = append(groupReconcilers[group].reconcilers, reconciler) - } + // TODO: determine if the reconsilers behave different for sync compared to async + if recs, ok := reconcilers.ReconcilerGroups[group]; ok { + log.Info("reconciler group", "group", group) + groupReconcilers[group] = &ReconcilerGroup{ + addToSchema: groupConfig.AddToScheme, + reconcilers: make([]reconcilers.Reconciler, 0, len(recs)), + } + for name, reconciler := range recs { + log.Info("reconciler", "group", group, "name", name) + groupReconcilers[group].reconcilers = append(groupReconcilers[group].reconcilers, reconciler) } - // add the backend -> for etcd this needs to be configmaps -> tbd how we handle this } + // add the backend -> for etcd this needs to be configmaps -> tbd how we handle this } if kuidConfig.Storage != config.StorageType_Etcd { @@ -154,17 +153,20 @@ func main() { } if groupConfig.ApplyStorageToBackendFn != nil { - if err := groupConfig.ApplyStorageToBackendFn(ctx, backends[group], apiserver); err != nil { + if err := groupConfig.ApplyStorageToBackendFn(ctx, ctrlCfg.Backends[group], apiserver); err != nil { log.Error("cannot apply storage to backend", "error", err.Error()) os.Exit(1) } } } - if err := cmd.Execute(); err != nil { - panic(err) - } + go func() { + if err := cmd.Execute(); err != nil { + panic(err) + } + }() } + log.Info("groupReconcilers", "total", len(groupReconcilers)) if len(groupReconcilers) != 0 { // setup scheme for controllers runScheme := runtime.NewScheme() diff --git a/pkg/backend-orig/as/as_helpers_test.go b/pkg/backend-orig/as/as_helpers_test.go deleted file mode 100644 index f4401d3..0000000 --- a/pkg/backend-orig/as/as_helpers_test.go +++ /dev/null @@ -1,105 +0,0 @@ -package as - -/* - -import ( - "fmt" - - "github.com/kuidio/kuid/apis/backend" - asbev1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" - commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/utils/ptr" -) - -type testCtx struct { - name string - claimType backend.ClaimType - id uint64 - tRange string - labels map[string]string - selector *metav1.LabelSelector - expectedError bool - expectedID *uint64 - expectedRange *string -} - -// alias -const ( - namespace = "dummy" - staticClaim = backend.ClaimType_StaticID - dynamicClaim = backend.ClaimType_DynamicID - rangeClaim = backend.ClaimType_Range -) - -func getIndex(index, _ string) (*asbev1alpha1.ASIndex, error) { - idx := asbev1alpha1.BuildASIndex( - metav1.ObjectMeta{Namespace: namespace, Name: index}, - nil, - nil, - ) - - fieldErrs := idx.ValidateSyntax("") - if len(fieldErrs) != 0 { - return nil, fmt.Errorf("syntax errors %v", fieldErrs) - } - return idx, nil -} - -func (r testCtx) getDynamicClaim(index, testType string) (*asbev1alpha1.ASClaim, error) { - claim := asbev1alpha1.BuildASClaim( - metav1.ObjectMeta{Namespace: namespace, Name: r.name}, - &asbev1alpha1.ASClaimSpec{ - Index: index, - ClaimLabels: commonv1alpha1.ClaimLabels{ - UserDefinedLabels: commonv1alpha1.UserDefinedLabels{Labels: r.labels}, - Selector: r.selector, - }, - }, - nil, - ) - fielErrList := claim.ValidateSyntax(testType) // this expands the ownerRef in the spec - if len(fielErrList) != 0 { - return nil, fmt.Errorf("invalid syntax %v", fielErrList) - } - return claim, nil -} - -func (r testCtx) getStaticClaim(index, testType string) (*asbev1alpha1.ASClaim, error) { - claim := asbev1alpha1.BuildASClaim( - metav1.ObjectMeta{Namespace: namespace, Name: r.name}, - &asbev1alpha1.ASClaimSpec{ - Index: index, - ID: ptr.To[uint32](uint32(r.id)), - ClaimLabels: commonv1alpha1.ClaimLabels{ - UserDefinedLabels: commonv1alpha1.UserDefinedLabels{Labels: r.labels}, - }, - }, - nil, - ) - fielErrList := claim.ValidateSyntax(testType) // this expands the ownerRef in the spec - if len(fielErrList) != 0 { - return nil, fmt.Errorf("invalid syntax %v", fielErrList) - } - return claim, nil -} - -func (r testCtx) getRangeClaim(index, testType string) (*asbev1alpha1.ASClaim, error) { - claim := asbev1alpha1.BuildASClaim( - metav1.ObjectMeta{Namespace: namespace, Name: r.name}, - &asbev1alpha1.ASClaimSpec{ - Index: index, - Range: ptr.To[string](r.tRange), - ClaimLabels: commonv1alpha1.ClaimLabels{ - UserDefinedLabels: commonv1alpha1.UserDefinedLabels{Labels: r.labels}, - }, - }, - nil, - ) - fielErrList := claim.ValidateSyntax(testType) // this expands the ownerRef in the spec - if len(fielErrList) != 0 { - return nil, fmt.Errorf("invalid syntax %v", fielErrList) - } - return claim, nil -} -*/ diff --git a/pkg/backend-orig/as/as_index_test.go b/pkg/backend-orig/as/as_index_test.go deleted file mode 100644 index 0076896..0000000 --- a/pkg/backend-orig/as/as_index_test.go +++ /dev/null @@ -1,43 +0,0 @@ -package as - -/* - -import ( - "context" - "testing" - - "github.com/kuidio/kuid/pkg/backend/backend" - "github.com/stretchr/testify/assert" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -func TestIndex(t *testing.T) { - tests := map[string]struct { - index string - testType string - }{ - "CreateDelete": { - index: "a", - testType: "", - }, - } - - for name, tc := range tests { - t.Run(name, func(t *testing.T) { - be := backend.New(nil, nil, nil, nil, nil, schema.GroupVersionKind{},schema.GroupVersionKind{}) - ctx := context.Background() - index, err := getIndex(tc.index, tc.testType) - assert.NoError(t, err) - if err := be.CreateIndex(ctx, index); err != nil { - assert.Error(t, err) - } - if err := be.DeleteIndex(ctx, index); err != nil { - assert.Error(t, err) - } - if err := be.DeleteIndex(ctx, index); err != nil { - assert.Error(t, err) - } - }) - } -} -*/ diff --git a/pkg/backend-orig/as/as_test.go b/pkg/backend-orig/as/as_test.go deleted file mode 100644 index a85b7b2..0000000 --- a/pkg/backend-orig/as/as_test.go +++ /dev/null @@ -1,131 +0,0 @@ -package as - -/* - -import ( - "context" - "fmt" - "testing" - - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - asbev1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" - backendbe "github.com/kuidio/kuid/pkg/backend/backend" - "github.com/stretchr/testify/assert" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/types" - "k8s.io/utils/ptr" -) - -func Test(t *testing.T) { - tests := map[string]struct { - index string - ctxs []testCtx - }{ - "Mix": { - index: "a", - ctxs: []testCtx{ - {claimType: dynamicClaim, name: "claim1", expectedError: false, expectedID: ptr.To[uint64](0)}, - {claimType: staticClaim, name: "claim2", id: 100, expectedError: false}, - {claimType: staticClaim, name: "claim3", id: 4000, expectedError: false}, - {claimType: rangeClaim, name: "claim4", tRange: "10-19", expectedError: false}, - {claimType: rangeClaim, name: "claim4", tRange: "11-19", expectedError: false}, // reclaim - {claimType: rangeClaim, name: "claim5", tRange: "5-10", expectedError: false}, // claim a new entry - {claimType: rangeClaim, name: "claim6", tRange: "19-100", expectedError: true}, // overlap - {claimType: staticClaim, name: "claim7", id: 12, expectedError: false}, - {claimType: staticClaim, name: "claim7", id: 13, expectedError: false}, // reclaim an existing id - {claimType: dynamicClaim, name: "claim8", selector: &metav1.LabelSelector{ - MatchLabels: map[string]string{backend.KuidClaimNameKey: "claim4"}, - }, expectedError: false, expectedID: ptr.To[uint64](11)}, // a dynamic claim from a range - {claimType: dynamicClaim, name: "claim9", selector: &metav1.LabelSelector{ - MatchLabels: map[string]string{backend.KuidClaimNameKey: "claim4"}, - }, expectedError: false, expectedID: ptr.To[uint64](12)}, // a dynamic claim from a range that was claimed before - {claimType: dynamicClaim, name: "claim10", selector: &metav1.LabelSelector{ - MatchLabels: map[string]string{backend.KuidClaimNameKey: "claim4"}, - }, expectedError: false, expectedID: ptr.To[uint64](14)}, - {claimType: dynamicClaim, name: "claim10", selector: &metav1.LabelSelector{ - MatchLabels: map[string]string{backend.KuidClaimNameKey: "claim4"}, // update - }, expectedError: false, expectedID: ptr.To[uint64](14)}, - {claimType: rangeClaim, name: "claim4", tRange: "11-19", expectedError: false}, // update - }, - }, - } - - for name, tc := range tests { - tc := tc - - testTypes := []string{""} - - for _, testType := range testTypes { - t.Run(name, func(t *testing.T) { - be := backendbe.New(nil, nil, nil, nil, nil, schema.GroupVersionKind{}, schema.GroupVersionKind{}) - ctx := context.Background() - if tc.index != "" { - index, err := getIndex(tc.index, testType) - assert.NoError(t, err) - err = be.CreateIndex(ctx, index) - assert.NoError(t, err) - } - - for _, v := range tc.ctxs { - v := v - var claim *asbev1alpha1.ASClaim - var err error - - switch v.claimType { - case staticClaim: - claim, err = v.getStaticClaim(tc.index, testType) - case dynamicClaim: - claim, err = v.getDynamicClaim(tc.index, testType) - case rangeClaim: - claim, err = v.getRangeClaim(tc.index, testType) - } - assert.NoError(t, err) - if err != nil { - return - } - - err = be.Claim(ctx, claim) - if v.expectedError { - assert.Error(t, err) - continue - } else { - assert.NoError(t, err) - } - switch v.claimType { - case staticClaim, dynamicClaim: - if claim.Status.ID == nil { - t.Errorf("expecting status id got nil") - } else { - expectedID := v.id - if v.expectedID != nil { - expectedID = *v.expectedID - } - if uint64(*claim.Status.ID) != expectedID { - t.Errorf("expecting id got %d, want %d\n", *claim.Status.ID, expectedID) - } - } - case rangeClaim: - if claim.Status.Range == nil { - t.Errorf("expecting status id got nil") - } else { - expectedRange := v.tRange - if v.expectedRange != nil { - expectedRange = *v.expectedRange - } - if *claim.Status.Range != expectedRange { - t.Errorf("expecting range got %s, want %s\n", *claim.Status.Range, expectedRange) - } - } - } - fmt.Println("entries after claim", v.name) - key := store.KeyFromNSN(types.NamespacedName{Namespace: namespace, Name: tc.index}) - err = be.PrintEntries(ctx, key) - assert.NoError(t, err) - } - }) - } - } -} -*/ diff --git a/pkg/backend-orig/backend/applicator.go b/pkg/backend-orig/backend/applicator.go deleted file mode 100644 index 8349786..0000000 --- a/pkg/backend-orig/backend/applicator.go +++ /dev/null @@ -1,155 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 backend - -/* - -import ( - "context" - "errors" - "fmt" - - "github.com/henderiw/idxtable/pkg/table" - "github.com/henderiw/idxtable/pkg/tree" - "github.com/henderiw/logger/log" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - "k8s.io/utils/ptr" -) - -type Applicator interface { - Validate(ctx context.Context, claim backend.ClaimObject) error - Apply(ctx context.Context, claim backend.ClaimObject) error - Delete(ctx context.Context, claim backend.ClaimObject) error -} - -type applicator struct { - cacheCtx *CacheContext -} - -func (r *applicator) getEntriesByOwner(ctx context.Context, claim backend.ClaimObject) (map[string]tree.Entries, error) { - treeEntries := map[string]tree.Entries{} - ownerSelector, err := claim.GetOwnerSelector() - if err != nil { - return nil, err - } - claimType := claim.GetClaimType() - //ln("getEntriesByOwner", r.cacheCtx.tree) - treeEntries[""] = r.cacheCtx.tree.GetByLabel(ownerSelector) - if len(treeEntries) != 0 { - // ranges and prefixes using network type can have multiple plrefixes - if len(treeEntries[""]) > 1 && (claimType != backend.ClaimType_Range) { - return treeEntries, fmt.Errorf("multiple entries match the owner, %v", treeEntries[""]) - } - } - // for id based claims we should also check the range tables - if claimType != backend.ClaimType_Range { - var errs error - r.cacheCtx.ranges.List(ctx, func(ctx context.Context, k store.Key, t table.Table) { - treeEntries[k.Name] = t.GetByLabel(ownerSelector) - if len(treeEntries[k.Name]) > 1 { - errs = errors.Join(errs, fmt.Errorf("multiple entries match the owner, %v", treeEntries[k.Name])) - return - } - }) - if errs != nil { - return treeEntries, errs - } - } - return treeEntries, nil -} - -func (r *applicator) delete(ctx context.Context, claim backend.ClaimObject) error { - existingEntries, err := r.getEntriesByOwner(ctx, claim) - if err != nil { - return err - } - - for treeName, existingEntries := range existingEntries { - for _, existingEntry := range existingEntries { - if treeName == "" { - r.cacheCtx.tree.ReleaseID(existingEntry.ID()) - } else { - k := store.ToKey(treeName) - if table, err := r.cacheCtx.ranges.Get(ctx, k); err == nil { - if err := table.Release(existingEntry.ID().ID()); err != nil { - return err - } - } - } - } - } - return nil -} - -func (r *applicator) getEntriesByLabelSelector(ctx context.Context, claim backend.ClaimObject) tree.Entries { - log := log.FromContext(ctx) - labelSelector, err := claim.GetLabelSelector() - if err != nil { - log.Error("cannot get label selector", "error", err.Error()) - return nil - } - return r.cacheCtx.tree.GetByLabel(labelSelector) -} - -func (r *applicator) deleteNonClaimedEntries(ctx context.Context, existingEntries map[string]tree.Entries, id *uint64, reclaimTreeName string) error { - for treeName, existingEntries := range existingEntries { - //fmt.Println("deleteNonClaimedEntries", treeName, existingEntries) - for _, existingEntry := range existingEntries { - if id != nil && *id == existingEntry.ID().ID() && reclaimTreeName == treeName { - continue - } - if treeName == "" { - r.cacheCtx.tree.ReleaseID(existingEntry.ID()) - } else { - k := store.ToKey(treeName) - if table, err := r.cacheCtx.ranges.Get(ctx, k); err == nil { - if err := table.Release(existingEntry.ID().ID()); err != nil { - return err - } - } - } - } - } - return nil -} - -func reclaimIDFromExisitingEntries(existingEntries map[string]tree.Entries, id uint64) (*uint64, string) { - for treeName, existingEntries := range existingEntries { - for _, existingEntry := range existingEntries { - if id == existingEntry.ID().ID() { - return &id, treeName - } - } - } - return nil, "" -} - -func claimIDFromExisitingEntries(existingEntries map[string]tree.Entries) (*uint64, string) { - for treeName, existingEntries := range existingEntries { - for _, existingEntry := range existingEntries { - return ptr.To[uint64](existingEntry.ID().ID()), treeName - } - } - return nil, "" -} - -func isReserved(parentName, index string) bool { - return parentName == fmt.Sprintf("%s.%s", index, backend.IndexReservedMaxName) || - parentName == fmt.Sprintf("%s.%s", index, backend.IndexReservedMinName) -} -*/ diff --git a/pkg/backend-orig/backend/applicator_dynamic_id.go b/pkg/backend-orig/backend/applicator_dynamic_id.go deleted file mode 100644 index db9ca89..0000000 --- a/pkg/backend-orig/backend/applicator_dynamic_id.go +++ /dev/null @@ -1,162 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 backend - -/* - -import ( - "context" - "fmt" - - "github.com/henderiw/logger/log" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - "k8s.io/utils/ptr" -) - -type dynamicApplicator struct { - name string - applicator - claimID *uint64 - parentTreeName string -} - -func (r *dynamicApplicator) Validate(ctx context.Context, claim backend.ClaimObject) error { - if err := r.reclaimID(ctx, claim); err != nil { - return err - } - // if the id is unknown we need to get the parent context - // to determine if the claim is within the main tree or - // within a range - if r.claimID == nil { - if err := r.getParentContext(ctx, claim); err != nil { - return err - } - } - return nil -} - -func (r *dynamicApplicator) reclaimID(ctx context.Context, claim backend.ClaimObject) error { - existingEntries, err := r.getEntriesByOwner(ctx, claim) - if err != nil { - return err - } - - var claimID *uint64 - var claimTreeName string - if claim.GetStatusID() != nil { - claimID, claimTreeName = reclaimIDFromExisitingEntries(existingEntries, *claim.GetStatusID()) - } else { - claimID, claimTreeName = claimIDFromExisitingEntries(existingEntries) - } - // remove the existing entries that don't match the claimed ID - // should be none, but just in case - if err := r.deleteNonClaimedEntries(ctx, existingEntries, claimID, claimTreeName); err != nil { - return err - } - - r.claimID = claimID - if claimID != nil { - r.parentTreeName = claimTreeName - } - return nil -} - -// There are 2 scenario's. -// without a label selector: this claims from the main tree -// with a label selector: we expect a parent as this claims from a range -func (r *dynamicApplicator) getParentContext(ctx context.Context, claim backend.ClaimObject) error { - //log := log.FromContext(ctx).With("name", claim.GetName()) - // get entries by labelSelector if the label selector is defined - if claim.GetSelector() == nil { - // this is a dyanmic claim for the main tree - return nil - } - // this is a allocation for a range - parentEntries := r.getEntriesByLabelSelector(ctx, claim) - - if len(parentEntries) == 0 { - return fmt.Errorf("no parent found") - } - - // validate if all parents are from the same range - for _, parentEntry := range parentEntries { - labels := parentEntry.Labels() - parentClaimType := backend.GetClaimTypeFromString(labels[backend.KuidClaimTypeKey]) - if parentClaimType == backend.ClaimType_Range { - if r.parentTreeName != "" && r.parentTreeName != labels[backend.KuidClaimNameKey] { - return fmt.Errorf("a dynamic claim can only come from 1 parent range got %s and %s", r.parentTreeName, labels[backend.KuidClaimNameKey]) - } - r.parentTreeName = labels[backend.KuidClaimNameKey] - } else { - return fmt.Errorf("a parent can only be a range, got: %s", string(parentClaimType)) - } - } - - return nil -} - -func (r *dynamicApplicator) Apply(ctx context.Context, claim backend.ClaimObject) error { - log := log.FromContext(ctx).With("name", claim.GetName()) - log.Info("dynamic claim") - if isReserved(r.parentTreeName, claim.GetIndex()) { - return fmt.Errorf("cannot claim from a reserved range") - } - - if r.parentTreeName == "" { - if r.claimID != nil { - if err := r.cacheCtx.tree.Update(claim.GetClaimID(r.cacheCtx.Type(), *r.claimID), claim.GetClaimLabels()); err != nil { - return err - } - } else { - e, err := r.cacheCtx.tree.ClaimFree(claim.GetClaimLabels()) - if err != nil { - return err - } - r.claimID = ptr.To[uint64](e.ID().ID()) - } - } else { - k := store.ToKey(r.parentTreeName) - table, err := r.cacheCtx.ranges.Get(ctx, k) - if err != nil { - return fmt.Errorf("selectAddress range does not have corresponding range table: err: %s", err.Error()) - } - if r.claimID != nil { - if err := table.Update(*r.claimID, claim.GetClaimLabels()); err != nil { - return err - } - } else { - e, err := table.ClaimFree(claim.GetClaimLabels()) - if err != nil { - return err - } - r.claimID = ptr.To[uint64](e.ID().ID()) - } - } - //fmt.Println("apply", r.claimID) - if r.claimID == nil { - return fmt.Errorf("claimed failed, no claim ID found") - } - claim.SetStatusID(r.claimID) - return nil -} - -func (r *dynamicApplicator) Delete(ctx context.Context, claim backend.ClaimObject) error { - // this is a generic delete by owner - return r.delete(ctx, claim) -} -*/ diff --git a/pkg/backend-orig/backend/applicator_static_id.go b/pkg/backend-orig/backend/applicator_static_id.go deleted file mode 100644 index ddd1df4..0000000 --- a/pkg/backend-orig/backend/applicator_static_id.go +++ /dev/null @@ -1,171 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 backend - -/* - -import ( - "context" - "fmt" - - "github.com/henderiw/logger/log" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" -) - -type staticApplicator struct { - name string - applicator - claimID *uint64 - parentTreeName string -} - -func (r *staticApplicator) Validate(ctx context.Context, claim backend.ClaimObject) error { - //log := log.FromContext(ctx) - if claim.GetStaticID() == nil { - return fmt.Errorf("cannot claim a static id w/o an id") - } - - if err := r.reclaimID(ctx, claim); err != nil { - return err - } - - if r.claimID == nil { - // when the claim did not exist we need to check the - // parent contect to know from which tree/table to - // claim the ID - if err := r.getParentContext(ctx, claim); err != nil { - return err - } - } - return nil -} - -// reclaimID will validate if the id specified in the claim exists already. -// If so it will reclaim it and update the parentTreeName (this is to ensure the claim reclaims it from the proper tree/table) -// if no entry exist it will return an empty -// On top the entries that were not claimed are cleaned up, such that we delete entries that are -// void. E.g. this takes care of the fact that a use changed the static ID as the reclaim failed -// so the remaining entry is cleaned up -func (r *staticApplicator) reclaimID(ctx context.Context, claim backend.ClaimObject) error { - // reclaim ID - existingEntries, err := r.getEntriesByOwner(ctx, claim) - if err != nil { - return err - } - - claimID, claimTreeName := reclaimIDFromExisitingEntries(existingEntries, *claim.GetStaticID()) - //fmt.Println("static id", claim.GetName(), claimID, claimTreeName) - // remove the existing entries that done match the claimed ID - // should be none, but just in case - if err := r.deleteNonClaimedEntries(ctx, existingEntries, claimID, claimTreeName); err != nil { - return err - } - - r.claimID = claimID - if claimID != nil { - // here we are sure we got the same ID as the static ID - // otherwise it would have been nil - r.parentTreeName = claimTreeName - } - - return nil -} - -func (r *staticApplicator) getParentContext(ctx context.Context, claim backend.ClaimObject) error { - log := log.FromContext(ctx).With("name", claim.GetName()) - - entry, err := r.cacheCtx.tree.Get(claim.GetStaticTreeID(r.cacheCtx.Type())) - if err == nil { - // entry exists - labels := entry.Labels() - // a range can overlap so we return the entry as a parent if the entry match and it is a range - claimType := backend.GetClaimTypeFromString(labels[backend.KuidClaimTypeKey]) - if claimType == backend.ClaimType_Range { - r.parentTreeName = labels[backend.KuidClaimNameKey] - return nil - } else { - // This should always result in a different owner - // since we checked the claimed entries before - if err := claim.ValidateOwner(labels); err != nil { - return err - } - return nil - } - } - parentEntries := r.cacheCtx.tree.Parents(claim.GetStaticTreeID(r.cacheCtx.Type())) - if len(parentEntries) > 1 { - log.Error("got multiple parent entries", "entries", parentEntries) - return fmt.Errorf("multiple parent entries %v", parentEntries) - } - for _, parentEntry := range parentEntries { - labels := parentEntry.Labels() - parentClaimType := backend.GetClaimTypeFromString(labels[backend.KuidClaimTypeKey]) - if parentClaimType == backend.ClaimType_Range { - r.parentTreeName = labels[backend.KuidClaimNameKey] - break - } else { - log.Error("got parent which is not a range", "entry", parentEntry) - return fmt.Errorf("got parent which is not a range %s", labels[backend.KuidClaimTypeKey]) - } - } - return nil -} - -func (r *staticApplicator) Apply(ctx context.Context, claim backend.ClaimObject) error { - if isReserved(r.parentTreeName, claim.GetIndex()) { - return fmt.Errorf("cannot claim from a reserved range") - } - if r.parentTreeName == "" { - // a claim in the main tree - if r.claimID != nil { - if err := r.cacheCtx.tree.Update(claim.GetClaimID(r.cacheCtx.Type(), *r.claimID), claim.GetClaimLabels()); err != nil { - return err - } - } else { - if err := r.cacheCtx.tree.ClaimID(claim.GetStaticTreeID(r.cacheCtx.Type()), claim.GetClaimLabels()); err != nil { - return err - } - } - } else { - //fmt.Println("static id in range", r.parentTreeName) - // a claim in a range - k := store.ToKey(r.parentTreeName) - table, err := r.cacheCtx.ranges.Get(ctx, k) - if err != nil { - return fmt.Errorf("selectAddress range does not have corresponding range table: err: %s", err.Error()) - } - if r.claimID != nil { - if err := table.Update(*claim.GetStaticID(), claim.GetClaimLabels()); err != nil { - return err - } - } else { - if err := table.Claim(*claim.GetStaticID(), claim.GetClaimLabels()); err != nil { - return err - } - } - } - //fmt.Println("apply", *claim.GetStaticID()) - - claim.SetStatusID(claim.GetStaticID()) - return nil -} - -func (r *staticApplicator) Delete(ctx context.Context, claim backend.ClaimObject) error { - return r.delete(ctx, claim) -} -*/ diff --git a/pkg/backend-orig/backend/applicator_static_range.go b/pkg/backend-orig/backend/applicator_static_range.go deleted file mode 100644 index 799634b..0000000 --- a/pkg/backend-orig/backend/applicator_static_range.go +++ /dev/null @@ -1,174 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 backend - -/* - -import ( - "context" - "fmt" - - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" -) - -type rangeApplicator struct { - name string - applicator - rangeExists bool -} - -// when a range changes the start and stop we delete the range -// and recreate it. All the children will be deleted as well -func (r *rangeApplicator) Validate(ctx context.Context, claim backend.ClaimObject) error { - //log := log.FromContext(ctx) - - // reclaimRange gets the existing entries based on owner - // -> 3 scenarios: none exist, they all exist, some exist - // -> none exist -> claim them - // -> they all exist -> reclaim them - // -> same exist -> delete them including the children and reclaim the new range aftre the entries - // have been deleted - if err := r.reclaimRange(ctx, claim); err != nil { - return err - } - if !r.rangeExists { - // we need to validate if there are no children - if err := r.validateRangeOverlap(ctx, claim); err != nil { - return err - } - } - - return nil -} - -// reclaimRange gets the existing entries based on owner -// -> 3 scenarios: none exist, they all exist, some exist -// -> none exist -> claim them -// -> they all exist -> reclaim them -// -> same exist -> delete them including the children and reclaim the new range aftre the entries -// have been deleted -func (r *rangeApplicator) reclaimRange(ctx context.Context, claim backend.ClaimObject) error { - //if claim.Spec.Range == nil { - // return fmt.Errorf("cannot claim a range w/o a range") - //} - arange, err := claim.GetRangeID(r.cacheCtx.Type()) - if err != nil { - return err - } - claimSet := map[string]struct{}{} - for _, rangeID := range arange.IDs() { - r.rangeExists = true // we are optimistic and set the claimset to true since we have entries - claimSet[rangeID.String()] = struct{}{} - } - //fmt.Println("claimSet before", claim.GetName(), claimSet) - - existingEntries, err := r.getEntriesByOwner(ctx, claim) - if err != nil { - return err - } - //fmt.Println("existingEntries", existingEntries) - // delete the - for treeName, existingEntries := range existingEntries { - if treeName != "" { - return fmt.Errorf("cannot have a range in non root tree: %s", treeName) - } - for _, existingEntry := range existingEntries { - //fmt.Println("existingEntry", existingEntry.ID().String()) - delete(claimSet, existingEntry.ID().String()) - } - } - - //fmt.Println("claimSet after", claim.GetName(), claimSet) - if len(claimSet) != 0 { - // cleanup - r.rangeExists = false - // remove all entries as the range change - if err := r.deleteNonClaimedEntries(ctx, existingEntries, nil, ""); err != nil { - return err - } - k := store.ToKey(claim.GetName()) - if _, err := r.cacheCtx.ranges.Get(ctx, k); err == nil { - // exists - if err := r.cacheCtx.ranges.Delete(ctx, k); err != nil { - return err - } - } - } - // all good -> they either all exist or none exists or we cleaned up - return nil -} - -func (r *rangeApplicator) validateRangeOverlap(_ context.Context, claim backend.ClaimObject) error { - arange, err := claim.GetRangeID(r.cacheCtx.Type()) - if err != nil { - return err - } - for _, id := range arange.IDs() { - entry, err := r.cacheCtx.tree.Get(id) - if err == nil { - // this shouls always fail since the range existance was already validated - labels := entry.Labels() - if err := claim.ValidateOwner(labels); err != nil { - return err - } - } - childEntries := r.cacheCtx.tree.Children(id) - if len(childEntries) != 0 { - return fmt.Errorf("range overlaps with children: %v", childEntries) - } - parentEntries := r.cacheCtx.tree.Parents(id) - if len(parentEntries) > 0 { - return fmt.Errorf("range overlaps with parent: %v", parentEntries) - } - } - return nil -} - -func (r *rangeApplicator) Apply(ctx context.Context, claim backend.ClaimObject) error { - arange, err := claim.GetRangeID(r.cacheCtx.Type()) - if err != nil { - return err - } - for _, id := range arange.IDs() { - if r.rangeExists { - if err := r.cacheCtx.tree.Update(id, claim.GetClaimLabels()); err != nil { - return err - } - } else { - if err := r.cacheCtx.tree.ClaimID(id, claim.GetClaimLabels()); err != nil { - return err - } - } - - } - k := store.ToKey(claim.GetName()) - if _, err := r.cacheCtx.ranges.Get(ctx, k); err != nil { - //table := table.New(uint32(arange.From().ID()), uint32(arange.To().ID())) - table := claim.GetTable(r.cacheCtx.Type(), arange.From().ID(), arange.To().ID()) - if err := r.cacheCtx.ranges.Create(ctx, k, table); err != nil { - return err - } - } - claim.SetStatusRange(claim.GetRange()) - return nil -} - -func (r *rangeApplicator) Delete(ctx context.Context, claim backend.ClaimObject) error { - return r.delete(ctx, claim) -} -*/ diff --git a/pkg/backend-orig/backend/be.go b/pkg/backend-orig/backend/be.go deleted file mode 100644 index 5f5ca98..0000000 --- a/pkg/backend-orig/backend/be.go +++ /dev/null @@ -1,207 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 backend - -/* - -import ( - "context" - "fmt" - - "github.com/henderiw/idxtable/pkg/table" - "github.com/henderiw/logger/log" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/client" -) - -type Backend interface { - // CreateIndex creates a backend index - CreateIndex(ctx context.Context, obj backend.IndexObject) error - // DeleteIndex deletes a backend index - DeleteIndex(ctx context.Context, obj backend.IndexObject) error - // Claim claims an entry in the backend index - Claim(ctx context.Context, obj backend.ClaimObject) error - // Release a claim in the backend - Release(ctx context.Context, obj backend.ClaimObject) error - // PrintEntries prints the entries of the cache - PrintEntries(ctx context.Context, k store.Key) error -} - -func New( - c client.Client, - newIndex func() backend.IndexObject, - newEntryList func() backend.ObjectList, - newClaimList func() backend.ObjectList, - newEntry func(k store.Key, vrange, id string, labels map[string]string) backend.EntryObject, - indexGVK schema.GroupVersionKind, - claimGVK schema.GroupVersionKind) Backend { - - cache := NewCache[*CacheContext]() - - store := NewNopStore() - if c != nil { - store = NewStore(c, cache, newIndex, newEntryList, newClaimList, newEntry, indexGVK, claimGVK) - } - return &be{ - cache: cache, - store: store, - } -} - -type be struct { - cache Cache[*CacheContext] - store Store -} - -// CreateIndex creates a backend index -func (r *be) CreateIndex(ctx context.Context, idx backend.IndexObject) error { - ctx = InitIndexContext(ctx, "create", idx) - log := log.FromContext(ctx) - log.Info("start") - key := idx.GetKey() - //log := log.FromContext(ctx).With("key", key) - - log.Info("start", "isInitialized", r.cache.IsInitialized(ctx, key)) - // if the Cache is not initialized -> restore the cache - // this happens upon initialization or backend restart - cacheCtx := NewCacheContext(idx.GetTree(), idx.GetType()) - r.cache.Create(ctx, key, cacheCtx) - if r.cache.IsInitialized(ctx, key) { - log.Info("already initialized") - return nil - } - if err := r.store.Restore(ctx, key); err != nil { - log.Error("cannot restore index", "error", err.Error()) - return err - } - log.Info("finished") - return r.cache.SetInitialized(ctx, key) -} - -// DeleteIndex deletes a backend index -func (r *be) DeleteIndex(ctx context.Context, idx backend.IndexObject) error { - ctx = InitIndexContext(ctx, "delete", idx) - log := log.FromContext(ctx) - log.Debug("start") - key := idx.GetKey() - - log.Debug("start", "isInitialized", r.cache.IsInitialized(ctx, key)) - // delete the data from the backend - if err := r.store.Destroy(ctx, key); err != nil { - log.Error("cannot delete Index", "error", err.Error()) - return err - } - r.cache.Delete(ctx, key) - - log.Debug("finished") - return nil - -} - -// Claim claims an entry in the backend index -func (r *be) Claim(ctx context.Context, claim backend.ClaimObject) error { - ctx = InitClaimContext(ctx, "create", claim) - log := log.FromContext(ctx) - log.Debug("start") - - cacheCtx, err := r.cache.Get(ctx, claim.GetKey(), false) - if err != nil { - return err - } - - a, err := getApplicator(ctx, cacheCtx, claim) - if err != nil { - return err - } - if err := a.Validate(ctx, claim); err != nil { - return err - } - if err := a.Apply(ctx, claim); err != nil { - return err - } - - // store the resources in the backend - return r.store.SaveAll(ctx, claim.GetKey()) -} - -// Release delete a claim in the backend index -func (r *be) Release(ctx context.Context, claim backend.ClaimObject) error { - ctx = InitClaimContext(ctx, "delete", claim) - log := log.FromContext(ctx) - log.Debug("start") - - cacheCtx, err := r.cache.Get(ctx, claim.GetKey(), false) - if err != nil { - return err - } - - // ip claim delete and store - a, err := getApplicator(ctx, cacheCtx, claim) - if err != nil { - // error gets returned when rib is not initialized -> this means we can safely return - // and pretend nothing is wrong (hence return nil) since the cleanup already happened - return nil - } - if err := a.Delete(ctx, claim); err != nil { - return err - } - - return r.store.SaveAll(ctx, claim.GetKey()) -} - -func getApplicator(_ context.Context, cacheCtx *CacheContext, claim backend.ClaimObject) (Applicator, error) { - claimType := claim.GetClaimType() - var a Applicator - switch claimType { - case backend.ClaimType_DynamicID: - a = &dynamicApplicator{name: string(claimType), applicator: applicator{cacheCtx: cacheCtx}} - case backend.ClaimType_StaticID: - a = &staticApplicator{name: string(claimType), applicator: applicator{cacheCtx: cacheCtx}} - case backend.ClaimType_Range: - a = &rangeApplicator{name: string(claimType), applicator: applicator{cacheCtx: cacheCtx}} - default: - return nil, fmt.Errorf("invalid addressing, got: %s", string(claimType)) - } - - return a, nil -} - -func (r *be) PrintEntries(ctx context.Context, k store.Key) error { - cachectx, err := r.cache.Get(ctx, k, false) - if err != nil { - return fmt.Errorf("key not found: %s", err.Error()) - } - fmt.Println("---------") - for _, entry := range cachectx.tree.GetAll() { - entry := entry - fmt.Println("entry", entry.ID().String()) - } - cachectx.ranges.List(ctx, func(ctx context.Context, k store.Key, t table.Table) { - fmt.Println("range", k.Name) - if t != nil { - for _, entry := range t.GetAll() { - entry := entry - fmt.Println("entry", entry.ID().String()) - } - } - - }) - return nil -} -*/ \ No newline at end of file diff --git a/pkg/backend-orig/backend/cache_context.go b/pkg/backend-orig/backend/cache_context.go deleted file mode 100644 index 355e24c..0000000 --- a/pkg/backend-orig/backend/cache_context.go +++ /dev/null @@ -1,80 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 backend - -/* - -import ( - "context" - - "github.com/henderiw/idxtable/pkg/table" - "github.com/henderiw/idxtable/pkg/tree/gtree" - "github.com/henderiw/store" - "github.com/henderiw/store/memory" -) - -// newCacheContext holds the cache instance context -// with a status to indicate if it is initialized or not -// initialized false: means it is NOT initialized, -// initialized true means it is initialized -func newCacheContext[T1 any](i T1) *cacheContext[T1] { - return &cacheContext[T1]{ - initialized: false, - instance: i, - } -} - -type cacheContext[T1 any] struct { - initialized bool - instance T1 -} - -func (r *cacheContext[T1]) Initialized() { - r.initialized = true -} - -func (r *cacheContext[T1]) IsInitialized() bool { - return r.initialized -} - -type CacheContext struct { - idxType string - tree gtree.GTree - ranges store.Storer[table.Table] -} - -func NewCacheContext(tree gtree.GTree, idxType string) *CacheContext { - return &CacheContext{ - idxType: idxType, // provides extra context around the - tree: tree, - ranges: memory.NewStore[table.Table](), - } -} - -func (r *CacheContext) Size() int { - var size int - size += r.tree.Size() - r.ranges.List(context.Background(), func(ctx context.Context, k store.Key, t table.Table) { - size += t.Size() - }) - return size -} - -func (r *CacheContext) Type() string { - return r.idxType -} -*/ diff --git a/pkg/backend-orig/backend/cache_interface.go b/pkg/backend-orig/backend/cache_interface.go deleted file mode 100644 index bb9fc1a..0000000 --- a/pkg/backend-orig/backend/cache_interface.go +++ /dev/null @@ -1,93 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 backend - -/* - -import ( - "context" - "fmt" - - "github.com/henderiw/store" - "github.com/henderiw/store/memory" -) - -type Cache[T1 any] interface { - IsInitialized(ctx context.Context, k store.Key) bool - SetInitialized(ctx context.Context, k store.Key) error - Get(ctx context.Context, k store.Key, i bool) (T1, error) - Create(ctx context.Context, k store.Key, i T1) - Delete(ctx context.Context, k store.Key) -} - -func NewCache[T1 any]() Cache[T1] { - return &cache[T1]{ - store: memory.NewStore[*cacheContext[T1]](), - } -} - -type cache[T1 any] struct { - store store.Storer[*cacheContext[T1]] -} - -func (r *cache[T1]) Create(ctx context.Context, k store.Key, i T1) { - cacheCtx, err := r.store.Get(ctx, k) - if err != nil { - _ = r.store.Create(ctx, k, newCacheContext(i)) - } - if cacheCtx == nil { - _ = r.store.Create(ctx, k, newCacheContext(i)) - } -} - -func (r *cache[T1]) Delete(ctx context.Context, k store.Key) { - _ = r.store.Delete(ctx, k) -} - -// Get returns the cache; the initialized flag can be used to return a cache even if not initialized -func (r *cache[T1]) Get(ctx context.Context, k store.Key, ignoreInitializing bool) (T1, error) { - cacheCtx, err := r.store.Get(ctx, k) - if err != nil { - return *new(T1), fmt.Errorf("index %s not initialized", k.String()) - } - - if !ignoreInitializing && !cacheCtx.IsInitialized() { - return *new(T1), fmt.Errorf("index %s is initializing", k.String()) - } - return cacheCtx.instance, nil -} - -// IsInitialized returns true if the cache is initialized and false if the cache is -// not initialized -func (r *cache[T1]) IsInitialized(ctx context.Context, k store.Key) bool { - cacheCtx, err := r.store.Get(ctx, k) - if err != nil { - return false - } - return cacheCtx.IsInitialized() -} - -// SetInitialized sets the status in the cacheContext to initialized -func (r *cache[T1]) SetInitialized(ctx context.Context, k store.Key) error { - cacheCtx, err := r.store.Get(ctx, k) - if err != nil { - return fmt.Errorf("index %s not initialized", k.String()) - } - cacheCtx.Initialized() - return nil -} -*/ diff --git a/pkg/backend-orig/backend/context.go b/pkg/backend-orig/backend/context.go deleted file mode 100644 index e8e6f79..0000000 --- a/pkg/backend-orig/backend/context.go +++ /dev/null @@ -1,70 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 backend - -/* -import ( - "context" - "fmt" - "log/slog" - - "github.com/henderiw/logger/log" - "github.com/kuidio/kuid/apis/backend" -) - -func InitIndexContext(ctx context.Context, op string, idx backend.IndexObject) context.Context { - l := log.FromContext(ctx). - With( - "op", fmt.Sprintf("%s index", op), - "gvk", idx.GetObjectKind().GroupVersionKind().String(), - "nsn", idx.GetNamespacedName().String(), - ) - return log.IntoContext(ctx, l) -} - -func InitClaimContext(ctx context.Context, op string, claim backend.ClaimObject) context.Context { - var l *slog.Logger - - claimType := claim.GetClaimType() - switch claimType { - case backend.ClaimType_DynamicID: - l = log.FromContext(ctx). - With( - "op", fmt.Sprintf("%s %s claim", op, string(claimType)), - "nsn", claim.GetNamespacedName().String(), - "index", claim.GetIndex(), - ) - case backend.ClaimType_StaticID: - l = log.FromContext(ctx). - With( - "op", fmt.Sprintf("%s %s claim", op, string(claimType)), - "nsn", claim.GetNamespacedName().String(), - "index", claim.GetIndex(), - "id", *claim.GetStaticID(), // safe - ) - case backend.ClaimType_Range: - l = log.FromContext(ctx). - With( - "op", fmt.Sprintf("%s %s claim", op, string(claimType)), - "nsn", claim.GetNamespacedName().String(), - "index", claim.GetIndex(), - "range", *claim.GetRange(), // safe - ) - } - return log.IntoContext(ctx, l) -} -*/ diff --git a/pkg/backend-orig/backend/store.go b/pkg/backend-orig/backend/store.go deleted file mode 100644 index 8770c4b..0000000 --- a/pkg/backend-orig/backend/store.go +++ /dev/null @@ -1,333 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 backend - -/* - -import ( - "context" - "errors" - "fmt" - - "github.com/henderiw/idxtable/pkg/table" - "github.com/henderiw/logger/log" - "github.com/henderiw/store" - "github.com/kuidio/kuid/apis/backend" - asbev1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" - "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/client" -) - -func NewStore( - c client.Client, - cache Cache[*CacheContext], - newIndex func() backend.IndexObject, - newEntryList func() backend.ObjectList, - newClaimList func() backend.ObjectList, - newEntry func(k store.Key, vrange, id string, labels map[string]string) backend.EntryObject, - indexGVK schema.GroupVersionKind, - claimGVK schema.GroupVersionKind) Store { - return &bestore{ - client: c, - cache: cache, - newIndex: newIndex, - newClaimList: newClaimList, - newEntryList: newEntryList, - newEntry: newEntry, - indexGVK: indexGVK, - claimGVK: claimGVK, - } -} - -type bestore struct { - client client.Client - cache Cache[*CacheContext] - newIndex func() backend.IndexObject - newClaimList func() backend.ObjectList - newEntryList func() backend.ObjectList - newEntry func(k store.Key, vrange, id string, labels map[string]string) backend.EntryObject - indexGVK schema.GroupVersionKind - claimGVK schema.GroupVersionKind -} - -func (r *bestore) Restore(ctx context.Context, k store.Key) error { - log := log.FromContext(ctx).With("key", k.String()) - - cacheCtx, err := r.cache.Get(ctx, k, true) - if err != nil { - log.Error("cannot get index", "error", err.Error()) - return err - } - // Fetch the current entries that were stored - curEntries, err := r.listEntries(ctx, k) - if err != nil { - return err - } - - claimmap, err := r.listClaims(ctx, k) - if err != nil { - return nil - } - - // retrieve the index to be able to restore the min/max values - index := r.newIndex() - if err := r.client.Get(ctx, k.NamespacedName, index); err != nil { - return err - } - - if err := r.restoreMinMaxRanges(ctx, cacheCtx, curEntries, index); err != nil { - return err - } - - if err := r.restoreClaims(ctx, cacheCtx, curEntries, backend.ClaimType_Range, claimmap); err != nil { - return err - } - if err := r.restoreClaims(ctx, cacheCtx, curEntries, backend.ClaimType_StaticID, claimmap); err != nil { - return err - } - if err := r.restoreClaims(ctx, cacheCtx, curEntries, backend.ClaimType_DynamicID, claimmap); err != nil { - return err - } - - log.Info("restore entries left", "items", len(curEntries)) - - return nil - -} - -// only used in configmap -func (r *bestore) SaveAll(ctx context.Context, k store.Key) error { - log := log.FromContext(ctx) - log.Info("SaveAll", "key", k.String()) - - newEntries, err := r.getEntriesFromCache(ctx, k) - if err != nil { - return err - } - curEntries, err := r.listEntries(ctx, k) - if err != nil { - return err - } - // debug end - for _, newEntry := range newEntries { - newEntry := newEntry - found := false - var entry backend.EntryObject - for idx, curEntry := range curEntries { - idx := idx - curEntry := curEntry - //fmt.Println("saveAll entries", newIPEntry.Name, curIPEntry.Name) - if curEntry.GetNamespacedName() == newEntry.GetNamespacedName() { - curEntries = append(curEntries[:idx], curEntries[idx+1:]...) - found = true - entry = curEntry - break - } - } - //fmt.Println("saveAll entries", found, newIPEntry.Name) - if !found { - if err := r.client.Create(ctx, newEntry); err != nil { - log.Error("saveAll create failed", "name", newEntry.GetName(), "error", err.Error()) - return err - } - continue - } - entry.SetSpec(newEntry.GetSpec) - log.Debug("save all ipEntry update", "ipEntry", entry.GetName()) - if err := r.client.Update(ctx, entry); err != nil { - return err - } - } - for _, curEntry := range curEntries { - if err := r.client.Delete(ctx, curEntry); err != nil { - return err - } - } - return nil -} - -// Destroy removes the store db -func (r *bestore) Destroy(ctx context.Context, k store.Key) error { - // no need to delete the ip index as this is what this fn is supposed to do - return r.deleteEntries(ctx, k) -} - -func (r *bestore) getEntriesFromCache(ctx context.Context, k store.Key) ([]backend.EntryObject, error) { - log := log.FromContext(ctx).With("key", k.String()) - cacheCtx, err := r.cache.Get(ctx, k, false) - if err != nil { - log.Error("cannot get index", "error", err.Error()) - return nil, err - } - - entries := make([]backend.EntryObject, 0, cacheCtx.Size()) - // add the main rib entry - for _, entry := range cacheCtx.tree.GetAll() { - //fmt.Println("getEntriesFromCache rib entry", route.Prefix().String()) - entry := entry - entries = append(entries, r.newEntry(k, "", entry.ID().String(), entry.Labels())) - } - // add all the range entries - cacheCtx.ranges.List(ctx, func(ctx context.Context, key store.Key, t table.Table) { - for _, entry := range t.GetAll() { - //fmt.Println("getEntriesFromCache range", key.Name, route.Prefix().String()) - entry := entry - entries = append(entries, r.newEntry(k, key.Name, entry.ID().String(), entry.Labels())) - } - }) - - return entries, nil -} - -func (r *bestore) deleteEntries(ctx context.Context, k store.Key) error { - log := log.FromContext(ctx).With("key", k.String()) - - entries, err := r.listEntries(ctx, k) - if err != nil { - log.Error("cannot list entries", "error", err) - return err - } - - var errm error - for _, entry := range entries { - if err := r.client.Delete(ctx, entry); err != nil { - log.Error("cannot delete entry", "error", err) - errm = errors.Join(errm, err) - continue - } - } - return errm -} - -func (r *bestore) listEntries(ctx context.Context, k store.Key) ([]backend.EntryObject, error) { - opt := []client.ListOption{ - //client.MatchingFields{ - // "spec.networkInstance": k.Name, - //}, - } - - entryList := r.newEntryList() - if err := r.client.List(ctx, entryList, opt...); err != nil { - return nil, err - } - entries := []backend.EntryObject{} - for _, entry := range entryList.GetItems() { - entry, ok := entry.(backend.EntryObject) - if !ok { - return nil, fmt.Errorf("wrong object") - } - if entry.GetKey() == k { - entries = append(entries, entry) - } - } - - return entries, nil -} - -func (r *bestore) listClaims(ctx context.Context, k store.Key) (map[string]backend.ClaimObject, error) { - opt := []client.ListOption{ - - // client.MatchingFields{ - // "spec.networkInstance": k.Name, - // }, - } - - claims := r.newClaimList() - if err := r.client.List(ctx, claims, opt...); err != nil { - return nil, err - } - - claimmap := map[string]backend.ClaimObject{} - for _, claim := range claims.GetItems() { - claim, ok := claim.(backend.ClaimObject) - if !ok { - return nil, fmt.Errorf("wrong object") - } - if claim.GetKey() == k { - claimmap[claim.GetNamespacedName().String()] = claim - } - } - - return claimmap, nil -} - -func (r *bestore) restoreMinMaxRanges(ctx context.Context, cacheCtx *CacheContext, entries []backend.EntryObject, index backend.IndexObject) error { - for i := len(entries) - 1; i >= 0; i-- { - entry := entries[i] - if entry.GetOwnerGVK() == r.indexGVK { - entries = append(entries[:i], entries[i+1:]...) - } - } - - if index.GetMinID() != nil && *index.GetMinID() != 0 { - claim := index.GetMinClaim() - if err := r.restoreClaim(ctx, cacheCtx, claim); err != nil { - return err - } - } - if index.GetMaxID() != nil && *index.GetMaxID() != asbev1alpha1.ASID_Max { - claim := index.GetMaxClaim() - if err := r.restoreClaim(ctx, cacheCtx, claim); err != nil { - return err - } - } - return nil -} - -func (r *bestore) restoreClaims(ctx context.Context, cacheCtx *CacheContext, entries []backend.EntryObject, claimType backend.ClaimType, claimmap map[string]backend.ClaimObject) error { - - for i := len(entries) - 1; i >= 0; i-- { - entry := entries[i] - if entry.GetOwnerGVK() == r.claimGVK { - if claimType == entry.GetClaimType() { - nsn := entry.GetOwnerNSN().String() - claim, ok := claimmap[nsn] - if ok { - if err := r.restoreClaim(ctx, cacheCtx, claim); err != nil { - return err - } - // remove the entry since it is processed - entries = append(entries[:i], entries[i+1:]...) - delete(claimmap, nsn) // delete the entry to optimize - } - } - } - } - return nil -} - -func (r *bestore) restoreClaim(ctx context.Context, cacheCtx *CacheContext, claim backend.ClaimObject) error { - ctx = InitClaimContext(ctx, "restore", claim) - a, err := getApplicator(ctx, cacheCtx, claim) - if err != nil { - return err - } - // validate is needed, mainly for addresses since the parent route determines - // e.g. the fact the address belongs to a range or not - errList := claim.ValidateSyntax(cacheCtx.Type()) // needed to expand the createPrefix/prefixLength and owner - if len(errList) != 0 { - return fmt.Errorf("invalid syntax %v", errList) - } - if err := a.Validate(ctx, claim); err != nil { - return err - } - if err := a.Apply(ctx, claim); err != nil { - return err - } - return nil -} -*/ diff --git a/pkg/backend-orig/backend/store_interface.go b/pkg/backend-orig/backend/store_interface.go deleted file mode 100644 index 72bba99..0000000 --- a/pkg/backend-orig/backend/store_interface.go +++ /dev/null @@ -1,47 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 backend - -/* - -import ( - "context" - - "github.com/henderiw/store" -) - -type Store interface { - // Restore restores the backend data in the cache - Restore(ctx context.Context, k store.Key) error - // SaveAll saves the backend in memory cache to disk - SaveAll(ctx context.Context, k store.Key) error - // Destroy detroys the storage - Destroy(ctx context.Context, k store.Key) error -} - -func NewNopStore() Store { - return &nopStore{} -} - -type nopStore struct{} - -func (r *nopStore) Restore(ctx context.Context, k store.Key) error { return nil } - -func (r *nopStore) SaveAll(ctx context.Context, k store.Key) error { return nil } - -func (r *nopStore) Destroy(ctx context.Context, k store.Key) error { return nil } -*/ diff --git a/pkg/backend/ipam/backend_store.go b/pkg/backend/ipam/backend_store.go index c7afd17..ea145d0 100644 --- a/pkg/backend/ipam/backend_store.go +++ b/pkg/backend/ipam/backend_store.go @@ -481,7 +481,6 @@ func (r *be) listIndexClaims(ctx context.Context, k store.Key) (map[string]*ipam continue } if claim.GetIndex() == k.Name { - fmt.Println("listIndexClaims", claim.Name, claim.OwnerReferences) for _, ownerRef := range claim.OwnerReferences { if ownerRef.Kind == ipam.IPIndexKind { claimMap[claim.GetNamespacedName().String()] = claim diff --git a/pkg/reconcilers/all/all.go b/pkg/reconcilers/all/all.go index 702a0c6..ae166e6 100644 --- a/pkg/reconcilers/all/all.go +++ b/pkg/reconcilers/all/all.go @@ -17,6 +17,6 @@ limitations under the License. package all import ( - _ "github.com/kuidio/kuid/pkg/reconcilers/asclaim" - _ "github.com/kuidio/kuid/pkg/reconcilers/asindex" + _ "github.com/kuidio/kuid/pkg/reconcilers/ipindex" + _ "github.com/kuidio/kuid/pkg/reconcilers/ipclaim" ) diff --git a/pkg/reconcilers/ipclaim/reconciler.go b/pkg/reconcilers/ipclaim/reconciler.go new file mode 100644 index 0000000..7fed289 --- /dev/null +++ b/pkg/reconcilers/ipclaim/reconciler.go @@ -0,0 +1,184 @@ +/* +Copyright 2024 Nokia. + +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 ipclaim + +import ( + "context" + "fmt" + "reflect" + "strings" + + "github.com/henderiw/logger/log" + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + "github.com/kuidio/kuid/apis/backend/ipam" + ipambev1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" + "github.com/kuidio/kuid/pkg/backend" + "github.com/kuidio/kuid/pkg/reconcilers" + "github.com/kuidio/kuid/pkg/reconcilers/ctrlconfig" + "github.com/kuidio/kuid/pkg/reconcilers/resource" + "github.com/pkg/errors" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/client-go/tools/record" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/event" +) + +func init() { + reconcilers.Register(ipambev1alpha1.Group, ipambev1alpha1.IPClaimKind, &reconciler{}) +} + +const ( + reconcilerName = "IPClaimController" + finalizer = "ipclaim.ipam.be.kuid.dev/finalizer" + // errors + errGetCr = "cannot get cr" + errUpdateStatus = "cannot update status" +) + +// SetupWithManager sets up the controller with the Manager. +func (r *reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, c interface{}) (map[schema.GroupVersionKind]chan event.GenericEvent, error) { + cfg, ok := c.(*ctrlconfig.ControllerConfig) + if !ok { + return nil, fmt.Errorf("cannot initialize, expecting controllerConfig, got: %s", reflect.TypeOf(c).Name()) + } + + r.Client = mgr.GetClient() + r.finalizer = resource.NewAPIFinalizer(mgr.GetClient(), finalizer, reconcilerName) + r.recorder = mgr.GetEventRecorderFor(reconcilerName) + r.be = cfg.Backends[ipambev1alpha1.SchemeGroupVersion.Group] + + return nil, ctrl.NewControllerManagedBy(mgr). + Named(reconcilerName). + For(&ipambev1alpha1.IPClaim{}). + //Watches(&ipambev1alpha1.IPEntry{}, + // &eventhandler.IPEntryEventHandler{ + // Client: mgr.GetClient(), + // ObjList: &ipambev1alpha1.IPClaimList{}, + // }). + Complete(r) +} + +type reconciler struct { + client.Client + finalizer *resource.APIFinalizer + recorder record.EventRecorder + be backend.Backend +} + +func (r *reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { + ctx = ctrlconfig.InitContext(ctx, reconcilerName, req.NamespacedName) + log := log.FromContext(ctx) + log.Info("reconcile") + + ipclaim := &ipambev1alpha1.IPClaim{} + if err := r.Get(ctx, req.NamespacedName, ipclaim); err != nil { + // if the resource no longer exists the reconcile loop is done + if resource.IgnoreNotFound(err) != nil { + log.Error(errGetCr, "error", err) + return ctrl.Result{}, errors.Wrap(resource.IgnoreNotFound(err), errGetCr) + } + return ctrl.Result{}, nil + } + ipclaimOrig := ipclaim.DeepCopy() + log.Debug("reconcile", "status orig", ipclaimOrig.Status) + + if !ipclaim.GetDeletionTimestamp().IsZero() { + intIPClaim := &ipam.IPClaim{} + if err := ipambev1alpha1.Convert_v1alpha1_IPClaim_To_ipam_IPClaim(ipclaim, intIPClaim, nil); err != nil { + return ctrl.Result{Requeue: true}, + errors.Wrap(r.handleError(ctx, ipclaimOrig, "cannot convert ipclaim before delete claim", err), errUpdateStatus) + } + + if err := r.be.Release(ctx, intIPClaim, false); err != nil { + if !strings.Contains(err.Error(), "not initialized") { + return ctrl.Result{Requeue: true}, + errors.Wrap(r.handleError(ctx, ipclaimOrig, "cannot delete ipclaim", err), errUpdateStatus) + } + } + if err := ipambev1alpha1.Convert_ipam_IPClaim_To_v1alpha1_IPClaim(intIPClaim, ipclaim, nil); err != nil { + return ctrl.Result{Requeue: true}, + errors.Wrap(r.handleError(ctx, ipclaimOrig, "cannot convert ipclaim after delete claim", err), errUpdateStatus) + } + + if err := r.finalizer.RemoveFinalizer(ctx, ipclaim); err != nil { + return ctrl.Result{Requeue: true}, + errors.Wrap(r.handleError(ctx, ipclaimOrig, "cannot delete finalizer", err), errUpdateStatus) + } + return ctrl.Result{}, nil + } + + if err := r.finalizer.AddFinalizer(ctx, ipclaim); err != nil { + return ctrl.Result{Requeue: true}, + errors.Wrap(r.handleError(ctx, ipclaimOrig, "cannot add finalizer", err), errUpdateStatus) + } + + intIPClaim := &ipam.IPClaim{} + if err := ipambev1alpha1.Convert_v1alpha1_IPClaim_To_ipam_IPClaim(ipclaim, intIPClaim, nil); err != nil { + return ctrl.Result{Requeue: true}, + errors.Wrap(r.handleError(ctx, ipclaimOrig, "cannot convert ipclaim before claim", err), errUpdateStatus) + } + if err := r.be.Claim(ctx, intIPClaim, false); err != nil { + return ctrl.Result{Requeue: true}, + errors.Wrap(r.handleError(ctx, ipclaimOrig, "cannot claim ip", err), errUpdateStatus) + } + if err := ipambev1alpha1.Convert_ipam_IPClaim_To_v1alpha1_IPClaim(intIPClaim, ipclaim, nil); err != nil { + return ctrl.Result{Requeue: true}, + errors.Wrap(r.handleError(ctx, ipclaimOrig, "cannot convert ipclaim after claim", err), errUpdateStatus) + } + + return ctrl.Result{}, errors.Wrap(r.handleSuccess(ctx, ipclaimOrig), errUpdateStatus) +} + +func (r *reconciler) handleSuccess(ctx context.Context, ipClaim *ipambev1alpha1.IPClaim) error { + log := log.FromContext(ctx) + log.Debug("handleSuccess", "key", ipClaim.GetNamespacedName(), "status old", ipClaim.DeepCopy().Status) + // take a snapshot of the current object + patch := client.MergeFrom(ipClaim.DeepCopy()) + // update status + ipClaim.SetConditions(condv1alpha1.Ready()) + r.recorder.Eventf(ipClaim, corev1.EventTypeNormal, ipambev1alpha1.IPClaimKind, "ready") + + + log.Debug("handleSuccess", "key", ipClaim.GetNamespacedName(), "status new", ipClaim.Status) + + return r.Client.Status().Patch(ctx, ipClaim, patch, &client.SubResourcePatchOptions{ + PatchOptions: client.PatchOptions{ + FieldManager: "backend", + }, + }) +} + +func (r *reconciler) handleError(ctx context.Context, ipClaim *ipambev1alpha1.IPClaim, msg string, err error) error { + log := log.FromContext(ctx) + // take a snapshot of the current object + patch := client.MergeFrom(ipClaim.DeepCopy()) + + if err != nil { + msg = fmt.Sprintf("%s err %s", msg, err.Error()) + } + ipClaim.SetConditions(condv1alpha1.Failed(msg)) + log.Error(msg) + r.recorder.Eventf(ipClaim, corev1.EventTypeWarning, ipambev1alpha1.IPClaimKind, msg) + + return r.Client.Status().Patch(ctx, ipClaim, patch, &client.SubResourcePatchOptions{ + PatchOptions: client.PatchOptions{ + FieldManager: "backend", + }, + }) +} diff --git a/pkg/reconcilers/ipindex/reconciler.go b/pkg/reconcilers/ipindex/reconciler.go new file mode 100644 index 0000000..30d8177 --- /dev/null +++ b/pkg/reconcilers/ipindex/reconciler.go @@ -0,0 +1,271 @@ +/* +Copyright 2024 Nokia. + +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 ipindex + +import ( + "context" + "fmt" + "reflect" + + "github.com/henderiw/logger/log" + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + "github.com/kuidio/kuid/apis/backend/ipam" + ipambev1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" + "github.com/kuidio/kuid/pkg/backend" + "github.com/kuidio/kuid/pkg/reconcilers" + "github.com/kuidio/kuid/pkg/reconcilers/ctrlconfig" + "github.com/kuidio/kuid/pkg/reconcilers/resource" + "github.com/pkg/errors" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/client-go/tools/record" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/event" +) + +func init() { + reconcilers.Register(ipambev1alpha1.Group, ipambev1alpha1.IPIndexKind, &reconciler{}) +} + +const ( + reconcilerName = "IPIndexController" + finalizer = "ipindex.ipam.be.kuid.dev/finalizer" + // errors + errGetCr = "cannot get cr" + errUpdateStatus = "cannot update status" +) + +// SetupWithManager sets up the controller with the Manager. +func (r *reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, c interface{}) (map[schema.GroupVersionKind]chan event.GenericEvent, error) { + cfg, ok := c.(*ctrlconfig.ControllerConfig) + if !ok { + return nil, fmt.Errorf("cannot initialize, expecting controllerConfig, got: %s", reflect.TypeOf(c).Name()) + } + + r.Client = mgr.GetClient() + r.finalizer = resource.NewAPIFinalizer(mgr.GetClient(), finalizer, reconcilerName) + r.recorder = mgr.GetEventRecorderFor(reconcilerName) + r.be = cfg.Backends[ipambev1alpha1.SchemeGroupVersion.Group] + + return nil, ctrl.NewControllerManagedBy(mgr). + Named(reconcilerName). + For(&ipambev1alpha1.IPIndex{}). + //Watches(&ipambev1alpha1.IPEntry{}, + // &eventhandler.IPEntryEventHandler{ + // Client: mgr.GetClient(), + // ObjList: &ipambev1alpha1.IPIndexList{}, + // }). + Complete(r) +} + +type reconciler struct { + client.Client + finalizer *resource.APIFinalizer + recorder record.EventRecorder + be backend.Backend +} + +func (r *reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { + ctx = ctrlconfig.InitContext(ctx, reconcilerName, req.NamespacedName) + log := log.FromContext(ctx) + log.Info("reconcile") + + ipIndex := &ipambev1alpha1.IPIndex{} + if err := r.Get(ctx, req.NamespacedName, ipIndex); err != nil { + // if the resource no longer exists the reconcile loop is done + if resource.IgnoreNotFound(err) != nil { + log.Error(errGetCr, "error", err) + return ctrl.Result{}, errors.Wrap(resource.IgnoreNotFound(err), errGetCr) + } + return ctrl.Result{}, nil + } + ipIndexOrig := ipIndex.DeepCopy() + log.Debug("reconcile", "status orig", ipIndexOrig.Status) + + if !ipIndex.GetDeletionTimestamp().IsZero() { + // if prefixes are provided from the network instance we treat them as + // ipindex prefixes. + /* + for _, prefix := range index.Spec.Prefixes { + if err := r.deleteIPClaim(ctx, cr, prefix); err != nil { + if resource.IgnoreNotFound(err) != nil { + return ctrl.Result{Requeue: true}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) + } + } + } + */ + intIPIndex := &ipam.IPIndex{} + if err := ipambev1alpha1.Convert_v1alpha1_IPIndex_To_ipam_IPIndex(ipIndex, intIPIndex, nil); err != nil { + return ctrl.Result{Requeue: true}, + errors.Wrap(r.handleError(ctx, ipIndexOrig, "cannot convert ipIndex before delete", err), errUpdateStatus) + } + if err := r.be.DeleteIndex(ctx, intIPIndex); err != nil { + if resource.IgnoreNotFound(err) != nil { + return ctrl.Result{Requeue: true}, + errors.Wrap(r.handleError(ctx, ipIndexOrig, "cannot delete index", err), errUpdateStatus) + } + } + if err := ipambev1alpha1.Convert_ipam_IPIndex_To_v1alpha1_IPIndex(intIPIndex, ipIndex, nil); err != nil { + return ctrl.Result{Requeue: true}, + errors.Wrap(r.handleError(ctx, ipIndexOrig, "cannot convert ipIndex after delete", err), errUpdateStatus) + } + + // We use owner reference so the k8s garbage collector takes care of the cleanup + if err := r.finalizer.RemoveFinalizer(ctx, ipIndex); err != nil { + return ctrl.Result{Requeue: true}, + errors.Wrap(r.handleError(ctx, ipIndexOrig, "cannot remove finalizer", err), errUpdateStatus) + } + return ctrl.Result{}, nil + } + + if err := r.finalizer.AddFinalizer(ctx, ipIndex); err != nil { + return ctrl.Result{Requeue: true}, + errors.Wrap(r.handleError(ctx, ipIndexOrig, "cannot add finalizer", err), errUpdateStatus) + } + + // create ip index + intIPIndex := &ipam.IPIndex{} + if err := ipambev1alpha1.Convert_v1alpha1_IPIndex_To_ipam_IPIndex(ipIndex, intIPIndex, nil); err != nil { + return ctrl.Result{Requeue: true}, + errors.Wrap(r.handleError(ctx, ipIndexOrig, "cannot convert ipIndex before create", err), errUpdateStatus) + } + if err := r.be.CreateIndex(ctx, intIPIndex); err != nil { + return ctrl.Result{Requeue: true}, + errors.Wrap(r.handleError(ctx, ipIndexOrig, "cannot apply index", err), errUpdateStatus) + } + if err := ipambev1alpha1.Convert_ipam_IPIndex_To_v1alpha1_IPIndex(intIPIndex, ipIndex, nil); err != nil { + return ctrl.Result{Requeue: true}, + errors.Wrap(r.handleError(ctx, ipIndexOrig, "cannot convert ipIndex after create", err), errUpdateStatus) + } + + // first validate if the previously claimed prefixes are still needed + // if not delete them + /* + for _, claimedPrefix := range cr.Status.Prefixes { + found := false + for _, prefix := range cr.Spec.Prefixes { + if claimedPrefix.Prefix == prefix.Prefix { + found = true + break + } + } + if !found { + if err := r.deleteIPClaim(ctx, cr, claimedPrefix); err != nil { + return ctrl.Result{RequeueAfter: 1 * time.Second}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) + } + } + } + // if prefixes are provided from the network instance we treat them as + // aggregate prefixes. + for _, prefix := range cr.Spec.Prefixes { + prefix := prefix + if err := r.applyIPClaim(ctx, cr, prefix); err != nil { + return ctrl.Result{RequeueAfter: 1 * time.Second}, errors.Wrap(r.Update(ctx, cr), errUpdateStatus) + } + } + */ + + return ctrl.Result{}, errors.Wrap(r.handleSuccess(ctx, ipIndexOrig), errUpdateStatus) +} + +func (r *reconciler) handleSuccess(ctx context.Context, ipIndex *ipambev1alpha1.IPIndex) error { + // take a snapshot of the current object + patch := client.MergeFrom(ipIndex.DeepCopy()) + // update status + ipIndex.SetConditions(condv1alpha1.Ready()) + r.recorder.Eventf(ipIndex, corev1.EventTypeNormal, ipambev1alpha1.IPIndexKind, "ready") + + return r.Client.Status().Patch(ctx, ipIndex, patch, &client.SubResourcePatchOptions{ + PatchOptions: client.PatchOptions{ + FieldManager: "backend", + }, + }) +} + +func (r *reconciler) handleError(ctx context.Context, ipIndex *ipambev1alpha1.IPIndex, msg string, err error) error { + log := log.FromContext(ctx) + // take a snapshot of the current object + patch := client.MergeFrom(ipIndex.DeepCopy()) + + if err != nil { + msg = fmt.Sprintf("%s err %s", msg, err.Error()) + } + ipIndex.SetConditions(condv1alpha1.Failed(msg)) + log.Error(msg) + r.recorder.Eventf(ipIndex, corev1.EventTypeWarning, ipambev1alpha1.IPIndexKind, msg) + + return r.Client.Status().Patch(ctx, ipIndex, patch, &client.SubResourcePatchOptions{ + PatchOptions: client.PatchOptions{ + FieldManager: "backend", + }, + }) +} + +/* +func (r *reconciler) deleteIndex(ctx context.Context, cr *ipambev1alpha1.IPIndex) error { + if err := r.be.DeleteIndex(ctx, cr); err != nil { + r.handleError(ctx, cr, "cannot delete index", err) + return err + } + return nil +} + +func (r *reconciler) applyIndex(ctx context.Context, cr *ipambev1alpha1.IPIndex) error { + if err := r.be.CreateIndex(ctx, cr); err != nil { + r.handleError(ctx, cr, "cannot create index", err) + return err + } + return nil +} +*/ + +/* +func (r *reconciler) applyIPClaim(ctx context.Context, cr *ipambev1alpha1.IPIndex, prefix ipambev1alpha1.Prefix) error { + ipclaim, err := cr.GetClaim(prefix) + if err != nil { // strange if this happens since the prefix was already processed + r.handleError(ctx, cr, "build ipclaim", err) + return err + } + if err := r.be.Claim(ctx, ipclaim); err != nil { + r.handleError(ctx, cr, "cannot claim ip", err) + return err + } + if ipclaim.Status.Prefix == nil || *ipclaim.Status.Prefix != prefix.Prefix { + //we got a different prefix than requested one + msg := fmt.Sprintf("ip prefix not ready: req/rsp %s/%v", prefix.Prefix, ipclaim.Status.Prefix) + r.handleError(ctx, cr, msg, nil) + return err + } + return nil +} + +func (r *reconciler) deleteIPClaim(ctx context.Context, cr *ipambev1alpha1.IPIndex, prefix ipambev1alpha1.Prefix) error { + //ipclaim, err := buildIPClaim(ctx, cr, prefix) + ipclaim, err := cr.GetClaim(prefix) + if err != nil { // strange if this happens since the prefix was already processed + r.handleError(ctx, cr, "cannot build ipclaim", err) + return err + } + if err := r.be.Release(ctx, ipclaim); err != nil { + if !strings.Contains(err.Error(), "not initialized") { + r.handleError(ctx, cr, "cannot delete ipclaim", err) + } + } + return nil +} +*/ diff --git a/pkg/reconcilers/resource/api.go b/pkg/reconcilers/resource/api.go deleted file mode 100644 index bffa1d6..0000000 --- a/pkg/reconcilers/resource/api.go +++ /dev/null @@ -1,83 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 resource - -import ( - "context" - "encoding/json" - - "github.com/pkg/errors" - kerrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/types" - "sigs.k8s.io/controller-runtime/pkg/client" -) - -// An APIPatchingApplicator applies changes to an object by either creating or -// patching it in a Kubernetes API server. -type APIPatchingApplicator struct { - client.Client -} - -// NewAPIPatchingApplicator returns an Applicator that applies changes to an -// object by either creating or patching it in a Kubernetes API server. -func NewAPIPatchingApplicator(c client.Client) APIPatchingApplicator { - return APIPatchingApplicator{c} -} - -// Apply changes to the supplied object. The object will be created if it does -// not exist, or patched if it does. If the object does exist, it will only be -// patched if the passed object has the same or an empty resource version. -func (a *APIPatchingApplicator) Apply(ctx context.Context, o client.Object, ao ...ApplyOption) error { - //if o.GetNamespace() == "" { - // o.SetNamespace("default") - //} - - m, ok := o.(metav1.Object) - if !ok { - return errors.New("cannot access object metadata") - } - - if m.GetName() == "" && m.GetGenerateName() != "" { - return errors.Wrap(a.Create(ctx, o), "cannot create object") - } - - desired := o.DeepCopyObject() - - err := a.Get(ctx, types.NamespacedName{Name: m.GetName(), Namespace: m.GetNamespace()}, o) - if kerrors.IsNotFound(err) { - // TODO: Apply ApplyOptions here too? - return errors.Wrap(a.Create(ctx, o), "cannot create object") - } - if err != nil { - return errors.Wrap(err, "cannot get object") - } - - for _, fn := range ao { - if err := fn(ctx, o, desired); err != nil { - return err - } - } - - // TODO: Allow callers to override the kind of patch used. - return errors.Wrap(a.Patch(ctx, o, &patch{desired.(client.Object)}), "cannot patch object") -} - -type patch struct{ from client.Object } - -func (p *patch) Type() types.PatchType { return types.MergePatchType } -func (p *patch) Data(_ client.Object) ([]byte, error) { return json.Marshal(p.from) } diff --git a/pkg/reconcilers/resource/api_test.go b/pkg/reconcilers/resource/api_test.go deleted file mode 100644 index 8255a0e..0000000 --- a/pkg/reconcilers/resource/api_test.go +++ /dev/null @@ -1,160 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 resource - -import ( - "context" - "testing" - - "github.com/google/go-cmp/cmp" - "github.com/pkg/errors" - kerrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/client" -) - -type object struct { - runtime.Object - metav1.ObjectMeta -} - -func (o *object) DeepCopyObject() runtime.Object { - return &object{ObjectMeta: *o.ObjectMeta.DeepCopy()} -} - -func TestAPIPatchingApplicator(t *testing.T) { - errBoom := errors.New("boom") - desired := &object{} - desired.SetName("desired") - - type args struct { - ctx context.Context - o client.Object - ao []ApplyOption - } - - type want struct { - o client.Object - err error - } - - cases := map[string]struct { - reason string - c client.Client - args args - want want - }{ - "GetError": { - reason: "An error should be returned if we can't get the object", - c: &MockClient{MockGet: NewMockGetFn(errBoom)}, - args: args{ - o: &object{}, - }, - want: want{ - o: &object{}, - err: errors.Wrap(errBoom, "cannot get object"), - }, - }, - "CreateError": { - reason: "No error should be returned if we successfully create a new object", - c: &MockClient{ - MockGet: NewMockGetFn(kerrors.NewNotFound(schema.GroupResource{}, "")), - MockCreate: NewMockCreateFn(errBoom), - }, - args: args{ - o: &object{}, - }, - want: want{ - o: &object{}, - err: errors.Wrap(errBoom, "cannot create object"), - }, - }, - "ApplyOptionError": { - reason: "Any errors from an apply option should be returned", - c: &MockClient{MockGet: NewMockGetFn(nil)}, - args: args{ - o: &object{}, - ao: []ApplyOption{func(_ context.Context, _, _ runtime.Object) error { return errBoom }}, - }, - want: want{ - o: &object{}, - err: errBoom, - }, - }, - "PatchError": { - reason: "An error should be returned if we can't patch the object", - c: &MockClient{ - MockGet: NewMockGetFn(nil), - MockPatch: NewMockPatchFn(errBoom), - }, - args: args{ - o: &object{}, - }, - want: want{ - o: &object{}, - err: errors.Wrap(errBoom, "cannot patch object"), - }, - }, - "Created": { - reason: "No error should be returned if we successfully create a new object", - c: &MockClient{ - MockGet: NewMockGetFn(kerrors.NewNotFound(schema.GroupResource{}, "")), - MockCreate: NewMockCreateFn(nil, func(o client.Object) error { - *o.(*object) = *desired - return nil - }), - }, - args: args{ - o: desired, - }, - want: want{ - o: desired, - }, - }, - "Patched": { - reason: "No error should be returned if we successfully patch an existing object", - c: &MockClient{ - MockGet: NewMockGetFn(nil), - MockPatch: NewMockPatchFn(nil, func(o client.Object) error { - *o.(*object) = *desired - return nil - }), - }, - args: args{ - o: desired, - }, - want: want{ - o: desired, - }, - }, - } - - for name, tc := range cases { - t.Run(name, func(t *testing.T) { - a := NewAPIPatchingApplicator(tc.c) - err := a.Apply(tc.args.ctx, tc.args.o, tc.args.ao...) - if diff := cmp.Diff(tc.want.err, err, EquateErrors()); diff != "" { - t.Errorf("\n%s\nApply(...): -want error, +got error\n%s\n", tc.reason, diff) - } - if diff := cmp.Diff(tc.want.o, tc.args.o); diff != "" { - t.Errorf("\n%s\nApply(...): -want, +got\n%s\n", tc.reason, diff) - } - }) - } -} diff --git a/pkg/reconcilers/resource/applicator.go b/pkg/reconcilers/resource/applicator.go deleted file mode 100644 index b5c524e..0000000 --- a/pkg/reconcilers/resource/applicator.go +++ /dev/null @@ -1,57 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 resource - -import ( - "context" - - "k8s.io/apimachinery/pkg/runtime" - "sigs.k8s.io/controller-runtime/pkg/client" -) - -// A ClientApplicator may be used to build a single 'client' that satisfies both -// client.Client and Applicator. -type ClientApplicator struct { - client.Client - Applicator -} - -// An ApplyFn is a function that satisfies the Applicator interface. -type ApplyFn func(context.Context, client.Object, ...ApplyOption) error - -// Apply changes to the supplied object. -func (fn ApplyFn) Apply(ctx context.Context, o client.Object, ao ...ApplyOption) error { - return fn(ctx, o, ao...) -} - -// An Applicator applies changes to an object. -type Applicator interface { - Apply(context.Context, client.Object, ...ApplyOption) error -} - -// An ApplyOption is called before patching the current object to match the -// desired object. ApplyOptions are not called if no current object exists. -type ApplyOption func(ctx context.Context, current, desired runtime.Object) error - -// UpdateFn returns an ApplyOption that is used to modify the current object to -// match fields of the desired. -func UpdateFn(fn func(current, desired runtime.Object)) ApplyOption { - return func(_ context.Context, c, d runtime.Object) error { - fn(c, d) - return nil - } -} diff --git a/pkg/reconcilers/resource/error_test.go b/pkg/reconcilers/resource/error_test.go deleted file mode 100644 index 375f97d..0000000 --- a/pkg/reconcilers/resource/error_test.go +++ /dev/null @@ -1,125 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 resource - -import ( - "reflect" - "testing" - - "github.com/google/go-cmp/cmp" - "github.com/pkg/errors" -) - -func TestIgnore(t *testing.T) { - errBoom := errors.New("boom") - - type args struct { - is ErrorIs - err error - } - cases := map[string]struct { - args args - want error - }{ - "IgnoreError": { - args: args{ - is: func(err error) bool { return true }, - err: errBoom, - }, - want: nil, - }, - "PropagateError": { - args: args{ - is: func(err error) bool { return false }, - err: errBoom, - }, - want: errBoom, - }, - } - - for name, tc := range cases { - t.Run(name, func(t *testing.T) { - got := Ignore(tc.args.is, tc.args.err) - if diff := cmp.Diff(tc.want, got, EquateErrors()); diff != "" { - t.Errorf("Ignore(...): -want error, +got error:\n%s", diff) - } - }) - } -} - -func TestIgnoreAny(t *testing.T) { - errBoom := errors.New("boom") - - type args struct { - is []ErrorIs - err error - } - cases := map[string]struct { - args args - want error - }{ - "IgnoreError": { - args: args{ - is: []ErrorIs{func(err error) bool { return true }}, - err: errBoom, - }, - want: nil, - }, - "IgnoreErrorArr": { - args: args{ - is: []ErrorIs{ - func(err error) bool { return true }, - func(err error) bool { return false }, - }, - err: errBoom, - }, - want: nil, - }, - "PropagateError": { - args: args{ - is: []ErrorIs{func(err error) bool { return false }}, - err: errBoom, - }, - want: errBoom, - }, - } - - for name, tc := range cases { - t.Run(name, func(t *testing.T) { - got := IgnoreAny(tc.args.err, tc.args.is...) - if diff := cmp.Diff(tc.want, got, EquateErrors()); diff != "" { - t.Errorf("Ignore(...): -want error, +got error:\n%s", diff) - } - }) - } -} - -func EquateErrors() cmp.Option { - return cmp.Comparer(func(a, b error) bool { - if a == nil || b == nil { - return a == nil && b == nil - } - - av := reflect.ValueOf(a) - bv := reflect.ValueOf(b) - if av.Type() != bv.Type() { - return false - } - - return a.Error() == b.Error() - }) -} diff --git a/pkg/reconcilers/resource/errors.go b/pkg/reconcilers/resource/errors.go index 351fdb3..1c6425f 100644 --- a/pkg/reconcilers/resource/errors.go +++ b/pkg/reconcilers/resource/errors.go @@ -50,9 +50,3 @@ func IgnoreAny(err error, is ...ErrorIs) error { func IgnoreNotFound(err error) error { return Ignore(errors.IsNotFound, err) } - -// IgnoreAlreadyExist returns the supplied error, or nil if the error indicates a -// Kubernetes resource that already exists. -func IgnoreAlreadyExist(err error) error { - return Ignore(errors.IsAlreadyExists, err) -} \ No newline at end of file diff --git a/pkg/reconcilers/resource/fake.go b/pkg/reconcilers/resource/fake.go deleted file mode 100644 index d9cb9e8..0000000 --- a/pkg/reconcilers/resource/fake.go +++ /dev/null @@ -1,343 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 resource - -import ( - "context" - - "k8s.io/apimachinery/pkg/api/meta" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/client" -) - -var _ client.Client = &MockClient{} - -// A MockGetFn is used to mock client.Client's Get implementation. -type MockGetFn func(ctx context.Context, key client.ObjectKey, obj client.Object) error - -// A MockListFn is used to mock client.Client's List implementation. -type MockListFn func(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error - -// A MockCreateFn is used to mock client.Client's Create implementation. -type MockCreateFn func(ctx context.Context, obj client.Object, opts ...client.CreateOption) error - -// A MockDeleteFn is used to mock client.Client's Delete implementation. -type MockDeleteFn func(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error - -// A MockDeleteAllOfFn is used to mock client.Client's Delete implementation. -type MockDeleteAllOfFn func(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error - -// A MockUpdateFn is used to mock client.Client's Update implementation. -type MockUpdateFn func(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error - -// A MockPatchFn is used to mock client.Client's Patch implementation. -type MockPatchFn func(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error - -// A MockSubResourceGetFn is used to mock client.SubResourceClient's get implementation. -type MockSubResourceGetFn func(ctx context.Context, obj, subResource client.Object, opts ...client.SubResourceGetOption) error - -// A MockSubResourceCreateFn is used to mock client.SubResourceClient's create implementation. -type MockSubResourceCreateFn func(ctx context.Context, obj, subResource client.Object, opts ...client.SubResourceCreateOption) error - -// A MockSubResourceUpdateFn is used to mock client.SubResourceClient's update implementation. -type MockSubResourceUpdateFn func(ctx context.Context, obj client.Object, opts ...client.SubResourceUpdateOption) error - -// A MockSubResourcePatchFn is used to mock client.SubResourceClient's patch implementation. -type MockSubResourcePatchFn func(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.SubResourcePatchOption) error - -// A MockSchemeFn is used to mock client.Client's Scheme implementation. -type MockSchemeFn func() *runtime.Scheme - -// An ObjectFn operates on the supplied Object. You might use an ObjectFn to -// test or update the contents of an Object. -type ObjectFn func(obj client.Object) error - -// An ObjectListFn operates on the supplied ObjectList. You might use an -// ObjectListFn to test or update the contents of an ObjectList. -type ObjectListFn func(obj client.ObjectList) error - -// NewMockGetFn returns a MockGetFn that returns the supplied error. -func NewMockGetFn(err error, ofn ...ObjectFn) MockGetFn { - return func(_ context.Context, _ client.ObjectKey, obj client.Object) error { - for _, fn := range ofn { - if err := fn(obj); err != nil { - return err - } - } - return err - } -} - -// NewMockListFn returns a MockListFn that returns the supplied error. -func NewMockListFn(err error, ofn ...ObjectListFn) MockListFn { - return func(_ context.Context, obj client.ObjectList, _ ...client.ListOption) error { - for _, fn := range ofn { - if err := fn(obj); err != nil { - return err - } - } - return err - } -} - -// NewMockCreateFn returns a MockCreateFn that returns the supplied error. -func NewMockCreateFn(err error, ofn ...ObjectFn) MockCreateFn { - return func(_ context.Context, obj client.Object, opts ...client.CreateOption) error { - for _, fn := range ofn { - if err := fn(obj); err != nil { - return err - } - } - return err - } -} - -// NewMockDeleteFn returns a MockDeleteFn that returns the supplied error. -func NewMockDeleteFn(err error, ofn ...ObjectFn) MockDeleteFn { - return func(_ context.Context, obj client.Object, _ ...client.DeleteOption) error { - for _, fn := range ofn { - if err := fn(obj); err != nil { - return err - } - } - return err - } -} - -// NewMockDeleteAllOfFn returns a MockDeleteAllOfFn that returns the supplied error. -func NewMockDeleteAllOfFn(err error, ofn ...ObjectFn) MockDeleteAllOfFn { - return func(_ context.Context, obj client.Object, _ ...client.DeleteAllOfOption) error { - for _, fn := range ofn { - if err := fn(obj); err != nil { - return err - } - } - return err - } -} - -// NewMockUpdateFn returns a MockUpdateFn that returns the supplied error. -func NewMockUpdateFn(err error, ofn ...ObjectFn) MockUpdateFn { - return func(_ context.Context, obj client.Object, _ ...client.UpdateOption) error { - for _, fn := range ofn { - if err := fn(obj); err != nil { - return err - } - } - return err - } -} - -// NewMockPatchFn returns a MockPatchFn that returns the supplied error. -func NewMockPatchFn(err error, ofn ...ObjectFn) MockPatchFn { - return func(_ context.Context, obj client.Object, _ client.Patch, _ ...client.PatchOption) error { - for _, fn := range ofn { - if err := fn(obj); err != nil { - return err - } - } - return err - } -} - -// NewMockSubResourceCreateFn returns a MockSubResourceCreateFn that returns the supplied error. -func NewMockSubResourceCreateFn(err error, ofn ...ObjectFn) MockSubResourceCreateFn { - return func(_ context.Context, obj, subResource client.Object, _ ...client.SubResourceCreateOption) error { - for _, fn := range ofn { - if err := fn(obj); err != nil { - return err - } - } - return err - } -} - -// NewMockSubResourceUpdateFn returns a MockSubResourceUpdateFn that returns the supplied error. -func NewMockSubResourceUpdateFn(err error, ofn ...ObjectFn) MockSubResourceUpdateFn { - return func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error { - for _, fn := range ofn { - if err := fn(obj); err != nil { - return err - } - } - return err - } -} - -// NewMockSubResourcePatchFn returns a MockSubResourcePatchFn that returns the supplied error. -func NewMockSubResourcePatchFn(err error, ofn ...ObjectFn) MockSubResourcePatchFn { - return func(_ context.Context, obj client.Object, _ client.Patch, _ ...client.SubResourcePatchOption) error { - for _, fn := range ofn { - if err := fn(obj); err != nil { - return err - } - } - return err - } -} - -// NewMockSchemeFn returns a MockSchemeFn that returns the scheme -func NewMockSchemeFn(scheme *runtime.Scheme) MockSchemeFn { - return func() *runtime.Scheme { - return scheme - } -} - -// MockClient implements controller-runtime's Client interface, allowing each -// method to be overridden for testing. The controller-runtime provides a fake -// client, but it is has surprising side effects (e.g. silently calling -// os.Exit(1)) and does not allow us control over the errors it returns. -type MockClient struct { - MockGet MockGetFn - MockList MockListFn - MockCreate MockCreateFn - MockDelete MockDeleteFn - MockDeleteAllOf MockDeleteAllOfFn - MockUpdate MockUpdateFn - MockPatch MockPatchFn - - MockStatusCreate MockSubResourceCreateFn - MockStatusUpdate MockSubResourceUpdateFn - MockStatusPatch MockSubResourcePatchFn - - MockSubResourceGet MockSubResourceGetFn - MockSubResourceCreate MockSubResourceCreateFn - MockSubResourceUpdate MockSubResourceUpdateFn - MockSubResourcePatch MockSubResourcePatchFn - - MockScheme MockSchemeFn -} - -// NewMockClient returns a MockClient that does nothing when its methods are -// called. -func NewMockClient() *MockClient { - return &MockClient{ - MockGet: NewMockGetFn(nil), - MockList: NewMockListFn(nil), - MockCreate: NewMockCreateFn(nil), - MockDelete: NewMockDeleteFn(nil), - MockDeleteAllOf: NewMockDeleteAllOfFn(nil), - MockUpdate: NewMockUpdateFn(nil), - MockPatch: NewMockPatchFn(nil), - - MockStatusUpdate: NewMockSubResourceUpdateFn(nil), - MockStatusPatch: NewMockSubResourcePatchFn(nil), - - MockScheme: NewMockSchemeFn(nil), - } -} - -// Get calls MockClient's MockGet function. -func (c *MockClient) Get(ctx context.Context, key client.ObjectKey, obj client.Object, _ ...client.GetOption) error { - return c.MockGet(ctx, key, obj) -} - -// List calls MockClient's MockList function. -func (c *MockClient) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error { - return c.MockList(ctx, list, opts...) -} - -// Create calls MockClient's MockCreate function. -func (c *MockClient) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error { - return c.MockCreate(ctx, obj, opts...) -} - -// Delete calls MockClient's MockDelete function. -func (c *MockClient) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error { - return c.MockDelete(ctx, obj, opts...) -} - -// DeleteAllOf calls MockClient's DeleteAllOf function. -func (c *MockClient) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error { - return c.MockDeleteAllOf(ctx, obj, opts...) -} - -// Update calls MockClient's MockUpdate function. -func (c *MockClient) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error { - return c.MockUpdate(ctx, obj, opts...) -} - -// Patch calls MockClient's MockPatch function. -func (c *MockClient) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error { - return c.MockPatch(ctx, obj, patch, opts...) -} - -// Status returns status writer for status sub-resource -func (c *MockClient) Status() client.SubResourceWriter { - return &MockSubResourceClient{ - MockCreate: c.MockStatusCreate, - MockUpdate: c.MockStatusUpdate, - MockPatch: c.MockStatusPatch, - } -} - -// SubResource is unimplemented. It panics if called. -func (c *MockClient) SubResource(_ string) client.SubResourceClient { - return &MockSubResourceClient{ - MockGet: c.MockSubResourceGet, - MockCreate: c.MockSubResourceCreate, - MockUpdate: c.MockSubResourceUpdate, - MockPatch: c.MockSubResourcePatch, - } -} - -// RESTMapper returns the REST mapper. -func (c *MockClient) RESTMapper() meta.RESTMapper { - return nil -} - -// Scheme calls MockClient's MockScheme function -func (c *MockClient) Scheme() *runtime.Scheme { - return c.MockScheme() -} - -func (c *MockClient) GroupVersionKindFor(obj runtime.Object) (schema.GroupVersionKind, error) { - return schema.GroupVersionKind{}, nil -} - -func (c *MockClient) IsObjectNamespaced(obj runtime.Object) (bool, error) { - return false, nil -} - -// MockSubResourceClient provides mock functionality for status sub-resource -type MockSubResourceClient struct { - MockGet MockSubResourceGetFn - MockCreate MockSubResourceCreateFn - MockUpdate MockSubResourceUpdateFn - MockPatch MockSubResourcePatchFn -} - -// Get a sub-resource -func (m *MockSubResourceClient) Get(ctx context.Context, obj, subResource client.Object, opts ...client.SubResourceGetOption) error { - return m.MockGet(ctx, obj, subResource, opts...) -} - -// Create a sub-resource -func (m *MockSubResourceClient) Create(ctx context.Context, obj, subResource client.Object, opts ...client.SubResourceCreateOption) error { - return m.MockCreate(ctx, obj, subResource, opts...) -} - -// Update a sub-resource -func (m *MockSubResourceClient) Update(ctx context.Context, obj client.Object, opts ...client.SubResourceUpdateOption) error { - return m.MockUpdate(ctx, obj, opts...) -} - -// Patch a sub-resource -func (m *MockSubResourceClient) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.SubResourcePatchOption) error { - return m.MockPatch(ctx, obj, patch, opts...) -} diff --git a/pkg/reconcilers/resource/finalizer.go b/pkg/reconcilers/resource/finalizer.go index 6aa5471..4fe583d 100644 --- a/pkg/reconcilers/resource/finalizer.go +++ b/pkg/reconcilers/resource/finalizer.go @@ -18,6 +18,7 @@ package resource import ( "context" + "fmt" "github.com/pkg/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -26,36 +27,66 @@ import ( // Finalizer manages the lifecycle of the finalizer on a k8s object type Finalizer interface { - AddFinalizer(ctx context.Context, obj Object) error - RemoveFinalizer(ctx context.Context, obj Object) error + AddFinalizer(ctx context.Context, obj client.Object) error + RemoveFinalizer(ctx context.Context, obj client.Object) error } // An APIFinalizer manages the lifecycle of a finalizer on a k8s object. type APIFinalizer struct { - client client.Client - finalizer string + client client.Client + reconcilerName string + finalizer string } // NewAPIFinalizer returns a new APIFinalizer. -func NewAPIFinalizer(c client.Client, finalizer string) *APIFinalizer { - return &APIFinalizer{client: c, finalizer: finalizer} +func NewAPIFinalizer(c client.Client, finalizer, reconcilerName string) *APIFinalizer { + return &APIFinalizer{client: c, finalizer: finalizer, reconcilerName: reconcilerName} } // AddFinalizer to the supplied Managed resource. -func (a *APIFinalizer) AddFinalizer(ctx context.Context, obj Object) error { - if FinalizerExists(obj, a.finalizer) { +func (r *APIFinalizer) AddFinalizer(ctx context.Context, obj client.Object) error { + // take a snapshot of the current object + origObj := obj.DeepCopyObject() + + // Again assert to client.Object to manipulate metadata and finalizers + copiedObj, ok := origObj.(client.Object) + if !ok { + return fmt.Errorf("deep copied object does not implement client.Object") + } + + patch := client.MergeFrom(copiedObj) + + if FinalizerExists(obj, r.finalizer) { return nil } - AddFinalizer(obj, a.finalizer) - return errors.Wrap(a.client.Update(ctx, obj), errUpdateObject) + AddFinalizer(obj, r.finalizer) + return errors.Wrap(r.Update(ctx, obj, patch), errUpdateObject) } -func (a *APIFinalizer) RemoveFinalizer(ctx context.Context, obj Object) error { - if !FinalizerExists(obj, a.finalizer) { +func (r *APIFinalizer) Update(ctx context.Context, obj client.Object, patch client.Patch) error { + return r.client.Patch(ctx, obj, patch, &client.SubResourcePatchOptions{ + PatchOptions: client.PatchOptions{ + FieldManager: r.reconcilerName, + }, + }) +} + +func (r *APIFinalizer) RemoveFinalizer(ctx context.Context, obj client.Object) error { + // take a snapshot of the current object + origObj := obj.DeepCopyObject() + + // Again assert to client.Object to manipulate metadata and finalizers + copiedObj, ok := origObj.(client.Object) + if !ok { + return fmt.Errorf("deep copied object does not implement client.Object") + } + patch := client.MergeFrom(copiedObj) + + if !FinalizerExists(obj, r.finalizer) { return nil } - RemoveFinalizer(obj, a.finalizer) - return errors.Wrap(IgnoreNotFound(a.client.Update(ctx, obj)), errUpdateObject) + RemoveFinalizer(obj, r.finalizer) + return errors.Wrap(r.Update(ctx, obj, patch), errUpdateObject) } // AddFinalizer to the supplied k8s object's metadata. diff --git a/pkg/reconcilers/resource/finalizer_test.go b/pkg/reconcilers/resource/finalizer_test.go deleted file mode 100644 index 9ce78e5..0000000 --- a/pkg/reconcilers/resource/finalizer_test.go +++ /dev/null @@ -1,190 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 resource - -import ( - "testing" - - "github.com/google/go-cmp/cmp" - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -func TestAddFinalizer(t *testing.T) { - finalizer := "fin" - funalizer := "fun" - - type args struct { - o metav1.Object - finalizer string - } - - cases := map[string]struct { - args args - want []string - }{ - "NoExistingFinalizers": { - args: args{ - o: &corev1.Pod{}, - finalizer: finalizer, - }, - want: []string{finalizer}, - }, - "FinalizerAlreadyExists": { - args: args{ - o: &corev1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Finalizers: []string{finalizer}, - }, - }, - finalizer: finalizer, - }, - want: []string{finalizer}, - }, - "AnotherFinalizerExists": { - args: args{ - o: &corev1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Finalizers: []string{funalizer}, - }, - }, - finalizer: finalizer, - }, - want: []string{funalizer, finalizer}, - }, - } - - for name, tc := range cases { - t.Run(name, func(t *testing.T) { - AddFinalizer(tc.args.o, tc.args.finalizer) - - got := tc.args.o.GetFinalizers() - if diff := cmp.Diff(tc.want, got); diff != "" { - t.Errorf("tc.args.o.GetFinalizers(...): -want, +got:\n%s", diff) - } - }) - } -} - -func TestRemoveFinalizer(t *testing.T) { - finalizer := "fin" - funalizer := "fun" - - type args struct { - o metav1.Object - finalizer string - } - - cases := map[string]struct { - args args - want []string - }{ - "NoExistingFinalizers": { - args: args{ - o: &corev1.Pod{}, - finalizer: finalizer, - }, - want: nil, - }, - "FinalizerExists": { - args: args{ - o: &corev1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Finalizers: []string{finalizer}, - }, - }, - finalizer: finalizer, - }, - want: []string{}, - }, - "AnotherFinalizerExists": { - args: args{ - o: &corev1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Finalizers: []string{finalizer, funalizer}, - }, - }, - finalizer: finalizer, - }, - want: []string{funalizer}, - }, - } - - for name, tc := range cases { - t.Run(name, func(t *testing.T) { - RemoveFinalizer(tc.args.o, tc.args.finalizer) - - got := tc.args.o.GetFinalizers() - if diff := cmp.Diff(tc.want, got); diff != "" { - t.Errorf("tc.args.o.GetFinalizers(...): -want, +got:\n%s", diff) - } - }) - } -} - -func TestFinalizerExists(t *testing.T) { - finalizer := "fin" - funalizer := "fun" - - type args struct { - o metav1.Object - finalizer string - } - - cases := map[string]struct { - args args - want bool - }{ - "NoExistingFinalizers": { - args: args{ - o: &corev1.Pod{}, - finalizer: finalizer, - }, - want: false, - }, - "FinalizerExists": { - args: args{ - o: &corev1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Finalizers: []string{finalizer}, - }, - }, - finalizer: finalizer, - }, - want: true, - }, - "AnotherFinalizerExists": { - args: args{ - o: &corev1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Finalizers: []string{funalizer}, - }, - }, - finalizer: finalizer, - }, - want: false, - }, - } - - for name, tc := range cases { - t.Run(name, func(t *testing.T) { - if diff := cmp.Diff(tc.want, FinalizerExists(tc.args.o, tc.args.finalizer)); diff != "" { - t.Errorf("tc.args.o.GetFinalizers(...): -want, +got:\n%s", diff) - } - }) - } -} diff --git a/pkg/reconcilers/resource/object.go b/pkg/reconcilers/resource/object.go deleted file mode 100644 index 36d8560..0000000 --- a/pkg/reconcilers/resource/object.go +++ /dev/null @@ -1,35 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 resource - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" -) - -type Object interface { - metav1.Object - runtime.Object - //GetOwnerReference() *commonv1alpha1.OwnerReference -} - -/* -type ObjectList interface { - GetItems() []Object - client.ObjectList -} -*/ diff --git a/pkg/reconcilers/resource/unstructured.go b/pkg/reconcilers/resource/unstructured.go deleted file mode 100644 index d391732..0000000 --- a/pkg/reconcilers/resource/unstructured.go +++ /dev/null @@ -1,52 +0,0 @@ -/* -Copyright 2024 Nokia. - -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 resource - -import ( - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/yaml" -) - -func GetUnstructuredFromGVK(gvk *schema.GroupVersionKind) *unstructured.Unstructured { - var u unstructured.Unstructured - u.SetAPIVersion(gvk.GroupVersion().String()) - u.SetKind(gvk.Kind) - uCopy := u.DeepCopy() - return uCopy -} - -func GetUnstructuredListFromGVK(gvk *schema.GroupVersionKind) *unstructured.UnstructuredList { - var u unstructured.UnstructuredList - u.SetAPIVersion(gvk.GroupVersion().String()) - u.SetKind(gvk.Kind) - uCopy := u.DeepCopy() - return uCopy -} - -func MarshalData(o *unstructured.Unstructured) (any, error) { - b, err := yaml.Marshal(o.UnstructuredContent()) - if err != nil { - return nil, err - } - - rj := map[string]interface{}{} - if err := yaml.Unmarshal(b, &rj); err != nil { - return nil, err - } - return rj, nil -} diff --git a/pkg/registry/generic/strategy_status.go b/pkg/registry/generic/strategy_status.go index 5008303..4c633fa 100644 --- a/pkg/registry/generic/strategy_status.go +++ b/pkg/registry/generic/strategy_status.go @@ -91,8 +91,12 @@ func (r *statusStrategy) InvokeUpdate(ctx context.Context, obj, old runtime.Obje } func (r *statusStrategy) Update(ctx context.Context, key types.NamespacedName, obj, old runtime.Object, dryrun bool) (runtime.Object, error) { + log := log.FromContext(ctx) + log.Debug("Update status", "key", key.String(), "old", old) + log.Debug("Update status", "key", key.String(), "new", obj) // check if there is a change if r.obj.IsStatusEqual(ctx, obj, old) { + log.Debug("Update status equal", "key", key.String()) return obj, nil } From 5eb4013942788a295d2b2c342218d5ce3a68d93b Mon Sep 17 00:00:00 2001 From: Wim Henderickx Date: Mon, 28 Oct 2024 09:22:37 +0100 Subject: [PATCH 12/23] added genid and extcomm --- apis/all/all.go | 6 +- apis/backend/extcomm/doc.go | 21 + apis/backend/extcomm/extcomm_types.go | 61 + apis/backend/extcomm/extcommclaim_object.go | 409 +++++ apis/backend/extcomm/extcommclaim_resource.go | 318 ++++ .../extcomm/extcommclaim_syntaxvalidator.go | 68 + apis/backend/extcomm/extcommclaim_types.go | 84 + apis/backend/extcomm/extcommentry_object.go | 133 ++ apis/backend/extcomm/extcommentry_resource.go | 315 ++++ apis/backend/extcomm/extcommentry_types.go | 75 + apis/backend/extcomm/extcommindex_helpers.go | 106 ++ apis/backend/extcomm/extcommindex_object.go | 166 ++ apis/backend/extcomm/extcommindex_resource.go | 314 ++++ apis/backend/extcomm/extcommindex_types.go | 91 + apis/backend/extcomm/helper.go | 35 + apis/backend/extcomm/register.go | 52 + apis/backend/extcomm/register/register.go | 113 ++ apis/backend/extcomm/v1alpha1/doc.go | 28 + .../extcomm/v1alpha1/extcommclaim_types.go | 84 + .../extcomm/v1alpha1/extcommentry_types.go | 75 + .../extcomm/v1alpha1/extcommindex_types.go | 91 + .../extcomm/v1alpha1/genidclaim_resource.go | 80 + .../extcomm/v1alpha1/genidentry_resource.go | 80 + .../extcomm/v1alpha1/genidindex_resource.go | 80 + apis/backend/extcomm/v1alpha1/register.go | 67 + .../v1alpha1/zz_generated.conversion.go | 563 ++++++ .../extcomm/v1alpha1/zz_generated.deepcopy.go | 355 ++++ .../extcomm/v1alpha1/zz_generated.defaults.go | 32 + apis/backend/extcomm/zz_generated.deepcopy.go | 451 +++++ apis/backend/genid/doc.go | 21 + apis/backend/genid/genid_types.go | 42 + apis/backend/genid/genidclaim_object.go | 395 +++++ apis/backend/genid/genidclaim_resource.go | 318 ++++ .../genid/genidclaim_syntaxvalidator.go | 69 + apis/backend/genid/genidclaim_types.go | 82 + apis/backend/genid/genidentry_object.go | 133 ++ apis/backend/genid/genidentry_resource.go | 315 ++++ apis/backend/genid/genidentry_types.go | 71 + apis/backend/genid/genidindex_helpers.go | 98 ++ apis/backend/genid/genidindex_object.go | 173 ++ apis/backend/genid/genidindex_resource.go | 314 ++++ apis/backend/genid/genidindex_types.go | 79 + apis/backend/genid/helper.go | 49 + apis/backend/genid/register.go | 52 + apis/backend/genid/register/register.go | 113 ++ apis/backend/genid/v1alpha1/doc.go | 28 + .../genid/v1alpha1/genidclaim_resource.go | 80 + .../genid/v1alpha1/genidclaim_types.go | 82 + .../genid/v1alpha1/genidentry_resource.go | 80 + .../genid/v1alpha1/genidentry_types.go | 71 + .../genid/v1alpha1/genidindex_resource.go | 80 + .../genid/v1alpha1/genidindex_types.go | 79 + apis/backend/genid/v1alpha1/register.go | 67 + .../genid/v1alpha1/zz_generated.conversion.go | 555 ++++++ .../genid/v1alpha1/zz_generated.deepcopy.go | 355 ++++ apis/backend/genid/zz_generated.deepcopy.go | 451 +++++ .../infra/v1alpha1/zz_generated.conversion.go | 1 - pkg/config/config.go | 4 +- .../clientset/versioned/clientset.go | 21 +- .../versioned/fake/clientset_generated.go | 7 + .../clientset/versioned/fake/register.go | 2 + .../clientset/versioned/scheme/register.go | 2 + .../versioned/typed/extcomm/v1alpha1/doc.go | 19 + .../typed/extcomm/v1alpha1/extcomm_client.go | 116 ++ .../typed/extcomm/v1alpha1/extcommclaim.go | 68 + .../typed/extcomm/v1alpha1/extcommentry.go | 68 + .../typed/extcomm/v1alpha1/extcommindex.go | 68 + .../typed/extcomm/v1alpha1/fake/doc.go | 19 + .../v1alpha1/fake/fake_extcomm_client.go | 47 + .../v1alpha1/fake/fake_extcommclaim.go | 146 ++ .../v1alpha1/fake/fake_extcommentry.go | 146 ++ .../v1alpha1/fake/fake_extcommindex.go | 146 ++ .../extcomm/v1alpha1/generated_expansion.go | 24 + .../externalversions/extcomm/interface.go | 45 + .../extcomm/v1alpha1/extcommclaim.go | 89 + .../extcomm/v1alpha1/extcommentry.go | 89 + .../extcomm/v1alpha1/extcommindex.go | 89 + .../extcomm/v1alpha1/interface.go | 58 + .../informers/externalversions/factory.go | 6 + .../informers/externalversions/generic.go | 9 + .../extcomm/v1alpha1/expansion_generated.go | 42 + .../listers/extcomm/v1alpha1/extcommclaim.go | 69 + .../listers/extcomm/v1alpha1/extcommentry.go | 69 + .../listers/extcomm/v1alpha1/extcommindex.go | 69 + pkg/generated/openapi/zz_generated.openapi.go | 1544 +++++++++++++++-- 85 files changed, 11515 insertions(+), 172 deletions(-) create mode 100644 apis/backend/extcomm/doc.go create mode 100644 apis/backend/extcomm/extcomm_types.go create mode 100644 apis/backend/extcomm/extcommclaim_object.go create mode 100644 apis/backend/extcomm/extcommclaim_resource.go create mode 100644 apis/backend/extcomm/extcommclaim_syntaxvalidator.go create mode 100644 apis/backend/extcomm/extcommclaim_types.go create mode 100644 apis/backend/extcomm/extcommentry_object.go create mode 100644 apis/backend/extcomm/extcommentry_resource.go create mode 100644 apis/backend/extcomm/extcommentry_types.go create mode 100644 apis/backend/extcomm/extcommindex_helpers.go create mode 100644 apis/backend/extcomm/extcommindex_object.go create mode 100644 apis/backend/extcomm/extcommindex_resource.go create mode 100644 apis/backend/extcomm/extcommindex_types.go create mode 100644 apis/backend/extcomm/helper.go create mode 100644 apis/backend/extcomm/register.go create mode 100644 apis/backend/extcomm/register/register.go create mode 100644 apis/backend/extcomm/v1alpha1/doc.go create mode 100644 apis/backend/extcomm/v1alpha1/extcommclaim_types.go create mode 100644 apis/backend/extcomm/v1alpha1/extcommentry_types.go create mode 100644 apis/backend/extcomm/v1alpha1/extcommindex_types.go create mode 100644 apis/backend/extcomm/v1alpha1/genidclaim_resource.go create mode 100644 apis/backend/extcomm/v1alpha1/genidentry_resource.go create mode 100644 apis/backend/extcomm/v1alpha1/genidindex_resource.go create mode 100644 apis/backend/extcomm/v1alpha1/register.go create mode 100644 apis/backend/extcomm/v1alpha1/zz_generated.conversion.go create mode 100644 apis/backend/extcomm/v1alpha1/zz_generated.deepcopy.go create mode 100644 apis/backend/extcomm/v1alpha1/zz_generated.defaults.go create mode 100644 apis/backend/extcomm/zz_generated.deepcopy.go create mode 100644 apis/backend/genid/doc.go create mode 100644 apis/backend/genid/genid_types.go create mode 100644 apis/backend/genid/genidclaim_object.go create mode 100644 apis/backend/genid/genidclaim_resource.go create mode 100644 apis/backend/genid/genidclaim_syntaxvalidator.go create mode 100644 apis/backend/genid/genidclaim_types.go create mode 100644 apis/backend/genid/genidentry_object.go create mode 100644 apis/backend/genid/genidentry_resource.go create mode 100644 apis/backend/genid/genidentry_types.go create mode 100644 apis/backend/genid/genidindex_helpers.go create mode 100644 apis/backend/genid/genidindex_object.go create mode 100644 apis/backend/genid/genidindex_resource.go create mode 100644 apis/backend/genid/genidindex_types.go create mode 100644 apis/backend/genid/helper.go create mode 100644 apis/backend/genid/register.go create mode 100644 apis/backend/genid/register/register.go create mode 100644 apis/backend/genid/v1alpha1/doc.go create mode 100644 apis/backend/genid/v1alpha1/genidclaim_resource.go create mode 100644 apis/backend/genid/v1alpha1/genidclaim_types.go create mode 100644 apis/backend/genid/v1alpha1/genidentry_resource.go create mode 100644 apis/backend/genid/v1alpha1/genidentry_types.go create mode 100644 apis/backend/genid/v1alpha1/genidindex_resource.go create mode 100644 apis/backend/genid/v1alpha1/genidindex_types.go create mode 100644 apis/backend/genid/v1alpha1/register.go create mode 100644 apis/backend/genid/v1alpha1/zz_generated.conversion.go create mode 100644 apis/backend/genid/v1alpha1/zz_generated.deepcopy.go create mode 100644 apis/backend/genid/zz_generated.deepcopy.go create mode 100644 pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/doc.go create mode 100644 pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/extcomm_client.go create mode 100644 pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/extcommclaim.go create mode 100644 pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/extcommentry.go create mode 100644 pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/extcommindex.go create mode 100644 pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/doc.go create mode 100644 pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/fake_extcomm_client.go create mode 100644 pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/fake_extcommclaim.go create mode 100644 pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/fake_extcommentry.go create mode 100644 pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/fake_extcommindex.go create mode 100644 pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/generated_expansion.go create mode 100644 pkg/generated/informers/externalversions/extcomm/interface.go create mode 100644 pkg/generated/informers/externalversions/extcomm/v1alpha1/extcommclaim.go create mode 100644 pkg/generated/informers/externalversions/extcomm/v1alpha1/extcommentry.go create mode 100644 pkg/generated/informers/externalversions/extcomm/v1alpha1/extcommindex.go create mode 100644 pkg/generated/informers/externalversions/extcomm/v1alpha1/interface.go create mode 100644 pkg/generated/listers/extcomm/v1alpha1/expansion_generated.go create mode 100644 pkg/generated/listers/extcomm/v1alpha1/extcommclaim.go create mode 100644 pkg/generated/listers/extcomm/v1alpha1/extcommentry.go create mode 100644 pkg/generated/listers/extcomm/v1alpha1/extcommindex.go diff --git a/apis/all/all.go b/apis/all/all.go index 59e880e..6731b69 100644 --- a/apis/all/all.go +++ b/apis/all/all.go @@ -17,12 +17,14 @@ limitations under the License. package all import ( + _ "github.com/kuidio/kuid/apis/infra/register" _ "github.com/kuidio/kuid/apis/backend/as/register" _ "github.com/kuidio/kuid/apis/backend/ipam/register" _ "github.com/kuidio/kuid/apis/backend/vlan/register" - _ "github.com/kuidio/kuid/apis/infra/register" + _ "github.com/kuidio/kuid/apis/backend/genid/register" + _ "github.com/kuidio/kuid/apis/backend/extcomm/register" + ) //vxlanbev1alpha1.AddToScheme, //extcommbev1alpha1.AddToScheme, -//genidbev1alpha1.AddToScheme, diff --git a/apis/backend/extcomm/doc.go b/apis/backend/extcomm/doc.go new file mode 100644 index 0000000..ec31742 --- /dev/null +++ b/apis/backend/extcomm/doc.go @@ -0,0 +1,21 @@ +/* +Copyright 2024 Nokia. + +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. +*/ + +// +k8s:deepcopy-gen=package,register +// +groupName=extcomm.be.kuid.dev + +// Package genid is the internal version of the API. +package extcomm // import "github.com/kuidio/kuid/apis/backend/extcomm" diff --git a/apis/backend/extcomm/extcomm_types.go b/apis/backend/extcomm/extcomm_types.go new file mode 100644 index 0000000..8bc6be4 --- /dev/null +++ b/apis/backend/extcomm/extcomm_types.go @@ -0,0 +1,61 @@ +/* +Copyright 2024 Nokia. + +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 extcomm + +type ExtendedCommunityType string + +const ( + ExtendedCommunityType_Invalid ExtendedCommunityType = "invalid" + ExtendedCommunityType_2byteAS ExtendedCommunityType = "2byteAS" // 0x00, 0x40 -> 4 byte local admin + ExtendedCommunityType_IPv4Address ExtendedCommunityType = "ipv4Address" // 0x01, 0x41 -> 2 byte local admin + ExtendedCommunityType_4byteAS ExtendedCommunityType = "4byteAS" // 0x02, 0x42 -> 2 byte local admin + ExtendedCommunityType_Opaque ExtendedCommunityType = "opaque" // 0x03, 0x43 -> 6 byte local admin +) + +func GetEXTCOMMType(s string) ExtendedCommunityType { + switch s { + case string(ExtendedCommunityType_2byteAS): + return ExtendedCommunityType_2byteAS + case string(ExtendedCommunityType_IPv4Address): + return ExtendedCommunityType_IPv4Address + case string(ExtendedCommunityType_4byteAS): + return ExtendedCommunityType_4byteAS + case string(ExtendedCommunityType_Opaque): + return ExtendedCommunityType_Opaque + default: + return ExtendedCommunityType_Invalid + } +} + +type ExtendedCommunitySubType string + +const ( + ExtendedCommunitySubType_Invalid ExtendedCommunitySubType = "invalid" + ExtendedCommunitySubType_RouteTarget ExtendedCommunitySubType = "target" // 0x02 + ExtendedCommunitySubType_RouteOrigin ExtendedCommunitySubType = "origin" // 0x03 +) + +func GetExtendedCommunitySubType(s string) ExtendedCommunitySubType { + switch s { + case string(ExtendedCommunitySubType_RouteTarget): + return ExtendedCommunitySubType_RouteTarget + case string(ExtendedCommunitySubType_RouteOrigin): + return ExtendedCommunitySubType_RouteOrigin + default: + return ExtendedCommunitySubType_Invalid + } +} diff --git a/apis/backend/extcomm/extcommclaim_object.go b/apis/backend/extcomm/extcommclaim_object.go new file mode 100644 index 0000000..e9b605b --- /dev/null +++ b/apis/backend/extcomm/extcommclaim_object.go @@ -0,0 +1,409 @@ +/* +Copyright 2024 Nokia. + +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 "VLAN IS" BVLANIS, +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 extcomm + +import ( + "errors" + "fmt" + "strconv" + "strings" + + "github.com/henderiw/idxtable/pkg/table" + "github.com/henderiw/idxtable/pkg/table/table16" + "github.com/henderiw/idxtable/pkg/tree" + "github.com/henderiw/idxtable/pkg/tree/id16" + "github.com/henderiw/idxtable/pkg/tree/id32" + "github.com/henderiw/store" + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/backend" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/apimachinery/pkg/util/validation/field" + "k8s.io/utils/ptr" +) + +var _ backend.ClaimObject = &EXTCOMMClaim{} + +func (r *EXTCOMMClaim) GetNamespacedName() types.NamespacedName { + return types.NamespacedName{ + Namespace: r.GetNamespace(), + Name: r.GetName(), + } +} + +func (r *EXTCOMMClaim) GetKey() store.Key { + return store.KeyFromNSN(types.NamespacedName{Namespace: r.Namespace, Name: r.Spec.Index}) +} + +// GetCondition returns the condition bVLANed on the condition kind +func (r *EXTCOMMClaim) GetCondition(t condition.ConditionType) condition.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *EXTCOMMClaim) SetConditions(c ...condition.Condition) { + r.Status.SetConditions(c...) +} + +func (r *EXTCOMMClaim) ValidateSyntax(s string) field.ErrorList { + var allErrs field.ErrorList + + if GetEXTCOMMType(s) == ExtendedCommunityType_Invalid { + allErrs = append(allErrs, field.Invalid( + field.NewPath(""), + r, + fmt.Errorf("invalid extended community type. got %s", s).Error(), + )) + return allErrs + } + + if err := r.ValidateEXTCOMMClaimType(); err != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath(""), + r, + err.Error(), + )) + return allErrs + } + var v SyntaxValidator + claimType := r.GetClaimType() + switch claimType { + case backend.ClaimType_DynamicID: + v = &EXTCOMMDynamicIDSyntaxValidator{name: string(claimType)} + case backend.ClaimType_StaticID: + v = &EXTCOMMStaticIDSyntaxValidator{name: string(claimType)} + case backend.ClaimType_Range: + v = &EXTCOMMRangeSyntaxValidator{name: string(claimType)} + default: + return allErrs + } + return v.Validate(r, GetEXTCOMMType(s)) +} + +func (r *EXTCOMMClaim) ValidateEXTCOMMRange(extCommType ExtendedCommunityType) error { + if r.Spec.Range == nil { + return fmt.Errorf("no EXTCOMM range provided") + } + parts := strings.SplitN(*r.Spec.Range, "-", 2) + if len(parts) != 2 { + return fmt.Errorf("invalid EXTCOMM range, expected -, got: %s", *r.Spec.Range) + } + var errm error + start, err := strconv.Atoi(parts[0]) + if err != nil { + errm = errors.Join(errm, fmt.Errorf("invalid EXTCOMM range start, got: %s, err: %s", *r.Spec.Range, err.Error())) + } + end, err := strconv.Atoi(parts[1]) + if err != nil { + errm = errors.Join(errm, fmt.Errorf("invalid EXTCOMM range end, got: %s, err: %s", *r.Spec.Range, err.Error())) + } + if errm != nil { + return errm + } + if start > end { + errm = errors.Join(errm, fmt.Errorf("invalid EXTCOMM range start > end %s", *r.Spec.Range)) + } + if err := validateEXTCOMMID(extCommType, uint64(start)); err != nil { + errm = errors.Join(errm, fmt.Errorf("invalid EXTCOMM start err %s", err.Error())) + } + if err := validateEXTCOMMID(extCommType, uint64(end)); err != nil { + errm = errors.Join(errm, fmt.Errorf("invalid EXTCOMM end err %s", err.Error())) + } + return errm +} + +func (r *EXTCOMMClaim) ValidateEXTCOMMID(extCommType ExtendedCommunityType) error { + if r.Spec.ID == nil { + return fmt.Errorf("no id provided") + } + if err := validateEXTCOMMID(extCommType, *r.Spec.ID); err != nil { + return fmt.Errorf("invalid id err %s", err.Error()) + } + return nil +} + +func validateEXTCOMMID(extCommType ExtendedCommunityType, id uint64) error { + if id < EXTCOMMID_Min { + return fmt.Errorf("invalid id, got %d", id) + } + if id > uint64(EXTCOMMID_MaxValue[extCommType]) { + return fmt.Errorf("invalid id, got %d", id) + } + return nil +} + +func (r *EXTCOMMClaim) ValidateEXTCOMMClaimType() error { + var sb strings.Builder + count := 0 + if r.Spec.ID != nil { + sb.WriteString(fmt.Sprintf("id: %d", *r.Spec.ID)) + count++ + + } + if r.Spec.Range != nil { + if count > 0 { + sb.WriteString(", ") + } + sb.WriteString(fmt.Sprintf("range: %s", *r.Spec.Range)) + count++ + + } + if count > 1 { + return fmt.Errorf("a claim can only have 1 addressing, got %s", sb.String()) + } + return nil +} + +func (r *EXTCOMMClaim) GetIndex() string { return r.Spec.Index } + +func (r *EXTCOMMClaim) GetSelector() *metav1.LabelSelector { return r.Spec.Selector } + +func (r *EXTCOMMClaim) IsOwner(labels labels.Set) bool { + ownerLabels := r.getOnwerLabels() + for k, v := range ownerLabels { + if val, ok := labels[k]; !ok || val != v { + return false + } + } + return true +} + +func (r *EXTCOMMClaim) getOnwerLabels() map[string]string { + claimName := r.Name + claimKind := r.Kind + claimUID := r.UID + for _, owner := range r.GetOwnerReferences() { + if owner.APIVersion == SchemeGroupVersion.Identifier() && + owner.Kind == EXTCOMMIndexKind { + claimName = owner.Name + claimKind = owner.Kind + claimUID = owner.UID + } + } + + return map[string]string{ + backend.KuidClaimNameKey: claimName, + backend.KuidClaimUIDKey: string(claimUID), + backend.KuidOwnerKindKey: claimKind, + } +} + +// GetOwnerSelector selects the route bVLANed on the name of the claim +func (r *EXTCOMMClaim) GetOwnerSelector() (labels.Selector, error) { + l := r.getOnwerLabels() + + fullselector := labels.NewSelector() + for k, v := range l { + req, err := labels.NewRequirement(k, selection.Equals, []string{v}) + if err != nil { + return nil, err + } + fullselector = fullselector.Add(*req) + } + return fullselector, nil +} + +func (r *EXTCOMMClaim) GetLabelSelector() (labels.Selector, error) { return r.Spec.GetLabelSelector() } + +func (r *EXTCOMMClaim) GetClaimLabels() labels.Set { + labels := r.Spec.GetUserDefinedLabels() + + // for claims originated from the index we need to use the ownerreferences, since these claims + // are never stored in the apiserver, the ip entries need to reference the index instead + claimName := r.Name + claimKind := EXTCOMMClaimKind + claimUID := r.UID + for _, owner := range r.GetOwnerReferences() { + if owner.APIVersion == SchemeGroupVersion.Identifier() && + owner.Kind == EXTCOMMIndexKind { + claimName = owner.Name + claimKind = owner.Kind + claimUID = owner.UID + } + } + // system defined labels + labels[backend.KuidClaimTypeKey] = string(r.GetClaimType()) + labels[backend.KuidClaimNameKey] = claimName + labels[backend.KuidClaimUIDKey] = string(claimUID) + labels[backend.KuidOwnerKindKey] = claimKind + return labels +} + +func (r *EXTCOMMClaim) ValidateOwner(labels labels.Set) error { + routeClaimName := labels[backend.KuidClaimNameKey] + routeClaimUID := labels[backend.KuidClaimUIDKey] + + if string(r.UID) != routeClaimUID && r.Name != routeClaimName { + return fmt.Errorf("route owned by different claim got name %s/%s uid %s/%s", + r.Name, + routeClaimName, + string(r.UID), + routeClaimUID, + ) + } + return nil +} + +func (r *EXTCOMMClaim) GetClaimType() backend.ClaimType { + claimType := backend.ClaimType_Invalid + count := 0 + if r.Spec.ID != nil { + claimType = backend.ClaimType_StaticID + count++ + + } + if r.Spec.Range != nil { + claimType = backend.ClaimType_Range + count++ + + } + if count > 1 { + return backend.ClaimType_Invalid + } + if count == 0 { + return backend.ClaimType_DynamicID + } + return claimType +} +func (r *EXTCOMMClaim) GetStaticID() *uint64 { + if r.Spec.ID == nil { + return nil + } + return ptr.To[uint64](uint64(*r.Spec.ID)) +} +func (r *EXTCOMMClaim) GetStaticTreeID(t string) tree.ID { + if r.Spec.ID == nil { + return nil + } + return id16.NewID(uint16(*r.Spec.ID), id16.IDBitSize) +} + +func (r *EXTCOMMClaim) GetClaimID(t string, id uint64) tree.ID { + return id16.NewID(uint16(id), id16.IDBitSize) +} + +func (r *EXTCOMMClaim) GetRange() *string { + return r.Spec.Range +} + +func (r *EXTCOMMClaim) GetRangeID(t string) (tree.Range, error) { + if r.Spec.Range == nil { + return nil, fmt.Errorf("cannot provide a range without an id") + } + return id32.ParseRange(*r.Spec.Range) +} + +func (r *EXTCOMMClaim) GetTable(t string, to, from uint64) table.Table { + return table16.New(uint16(to), uint16(from)) +} + +func (r *EXTCOMMClaim) SetStatusRange(s *string) { + r.Status.Range = s +} + +func (r *EXTCOMMClaim) SetStatusID(s *uint64) { + if s == nil { + r.Status.ID = nil + return + } + r.Status.ID = ptr.To[uint64](uint64(*s)) +} + +func (r *EXTCOMMClaim) GetStatusID() *uint64 { + if r.Status.ID == nil { + return nil + } + return ptr.To[uint64](uint64(*r.Status.ID)) +} + +func (r *EXTCOMMClaim) GetClaimRequest() string { + // we assume validation is already done when calling this + if r.Spec.ID != nil { + return strconv.Itoa(int(*r.Spec.ID)) + } + if r.Spec.Range != nil { + return *r.Spec.Range + } + return "" +} + +func (r *EXTCOMMClaim) GetClaimResponse() string { + // we assume validation is already done when calling this + if r.Status.ID != nil { + return strconv.Itoa(int(*r.Status.ID)) + } + if r.Status.Range != nil { + return *r.Status.Range + } + return "" +} + +func (r *EXTCOMMClaim) GetClaimSet(typ string) (sets.Set[tree.ID], error) { + arange, err := r.GetRangeID(typ) + if err != nil { + return nil, fmt.Errorf("cannot get range from claim: %v", err) + } + // claim set represents the new entries + newClaimSet := sets.New[tree.ID]() + for _, rangeID := range arange.IDs() { + newClaimSet.Insert(rangeID) + } + return newClaimSet, nil +} + +func EXTCOMMClaimFromUnstructured(ru runtime.Unstructured) (backend.ClaimObject, error) { + obj := &EXTCOMMClaim{} + err := runtime.DefaultUnstructuredConverter.FromUnstructured(ru.UnstructuredContent(), obj) + if err != nil { + return nil, fmt.Errorf("error converting unstructured to asIndex: %v", err) + } + return obj, nil +} + +func EXTCOMMClaimFromRuntime(ru runtime.Object) (backend.ClaimObject, error) { + claim, ok := ru.(*EXTCOMMClaim) + if !ok { + return nil, errors.New("runtime object not EXTCOMMClaim") + } + return claim, nil +} + +// BuildEXTCOMMClaim returns a reource from a client Object a Spec/Status +func BuildEXTCOMMClaim(meta metav1.ObjectMeta, spec *EXTCOMMClaimSpec, status *EXTCOMMClaimStatus) backend.ClaimObject { + vlanspec := EXTCOMMClaimSpec{} + if spec != nil { + vlanspec = *spec + } + vlanstatus := EXTCOMMClaimStatus{} + if status != nil { + vlanstatus = *status + } + return &EXTCOMMClaim{ + TypeMeta: metav1.TypeMeta{ + APIVersion: SchemeGroupVersion.Identifier(), + Kind: EXTCOMMClaimKind, + }, + ObjectMeta: meta, + Spec: vlanspec, + Status: vlanstatus, + } +} diff --git a/apis/backend/extcomm/extcommclaim_resource.go b/apis/backend/extcomm/extcommclaim_resource.go new file mode 100644 index 0000000..7c87db7 --- /dev/null +++ b/apis/backend/extcomm/extcommclaim_resource.go @@ -0,0 +1,318 @@ +/* +Copyright 2024 Nokia. + +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 "VLAN IS" BVLANIS, +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 extcomm + +import ( + "context" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/kform-dev/choreo/apis/condition" + apiequality "k8s.io/apimachinery/pkg/api/equality" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/util/validation/field" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +const ( + EXTCOMMClaimPlural = "extcommclaims" + EXTCOMMClaimSingular = "extcommclaim" +) + +var ( + EXTCOMMClaimShortNames = []string{} + EXTCOMMClaimCategories = []string{"kuid", "knet"} +) + +// +k8s:deepcopy-gen=false +var _ resource.InternalObject = &EXTCOMMClaim{} +var _ resource.ObjectList = &EXTCOMMClaimList{} +var _ resource.ObjectWithStatusSubResource = &EXTCOMMClaim{} +var _ resource.StatusSubResource = &EXTCOMMClaimStatus{} + +func (EXTCOMMClaim) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: EXTCOMMClaimPlural, + } +} + +// IsStorageVersion returns true -- Config is used VLAN the internal version. +// IsStorageVersion implements resource.Object +func (EXTCOMMClaim) IsStorageVersion() bool { + return true +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (EXTCOMMClaim) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *EXTCOMMClaim) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// GetSingularName returns the singular name of the resource +// GetSingularName implements resource.Object +func (EXTCOMMClaim) GetSingularName() string { + return EXTCOMMClaimSingular +} + +// GetShortNames returns the shortnames for the resource +// GetShortNames implements resource.Object +func (EXTCOMMClaim) GetShortNames() []string { + return EXTCOMMClaimShortNames +} + +// GetCategories return the categories of the resource +// GetCategories implements resource.Object +func (EXTCOMMClaim) GetCategories() []string { + return EXTCOMMClaimCategories +} + +// New return an empty resource +// New implements resource.Object +func (EXTCOMMClaim) New() runtime.Object { + return &EXTCOMMClaim{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (EXTCOMMClaim) NewList() runtime.Object { + return &EXTCOMMClaimList{} +} + +// IsEqual returns a bool indicating if the desired state of both resources is equal or not +func (r *EXTCOMMClaim) IsEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*EXTCOMMClaim) + oldobj := old.(*EXTCOMMClaim) + + if !apiequality.Semantic.DeepEqual(oldobj.ObjectMeta, newobj.ObjectMeta) { + return false + } + // if equal we also test the spec + return apiequality.Semantic.DeepEqual(oldobj.Spec, newobj.Spec) +} + +// GetStatus return the resource.StatusSubResource interface +func (r *EXTCOMMClaim) GetStatus() resource.StatusSubResource { + return r.Status +} + +// IsStatusEqual returns a bool indicating if the status of both resources is equal or not +func (r *EXTCOMMClaim) IsStatusEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*EXTCOMMClaim) + oldobj := old.(*EXTCOMMClaim) + return apiequality.Semantic.DeepEqual(oldobj.Status, newobj.Status) +} + +// PrepareForStatusUpdate prepares the status update +func (r *EXTCOMMClaim) PrepareForStatusUpdate(ctx context.Context, obj, old runtime.Object) { + newObj := obj.(*EXTCOMMClaim) + oldObj := old.(*EXTCOMMClaim) + newObj.Spec = oldObj.Spec + + // Status updates are for only for updating status, not objectmeta. + metav1.ResetObjectMetaForStatus(&newObj.ObjectMeta, &newObj.ObjectMeta) +} + +// ValidateStatusUpdate validates status updates +func (r *EXTCOMMClaim) ValidateStatusUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +// SubResourceName resturns the name of the subresource +// SubResourceName implements the resource.StatusSubResource +func (EXTCOMMClaimStatus) SubResourceName() string { + return fmt.Sprintf("%s/%s", EXTCOMMClaimPlural, "status") +} + +// CopyTo copies the content of the status subresource to a parent resource. +// CopyTo implements the resource.StatusSubResource +func (r EXTCOMMClaimStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { + parent, ok := obj.(*EXTCOMMClaim) + if ok { + parent.Status = r + } +} + +// GetListMeta returns the ListMeta +// GetListMeta implements the resource.ObjectList +func (r *EXTCOMMClaimList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// TableConvertor return the table format of the resource +func (r *EXTCOMMClaim) TableConvertor() func(gr schema.GroupResource) rest.TableConvertor { + return func(gr schema.GroupResource) rest.TableConvertor { + return registry.NewTableConverter( + gr, + func(obj runtime.Object) []interface{} { + claim, ok := obj.(*EXTCOMMClaim) + if !ok { + return nil + } + return []interface{}{ + claim.GetName(), + claim.GetCondition(condition.ConditionTypeReady).Status, + claim.GetIndex(), + string(claim.GetClaimType()), + claim.GetClaimRequest(), + claim.GetClaimResponse(), + } + }, + []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + {Name: "Ready", Type: "string"}, + {Name: "Index", Type: "string"}, + {Name: "ClaimType", Type: "string"}, + {Name: "ClaimReq", Type: "string"}, + {Name: "ClaimRsp", Type: "string"}, + }, + ) + } +} + +// FieldLabelConversion is the schema conversion function for normalizing the FieldSelector for the resource +func (r *EXTCOMMClaim) FieldLabelConversion() runtime.FieldLabelConversionFunc { + return func(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } + } +} + +func (r *EXTCOMMClaim) FieldSelector() func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + return func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + var filter *EXTCOMMClaimFilter + + // add the namespace to the list + namespace, ok := genericapirequest.NamespaceFrom(ctx) + if fieldSelector == nil { + if ok { + return &EXTCOMMClaimFilter{Namespace: namespace}, nil + } + return filter, nil + } + requirements := fieldSelector.Requirements() + for _, requirement := range requirements { + filter = &EXTCOMMClaimFilter{} + switch requirement.Operator { + case selection.Equals, selection.DoesNotExist: + if requirement.Value == "" { + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) + } + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) + } + + switch requirement.Field { + case "metadata.name": + filter.Name = requirement.Value + case "metadata.namespace": + filter.Namespace = requirement.Value + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) + } + } + // add namespace to the filter selector if specified + if ok { + if filter != nil { + filter.Namespace = namespace + } else { + filter = &EXTCOMMClaimFilter{Namespace: namespace} + } + return filter, nil + } + + return &EXTCOMMClaimFilter{}, nil + } + +} + +type EXTCOMMClaimFilter struct { + // Name filters by the name of the objects + Name string `protobuf:"bytes,1,opt,name=name"` + + // Namespace filters by the namespace of the objects + Namespace string `protobuf:"bytes,2,opt,name=namespace"` +} + +func (r *EXTCOMMClaimFilter) Filter(ctx context.Context, obj runtime.Object) bool { + f := false // result of the previous filter + o, ok := obj.(*EXTCOMMClaim) + if !ok { + return f + } + if r == nil { + return false + } + if r.Name != "" { + if o.GetName() == r.Name { + f = false + } else { + f = true + } + } + if r.Namespace != "" { + if o.GetNamespace() == r.Namespace { + f = false + } else { + f = true + } + } + return f +} + +func (r *EXTCOMMClaim) PrepareForCreate(ctx context.Context, obj runtime.Object) { + // status cannot be set upon create -> reset it + newobj := obj.(*EXTCOMMClaim) + newobj.Status = EXTCOMMClaimStatus{} +} + +// ValidateCreate statically validates +func (r *EXTCOMMClaim) ValidateCreate(ctx context.Context, obj runtime.Object) field.ErrorList { + return r.ValidateSyntax("") +} + +func (r *EXTCOMMClaim) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { + // ensure the status dont get updated + newobj := obj.(*EXTCOMMClaim) + oldObj := old.(*EXTCOMMClaim) + newobj.Status = oldObj.Status +} + +func (r *EXTCOMMClaim) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + return r.ValidateSyntax("") +} diff --git a/apis/backend/extcomm/extcommclaim_syntaxvalidator.go b/apis/backend/extcomm/extcommclaim_syntaxvalidator.go new file mode 100644 index 0000000..5a3ac93 --- /dev/null +++ b/apis/backend/extcomm/extcommclaim_syntaxvalidator.go @@ -0,0 +1,68 @@ +/* +Copyright 2024 Nokia. + +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 extcomm + +import ( + fmt "fmt" + + "k8s.io/apimachinery/pkg/util/validation/field" +) + +type SyntaxValidator interface { + Validate(claim *EXTCOMMClaim, extCommType ExtendedCommunityType) field.ErrorList +} + +type EXTCOMMRangeSyntaxValidator struct { + name string +} + +func (r *EXTCOMMRangeSyntaxValidator) Validate(claim *EXTCOMMClaim, extCommType ExtendedCommunityType) field.ErrorList { + var allErrs field.ErrorList + if err := claim.ValidateEXTCOMMRange(extCommType); err != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.range"), + claim, + fmt.Errorf("invalid EXTCOMM range %s", r.name).Error(), + )) + } + return allErrs +} + +type EXTCOMMDynamicIDSyntaxValidator struct { + name string +} + +func (r *EXTCOMMDynamicIDSyntaxValidator) Validate(claim *EXTCOMMClaim, extCommType ExtendedCommunityType) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +type EXTCOMMStaticIDSyntaxValidator struct { + name string +} + +func (r *EXTCOMMStaticIDSyntaxValidator) Validate(claim *EXTCOMMClaim, extCommType ExtendedCommunityType) field.ErrorList { + var allErrs field.ErrorList + if err := claim.ValidateEXTCOMMID(extCommType); err != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.id"), + claim, + fmt.Errorf("invalid EXTCOMM id %s", r.name).Error(), + )) + } + return allErrs +} diff --git a/apis/backend/extcomm/extcommclaim_types.go b/apis/backend/extcomm/extcommclaim_types.go new file mode 100644 index 0000000..16ddf6c --- /dev/null +++ b/apis/backend/extcomm/extcommclaim_types.go @@ -0,0 +1,84 @@ +/* +Copyright 2024 Nokia. + +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 "VLAN IS" BVLANIS, +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 extcomm + +import ( + "reflect" + + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// EXTCOMMClaimSpec defines the dEXTCOMMred state of EXTCOMMClaim +type EXTCOMMClaimSpec struct { + // EXTCOMMIndex defines the EXTCOMM index for the EXTCOMM Claim + Index string `json:"index" yaml:"index" protobuf:"bytes,1,opt,name=index"` + // EXTCOMMID defines the EXTCOMM for the EXTCOMM claim + ID *uint64 `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,2,opt,name=id"` + // Range defines the EXTCOMM range for the EXTCOMM claim + // The following notation is used: start-end - + // the EXTCOMMs in the range must be consecutive + Range *string `json:"range,omitempty" yaml:"range,omitempty" protobuf:"bytes,3,opt,name=range"` + // ClaimLabels define the user defined labels and selector labels used + // in resource claim + common.ClaimLabels `json:",inline" yaml:",inline" protobuf:"bytes,4,opt,name=claimLabels"` +} + +// EXTCOMMClaimStatus defines the observed state of EXTCOMMClaim +type EXTCOMMClaimStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condition.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` + // EXTCOMMID defines the EXTCOMM for the EXTCOMM claim + // +optional + ID *uint64 `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,2,opt,name=id"` + // EXTCOMMRange defines the EXTCOMM range for the EXTCOMM claim + // +optional + Range *string `json:"range,omitempty" yaml:"range,omitempty" protobuf:"bytes,3,opt,name=range"` + // ExpiryTime defines when the claim expires + // +kubebuilder:validation:Optional + // +optional + ExpiryTime *string `json:"expiryTime,omitempty" yaml:"expiryTime,omitempty" protobuf:"bytes,4,opt,name=expiryTime"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// EXTCOMMClaim is the Schema for the EXTCOMMClaim API +// +// +k8s:openapi-gen=true +type EXTCOMMClaim struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec EXTCOMMClaimSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status EXTCOMMClaimStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// EXTCOMMClaimList contains a list of EXTCOMMClaims +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type EXTCOMMClaimList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []EXTCOMMClaim `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + EXTCOMMClaimKind = reflect.TypeOf(EXTCOMMClaim{}).Name() + EXTCOMMClaimListKind = reflect.TypeOf(EXTCOMMClaimList{}).Name() +) diff --git a/apis/backend/extcomm/extcommentry_object.go b/apis/backend/extcomm/extcommentry_object.go new file mode 100644 index 0000000..ede7ec1 --- /dev/null +++ b/apis/backend/extcomm/extcommentry_object.go @@ -0,0 +1,133 @@ +/* +Copyright 2024 Nokia. + +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 extcomm + +import ( + "errors" + "fmt" + "strings" + + "github.com/henderiw/store" + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/backend" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +var _ backend.EntryObject = &EXTCOMMEntry{} + +func (r *EXTCOMMEntry) GetNamespacedName() types.NamespacedName { + return types.NamespacedName{ + Namespace: r.GetNamespace(), + Name: r.GetName(), + } +} +func (r *EXTCOMMEntry) GetKey() store.Key { + return store.KeyFromNSN(types.NamespacedName{Namespace: r.Namespace, Name: r.Spec.Index}) +} + +// GetCondition returns the condition based on the condition kind +func (r *EXTCOMMEntry) GetCondition(t condition.ConditionType) condition.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *EXTCOMMEntry) SetConditions(c ...condition.Condition) { + r.Status.SetConditions(c...) +} + +func (r *EXTCOMMEntry) ValidateSyntax(s string) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +func (r *EXTCOMMEntry) GetIndex() string { return r.Spec.Index } +func (r *EXTCOMMEntry) GetClaimType() backend.ClaimType { return r.Spec.ClaimType } +func (r *EXTCOMMEntry) GetSpecID() string { return r.Spec.ID } + +func EXTCOMMEntryFromRuntime(ru runtime.Object) (backend.EntryObject, error) { + entry, ok := ru.(*EXTCOMMEntry) + if !ok { + return nil, errors.New("runtime object not ASIndex") + } + return entry, nil +} + +func GetEXTCOMMEntry(k store.Key, vrange, id string, labels map[string]string) backend.EntryObject { + index := k.Name + ns := k.Namespace + + spec := &EXTCOMMEntrySpec{ + Index: index, + ClaimType: backend.GetClaimTypeFromString(labels[backend.KuidClaimTypeKey]), + ID: id, + } + // filter the system defined labels from the labels to prepare for the user defined labels + udLabels := map[string]string{} + for k, v := range labels { + if !backend.BackendSystemKeys.Has(k) { + udLabels[k] = v + } + } + spec.UserDefinedLabels.Labels = udLabels + + id = strings.ReplaceAll(id, "/", "-") + name := fmt.Sprintf("%s.%s", index, id) + if vrange != "" { + name = fmt.Sprintf("%s.%s", vrange, id) + } + + return BuildEXTCOMMEntry( + metav1.ObjectMeta{ + Name: name, + Namespace: ns, + OwnerReferences: []metav1.OwnerReference{ + { + APIVersion: SchemeGroupVersion.Identifier(), + Kind: labels[backend.KuidOwnerKindKey], + Name: labels[backend.KuidClaimNameKey], + UID: types.UID(labels[backend.KuidClaimUIDKey]), + }, + }, + }, + spec, + nil, + ) +} + +func BuildEXTCOMMEntry(meta metav1.ObjectMeta, spec *EXTCOMMEntrySpec, status *EXTCOMMEntryStatus) backend.EntryObject { + vlanspec := EXTCOMMEntrySpec{} + if spec != nil { + vlanspec = *spec + } + vlanstatus := EXTCOMMEntryStatus{} + if status != nil { + vlanstatus = *status + } + return &EXTCOMMEntry{ + TypeMeta: metav1.TypeMeta{ + APIVersion: SchemeGroupVersion.Identifier(), + Kind: EXTCOMMEntryKind, + }, + ObjectMeta: meta, + Spec: vlanspec, + Status: vlanstatus, + } +} diff --git a/apis/backend/extcomm/extcommentry_resource.go b/apis/backend/extcomm/extcommentry_resource.go new file mode 100644 index 0000000..6340981 --- /dev/null +++ b/apis/backend/extcomm/extcommentry_resource.go @@ -0,0 +1,315 @@ +/* +Copyright 2024 Nokia. + +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 extcomm + +import ( + "context" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + apiequality "k8s.io/apimachinery/pkg/api/equality" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/util/validation/field" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +const ( + EXTCOMMEntryPlural = "extcommentries" + EXTCOMMEntrySingular = "extcommentry" +) + +var ( + EXTCOMMEntryShortNames = []string{} + EXTCOMMEntryCategories = []string{"kuid", "knet"} +) + +// +k8s:deepcopy-gen=false +var _ resource.InternalObject = &EXTCOMMEntry{} +var _ resource.ObjectList = &EXTCOMMEntryList{} +var _ resource.ObjectWithStatusSubResource = &EXTCOMMEntry{} +var _ resource.StatusSubResource = &EXTCOMMEntryStatus{} + +func (EXTCOMMEntry) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: EXTCOMMEntryPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (EXTCOMMEntry) IsStorageVersion() bool { + return true +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (EXTCOMMEntry) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *EXTCOMMEntry) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// GetSingularName returns the singular name of the resource +// GetSingularName implements resource.Object +func (EXTCOMMEntry) GetSingularName() string { + return EXTCOMMEntrySingular +} + +// GetShortNames returns the shortnames for the resource +// GetShortNames implements resource.Object +func (EXTCOMMEntry) GetShortNames() []string { + return EXTCOMMEntryShortNames +} + +// GetCategories return the categories of the resource +// GetCategories implements resource.Object +func (EXTCOMMEntry) GetCategories() []string { + return EXTCOMMEntryCategories +} + +// New return an empty resource +// New implements resource.Object +func (EXTCOMMEntry) New() runtime.Object { + return &EXTCOMMEntry{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (EXTCOMMEntry) NewList() runtime.Object { + return &EXTCOMMEntryList{} +} + +// IsEqual returns a bool indicating if the desired state of both resources is equal or not +func (r *EXTCOMMEntry) IsEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*EXTCOMMEntry) + oldobj := old.(*EXTCOMMEntry) + + if !apiequality.Semantic.DeepEqual(oldobj.ObjectMeta, newobj.ObjectMeta) { + return false + } + // if equal we also test the spec + return apiequality.Semantic.DeepEqual(oldobj.Spec, newobj.Spec) +} + +// GetStatus return the resource.StatusSubResource interface +func (r *EXTCOMMEntry) GetStatus() resource.StatusSubResource { + return r.Status +} + +// IsStatusEqual returns a bool indicating if the status of both resources is equal or not +func (r *EXTCOMMEntry) IsStatusEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*EXTCOMMEntry) + oldobj := old.(*EXTCOMMEntry) + return apiequality.Semantic.DeepEqual(oldobj.Status, newobj.Status) +} + +// PrepareForStatusUpdate prepares the status update +func (r *EXTCOMMEntry) PrepareForStatusUpdate(ctx context.Context, obj, old runtime.Object) { + newObj := obj.(*EXTCOMMEntry) + oldObj := old.(*EXTCOMMEntry) + newObj.Spec = oldObj.Spec + + // Status updates are for only for updating status, not objectmeta. + metav1.ResetObjectMetaForStatus(&newObj.ObjectMeta, &newObj.ObjectMeta) +} + +// ValidateStatusUpdate validates status updates +func (r *EXTCOMMEntry) ValidateStatusUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +// SubResourceName resturns the name of the subresource +// SubResourceName implements the resource.StatusSubResource +func (EXTCOMMEntryStatus) SubResourceName() string { + return fmt.Sprintf("%s/%s", EXTCOMMEntryPlural, "status") +} + +// CopyTo copies the content of the status subresource to a parent resource. +// CopyTo implements the resource.StatusSubResource +func (r EXTCOMMEntryStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { + parent, ok := obj.(*EXTCOMMEntry) + if ok { + parent.Status = r + } +} + +// GetListMeta returns the ListMeta +// GetListMeta implements the resource.ObjectList +func (r *EXTCOMMEntryList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// TableConvertor return the table format of the resource +func (r *EXTCOMMEntry) TableConvertor() func(gr schema.GroupResource) rest.TableConvertor { + return func(gr schema.GroupResource) rest.TableConvertor { + return registry.NewTableConverter( + gr, + func(obj runtime.Object) []interface{} { + entry, ok := obj.(*EXTCOMMEntry) + if !ok { + return nil + } + return []interface{}{ + entry.GetName(), + //entry.GetCondition(condition.ConditionTypeReady).Status, + entry.GetIndex(), + entry.GetClaimType(), + entry.GetSpecID(), + } + }, + []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + //{Name: "Ready", Type: "string"}, + {Name: "Index", Type: "string"}, + {Name: "ClaimType", Type: "string"}, + {Name: "ID", Type: "string"}, + }, + ) + } +} + +// FieldLabelConversion is the schema conversion function for normalizing the FieldSelector for the resource +func (r *EXTCOMMEntry) FieldLabelConversion() runtime.FieldLabelConversionFunc { + return func(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } + } +} + +func (r *EXTCOMMEntry) FieldSelector() func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + return func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + var filter *EXTCOMMEntryFilter + + // add the namespace to the list + namespace, ok := genericapirequest.NamespaceFrom(ctx) + if fieldSelector == nil { + if ok { + return &EXTCOMMEntryFilter{Namespace: namespace}, nil + } + return filter, nil + } + requirements := fieldSelector.Requirements() + for _, requirement := range requirements { + filter = &EXTCOMMEntryFilter{} + switch requirement.Operator { + case selection.Equals, selection.DoesNotExist: + if requirement.Value == "" { + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) + } + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) + } + + switch requirement.Field { + case "metadata.name": + filter.Name = requirement.Value + case "metadata.namespace": + filter.Namespace = requirement.Value + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) + } + } + // add namespace to the filter selector if specified + if ok { + if filter != nil { + filter.Namespace = namespace + } else { + filter = &EXTCOMMEntryFilter{Namespace: namespace} + } + return filter, nil + } + + return &EXTCOMMEntryFilter{}, nil + } + +} + +type EXTCOMMEntryFilter struct { + // Name filters by the name of the objects + Name string `protobuf:"bytes,1,opt,name=name"` + + // Namespace filters by the namespace of the objects + Namespace string `protobuf:"bytes,2,opt,name=namespace"` +} + +func (r *EXTCOMMEntryFilter) Filter(ctx context.Context, obj runtime.Object) bool { + f := false // result of the previous filter + o, ok := obj.(*EXTCOMMEntry) + if !ok { + return f + } + if r == nil { + return false + } + if r.Name != "" { + if o.GetName() == r.Name { + f = false + } else { + f = true + } + } + if r.Namespace != "" { + if o.GetNamespace() == r.Namespace { + f = false + } else { + f = true + } + } + return f +} + +func (r *EXTCOMMEntry) PrepareForCreate(ctx context.Context, obj runtime.Object) { + // status cannot be set upon create -> reset it + newobj := obj.(*EXTCOMMEntry) + newobj.Status = EXTCOMMEntryStatus{} +} + +// ValidateCreate statically validates +func (r *EXTCOMMEntry) ValidateCreate(ctx context.Context, obj runtime.Object) field.ErrorList { + return r.ValidateSyntax("") +} + +func (r *EXTCOMMEntry) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { + // ensure the sttaus dont get updated + newobj := obj.(*EXTCOMMEntry) + oldObj := old.(*EXTCOMMEntry) + newobj.Status = oldObj.Status +} + +func (r *EXTCOMMEntry) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + return r.ValidateSyntax("") +} diff --git a/apis/backend/extcomm/extcommentry_types.go b/apis/backend/extcomm/extcommentry_types.go new file mode 100644 index 0000000..13726ce --- /dev/null +++ b/apis/backend/extcomm/extcommentry_types.go @@ -0,0 +1,75 @@ +/* +Copyright 2024 Nokia. + +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 "VLAN IS" BVLANIS, +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 extcomm + +import ( + "reflect" + + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/backend" + "github.com/kuidio/kuid/apis/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// EXTCOMMEntrySpec defines the dEXTCOMMred state of EXTCOMMEntry +type EXTCOMMEntrySpec struct { + // EXTCOMMIndex defines the EXTCOMM index for the EXTCOMM Claim + Index string `json:"index" yaml:"index" protobuf:"bytes,1,opt,name=index"` + // ClaimType defines the claimType of the EXTCOMM Entry + ClaimType backend.ClaimType `json:"claimType,omitempty" yaml:"claimType,omitempty" protobuf:"bytes,2,opt,name=claimType"` + // ID defines the id of the EXTCOMM entry in the tree + ID string `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,3,opt,name=id"` + // ClaimLabels define the user defined labels and selector labels used + // in resource claim + common.ClaimLabels `json:",inline" yaml:",inline" protobuf:"bytes,4,opt,name=claimLabels"` + // Claim defines the name of the claim that is the origin of this entry + Claim string `json:"claim" yaml:"claim" protobuf:"bytes,5,opt,name=claim"` +} + +// EXTCOMMEntryStatus defines the observed state of EXTCOMMEntry +type EXTCOMMEntryStatus struct { + // ConditionedStatus provides the status of the EXTCOMMEntry using conditions + // - a ready condition indicates the overall status of the resource + condition.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// EXTCOMMEntry is the Schema for the EXTCOMMentry API +// +// +k8s:openapi-gen=true +type EXTCOMMEntry struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec EXTCOMMEntrySpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status EXTCOMMEntryStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// EXTCOMMEntryList contains a list of EXTCOMMEntries +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type EXTCOMMEntryList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []EXTCOMMEntry `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + EXTCOMMEntryKind = reflect.TypeOf(EXTCOMMEntry{}).Name() + EXTCOMMEntryListKind = reflect.TypeOf(EXTCOMMEntryList{}).Name() +) diff --git a/apis/backend/extcomm/extcommindex_helpers.go b/apis/backend/extcomm/extcommindex_helpers.go new file mode 100644 index 0000000..368704c --- /dev/null +++ b/apis/backend/extcomm/extcommindex_helpers.go @@ -0,0 +1,106 @@ +/* +Copyright 2024 Nokia. + +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 extcomm + +import ( + "fmt" + + "github.com/kform-dev/choreo/apis/condition" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +// GetCondition returns the condition based on the condition kind +func (r *EXTCOMMIndex) GetCondition(t condition.ConditionType) condition.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *EXTCOMMIndex) SetConditions(c ...condition.Condition) { + r.Status.SetConditions(c...) +} + +func (r *EXTCOMMIndex) ValidateSyntax(s string) field.ErrorList { + var allErrs field.ErrorList + + if GetEXTCOMMType(r.Spec.Type) == ExtendedCommunityType_Invalid { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.type"), + r, + fmt.Errorf("invalid EXTCOMM Type %s", r.Spec.Type).Error(), + )) + } + + if GetExtendedCommunitySubType(r.Spec.SubType) == ExtendedCommunitySubType_Invalid { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.subType"), + r, + fmt.Errorf("invalid EXTCOMM SubType %s", r.Spec.SubType).Error(), + )) + } + + if r.Spec.MinID != nil { + if err := validateEXTCOMMID(GetEXTCOMMType(r.Spec.Type), *r.Spec.MinID); err != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.minID"), + r, + fmt.Errorf("invalid EXTCOMM ID %d", *r.Spec.MinID).Error(), + )) + } + } + if r.Spec.MaxID != nil { + if err := validateEXTCOMMID(GetEXTCOMMType(r.Spec.Type), *r.Spec.MaxID); err != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.maxID"), + r, + fmt.Errorf("invalid EXTCOMM ID %d", *r.Spec.MaxID).Error(), + )) + } + } + if r.Spec.MinID != nil && r.Spec.MaxID != nil { + if *r.Spec.MinID > *r.Spec.MaxID { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.maxID"), + r, + fmt.Errorf("min EXTCOMM ID %d cannot be bigger than max EXTCOMM ID %d", *r.Spec.MinID, *r.Spec.MaxID).Error(), + )) + } + } + return allErrs +} + +// BuildEXTCOMMIndex returns a reource from a client Object a Spec/Status +func BuildEXTCOMMIndex(meta metav1.ObjectMeta, spec *EXTCOMMIndexSpec, status *EXTCOMMIndexStatus) *EXTCOMMIndex { + aspec := EXTCOMMIndexSpec{} + if spec != nil { + aspec = *spec + } + astatus := EXTCOMMIndexStatus{} + if status != nil { + astatus = *status + } + return &EXTCOMMIndex{ + TypeMeta: metav1.TypeMeta{ + APIVersion: SchemeGroupVersion.Identifier(), + Kind: EXTCOMMIndexKind, + }, + ObjectMeta: meta, + Spec: aspec, + Status: astatus, + } +} diff --git a/apis/backend/extcomm/extcommindex_object.go b/apis/backend/extcomm/extcommindex_object.go new file mode 100644 index 0000000..56e1a58 --- /dev/null +++ b/apis/backend/extcomm/extcommindex_object.go @@ -0,0 +1,166 @@ +/* +Copyright 2024 Nokia. + +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 extcomm + +import ( + "errors" + "fmt" + + "github.com/henderiw/idxtable/pkg/tree/gtree" + "github.com/henderiw/idxtable/pkg/tree/tree16" + "github.com/henderiw/idxtable/pkg/tree/tree32" + "github.com/henderiw/idxtable/pkg/tree/tree64" + "github.com/henderiw/store" + "github.com/kuidio/kuid/apis/backend" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" + "k8s.io/utils/ptr" +) + +var _ backend.IndexObject = &EXTCOMMIndex{} + +func (r *EXTCOMMIndex) GetKey() store.Key { + return store.KeyFromNSN(r.GetNamespacedName()) +} + +func (r *EXTCOMMIndex) GetNamespacedName() types.NamespacedName { + return types.NamespacedName{ + Namespace: r.GetNamespace(), + Name: r.GetName(), + } +} + +func (r *EXTCOMMIndex) GetTree() gtree.GTree { + switch GetEXTCOMMType(r.Spec.Type) { + case ExtendedCommunityType_IPv4Address, ExtendedCommunityType_4byteAS: + tree, err := tree16.New(16) + if err != nil { + return nil + } + return tree + case ExtendedCommunityType_2byteAS: + tree, err := tree32.New(32) + if err != nil { + return nil + } + return tree + case ExtendedCommunityType_Opaque: + tree, err := tree64.New(48) + if err != nil { + return nil + } + return tree + } + return nil +} + +func (r *EXTCOMMIndex) GetType() string { + return r.Spec.Type +} + +func (r *EXTCOMMIndex) GetMinID() *uint64 { + if r.Spec.MinID == nil { + return nil + } + return ptr.To(uint64(*r.Spec.MinID)) +} + +func (r *EXTCOMMIndex) GetMaxID() *uint64 { + if r.Spec.MaxID == nil { + return nil + } + return ptr.To(uint64(*r.Spec.MaxID)) +} + +func (r *EXTCOMMIndex) GetMax() uint64 { + return EXTCOMMID_MaxValue[GetEXTCOMMType(r.GetType())] +} + +func GetMinClaimRange(id uint64) string { + return fmt.Sprintf("%d-%d", EXTCOMMID_Min, id-1) +} + +func GetMaxClaimRange(extCommType ExtendedCommunityType, id uint64) string { + return fmt.Sprintf("%d-%d", id+1, EXTCOMMID_MaxValue[extCommType]) +} + +func (r *EXTCOMMIndex) GetMinClaimNSN() types.NamespacedName { + return types.NamespacedName{ + Namespace: r.Namespace, + Name: fmt.Sprintf("%s.%s", r.Name, backend.IndexReservedMinName), + } +} + +func (r *EXTCOMMIndex) GetMaxClaimNSN() types.NamespacedName { + return types.NamespacedName{ + Namespace: r.Namespace, + Name: fmt.Sprintf("%s.%s", r.Name, backend.IndexReservedMaxName), + } +} + +func (r *EXTCOMMIndex) GetMinClaim() backend.ClaimObject { + return BuildEXTCOMMClaim( + metav1.ObjectMeta{ + Namespace: r.GetNamespace(), + Name: r.GetMinClaimNSN().Name, + OwnerReferences: []metav1.OwnerReference{ + { + APIVersion: r.APIVersion, + Kind: r.Kind, + Name: r.Name, + UID: r.UID, + }, + }, + }, + &EXTCOMMClaimSpec{ + Index: r.Name, + Range: ptr.To[string](GetMinClaimRange(*r.Spec.MinID)), + }, + nil, + ) +} + +func (r *EXTCOMMIndex) GetMaxClaim() backend.ClaimObject { + return BuildEXTCOMMClaim( + metav1.ObjectMeta{ + Namespace: r.GetNamespace(), + Name: r.GetMaxClaimNSN().Name, + OwnerReferences: []metav1.OwnerReference{ + { + APIVersion: r.APIVersion, + Kind: r.Kind, + Name: r.Name, + UID: r.UID, + }, + }, + }, + &EXTCOMMClaimSpec{ + Index: r.Name, + Range: ptr.To(GetMaxClaimRange(GetEXTCOMMType(r.Spec.Type), *r.Spec.MaxID)), + }, + nil, + ) +} + +func EXTCOMMIndexFromRuntime(ru runtime.Object) (backend.IndexObject, error) { + index, ok := ru.(*EXTCOMMIndex) + if !ok { + return nil, errors.New("runtime object not EXTCOMMIndex") + } + return index, nil +} diff --git a/apis/backend/extcomm/extcommindex_resource.go b/apis/backend/extcomm/extcommindex_resource.go new file mode 100644 index 0000000..99e1cb8 --- /dev/null +++ b/apis/backend/extcomm/extcommindex_resource.go @@ -0,0 +1,314 @@ +/* +Copyright 2024 Nokia. + +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 extcomm + +import ( + "context" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/kform-dev/choreo/apis/condition" + apiequality "k8s.io/apimachinery/pkg/api/equality" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/util/validation/field" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +const ( + EXTCOMMIndexPlural = "extcommindices" + EXTCOMMIndexSingular = "extcommndex" +) + +var ( + EXTCOMMIndexShortNames = []string{} + EXTCOMMIndexCategories = []string{"kuid", "knet"} +) + +// +k8s:deepcopy-gen=false +var _ resource.InternalObject = &EXTCOMMIndex{} +var _ resource.ObjectList = &EXTCOMMIndexList{} +var _ resource.ObjectWithStatusSubResource = &EXTCOMMIndex{} +var _ resource.StatusSubResource = &EXTCOMMIndexStatus{} + +func (EXTCOMMIndex) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: EXTCOMMIndexPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (EXTCOMMIndex) IsStorageVersion() bool { + return true +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (EXTCOMMIndex) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *EXTCOMMIndex) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// GetSingularName returns the singular name of the resource +// GetSingularName implements resource.Object +func (EXTCOMMIndex) GetSingularName() string { + return EXTCOMMIndexSingular +} + +// GetShortNames returns the shortnames for the resource +// GetShortNames implements resource.Object +func (EXTCOMMIndex) GetShortNames() []string { + return EXTCOMMIndexShortNames +} + +// GetCategories return the categories of the resource +// GetCategories implements resource.Object +func (EXTCOMMIndex) GetCategories() []string { + return EXTCOMMIndexCategories +} + +// New return an empty resource +// New implements resource.Object +func (EXTCOMMIndex) New() runtime.Object { + return &EXTCOMMIndex{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (EXTCOMMIndex) NewList() runtime.Object { + return &EXTCOMMIndexList{} +} + +// IsEqual returns a bool indicating if the desired state of both resources is equal or not +func (r *EXTCOMMIndex) IsEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*EXTCOMMIndex) + oldobj := old.(*EXTCOMMIndex) + + if !apiequality.Semantic.DeepEqual(oldobj.ObjectMeta, newobj.ObjectMeta) { + return false + } + // if equal we also test the spec + return apiequality.Semantic.DeepEqual(oldobj.Spec, newobj.Spec) +} + +// GetStatus return the resource.StatusSubResource interface +func (r *EXTCOMMIndex) GetStatus() resource.StatusSubResource { + return r.Status +} + +// IsStatusEqual returns a bool indicating if the status of both resources is equal or not +func (r *EXTCOMMIndex) IsStatusEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*EXTCOMMIndex) + oldobj := old.(*EXTCOMMIndex) + return apiequality.Semantic.DeepEqual(oldobj.Status, newobj.Status) +} + +// PrepareForStatusUpdate prepares the status update +func (r *EXTCOMMIndex) PrepareForStatusUpdate(ctx context.Context, obj, old runtime.Object) { + newObj := obj.(*EXTCOMMIndex) + oldObj := old.(*EXTCOMMIndex) + newObj.Spec = oldObj.Spec + + // Status updates are for only for updating status, not objectmeta. + metav1.ResetObjectMetaForStatus(&newObj.ObjectMeta, &newObj.ObjectMeta) +} + +// ValidateStatusUpdate validates status updates +func (r *EXTCOMMIndex) ValidateStatusUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +// SubResourceName resturns the name of the subresource +// SubResourceName implements the resource.StatusSubResource +func (EXTCOMMIndexStatus) SubResourceName() string { + return fmt.Sprintf("%s/%s", EXTCOMMIndexPlural, "status") +} + +// CopyTo copies the content of the status subresource to a parent resource. +// CopyTo implements the resource.StatusSubResource +func (r EXTCOMMIndexStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { + parent, ok := obj.(*EXTCOMMIndex) + if ok { + parent.Status = r + } +} + +// GetListMeta returns the ListMeta +// GetListMeta implements the resource.ObjectList +func (r *EXTCOMMIndexList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// TableConvertor return the table format of the resource +func (r *EXTCOMMIndex) TableConvertor() func(gr schema.GroupResource) rest.TableConvertor { + return func(gr schema.GroupResource) rest.TableConvertor { + return registry.NewTableConverter( + gr, + func(obj runtime.Object) []interface{} { + index, ok := obj.(*EXTCOMMIndex) + if !ok { + return nil + } + return []interface{}{ + index.GetName(), + index.GetCondition(condition.ConditionTypeReady).Status, + index.GetMinID(), + index.GetMaxID(), + } + }, + []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + {Name: "Ready", Type: "string"}, + {Name: "MinID", Type: "integer"}, + {Name: "MaxID", Type: "integer"}, + }, + ) + } +} + +// FieldLabelConversion is the schema conversion function for normalizing the FieldSelector for the resource +func (r *EXTCOMMIndex) FieldLabelConversion() runtime.FieldLabelConversionFunc { + return func(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } + } +} + +func (r *EXTCOMMIndex) FieldSelector() func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + return func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + var filter *EXTCOMMIndexFilter + + // add the namespace to the list + namespace, ok := genericapirequest.NamespaceFrom(ctx) + if fieldSelector == nil { + if ok { + return &EXTCOMMIndexFilter{Namespace: namespace}, nil + } + return filter, nil + } + requirements := fieldSelector.Requirements() + for _, requirement := range requirements { + filter = &EXTCOMMIndexFilter{} + switch requirement.Operator { + case selection.Equals, selection.DoesNotExist: + if requirement.Value == "" { + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) + } + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) + } + + switch requirement.Field { + case "metadata.name": + filter.Name = requirement.Value + case "metadata.namespace": + filter.Namespace = requirement.Value + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) + } + } + // add namespace to the filter selector if specified + if ok { + if filter != nil { + filter.Namespace = namespace + } else { + filter = &EXTCOMMIndexFilter{Namespace: namespace} + } + return filter, nil + } + + return &EXTCOMMIndexFilter{}, nil + } + +} + +type EXTCOMMIndexFilter struct { + // Name filters by the name of the objects + Name string `protobuf:"bytes,1,opt,name=name"` + + // Namespace filters by the namespace of the objects + Namespace string `protobuf:"bytes,2,opt,name=namespace"` +} + +func (r *EXTCOMMIndexFilter) Filter(ctx context.Context, obj runtime.Object) bool { + f := false // result of the previous filter + o, ok := obj.(*EXTCOMMIndex) + if !ok { + return f + } + if r == nil { + return false + } + if r.Name != "" { + if o.GetName() == r.Name { + f = false + } else { + f = true + } + } + if r.Namespace != "" { + if o.GetNamespace() == r.Namespace { + f = false + } else { + f = true + } + } + return f +} + +func (r *EXTCOMMIndex) PrepareForCreate(ctx context.Context, obj runtime.Object) { + // status cannot be set upon create -> reset it + newobj := obj.(*EXTCOMMIndex) + newobj.Status = EXTCOMMIndexStatus{} +} + +// ValidateCreate statically validates +func (r *EXTCOMMIndex) ValidateCreate(ctx context.Context, obj runtime.Object) field.ErrorList { + return r.ValidateSyntax("") +} + +func (r *EXTCOMMIndex) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { + // ensure the sttaus dont get updated + newobj := obj.(*EXTCOMMIndex) + oldObj := old.(*EXTCOMMIndex) + newobj.Status = oldObj.Status +} + +func (r *EXTCOMMIndex) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + return r.ValidateSyntax("") +} diff --git a/apis/backend/extcomm/extcommindex_types.go b/apis/backend/extcomm/extcommindex_types.go new file mode 100644 index 0000000..810d0f4 --- /dev/null +++ b/apis/backend/extcomm/extcommindex_types.go @@ -0,0 +1,91 @@ +/* +Copyright 2024 Nokia. + +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 "VLAN IS" BVLANIS, +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 extcomm + +import ( + "reflect" + + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// EXTCOMMIndexSpec defines the dEXTCOMMred state of EXTCOMMIndex +type EXTCOMMIndexSpec struct { + // MinID defines the min EXTCOMM ID the index supports + // +optional + MinID *uint64 `json:"minID,omitempty" yaml:"minID,omitempty" protobuf:"bytes,1,opt,name=minID"` + // MaxID defines the max EXTCOMM ID the index supports + // +optional + MaxID *uint64 `json:"maxID,omitempty" yaml:"maxID,omitempty" protobuf:"bytes,2,opt,name=maxID"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + common.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` + // Transitive defines the transative nature of the extended community + Transitive bool `json:"transitive,omitempty" yaml:"transitive,omitempty" protobuf:"bytes,4,opt,name=transitive"` + // Type defines the type of the extended community + // 2byteAS, 4byteAS, ipv4Address, opaque + Type string `json:"type" yaml:"type" protobuf:"bytes,5,opt,name=type"` + // SubType defines the subTyoe of the extended community + // routeTarget, routeOrigin; + SubType string `json:"subType" yaml:"subType" protobuf:"bytes,6,opt,name=subType"` + // GlobalID is interpreted dependeing on the type + // AS in case of 2byteAS, 4byteAS + // IPV4 addrress + // irrelevant for the opaque type + GlobalID string `json:"globalID,omitempty" yaml:"globalID,omitempty" protobuf:"bytes,7,opt,name=globalID"` +} + +// EXTCOMMIndexStatus defines the observed state of EXTCOMMIndex +type EXTCOMMIndexStatus struct { + // MinID defines the min EXTCOMM ID the index supports + // +optional + MinID *int64 `json:"minID,omitempty" yaml:"minID,omitempty" protobuf:"bytes,1,opt,name=minID"` + // MaxID defines the max EXTCOMM ID the index supports + // +optional + MaxID *int64 `json:"maxID,omitempty" yaml:"maxID,omitempty" protobuf:"bytes,2,opt,name=maxID"` + // ConditionedStatus provides the status of the EXTCOMMIndex using conditions + // - a ready condition indicates the overall status of the resource + condition.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// EXTCOMMIndex is the Schema for the EXTCOMMIndex API +// +// +k8s:openapi-gen=true +type EXTCOMMIndex struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec EXTCOMMIndexSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status EXTCOMMIndexStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// EXTCOMMIndexList contains a list of EXTCOMMIndexs +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type EXTCOMMIndexList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []EXTCOMMIndex `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + EXTCOMMIndexKind = reflect.TypeOf(EXTCOMMIndex{}).Name() + EXTCOMMIndexListKind = reflect.TypeOf(EXTCOMMIndexList{}).Name() +) diff --git a/apis/backend/extcomm/helper.go b/apis/backend/extcomm/helper.go new file mode 100644 index 0000000..43e87db --- /dev/null +++ b/apis/backend/extcomm/helper.go @@ -0,0 +1,35 @@ +/* +Copyright 2024 Nokia. + +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 extcomm + +const EXTCOMMID_Min = 0 + +var EXTCOMMID_MaxBits = map[ExtendedCommunityType]int{ + ExtendedCommunityType_Invalid: 0, + ExtendedCommunityType_2byteAS: 32, + ExtendedCommunityType_4byteAS: 16, + ExtendedCommunityType_IPv4Address: 16, + ExtendedCommunityType_Opaque: 48, +} + +var EXTCOMMID_MaxValue = map[ExtendedCommunityType]uint64{ + ExtendedCommunityType_Invalid: 1<- + // the EXTCOMMs in the range must be consecutive + Range *string `json:"range,omitempty" yaml:"range,omitempty" protobuf:"bytes,3,opt,name=range"` + // ClaimLabels define the user defined labels and selector labels used + // in resource claim + commonv1alpha1.ClaimLabels `json:",inline" yaml:",inline" protobuf:"bytes,4,opt,name=claimLabels"` +} + +// EXTCOMMClaimStatus defines the observed state of EXTCOMMClaim +type EXTCOMMClaimStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` + // EXTCOMMID defines the EXTCOMM for the EXTCOMM claim + // +optional + ID *uint64 `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,2,opt,name=id"` + // EXTCOMMRange defines the EXTCOMM range for the EXTCOMM claim + // +optional + Range *string `json:"range,omitempty" yaml:"range,omitempty" protobuf:"bytes,3,opt,name=range"` + // ExpiryTime defines when the claim expires + // +kubebuilder:validation:Optional + // +optional + ExpiryTime *string `json:"expiryTime,omitempty" yaml:"expiryTime,omitempty" protobuf:"bytes,4,opt,name=expiryTime"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// EXTCOMMClaim is the Schema for the EXTCOMMClaim API +// +// +k8s:openapi-gen=true +type EXTCOMMClaim struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec EXTCOMMClaimSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status EXTCOMMClaimStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// EXTCOMMClaimList contains a list of EXTCOMMClaims +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type EXTCOMMClaimList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []EXTCOMMClaim `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + EXTCOMMClaimKind = reflect.TypeOf(EXTCOMMClaim{}).Name() + EXTCOMMClaimListKind = reflect.TypeOf(EXTCOMMClaimList{}).Name() +) diff --git a/apis/backend/extcomm/v1alpha1/extcommentry_types.go b/apis/backend/extcomm/v1alpha1/extcommentry_types.go new file mode 100644 index 0000000..cc65fc1 --- /dev/null +++ b/apis/backend/extcomm/v1alpha1/extcommentry_types.go @@ -0,0 +1,75 @@ +/* +Copyright 2024 Nokia. + +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 "VLAN IS" BVLANIS, +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 v1alpha1 + +import ( + "reflect" + + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + "github.com/kuidio/kuid/apis/backend" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// EXTCOMMEntrySpec defines the dEXTCOMMred state of EXTCOMMEntry +type EXTCOMMEntrySpec struct { + // EXTCOMMIndex defines the EXTCOMM index for the EXTCOMM Claim + Index string `json:"index" yaml:"index" protobuf:"bytes,1,opt,name=index"` + // ClaimType defines the claimType of the EXTCOMM Entry + ClaimType backend.ClaimType `json:"claimType,omitempty" yaml:"claimType,omitempty" protobuf:"bytes,2,opt,name=claimType"` + // ID defines the id of the EXTCOMM entry in the tree + ID string `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,3,opt,name=id"` + // ClaimLabels define the user defined labels and selector labels used + // in resource claim + commonv1alpha1.ClaimLabels `json:",inline" yaml:",inline" protobuf:"bytes,4,opt,name=claimLabels"` + // Claim defines the name of the claim that is the origin of this entry + Claim string `json:"claim" yaml:"claim" protobuf:"bytes,5,opt,name=claim"` +} + +// EXTCOMMEntryStatus defines the observed state of EXTCOMMEntry +type EXTCOMMEntryStatus struct { + // ConditionedStatus provides the status of the EXTCOMMEntry using conditions + // - a ready condition indicates the overall status of the resource + condv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// EXTCOMMEntry is the Schema for the EXTCOMMentry API +// +// +k8s:openapi-gen=true +type EXTCOMMEntry struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec EXTCOMMEntrySpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status EXTCOMMEntryStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// EXTCOMMEntryList contains a list of EXTCOMMEntries +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type EXTCOMMEntryList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []EXTCOMMEntry `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + EXTCOMMEntryKind = reflect.TypeOf(EXTCOMMEntry{}).Name() + EXTCOMMEntryListKind = reflect.TypeOf(EXTCOMMEntryList{}).Name() +) diff --git a/apis/backend/extcomm/v1alpha1/extcommindex_types.go b/apis/backend/extcomm/v1alpha1/extcommindex_types.go new file mode 100644 index 0000000..683a21b --- /dev/null +++ b/apis/backend/extcomm/v1alpha1/extcommindex_types.go @@ -0,0 +1,91 @@ +/* +Copyright 2024 Nokia. + +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 "VLAN IS" BVLANIS, +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 v1alpha1 + +import ( + "reflect" + + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// EXTCOMMIndexSpec defines the dEXTCOMMred state of EXTCOMMIndex +type EXTCOMMIndexSpec struct { + // MinID defines the min EXTCOMM ID the index supports + // +optional + MinID *uint64 `json:"minID,omitempty" yaml:"minID,omitempty" protobuf:"bytes,1,opt,name=minID"` + // MaxID defines the max EXTCOMM ID the index supports + // +optional + MaxID *uint64 `json:"maxID,omitempty" yaml:"maxID,omitempty" protobuf:"bytes,2,opt,name=maxID"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` + // Transitive defines the transative nature of the extended community + Transitive bool `json:"transitive,omitempty" yaml:"transitive,omitempty" protobuf:"bytes,4,opt,name=transitive"` + // Type defines the type of the extended community + // 2byteAS, 4byteAS, ipv4Address, opaque + Type string `json:"type" yaml:"type" protobuf:"bytes,5,opt,name=type"` + // SubType defines the subTyoe of the extended community + // routeTarget, routeOrigin; + SubType string `json:"subType" yaml:"subType" protobuf:"bytes,6,opt,name=subType"` + // GlobalID is interpreted dependeing on the type + // AS in case of 2byteAS, 4byteAS + // IPV4 addrress + // irrelevant for the opaque type + GlobalID string `json:"globalID,omitempty" yaml:"globalID,omitempty" protobuf:"bytes,7,opt,name=globalID"` +} + +// EXTCOMMIndexStatus defines the observed state of EXTCOMMIndex +type EXTCOMMIndexStatus struct { + // MinID defines the min EXTCOMM ID the index supports + // +optional + MinID *int64 `json:"minID,omitempty" yaml:"minID,omitempty" protobuf:"bytes,1,opt,name=minID"` + // MaxID defines the max EXTCOMM ID the index supports + // +optional + MaxID *int64 `json:"maxID,omitempty" yaml:"maxID,omitempty" protobuf:"bytes,2,opt,name=maxID"` + // ConditionedStatus provides the status of the EXTCOMMIndex using conditions + // - a ready condition indicates the overall status of the resource + condv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// EXTCOMMIndex is the Schema for the EXTCOMMIndex API +// +// +k8s:openapi-gen=true +type EXTCOMMIndex struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec EXTCOMMIndexSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status EXTCOMMIndexStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// EXTCOMMIndexList contains a list of EXTCOMMIndexs +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type EXTCOMMIndexList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []EXTCOMMIndex `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + EXTCOMMIndexKind = reflect.TypeOf(EXTCOMMIndex{}).Name() + EXTCOMMIndexListKind = reflect.TypeOf(EXTCOMMIndexList{}).Name() +) diff --git a/apis/backend/extcomm/v1alpha1/genidclaim_resource.go b/apis/backend/extcomm/v1alpha1/genidclaim_resource.go new file mode 100644 index 0000000..89b6954 --- /dev/null +++ b/apis/backend/extcomm/v1alpha1/genidclaim_resource.go @@ -0,0 +1,80 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/kuidio/kuid/apis/backend/extcomm" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +k8s:deepcopy-gen=false +var _ resource.Object = &EXTCOMMClaim{} +var _ resource.ObjectList = &EXTCOMMClaimList{} +var _ resource.MultiVersionObject = &EXTCOMMClaim{} + +func (EXTCOMMClaim) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: extcomm.EXTCOMMClaimPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (EXTCOMMClaim) IsStorageVersion() bool { + return false +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (EXTCOMMClaim) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *EXTCOMMClaim) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// New return an empty resource +// New implements resource.Object +func (EXTCOMMClaim) New() runtime.Object { + return &EXTCOMMClaim{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (EXTCOMMClaim) NewList() runtime.Object { + return &EXTCOMMClaimList{} +} + +// GetListMeta returns the ListMeta +// GetListMeta implements resource.ObjectList +func (r *EXTCOMMClaimList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// RegisterConversions registers the conversions. +// RegisterConversions implements resource.MultiVersionObject +func (EXTCOMMClaim) RegisterConversions() func(s *runtime.Scheme) error { + return RegisterConversions +} diff --git a/apis/backend/extcomm/v1alpha1/genidentry_resource.go b/apis/backend/extcomm/v1alpha1/genidentry_resource.go new file mode 100644 index 0000000..4610b4c --- /dev/null +++ b/apis/backend/extcomm/v1alpha1/genidentry_resource.go @@ -0,0 +1,80 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/kuidio/kuid/apis/backend/extcomm" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +k8s:deepcopy-gen=false +var _ resource.Object = &EXTCOMMEntry{} +var _ resource.ObjectList = &EXTCOMMEntryList{} +var _ resource.MultiVersionObject = &EXTCOMMEntry{} + +func (EXTCOMMEntry) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: extcomm.EXTCOMMEntryPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (EXTCOMMEntry) IsStorageVersion() bool { + return false +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (EXTCOMMEntry) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *EXTCOMMEntry) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// New return an empty resource +// New implements resource.Object +func (EXTCOMMEntry) New() runtime.Object { + return &EXTCOMMEntry{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (EXTCOMMEntry) NewList() runtime.Object { + return &EXTCOMMEntryList{} +} + +// GetListMeta returns the ListMeta +// GetListMeta implements resource.ObjectList +func (r *EXTCOMMEntryList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// RegisterConversions registers the conversions. +// RegisterConversions implements resource.MultiVersionObject +func (EXTCOMMEntry) RegisterConversions() func(s *runtime.Scheme) error { + return RegisterConversions +} diff --git a/apis/backend/extcomm/v1alpha1/genidindex_resource.go b/apis/backend/extcomm/v1alpha1/genidindex_resource.go new file mode 100644 index 0000000..b4b1b8f --- /dev/null +++ b/apis/backend/extcomm/v1alpha1/genidindex_resource.go @@ -0,0 +1,80 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/kuidio/kuid/apis/backend/extcomm" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +k8s:deepcopy-gen=false +var _ resource.Object = &EXTCOMMIndex{} +var _ resource.ObjectList = &EXTCOMMIndexList{} +var _ resource.MultiVersionObject = &EXTCOMMIndex{} + +func (EXTCOMMIndex) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: extcomm.EXTCOMMIndexPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (EXTCOMMIndex) IsStorageVersion() bool { + return false +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (EXTCOMMIndex) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *EXTCOMMIndex) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// New return an empty resource +// New implements resource.Object +func (EXTCOMMIndex) New() runtime.Object { + return &EXTCOMMIndex{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (EXTCOMMIndex) NewList() runtime.Object { + return &EXTCOMMIndexList{} +} + +// GetListMeta returns the ListMeta +// GetListMeta implements resource.ObjectList +func (r *EXTCOMMIndexList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// RegisterConversions registers the conversions. +// RegisterConversions implements resource.MultiVersionObject +func (EXTCOMMIndex) RegisterConversions() func(s *runtime.Scheme) error { + return RegisterConversions +} diff --git a/apis/backend/extcomm/v1alpha1/register.go b/apis/backend/extcomm/v1alpha1/register.go new file mode 100644 index 0000000..f5eb582 --- /dev/null +++ b/apis/backend/extcomm/v1alpha1/register.go @@ -0,0 +1,67 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "github.com/kuidio/kuid/apis/backend/extcomm" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +const ( + Version = "v1alpha1" +) + +var ( + // SchemeGroupVersion contains the API group and version information for the types in this package. + SchemeGroupVersion = schema.GroupVersion{Group: extcomm.GroupName, Version: Version} + // AddToScheme applies all the stored functions to the scheme. A non-nil error + // indicates that one function failed and the attempt was abandoned. + //AddToScheme = (&runtime.SchemeBuilder{}).AddToScheme + AddToScheme = localSchemeBuilder.AddToScheme + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + schemeBuilder runtime.SchemeBuilder + localSchemeBuilder = &schemeBuilder +) + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +func init() { + localSchemeBuilder.Register(addKnownTypes) +} + +// Adds the list of known types to the given scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + // +kubebuilder:scaffold:install + + scheme.AddKnownTypes(SchemeGroupVersion, + &EXTCOMMIndex{}, + &EXTCOMMIndexList{}, + &EXTCOMMClaim{}, + &EXTCOMMClaimList{}, + &EXTCOMMEntry{}, + &EXTCOMMEntryList{}, + ) + + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/apis/backend/extcomm/v1alpha1/zz_generated.conversion.go b/apis/backend/extcomm/v1alpha1/zz_generated.conversion.go new file mode 100644 index 0000000..c8f5acb --- /dev/null +++ b/apis/backend/extcomm/v1alpha1/zz_generated.conversion.go @@ -0,0 +1,563 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2024 Nokia. + +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 conversion-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + unsafe "unsafe" + + backend "github.com/kuidio/kuid/apis/backend" + asv1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" + extcomm "github.com/kuidio/kuid/apis/backend/extcomm" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +func init() { + localSchemeBuilder.Register(RegisterConversions) +} + +// RegisterConversions adds conversion functions to the given scheme. +// Public to allow building arbitrary schemes. +func RegisterConversions(s *runtime.Scheme) error { + if err := s.AddGeneratedConversionFunc((*EXTCOMMClaim)(nil), (*extcomm.EXTCOMMClaim)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_EXTCOMMClaim_To_extcomm_EXTCOMMClaim(a.(*EXTCOMMClaim), b.(*extcomm.EXTCOMMClaim), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*extcomm.EXTCOMMClaim)(nil), (*EXTCOMMClaim)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_extcomm_EXTCOMMClaim_To_v1alpha1_EXTCOMMClaim(a.(*extcomm.EXTCOMMClaim), b.(*EXTCOMMClaim), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*EXTCOMMClaimList)(nil), (*extcomm.EXTCOMMClaimList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_EXTCOMMClaimList_To_extcomm_EXTCOMMClaimList(a.(*EXTCOMMClaimList), b.(*extcomm.EXTCOMMClaimList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*extcomm.EXTCOMMClaimList)(nil), (*EXTCOMMClaimList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_extcomm_EXTCOMMClaimList_To_v1alpha1_EXTCOMMClaimList(a.(*extcomm.EXTCOMMClaimList), b.(*EXTCOMMClaimList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*EXTCOMMClaimSpec)(nil), (*extcomm.EXTCOMMClaimSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_EXTCOMMClaimSpec_To_extcomm_EXTCOMMClaimSpec(a.(*EXTCOMMClaimSpec), b.(*extcomm.EXTCOMMClaimSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*extcomm.EXTCOMMClaimSpec)(nil), (*EXTCOMMClaimSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_extcomm_EXTCOMMClaimSpec_To_v1alpha1_EXTCOMMClaimSpec(a.(*extcomm.EXTCOMMClaimSpec), b.(*EXTCOMMClaimSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*EXTCOMMClaimStatus)(nil), (*extcomm.EXTCOMMClaimStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_EXTCOMMClaimStatus_To_extcomm_EXTCOMMClaimStatus(a.(*EXTCOMMClaimStatus), b.(*extcomm.EXTCOMMClaimStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*extcomm.EXTCOMMClaimStatus)(nil), (*EXTCOMMClaimStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_extcomm_EXTCOMMClaimStatus_To_v1alpha1_EXTCOMMClaimStatus(a.(*extcomm.EXTCOMMClaimStatus), b.(*EXTCOMMClaimStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*EXTCOMMEntry)(nil), (*extcomm.EXTCOMMEntry)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_EXTCOMMEntry_To_extcomm_EXTCOMMEntry(a.(*EXTCOMMEntry), b.(*extcomm.EXTCOMMEntry), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*extcomm.EXTCOMMEntry)(nil), (*EXTCOMMEntry)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_extcomm_EXTCOMMEntry_To_v1alpha1_EXTCOMMEntry(a.(*extcomm.EXTCOMMEntry), b.(*EXTCOMMEntry), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*EXTCOMMEntryList)(nil), (*extcomm.EXTCOMMEntryList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_EXTCOMMEntryList_To_extcomm_EXTCOMMEntryList(a.(*EXTCOMMEntryList), b.(*extcomm.EXTCOMMEntryList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*extcomm.EXTCOMMEntryList)(nil), (*EXTCOMMEntryList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_extcomm_EXTCOMMEntryList_To_v1alpha1_EXTCOMMEntryList(a.(*extcomm.EXTCOMMEntryList), b.(*EXTCOMMEntryList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*EXTCOMMEntrySpec)(nil), (*extcomm.EXTCOMMEntrySpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_EXTCOMMEntrySpec_To_extcomm_EXTCOMMEntrySpec(a.(*EXTCOMMEntrySpec), b.(*extcomm.EXTCOMMEntrySpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*extcomm.EXTCOMMEntrySpec)(nil), (*EXTCOMMEntrySpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_extcomm_EXTCOMMEntrySpec_To_v1alpha1_EXTCOMMEntrySpec(a.(*extcomm.EXTCOMMEntrySpec), b.(*EXTCOMMEntrySpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*EXTCOMMEntryStatus)(nil), (*extcomm.EXTCOMMEntryStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_EXTCOMMEntryStatus_To_extcomm_EXTCOMMEntryStatus(a.(*EXTCOMMEntryStatus), b.(*extcomm.EXTCOMMEntryStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*extcomm.EXTCOMMEntryStatus)(nil), (*EXTCOMMEntryStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_extcomm_EXTCOMMEntryStatus_To_v1alpha1_EXTCOMMEntryStatus(a.(*extcomm.EXTCOMMEntryStatus), b.(*EXTCOMMEntryStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*EXTCOMMIndex)(nil), (*extcomm.EXTCOMMIndex)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_EXTCOMMIndex_To_extcomm_EXTCOMMIndex(a.(*EXTCOMMIndex), b.(*extcomm.EXTCOMMIndex), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*extcomm.EXTCOMMIndex)(nil), (*EXTCOMMIndex)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_extcomm_EXTCOMMIndex_To_v1alpha1_EXTCOMMIndex(a.(*extcomm.EXTCOMMIndex), b.(*EXTCOMMIndex), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*EXTCOMMIndexList)(nil), (*extcomm.EXTCOMMIndexList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_EXTCOMMIndexList_To_extcomm_EXTCOMMIndexList(a.(*EXTCOMMIndexList), b.(*extcomm.EXTCOMMIndexList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*extcomm.EXTCOMMIndexList)(nil), (*EXTCOMMIndexList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_extcomm_EXTCOMMIndexList_To_v1alpha1_EXTCOMMIndexList(a.(*extcomm.EXTCOMMIndexList), b.(*EXTCOMMIndexList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*EXTCOMMIndexSpec)(nil), (*extcomm.EXTCOMMIndexSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_EXTCOMMIndexSpec_To_extcomm_EXTCOMMIndexSpec(a.(*EXTCOMMIndexSpec), b.(*extcomm.EXTCOMMIndexSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*extcomm.EXTCOMMIndexSpec)(nil), (*EXTCOMMIndexSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_extcomm_EXTCOMMIndexSpec_To_v1alpha1_EXTCOMMIndexSpec(a.(*extcomm.EXTCOMMIndexSpec), b.(*EXTCOMMIndexSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*EXTCOMMIndexStatus)(nil), (*extcomm.EXTCOMMIndexStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_EXTCOMMIndexStatus_To_extcomm_EXTCOMMIndexStatus(a.(*EXTCOMMIndexStatus), b.(*extcomm.EXTCOMMIndexStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*extcomm.EXTCOMMIndexStatus)(nil), (*EXTCOMMIndexStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_extcomm_EXTCOMMIndexStatus_To_v1alpha1_EXTCOMMIndexStatus(a.(*extcomm.EXTCOMMIndexStatus), b.(*EXTCOMMIndexStatus), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1alpha1_EXTCOMMClaim_To_extcomm_EXTCOMMClaim(in *EXTCOMMClaim, out *extcomm.EXTCOMMClaim, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_EXTCOMMClaimSpec_To_extcomm_EXTCOMMClaimSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_EXTCOMMClaimStatus_To_extcomm_EXTCOMMClaimStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_EXTCOMMClaim_To_extcomm_EXTCOMMClaim is an autogenerated conversion function. +func Convert_v1alpha1_EXTCOMMClaim_To_extcomm_EXTCOMMClaim(in *EXTCOMMClaim, out *extcomm.EXTCOMMClaim, s conversion.Scope) error { + return autoConvert_v1alpha1_EXTCOMMClaim_To_extcomm_EXTCOMMClaim(in, out, s) +} + +func autoConvert_extcomm_EXTCOMMClaim_To_v1alpha1_EXTCOMMClaim(in *extcomm.EXTCOMMClaim, out *EXTCOMMClaim, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_extcomm_EXTCOMMClaimSpec_To_v1alpha1_EXTCOMMClaimSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_extcomm_EXTCOMMClaimStatus_To_v1alpha1_EXTCOMMClaimStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_extcomm_EXTCOMMClaim_To_v1alpha1_EXTCOMMClaim is an autogenerated conversion function. +func Convert_extcomm_EXTCOMMClaim_To_v1alpha1_EXTCOMMClaim(in *extcomm.EXTCOMMClaim, out *EXTCOMMClaim, s conversion.Scope) error { + return autoConvert_extcomm_EXTCOMMClaim_To_v1alpha1_EXTCOMMClaim(in, out, s) +} + +func autoConvert_v1alpha1_EXTCOMMClaimList_To_extcomm_EXTCOMMClaimList(in *EXTCOMMClaimList, out *extcomm.EXTCOMMClaimList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]extcomm.EXTCOMMClaim, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_EXTCOMMClaim_To_extcomm_EXTCOMMClaim(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_EXTCOMMClaimList_To_extcomm_EXTCOMMClaimList is an autogenerated conversion function. +func Convert_v1alpha1_EXTCOMMClaimList_To_extcomm_EXTCOMMClaimList(in *EXTCOMMClaimList, out *extcomm.EXTCOMMClaimList, s conversion.Scope) error { + return autoConvert_v1alpha1_EXTCOMMClaimList_To_extcomm_EXTCOMMClaimList(in, out, s) +} + +func autoConvert_extcomm_EXTCOMMClaimList_To_v1alpha1_EXTCOMMClaimList(in *extcomm.EXTCOMMClaimList, out *EXTCOMMClaimList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]EXTCOMMClaim, len(*in)) + for i := range *in { + if err := Convert_extcomm_EXTCOMMClaim_To_v1alpha1_EXTCOMMClaim(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_extcomm_EXTCOMMClaimList_To_v1alpha1_EXTCOMMClaimList is an autogenerated conversion function. +func Convert_extcomm_EXTCOMMClaimList_To_v1alpha1_EXTCOMMClaimList(in *extcomm.EXTCOMMClaimList, out *EXTCOMMClaimList, s conversion.Scope) error { + return autoConvert_extcomm_EXTCOMMClaimList_To_v1alpha1_EXTCOMMClaimList(in, out, s) +} + +func autoConvert_v1alpha1_EXTCOMMClaimSpec_To_extcomm_EXTCOMMClaimSpec(in *EXTCOMMClaimSpec, out *extcomm.EXTCOMMClaimSpec, s conversion.Scope) error { + out.Index = in.Index + out.ID = (*uint64)(unsafe.Pointer(in.ID)) + out.Range = (*string)(unsafe.Pointer(in.Range)) + if err := asv1alpha1.Convert_v1alpha1_ClaimLabels_To_common_ClaimLabels(&in.ClaimLabels, &out.ClaimLabels, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_EXTCOMMClaimSpec_To_extcomm_EXTCOMMClaimSpec is an autogenerated conversion function. +func Convert_v1alpha1_EXTCOMMClaimSpec_To_extcomm_EXTCOMMClaimSpec(in *EXTCOMMClaimSpec, out *extcomm.EXTCOMMClaimSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_EXTCOMMClaimSpec_To_extcomm_EXTCOMMClaimSpec(in, out, s) +} + +func autoConvert_extcomm_EXTCOMMClaimSpec_To_v1alpha1_EXTCOMMClaimSpec(in *extcomm.EXTCOMMClaimSpec, out *EXTCOMMClaimSpec, s conversion.Scope) error { + out.Index = in.Index + out.ID = (*uint64)(unsafe.Pointer(in.ID)) + out.Range = (*string)(unsafe.Pointer(in.Range)) + if err := asv1alpha1.Convert_common_ClaimLabels_To_v1alpha1_ClaimLabels(&in.ClaimLabels, &out.ClaimLabels, s); err != nil { + return err + } + return nil +} + +// Convert_extcomm_EXTCOMMClaimSpec_To_v1alpha1_EXTCOMMClaimSpec is an autogenerated conversion function. +func Convert_extcomm_EXTCOMMClaimSpec_To_v1alpha1_EXTCOMMClaimSpec(in *extcomm.EXTCOMMClaimSpec, out *EXTCOMMClaimSpec, s conversion.Scope) error { + return autoConvert_extcomm_EXTCOMMClaimSpec_To_v1alpha1_EXTCOMMClaimSpec(in, out, s) +} + +func autoConvert_v1alpha1_EXTCOMMClaimStatus_To_extcomm_EXTCOMMClaimStatus(in *EXTCOMMClaimStatus, out *extcomm.EXTCOMMClaimStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + out.ID = (*uint64)(unsafe.Pointer(in.ID)) + out.Range = (*string)(unsafe.Pointer(in.Range)) + out.ExpiryTime = (*string)(unsafe.Pointer(in.ExpiryTime)) + return nil +} + +// Convert_v1alpha1_EXTCOMMClaimStatus_To_extcomm_EXTCOMMClaimStatus is an autogenerated conversion function. +func Convert_v1alpha1_EXTCOMMClaimStatus_To_extcomm_EXTCOMMClaimStatus(in *EXTCOMMClaimStatus, out *extcomm.EXTCOMMClaimStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_EXTCOMMClaimStatus_To_extcomm_EXTCOMMClaimStatus(in, out, s) +} + +func autoConvert_extcomm_EXTCOMMClaimStatus_To_v1alpha1_EXTCOMMClaimStatus(in *extcomm.EXTCOMMClaimStatus, out *EXTCOMMClaimStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + out.ID = (*uint64)(unsafe.Pointer(in.ID)) + out.Range = (*string)(unsafe.Pointer(in.Range)) + out.ExpiryTime = (*string)(unsafe.Pointer(in.ExpiryTime)) + return nil +} + +// Convert_extcomm_EXTCOMMClaimStatus_To_v1alpha1_EXTCOMMClaimStatus is an autogenerated conversion function. +func Convert_extcomm_EXTCOMMClaimStatus_To_v1alpha1_EXTCOMMClaimStatus(in *extcomm.EXTCOMMClaimStatus, out *EXTCOMMClaimStatus, s conversion.Scope) error { + return autoConvert_extcomm_EXTCOMMClaimStatus_To_v1alpha1_EXTCOMMClaimStatus(in, out, s) +} + +func autoConvert_v1alpha1_EXTCOMMEntry_To_extcomm_EXTCOMMEntry(in *EXTCOMMEntry, out *extcomm.EXTCOMMEntry, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_EXTCOMMEntrySpec_To_extcomm_EXTCOMMEntrySpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_EXTCOMMEntryStatus_To_extcomm_EXTCOMMEntryStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_EXTCOMMEntry_To_extcomm_EXTCOMMEntry is an autogenerated conversion function. +func Convert_v1alpha1_EXTCOMMEntry_To_extcomm_EXTCOMMEntry(in *EXTCOMMEntry, out *extcomm.EXTCOMMEntry, s conversion.Scope) error { + return autoConvert_v1alpha1_EXTCOMMEntry_To_extcomm_EXTCOMMEntry(in, out, s) +} + +func autoConvert_extcomm_EXTCOMMEntry_To_v1alpha1_EXTCOMMEntry(in *extcomm.EXTCOMMEntry, out *EXTCOMMEntry, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_extcomm_EXTCOMMEntrySpec_To_v1alpha1_EXTCOMMEntrySpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_extcomm_EXTCOMMEntryStatus_To_v1alpha1_EXTCOMMEntryStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_extcomm_EXTCOMMEntry_To_v1alpha1_EXTCOMMEntry is an autogenerated conversion function. +func Convert_extcomm_EXTCOMMEntry_To_v1alpha1_EXTCOMMEntry(in *extcomm.EXTCOMMEntry, out *EXTCOMMEntry, s conversion.Scope) error { + return autoConvert_extcomm_EXTCOMMEntry_To_v1alpha1_EXTCOMMEntry(in, out, s) +} + +func autoConvert_v1alpha1_EXTCOMMEntryList_To_extcomm_EXTCOMMEntryList(in *EXTCOMMEntryList, out *extcomm.EXTCOMMEntryList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]extcomm.EXTCOMMEntry, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_EXTCOMMEntry_To_extcomm_EXTCOMMEntry(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_EXTCOMMEntryList_To_extcomm_EXTCOMMEntryList is an autogenerated conversion function. +func Convert_v1alpha1_EXTCOMMEntryList_To_extcomm_EXTCOMMEntryList(in *EXTCOMMEntryList, out *extcomm.EXTCOMMEntryList, s conversion.Scope) error { + return autoConvert_v1alpha1_EXTCOMMEntryList_To_extcomm_EXTCOMMEntryList(in, out, s) +} + +func autoConvert_extcomm_EXTCOMMEntryList_To_v1alpha1_EXTCOMMEntryList(in *extcomm.EXTCOMMEntryList, out *EXTCOMMEntryList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]EXTCOMMEntry, len(*in)) + for i := range *in { + if err := Convert_extcomm_EXTCOMMEntry_To_v1alpha1_EXTCOMMEntry(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_extcomm_EXTCOMMEntryList_To_v1alpha1_EXTCOMMEntryList is an autogenerated conversion function. +func Convert_extcomm_EXTCOMMEntryList_To_v1alpha1_EXTCOMMEntryList(in *extcomm.EXTCOMMEntryList, out *EXTCOMMEntryList, s conversion.Scope) error { + return autoConvert_extcomm_EXTCOMMEntryList_To_v1alpha1_EXTCOMMEntryList(in, out, s) +} + +func autoConvert_v1alpha1_EXTCOMMEntrySpec_To_extcomm_EXTCOMMEntrySpec(in *EXTCOMMEntrySpec, out *extcomm.EXTCOMMEntrySpec, s conversion.Scope) error { + out.Index = in.Index + out.ClaimType = backend.ClaimType(in.ClaimType) + out.ID = in.ID + if err := asv1alpha1.Convert_v1alpha1_ClaimLabels_To_common_ClaimLabels(&in.ClaimLabels, &out.ClaimLabels, s); err != nil { + return err + } + out.Claim = in.Claim + return nil +} + +// Convert_v1alpha1_EXTCOMMEntrySpec_To_extcomm_EXTCOMMEntrySpec is an autogenerated conversion function. +func Convert_v1alpha1_EXTCOMMEntrySpec_To_extcomm_EXTCOMMEntrySpec(in *EXTCOMMEntrySpec, out *extcomm.EXTCOMMEntrySpec, s conversion.Scope) error { + return autoConvert_v1alpha1_EXTCOMMEntrySpec_To_extcomm_EXTCOMMEntrySpec(in, out, s) +} + +func autoConvert_extcomm_EXTCOMMEntrySpec_To_v1alpha1_EXTCOMMEntrySpec(in *extcomm.EXTCOMMEntrySpec, out *EXTCOMMEntrySpec, s conversion.Scope) error { + out.Index = in.Index + out.ClaimType = backend.ClaimType(in.ClaimType) + out.ID = in.ID + if err := asv1alpha1.Convert_common_ClaimLabels_To_v1alpha1_ClaimLabels(&in.ClaimLabels, &out.ClaimLabels, s); err != nil { + return err + } + out.Claim = in.Claim + return nil +} + +// Convert_extcomm_EXTCOMMEntrySpec_To_v1alpha1_EXTCOMMEntrySpec is an autogenerated conversion function. +func Convert_extcomm_EXTCOMMEntrySpec_To_v1alpha1_EXTCOMMEntrySpec(in *extcomm.EXTCOMMEntrySpec, out *EXTCOMMEntrySpec, s conversion.Scope) error { + return autoConvert_extcomm_EXTCOMMEntrySpec_To_v1alpha1_EXTCOMMEntrySpec(in, out, s) +} + +func autoConvert_v1alpha1_EXTCOMMEntryStatus_To_extcomm_EXTCOMMEntryStatus(in *EXTCOMMEntryStatus, out *extcomm.EXTCOMMEntryStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_EXTCOMMEntryStatus_To_extcomm_EXTCOMMEntryStatus is an autogenerated conversion function. +func Convert_v1alpha1_EXTCOMMEntryStatus_To_extcomm_EXTCOMMEntryStatus(in *EXTCOMMEntryStatus, out *extcomm.EXTCOMMEntryStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_EXTCOMMEntryStatus_To_extcomm_EXTCOMMEntryStatus(in, out, s) +} + +func autoConvert_extcomm_EXTCOMMEntryStatus_To_v1alpha1_EXTCOMMEntryStatus(in *extcomm.EXTCOMMEntryStatus, out *EXTCOMMEntryStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_extcomm_EXTCOMMEntryStatus_To_v1alpha1_EXTCOMMEntryStatus is an autogenerated conversion function. +func Convert_extcomm_EXTCOMMEntryStatus_To_v1alpha1_EXTCOMMEntryStatus(in *extcomm.EXTCOMMEntryStatus, out *EXTCOMMEntryStatus, s conversion.Scope) error { + return autoConvert_extcomm_EXTCOMMEntryStatus_To_v1alpha1_EXTCOMMEntryStatus(in, out, s) +} + +func autoConvert_v1alpha1_EXTCOMMIndex_To_extcomm_EXTCOMMIndex(in *EXTCOMMIndex, out *extcomm.EXTCOMMIndex, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_EXTCOMMIndexSpec_To_extcomm_EXTCOMMIndexSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_EXTCOMMIndexStatus_To_extcomm_EXTCOMMIndexStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_EXTCOMMIndex_To_extcomm_EXTCOMMIndex is an autogenerated conversion function. +func Convert_v1alpha1_EXTCOMMIndex_To_extcomm_EXTCOMMIndex(in *EXTCOMMIndex, out *extcomm.EXTCOMMIndex, s conversion.Scope) error { + return autoConvert_v1alpha1_EXTCOMMIndex_To_extcomm_EXTCOMMIndex(in, out, s) +} + +func autoConvert_extcomm_EXTCOMMIndex_To_v1alpha1_EXTCOMMIndex(in *extcomm.EXTCOMMIndex, out *EXTCOMMIndex, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_extcomm_EXTCOMMIndexSpec_To_v1alpha1_EXTCOMMIndexSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_extcomm_EXTCOMMIndexStatus_To_v1alpha1_EXTCOMMIndexStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_extcomm_EXTCOMMIndex_To_v1alpha1_EXTCOMMIndex is an autogenerated conversion function. +func Convert_extcomm_EXTCOMMIndex_To_v1alpha1_EXTCOMMIndex(in *extcomm.EXTCOMMIndex, out *EXTCOMMIndex, s conversion.Scope) error { + return autoConvert_extcomm_EXTCOMMIndex_To_v1alpha1_EXTCOMMIndex(in, out, s) +} + +func autoConvert_v1alpha1_EXTCOMMIndexList_To_extcomm_EXTCOMMIndexList(in *EXTCOMMIndexList, out *extcomm.EXTCOMMIndexList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]extcomm.EXTCOMMIndex, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_EXTCOMMIndex_To_extcomm_EXTCOMMIndex(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_EXTCOMMIndexList_To_extcomm_EXTCOMMIndexList is an autogenerated conversion function. +func Convert_v1alpha1_EXTCOMMIndexList_To_extcomm_EXTCOMMIndexList(in *EXTCOMMIndexList, out *extcomm.EXTCOMMIndexList, s conversion.Scope) error { + return autoConvert_v1alpha1_EXTCOMMIndexList_To_extcomm_EXTCOMMIndexList(in, out, s) +} + +func autoConvert_extcomm_EXTCOMMIndexList_To_v1alpha1_EXTCOMMIndexList(in *extcomm.EXTCOMMIndexList, out *EXTCOMMIndexList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]EXTCOMMIndex, len(*in)) + for i := range *in { + if err := Convert_extcomm_EXTCOMMIndex_To_v1alpha1_EXTCOMMIndex(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_extcomm_EXTCOMMIndexList_To_v1alpha1_EXTCOMMIndexList is an autogenerated conversion function. +func Convert_extcomm_EXTCOMMIndexList_To_v1alpha1_EXTCOMMIndexList(in *extcomm.EXTCOMMIndexList, out *EXTCOMMIndexList, s conversion.Scope) error { + return autoConvert_extcomm_EXTCOMMIndexList_To_v1alpha1_EXTCOMMIndexList(in, out, s) +} + +func autoConvert_v1alpha1_EXTCOMMIndexSpec_To_extcomm_EXTCOMMIndexSpec(in *EXTCOMMIndexSpec, out *extcomm.EXTCOMMIndexSpec, s conversion.Scope) error { + out.MinID = (*uint64)(unsafe.Pointer(in.MinID)) + out.MaxID = (*uint64)(unsafe.Pointer(in.MaxID)) + if err := asv1alpha1.Convert_v1alpha1_UserDefinedLabels_To_common_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + out.Transitive = in.Transitive + out.Type = in.Type + out.SubType = in.SubType + out.GlobalID = in.GlobalID + return nil +} + +// Convert_v1alpha1_EXTCOMMIndexSpec_To_extcomm_EXTCOMMIndexSpec is an autogenerated conversion function. +func Convert_v1alpha1_EXTCOMMIndexSpec_To_extcomm_EXTCOMMIndexSpec(in *EXTCOMMIndexSpec, out *extcomm.EXTCOMMIndexSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_EXTCOMMIndexSpec_To_extcomm_EXTCOMMIndexSpec(in, out, s) +} + +func autoConvert_extcomm_EXTCOMMIndexSpec_To_v1alpha1_EXTCOMMIndexSpec(in *extcomm.EXTCOMMIndexSpec, out *EXTCOMMIndexSpec, s conversion.Scope) error { + out.MinID = (*uint64)(unsafe.Pointer(in.MinID)) + out.MaxID = (*uint64)(unsafe.Pointer(in.MaxID)) + if err := asv1alpha1.Convert_common_UserDefinedLabels_To_v1alpha1_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + out.Transitive = in.Transitive + out.Type = in.Type + out.SubType = in.SubType + out.GlobalID = in.GlobalID + return nil +} + +// Convert_extcomm_EXTCOMMIndexSpec_To_v1alpha1_EXTCOMMIndexSpec is an autogenerated conversion function. +func Convert_extcomm_EXTCOMMIndexSpec_To_v1alpha1_EXTCOMMIndexSpec(in *extcomm.EXTCOMMIndexSpec, out *EXTCOMMIndexSpec, s conversion.Scope) error { + return autoConvert_extcomm_EXTCOMMIndexSpec_To_v1alpha1_EXTCOMMIndexSpec(in, out, s) +} + +func autoConvert_v1alpha1_EXTCOMMIndexStatus_To_extcomm_EXTCOMMIndexStatus(in *EXTCOMMIndexStatus, out *extcomm.EXTCOMMIndexStatus, s conversion.Scope) error { + out.MinID = (*int64)(unsafe.Pointer(in.MinID)) + out.MaxID = (*int64)(unsafe.Pointer(in.MaxID)) + if err := asv1alpha1.Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_EXTCOMMIndexStatus_To_extcomm_EXTCOMMIndexStatus is an autogenerated conversion function. +func Convert_v1alpha1_EXTCOMMIndexStatus_To_extcomm_EXTCOMMIndexStatus(in *EXTCOMMIndexStatus, out *extcomm.EXTCOMMIndexStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_EXTCOMMIndexStatus_To_extcomm_EXTCOMMIndexStatus(in, out, s) +} + +func autoConvert_extcomm_EXTCOMMIndexStatus_To_v1alpha1_EXTCOMMIndexStatus(in *extcomm.EXTCOMMIndexStatus, out *EXTCOMMIndexStatus, s conversion.Scope) error { + out.MinID = (*int64)(unsafe.Pointer(in.MinID)) + out.MaxID = (*int64)(unsafe.Pointer(in.MaxID)) + if err := asv1alpha1.Convert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_extcomm_EXTCOMMIndexStatus_To_v1alpha1_EXTCOMMIndexStatus is an autogenerated conversion function. +func Convert_extcomm_EXTCOMMIndexStatus_To_v1alpha1_EXTCOMMIndexStatus(in *extcomm.EXTCOMMIndexStatus, out *EXTCOMMIndexStatus, s conversion.Scope) error { + return autoConvert_extcomm_EXTCOMMIndexStatus_To_v1alpha1_EXTCOMMIndexStatus(in, out, s) +} diff --git a/apis/backend/extcomm/v1alpha1/zz_generated.deepcopy.go b/apis/backend/extcomm/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 0000000..2b83a4b --- /dev/null +++ b/apis/backend/extcomm/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,355 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +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 *EXTCOMMClaim) DeepCopyInto(out *EXTCOMMClaim) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMClaim. +func (in *EXTCOMMClaim) DeepCopy() *EXTCOMMClaim { + if in == nil { + return nil + } + out := new(EXTCOMMClaim) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EXTCOMMClaim) 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 *EXTCOMMClaimList) DeepCopyInto(out *EXTCOMMClaimList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]EXTCOMMClaim, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMClaimList. +func (in *EXTCOMMClaimList) DeepCopy() *EXTCOMMClaimList { + if in == nil { + return nil + } + out := new(EXTCOMMClaimList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EXTCOMMClaimList) 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 *EXTCOMMClaimSpec) DeepCopyInto(out *EXTCOMMClaimSpec) { + *out = *in + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(uint64) + **out = **in + } + if in.Range != nil { + in, out := &in.Range, &out.Range + *out = new(string) + **out = **in + } + in.ClaimLabels.DeepCopyInto(&out.ClaimLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMClaimSpec. +func (in *EXTCOMMClaimSpec) DeepCopy() *EXTCOMMClaimSpec { + if in == nil { + return nil + } + out := new(EXTCOMMClaimSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EXTCOMMClaimStatus) DeepCopyInto(out *EXTCOMMClaimStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(uint64) + **out = **in + } + if in.Range != nil { + in, out := &in.Range, &out.Range + *out = new(string) + **out = **in + } + if in.ExpiryTime != nil { + in, out := &in.ExpiryTime, &out.ExpiryTime + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMClaimStatus. +func (in *EXTCOMMClaimStatus) DeepCopy() *EXTCOMMClaimStatus { + if in == nil { + return nil + } + out := new(EXTCOMMClaimStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EXTCOMMEntry) DeepCopyInto(out *EXTCOMMEntry) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMEntry. +func (in *EXTCOMMEntry) DeepCopy() *EXTCOMMEntry { + if in == nil { + return nil + } + out := new(EXTCOMMEntry) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EXTCOMMEntry) 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 *EXTCOMMEntryList) DeepCopyInto(out *EXTCOMMEntryList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]EXTCOMMEntry, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMEntryList. +func (in *EXTCOMMEntryList) DeepCopy() *EXTCOMMEntryList { + if in == nil { + return nil + } + out := new(EXTCOMMEntryList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EXTCOMMEntryList) 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 *EXTCOMMEntrySpec) DeepCopyInto(out *EXTCOMMEntrySpec) { + *out = *in + in.ClaimLabels.DeepCopyInto(&out.ClaimLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMEntrySpec. +func (in *EXTCOMMEntrySpec) DeepCopy() *EXTCOMMEntrySpec { + if in == nil { + return nil + } + out := new(EXTCOMMEntrySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EXTCOMMEntryStatus) DeepCopyInto(out *EXTCOMMEntryStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMEntryStatus. +func (in *EXTCOMMEntryStatus) DeepCopy() *EXTCOMMEntryStatus { + if in == nil { + return nil + } + out := new(EXTCOMMEntryStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EXTCOMMIndex) DeepCopyInto(out *EXTCOMMIndex) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMIndex. +func (in *EXTCOMMIndex) DeepCopy() *EXTCOMMIndex { + if in == nil { + return nil + } + out := new(EXTCOMMIndex) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EXTCOMMIndex) 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 *EXTCOMMIndexList) DeepCopyInto(out *EXTCOMMIndexList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]EXTCOMMIndex, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMIndexList. +func (in *EXTCOMMIndexList) DeepCopy() *EXTCOMMIndexList { + if in == nil { + return nil + } + out := new(EXTCOMMIndexList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EXTCOMMIndexList) 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 *EXTCOMMIndexSpec) DeepCopyInto(out *EXTCOMMIndexSpec) { + *out = *in + if in.MinID != nil { + in, out := &in.MinID, &out.MinID + *out = new(uint64) + **out = **in + } + if in.MaxID != nil { + in, out := &in.MaxID, &out.MaxID + *out = new(uint64) + **out = **in + } + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMIndexSpec. +func (in *EXTCOMMIndexSpec) DeepCopy() *EXTCOMMIndexSpec { + if in == nil { + return nil + } + out := new(EXTCOMMIndexSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EXTCOMMIndexStatus) DeepCopyInto(out *EXTCOMMIndexStatus) { + *out = *in + if in.MinID != nil { + in, out := &in.MinID, &out.MinID + *out = new(int64) + **out = **in + } + if in.MaxID != nil { + in, out := &in.MaxID, &out.MaxID + *out = new(int64) + **out = **in + } + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMIndexStatus. +func (in *EXTCOMMIndexStatus) DeepCopy() *EXTCOMMIndexStatus { + if in == nil { + return nil + } + out := new(EXTCOMMIndexStatus) + in.DeepCopyInto(out) + return out +} diff --git a/apis/backend/extcomm/v1alpha1/zz_generated.defaults.go b/apis/backend/extcomm/v1alpha1/zz_generated.defaults.go new file mode 100644 index 0000000..c38f9bb --- /dev/null +++ b/apis/backend/extcomm/v1alpha1/zz_generated.defaults.go @@ -0,0 +1,32 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2024 Nokia. + +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 defaulter-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// RegisterDefaults adds defaulters functions to the given scheme. +// Public to allow building arbitrary schemes. +// All generated defaulters are covering - they call all nested defaulters. +func RegisterDefaults(scheme *runtime.Scheme) error { + return nil +} diff --git a/apis/backend/extcomm/zz_generated.deepcopy.go b/apis/backend/extcomm/zz_generated.deepcopy.go new file mode 100644 index 0000000..b990b8a --- /dev/null +++ b/apis/backend/extcomm/zz_generated.deepcopy.go @@ -0,0 +1,451 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2024 Nokia. + +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 extcomm + +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 *EXTCOMMClaim) DeepCopyInto(out *EXTCOMMClaim) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMClaim. +func (in *EXTCOMMClaim) DeepCopy() *EXTCOMMClaim { + if in == nil { + return nil + } + out := new(EXTCOMMClaim) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EXTCOMMClaim) 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 *EXTCOMMClaimFilter) DeepCopyInto(out *EXTCOMMClaimFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMClaimFilter. +func (in *EXTCOMMClaimFilter) DeepCopy() *EXTCOMMClaimFilter { + if in == nil { + return nil + } + out := new(EXTCOMMClaimFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EXTCOMMClaimList) DeepCopyInto(out *EXTCOMMClaimList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]EXTCOMMClaim, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMClaimList. +func (in *EXTCOMMClaimList) DeepCopy() *EXTCOMMClaimList { + if in == nil { + return nil + } + out := new(EXTCOMMClaimList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EXTCOMMClaimList) 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 *EXTCOMMClaimSpec) DeepCopyInto(out *EXTCOMMClaimSpec) { + *out = *in + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(uint64) + **out = **in + } + if in.Range != nil { + in, out := &in.Range, &out.Range + *out = new(string) + **out = **in + } + in.ClaimLabels.DeepCopyInto(&out.ClaimLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMClaimSpec. +func (in *EXTCOMMClaimSpec) DeepCopy() *EXTCOMMClaimSpec { + if in == nil { + return nil + } + out := new(EXTCOMMClaimSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EXTCOMMClaimStatus) DeepCopyInto(out *EXTCOMMClaimStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(uint64) + **out = **in + } + if in.Range != nil { + in, out := &in.Range, &out.Range + *out = new(string) + **out = **in + } + if in.ExpiryTime != nil { + in, out := &in.ExpiryTime, &out.ExpiryTime + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMClaimStatus. +func (in *EXTCOMMClaimStatus) DeepCopy() *EXTCOMMClaimStatus { + if in == nil { + return nil + } + out := new(EXTCOMMClaimStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EXTCOMMDynamicIDSyntaxValidator) DeepCopyInto(out *EXTCOMMDynamicIDSyntaxValidator) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMDynamicIDSyntaxValidator. +func (in *EXTCOMMDynamicIDSyntaxValidator) DeepCopy() *EXTCOMMDynamicIDSyntaxValidator { + if in == nil { + return nil + } + out := new(EXTCOMMDynamicIDSyntaxValidator) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EXTCOMMEntry) DeepCopyInto(out *EXTCOMMEntry) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMEntry. +func (in *EXTCOMMEntry) DeepCopy() *EXTCOMMEntry { + if in == nil { + return nil + } + out := new(EXTCOMMEntry) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EXTCOMMEntry) 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 *EXTCOMMEntryFilter) DeepCopyInto(out *EXTCOMMEntryFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMEntryFilter. +func (in *EXTCOMMEntryFilter) DeepCopy() *EXTCOMMEntryFilter { + if in == nil { + return nil + } + out := new(EXTCOMMEntryFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EXTCOMMEntryList) DeepCopyInto(out *EXTCOMMEntryList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]EXTCOMMEntry, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMEntryList. +func (in *EXTCOMMEntryList) DeepCopy() *EXTCOMMEntryList { + if in == nil { + return nil + } + out := new(EXTCOMMEntryList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EXTCOMMEntryList) 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 *EXTCOMMEntrySpec) DeepCopyInto(out *EXTCOMMEntrySpec) { + *out = *in + in.ClaimLabels.DeepCopyInto(&out.ClaimLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMEntrySpec. +func (in *EXTCOMMEntrySpec) DeepCopy() *EXTCOMMEntrySpec { + if in == nil { + return nil + } + out := new(EXTCOMMEntrySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EXTCOMMEntryStatus) DeepCopyInto(out *EXTCOMMEntryStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMEntryStatus. +func (in *EXTCOMMEntryStatus) DeepCopy() *EXTCOMMEntryStatus { + if in == nil { + return nil + } + out := new(EXTCOMMEntryStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EXTCOMMIndex) DeepCopyInto(out *EXTCOMMIndex) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMIndex. +func (in *EXTCOMMIndex) DeepCopy() *EXTCOMMIndex { + if in == nil { + return nil + } + out := new(EXTCOMMIndex) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EXTCOMMIndex) 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 *EXTCOMMIndexFilter) DeepCopyInto(out *EXTCOMMIndexFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMIndexFilter. +func (in *EXTCOMMIndexFilter) DeepCopy() *EXTCOMMIndexFilter { + if in == nil { + return nil + } + out := new(EXTCOMMIndexFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EXTCOMMIndexList) DeepCopyInto(out *EXTCOMMIndexList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]EXTCOMMIndex, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMIndexList. +func (in *EXTCOMMIndexList) DeepCopy() *EXTCOMMIndexList { + if in == nil { + return nil + } + out := new(EXTCOMMIndexList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EXTCOMMIndexList) 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 *EXTCOMMIndexSpec) DeepCopyInto(out *EXTCOMMIndexSpec) { + *out = *in + if in.MinID != nil { + in, out := &in.MinID, &out.MinID + *out = new(uint64) + **out = **in + } + if in.MaxID != nil { + in, out := &in.MaxID, &out.MaxID + *out = new(uint64) + **out = **in + } + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMIndexSpec. +func (in *EXTCOMMIndexSpec) DeepCopy() *EXTCOMMIndexSpec { + if in == nil { + return nil + } + out := new(EXTCOMMIndexSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EXTCOMMIndexStatus) DeepCopyInto(out *EXTCOMMIndexStatus) { + *out = *in + if in.MinID != nil { + in, out := &in.MinID, &out.MinID + *out = new(int64) + **out = **in + } + if in.MaxID != nil { + in, out := &in.MaxID, &out.MaxID + *out = new(int64) + **out = **in + } + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMIndexStatus. +func (in *EXTCOMMIndexStatus) DeepCopy() *EXTCOMMIndexStatus { + if in == nil { + return nil + } + out := new(EXTCOMMIndexStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EXTCOMMRangeSyntaxValidator) DeepCopyInto(out *EXTCOMMRangeSyntaxValidator) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMRangeSyntaxValidator. +func (in *EXTCOMMRangeSyntaxValidator) DeepCopy() *EXTCOMMRangeSyntaxValidator { + if in == nil { + return nil + } + out := new(EXTCOMMRangeSyntaxValidator) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EXTCOMMStaticIDSyntaxValidator) DeepCopyInto(out *EXTCOMMStaticIDSyntaxValidator) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EXTCOMMStaticIDSyntaxValidator. +func (in *EXTCOMMStaticIDSyntaxValidator) DeepCopy() *EXTCOMMStaticIDSyntaxValidator { + if in == nil { + return nil + } + out := new(EXTCOMMStaticIDSyntaxValidator) + in.DeepCopyInto(out) + return out +} diff --git a/apis/backend/genid/doc.go b/apis/backend/genid/doc.go new file mode 100644 index 0000000..8c8fad1 --- /dev/null +++ b/apis/backend/genid/doc.go @@ -0,0 +1,21 @@ +/* +Copyright 2024 Nokia. + +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. +*/ + +// +k8s:deepcopy-gen=package,register +// +groupName=genid.be.kuid.dev + +// Package genid is the internal version of the API. +package genid // import "github.com/kuidio/kuid/apis/backend/genid" diff --git a/apis/backend/genid/genid_types.go b/apis/backend/genid/genid_types.go new file mode 100644 index 0000000..d97d59a --- /dev/null +++ b/apis/backend/genid/genid_types.go @@ -0,0 +1,42 @@ +/* +Copyright 2024 Nokia. + +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 genid + +type GENIDType string + +const ( + GENIDType_Invalid GENIDType = "invalid" + GENIDType_16bit GENIDType = "16bit" + GENIDType_32bit GENIDType = "32bit" + GENIDType_48bit GENIDType = "48bit" + GENIDType_64bit GENIDType = "64bit" +) + +func GetGenIDType(s string) GENIDType { + switch s { + case string(GENIDType_16bit): + return GENIDType_16bit + case string(GENIDType_32bit): + return GENIDType_32bit + case string(GENIDType_48bit): + return GENIDType_48bit + case string(GENIDType_64bit): + return GENIDType_64bit + default: + return GENIDType_Invalid + } +} diff --git a/apis/backend/genid/genidclaim_object.go b/apis/backend/genid/genidclaim_object.go new file mode 100644 index 0000000..ba645ae --- /dev/null +++ b/apis/backend/genid/genidclaim_object.go @@ -0,0 +1,395 @@ +/* +Copyright 2024 Nokia. + +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 "VLAN IS" BVLANIS, +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 genid + +import ( + "errors" + "fmt" + "strconv" + "strings" + + "github.com/henderiw/idxtable/pkg/table" + "github.com/henderiw/idxtable/pkg/table/table16" + "github.com/henderiw/idxtable/pkg/tree" + "github.com/henderiw/idxtable/pkg/tree/id16" + "github.com/henderiw/idxtable/pkg/tree/id32" + "github.com/henderiw/store" + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/backend" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/apimachinery/pkg/util/validation/field" + "k8s.io/utils/ptr" +) + +var _ backend.ClaimObject = &GENIDClaim{} + +func (r *GENIDClaim) GetNamespacedName() types.NamespacedName { + return types.NamespacedName{ + Namespace: r.GetNamespace(), + Name: r.GetName(), + } +} + +func (r *GENIDClaim) GetKey() store.Key { + return store.KeyFromNSN(types.NamespacedName{Namespace: r.Namespace, Name: r.Spec.Index}) +} + +// GetCondition returns the condition bVLANed on the condition kind +func (r *GENIDClaim) GetCondition(t condition.ConditionType) condition.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *GENIDClaim) SetConditions(c ...condition.Condition) { + r.Status.SetConditions(c...) +} + +func (r *GENIDClaim) ValidateSyntax(s string) field.ErrorList { + var allErrs field.ErrorList + + if err := r.ValidateGENIDClaimType(); err != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath(""), + r, + err.Error(), + )) + return allErrs + } + var v SyntaxValidator + claimType := r.GetClaimType() + switch claimType { + case backend.ClaimType_DynamicID: + v = &GENIDDynamicIDSyntaxValidator{name: string(claimType)} + case backend.ClaimType_StaticID: + v = &GENIDStaticIDSyntaxValidator{name: string(claimType)} + case backend.ClaimType_Range: + v = &GENIDRangeSyntaxValidator{name: string(claimType)} + default: + return allErrs + } + return v.Validate(r, GetGenIDType(s)) +} + +func (r *GENIDClaim) ValidateGENIDRange(genidType GENIDType) error { + if r.Spec.Range == nil { + return fmt.Errorf("no GENID range provided") + } + parts := strings.SplitN(*r.Spec.Range, "-", 2) + if len(parts) != 2 { + return fmt.Errorf("invalid GENID range, expected -, got: %s", *r.Spec.Range) + } + var errm error + if r.Name == r.Spec.Index { + // to be able to check if the entry is reserved we get a parentname (rang name) equal to index + // this is because the ownerreference uses the name of the index in its labels in the cache + errm = errors.Join(errm, fmt.Errorf("a name of range cannot be the same as the index")) + } + start, err := strconv.Atoi(parts[0]) + if err != nil { + errm = errors.Join(errm, fmt.Errorf("invalid GENID range start, got: %s, err: %s", *r.Spec.Range, err.Error())) + } + end, err := strconv.Atoi(parts[1]) + if err != nil { + errm = errors.Join(errm, fmt.Errorf("invalid GENID range end, got: %s, err: %s", *r.Spec.Range, err.Error())) + } + if errm != nil { + return errm + } + if start > end { + errm = errors.Join(errm, fmt.Errorf("invalid GENID range start > end %s", *r.Spec.Range)) + } + if err := validateGENIDID(genidType, uint64(start)); err != nil { + errm = errors.Join(errm, fmt.Errorf("invalid GENID start err %s", err.Error())) + } + if err := validateGENIDID(genidType, uint64(end)); err != nil { + errm = errors.Join(errm, fmt.Errorf("invalid GENID end err %s", err.Error())) + } + return errm +} + +func (r *GENIDClaim) ValidateGENIDID(genidType GENIDType) error { + if r.Spec.ID == nil { + return fmt.Errorf("no id provided") + } + if err := validateGENIDID(genidType, *r.Spec.ID); err != nil { + return fmt.Errorf("invalid id err %s", err.Error()) + } + return nil +} + +func (r *GENIDClaim) ValidateGENIDClaimType() error { + var sb strings.Builder + count := 0 + if r.Spec.ID != nil { + sb.WriteString(fmt.Sprintf("id: %d", *r.Spec.ID)) + count++ + + } + if r.Spec.Range != nil { + if count > 0 { + sb.WriteString(", ") + } + sb.WriteString(fmt.Sprintf("range: %s", *r.Spec.Range)) + count++ + + } + if count > 1 { + return fmt.Errorf("a claim can only have 1 addressing, got %s", sb.String()) + } + return nil +} + +func (r *GENIDClaim) GetIndex() string { return r.Spec.Index } + +func (r *GENIDClaim) GetSelector() *metav1.LabelSelector { return r.Spec.Selector } + +func (r *GENIDClaim) IsOwner(labels labels.Set) bool { + ownerLabels := r.getOnwerLabels() + for k, v := range ownerLabels { + if val, ok := labels[k]; !ok || val != v { + return false + } + } + return true +} + +func (r *GENIDClaim) getOnwerLabels() map[string]string { + claimName := r.Name + claimKind := r.Kind + claimUID := r.UID + for _, owner := range r.GetOwnerReferences() { + if owner.APIVersion == SchemeGroupVersion.Identifier() && + owner.Kind == GENIDIndexKind { + claimName = owner.Name + claimKind = owner.Kind + claimUID = owner.UID + } + } + + return map[string]string{ + backend.KuidClaimNameKey: claimName, + backend.KuidClaimUIDKey: string(claimUID), + backend.KuidOwnerKindKey: claimKind, + } +} + +// GetOwnerSelector selects the route bVLANed on the name of the claim +func (r *GENIDClaim) GetOwnerSelector() (labels.Selector, error) { + l := r.getOnwerLabels() + + fullselector := labels.NewSelector() + for k, v := range l { + req, err := labels.NewRequirement(k, selection.Equals, []string{v}) + if err != nil { + return nil, err + } + fullselector = fullselector.Add(*req) + } + return fullselector, nil +} + +func (r *GENIDClaim) GetLabelSelector() (labels.Selector, error) { return r.Spec.GetLabelSelector() } + +func (r *GENIDClaim) GetClaimLabels() labels.Set { + labels := r.Spec.GetUserDefinedLabels() + + // for claims originated from the index we need to use the ownerreferences, since these claims + // are never stored in the apiserver, the ip entries need to reference the index instead + claimName := r.Name + claimKind := GENIDClaimKind + claimUID := r.UID + for _, owner := range r.GetOwnerReferences() { + if owner.APIVersion == SchemeGroupVersion.Identifier() && + owner.Kind == GENIDIndexKind { + claimName = owner.Name + claimKind = owner.Kind + claimUID = owner.UID + } + } + // system defined labels + labels[backend.KuidClaimTypeKey] = string(r.GetClaimType()) + labels[backend.KuidClaimNameKey] = claimName + labels[backend.KuidClaimUIDKey] = string(claimUID) + labels[backend.KuidOwnerKindKey] = claimKind + return labels +} + +func (r *GENIDClaim) ValidateOwner(labels labels.Set) error { + routeClaimName := labels[backend.KuidClaimNameKey] + routeClaimUID := labels[backend.KuidClaimUIDKey] + + if string(r.UID) != routeClaimUID && r.Name != routeClaimName { + return fmt.Errorf("route owned by different claim got name %s/%s uid %s/%s", + r.Name, + routeClaimName, + string(r.UID), + routeClaimUID, + ) + } + return nil +} + +func (r *GENIDClaim) GetClaimType() backend.ClaimType { + claimType := backend.ClaimType_Invalid + count := 0 + if r.Spec.ID != nil { + claimType = backend.ClaimType_StaticID + count++ + + } + if r.Spec.Range != nil { + claimType = backend.ClaimType_Range + count++ + + } + if count > 1 { + return backend.ClaimType_Invalid + } + if count == 0 { + return backend.ClaimType_DynamicID + } + return claimType +} +func (r *GENIDClaim) GetStaticID() *uint64 { + if r.Spec.ID == nil { + return nil + } + return ptr.To[uint64](uint64(*r.Spec.ID)) +} +func (r *GENIDClaim) GetStaticTreeID(t string) tree.ID { + if r.Spec.ID == nil { + return nil + } + return id16.NewID(uint16(*r.Spec.ID), id16.IDBitSize) +} + +func (r *GENIDClaim) GetClaimID(t string, id uint64) tree.ID { + return id16.NewID(uint16(id), id16.IDBitSize) +} + +func (r *GENIDClaim) GetRange() *string { + return r.Spec.Range +} + +func (r *GENIDClaim) GetRangeID(t string) (tree.Range, error) { + if r.Spec.Range == nil { + return nil, fmt.Errorf("cannot provide a range without an id") + } + return id32.ParseRange(*r.Spec.Range) +} + +func (r *GENIDClaim) GetTable(t string, to, from uint64) table.Table { + return table16.New(uint16(to), uint16(from)) +} + +func (r *GENIDClaim) SetStatusRange(s *string) { + r.Status.Range = s +} + +func (r *GENIDClaim) SetStatusID(s *uint64) { + if s == nil { + r.Status.ID = nil + return + } + r.Status.ID = ptr.To(*s) +} + +func (r *GENIDClaim) GetStatusID() *uint64 { + if r.Status.ID == nil { + return nil + } + return ptr.To[uint64](uint64(*r.Status.ID)) +} + +func (r *GENIDClaim) GetClaimRequest() string { + // we assume validation is already done when calling this + if r.Spec.ID != nil { + return strconv.Itoa(int(*r.Spec.ID)) + } + if r.Spec.Range != nil { + return *r.Spec.Range + } + return "" +} + +func (r *GENIDClaim) GetClaimResponse() string { + // we assume validation is already done when calling this + if r.Status.ID != nil { + return strconv.Itoa(int(*r.Status.ID)) + } + if r.Status.Range != nil { + return *r.Status.Range + } + return "" +} + +func (r *GENIDClaim) GetClaimSet(typ string) (sets.Set[tree.ID], error) { + arange, err := r.GetRangeID(typ) + if err != nil { + return nil, fmt.Errorf("cannot get range from claim: %v", err) + } + // claim set represents the new entries + newClaimSet := sets.New[tree.ID]() + for _, rangeID := range arange.IDs() { + newClaimSet.Insert(rangeID) + } + return newClaimSet, nil +} + +func GENIDClaimFromUnstructured(ru runtime.Unstructured) (backend.ClaimObject, error) { + obj := &GENIDClaim{} + err := runtime.DefaultUnstructuredConverter.FromUnstructured(ru.UnstructuredContent(), obj) + if err != nil { + return nil, fmt.Errorf("error converting unstructured to asIndex: %v", err) + } + return obj, nil +} + +func GENIDClaimFromRuntime(ru runtime.Object) (backend.ClaimObject, error) { + claim, ok := ru.(*GENIDClaim) + if !ok { + return nil, errors.New("runtime object not GENIDClaim") + } + return claim, nil +} + +// BuildGENIDClaim returns a reource from a client Object a Spec/Status +func BuildGENIDClaim(meta metav1.ObjectMeta, spec *GENIDClaimSpec, status *GENIDClaimStatus) backend.ClaimObject { + vlanspec := GENIDClaimSpec{} + if spec != nil { + vlanspec = *spec + } + vlanstatus := GENIDClaimStatus{} + if status != nil { + vlanstatus = *status + } + return &GENIDClaim{ + TypeMeta: metav1.TypeMeta{ + APIVersion: SchemeGroupVersion.Identifier(), + Kind: GENIDClaimKind, + }, + ObjectMeta: meta, + Spec: vlanspec, + Status: vlanstatus, + } +} diff --git a/apis/backend/genid/genidclaim_resource.go b/apis/backend/genid/genidclaim_resource.go new file mode 100644 index 0000000..a074215 --- /dev/null +++ b/apis/backend/genid/genidclaim_resource.go @@ -0,0 +1,318 @@ +/* +Copyright 2024 Nokia. + +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 "VLAN IS" BVLANIS, +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 genid + +import ( + "context" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/kform-dev/choreo/apis/condition" + apiequality "k8s.io/apimachinery/pkg/api/equality" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/util/validation/field" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +const ( + GENIDClaimPlural = "genidclaims" + GENIDClaimSingular = "genidclaim" +) + +var ( + GENIDClaimShortNames = []string{} + GENIDClaimCategories = []string{"kuid", "knet"} +) + +// +k8s:deepcopy-gen=false +var _ resource.InternalObject = &GENIDClaim{} +var _ resource.ObjectList = &GENIDClaimList{} +var _ resource.ObjectWithStatusSubResource = &GENIDClaim{} +var _ resource.StatusSubResource = &GENIDClaimStatus{} + +func (GENIDClaim) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: GENIDClaimPlural, + } +} + +// IsStorageVersion returns true -- Config is used VLAN the internal version. +// IsStorageVersion implements resource.Object +func (GENIDClaim) IsStorageVersion() bool { + return true +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (GENIDClaim) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *GENIDClaim) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// GetSingularName returns the singular name of the resource +// GetSingularName implements resource.Object +func (GENIDClaim) GetSingularName() string { + return GENIDClaimSingular +} + +// GetShortNames returns the shortnames for the resource +// GetShortNames implements resource.Object +func (GENIDClaim) GetShortNames() []string { + return GENIDClaimShortNames +} + +// GetCategories return the categories of the resource +// GetCategories implements resource.Object +func (GENIDClaim) GetCategories() []string { + return GENIDClaimCategories +} + +// New return an empty resource +// New implements resource.Object +func (GENIDClaim) New() runtime.Object { + return &GENIDClaim{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (GENIDClaim) NewList() runtime.Object { + return &GENIDClaimList{} +} + +// IsEqual returns a bool indicating if the desired state of both resources is equal or not +func (r *GENIDClaim) IsEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*GENIDClaim) + oldobj := old.(*GENIDClaim) + + if !apiequality.Semantic.DeepEqual(oldobj.ObjectMeta, newobj.ObjectMeta) { + return false + } + // if equal we also test the spec + return apiequality.Semantic.DeepEqual(oldobj.Spec, newobj.Spec) +} + +// GetStatus return the resource.StatusSubResource interface +func (r *GENIDClaim) GetStatus() resource.StatusSubResource { + return r.Status +} + +// IsStatusEqual returns a bool indicating if the status of both resources is equal or not +func (r *GENIDClaim) IsStatusEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*GENIDClaim) + oldobj := old.(*GENIDClaim) + return apiequality.Semantic.DeepEqual(oldobj.Status, newobj.Status) +} + +// PrepareForStatusUpdate prepares the status update +func (r *GENIDClaim) PrepareForStatusUpdate(ctx context.Context, obj, old runtime.Object) { + newObj := obj.(*GENIDClaim) + oldObj := old.(*GENIDClaim) + newObj.Spec = oldObj.Spec + + // Status updates are for only for updating status, not objectmeta. + metav1.ResetObjectMetaForStatus(&newObj.ObjectMeta, &newObj.ObjectMeta) +} + +// ValidateStatusUpdate validates status updates +func (r *GENIDClaim) ValidateStatusUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +// SubResourceName resturns the name of the subresource +// SubResourceName implements the resource.StatusSubResource +func (GENIDClaimStatus) SubResourceName() string { + return fmt.Sprintf("%s/%s", GENIDClaimPlural, "status") +} + +// CopyTo copies the content of the status subresource to a parent resource. +// CopyTo implements the resource.StatusSubResource +func (r GENIDClaimStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { + parent, ok := obj.(*GENIDClaim) + if ok { + parent.Status = r + } +} + +// GetListMeta returns the ListMeta +// GetListMeta implements the resource.ObjectList +func (r *GENIDClaimList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// TableConvertor return the table format of the resource +func (r *GENIDClaim) TableConvertor() func(gr schema.GroupResource) rest.TableConvertor { + return func(gr schema.GroupResource) rest.TableConvertor { + return registry.NewTableConverter( + gr, + func(obj runtime.Object) []interface{} { + claim, ok := obj.(*GENIDClaim) + if !ok { + return nil + } + return []interface{}{ + claim.GetName(), + claim.GetCondition(condition.ConditionTypeReady).Status, + claim.GetIndex(), + string(claim.GetClaimType()), + claim.GetClaimRequest(), + claim.GetClaimResponse(), + } + }, + []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + {Name: "Ready", Type: "string"}, + {Name: "Index", Type: "string"}, + {Name: "ClaimType", Type: "string"}, + {Name: "ClaimReq", Type: "string"}, + {Name: "ClaimRsp", Type: "string"}, + }, + ) + } +} + +// FieldLabelConversion is the schema conversion function for normalizing the FieldSelector for the resource +func (r *GENIDClaim) FieldLabelConversion() runtime.FieldLabelConversionFunc { + return func(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } + } +} + +func (r *GENIDClaim) FieldSelector() func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + return func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + var filter *GENIDClaimFilter + + // add the namespace to the list + namespace, ok := genericapirequest.NamespaceFrom(ctx) + if fieldSelector == nil { + if ok { + return &GENIDClaimFilter{Namespace: namespace}, nil + } + return filter, nil + } + requirements := fieldSelector.Requirements() + for _, requirement := range requirements { + filter = &GENIDClaimFilter{} + switch requirement.Operator { + case selection.Equals, selection.DoesNotExist: + if requirement.Value == "" { + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) + } + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) + } + + switch requirement.Field { + case "metadata.name": + filter.Name = requirement.Value + case "metadata.namespace": + filter.Namespace = requirement.Value + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) + } + } + // add namespace to the filter selector if specified + if ok { + if filter != nil { + filter.Namespace = namespace + } else { + filter = &GENIDClaimFilter{Namespace: namespace} + } + return filter, nil + } + + return &GENIDClaimFilter{}, nil + } + +} + +type GENIDClaimFilter struct { + // Name filters by the name of the objects + Name string `protobuf:"bytes,1,opt,name=name"` + + // Namespace filters by the namespace of the objects + Namespace string `protobuf:"bytes,2,opt,name=namespace"` +} + +func (r *GENIDClaimFilter) Filter(ctx context.Context, obj runtime.Object) bool { + f := false // result of the previous filter + o, ok := obj.(*GENIDClaim) + if !ok { + return f + } + if r == nil { + return false + } + if r.Name != "" { + if o.GetName() == r.Name { + f = false + } else { + f = true + } + } + if r.Namespace != "" { + if o.GetNamespace() == r.Namespace { + f = false + } else { + f = true + } + } + return f +} + +func (r *GENIDClaim) PrepareForCreate(ctx context.Context, obj runtime.Object) { + // status cannot be set upon create -> reset it + newobj := obj.(*GENIDClaim) + newobj.Status = GENIDClaimStatus{} +} + +// ValidateCreate statically validates +func (r *GENIDClaim) ValidateCreate(ctx context.Context, obj runtime.Object) field.ErrorList { + return r.ValidateSyntax("") +} + +func (r *GENIDClaim) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { + // ensure the status dont get updated + newobj := obj.(*GENIDClaim) + oldObj := old.(*GENIDClaim) + newobj.Status = oldObj.Status +} + +func (r *GENIDClaim) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + return r.ValidateSyntax("") +} diff --git a/apis/backend/genid/genidclaim_syntaxvalidator.go b/apis/backend/genid/genidclaim_syntaxvalidator.go new file mode 100644 index 0000000..0e56f2d --- /dev/null +++ b/apis/backend/genid/genidclaim_syntaxvalidator.go @@ -0,0 +1,69 @@ +/* +Copyright 2024 Nokia. + +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 genid + +import ( + fmt "fmt" + + "k8s.io/apimachinery/pkg/util/validation/field" +) + +// +kubebuilder:object:generate=false +type SyntaxValidator interface { + Validate(claim *GENIDClaim, genidType GENIDType) field.ErrorList +} + +type GENIDRangeSyntaxValidator struct { + name string +} + +func (r *GENIDRangeSyntaxValidator) Validate(claim *GENIDClaim, genidType GENIDType) field.ErrorList { + var allErrs field.ErrorList + if err := claim.ValidateGENIDRange(genidType); err != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.range"), + claim, + fmt.Errorf("invalid GENID range %s", r.name).Error(), + )) + } + return allErrs +} + +type GENIDDynamicIDSyntaxValidator struct { + name string +} + +func (r *GENIDDynamicIDSyntaxValidator) Validate(claim *GENIDClaim, genidType GENIDType) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +type GENIDStaticIDSyntaxValidator struct { + name string +} + +func (r *GENIDStaticIDSyntaxValidator) Validate(claim *GENIDClaim, genidType GENIDType) field.ErrorList { + var allErrs field.ErrorList + if err := claim.ValidateGENIDID(genidType); err != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.id"), + claim, + fmt.Errorf("invalid GENID id %s", r.name).Error(), + )) + } + return allErrs +} \ No newline at end of file diff --git a/apis/backend/genid/genidclaim_types.go b/apis/backend/genid/genidclaim_types.go new file mode 100644 index 0000000..b744704 --- /dev/null +++ b/apis/backend/genid/genidclaim_types.go @@ -0,0 +1,82 @@ +/* +Copyright 2024 Nokia. + +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 "VLAN IS" BVLANIS, +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 genid + +import ( + "reflect" + + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// GENIDClaimSpec defines the desired state of GENIDClaim +type GENIDClaimSpec struct { + // Index defines the index for the resource + Index string `json:"index" yaml:"index" protobuf:"bytes,1,opt,name=index"` + // ID defines the id of the resource + ID *uint64 `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,2,opt,name=id"` + // Range defines the VLAN range of the resource + // The following notation is used: start-end - + // the VLANs in the range must be consecutive + Range *string `json:"range,omitempty" yaml:"range,omitempty" protobuf:"bytes,3,opt,name=range"` + // ClaimLabels define the user defined labels and selector labels used + // in resource claim + common.ClaimLabels `json:",inline" yaml:",inline" protobuf:"bytes,4,opt,name=claimLabels"` +} + +// GENIDClaimStatus defines the observed state of GENIDClaim +type GENIDClaimStatus struct { + // ConditionedStatus provides the status of the VLANClain using conditions + // - a ready condition indicates the overall status of the resource + condition.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` + // ID defines the ID assigned to the resource + // +optional + ID *uint64 `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,2,opt,name=id"` + // Range defines the range assigned to the resource + // +optional + Range *string `json:"range,omitempty" yaml:"range,omitempty" protobuf:"bytes,3,opt,name=range"` + // ExpiryTime defines when the claim expires + // +kubebuilder:validation:Optional + // +optional + ExpiryTime *string `json:"expiryTime,omitempty" yaml:"expiryTime,omitempty" protobuf:"bytes,4,opt,name=expiryTime"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// GENIDClaim is the Schema for the GENIDClaim API +type GENIDClaim struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec GENIDClaimSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status GENIDClaimStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// GENIDClaimList contains a list of GENIDClaims +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type GENIDClaimList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []GENIDClaim `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + GENIDClaimKind = reflect.TypeOf(GENIDClaim{}).Name() + GENIDClaimListKind = reflect.TypeOf(GENIDClaimList{}).Name() +) diff --git a/apis/backend/genid/genidentry_object.go b/apis/backend/genid/genidentry_object.go new file mode 100644 index 0000000..ccc5e1b --- /dev/null +++ b/apis/backend/genid/genidentry_object.go @@ -0,0 +1,133 @@ +/* +Copyright 2024 Nokia. + +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 genid + +import ( + "errors" + "fmt" + "strings" + + "github.com/henderiw/store" + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/backend" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +var _ backend.EntryObject = &GENIDEntry{} + +func (r *GENIDEntry) GetNamespacedName() types.NamespacedName { + return types.NamespacedName{ + Namespace: r.GetNamespace(), + Name: r.GetName(), + } +} +func (r *GENIDEntry) GetKey() store.Key { + return store.KeyFromNSN(types.NamespacedName{Namespace: r.Namespace, Name: r.Spec.Index}) +} + +// GetCondition returns the condition based on the condition kind +func (r *GENIDEntry) GetCondition(t condition.ConditionType) condition.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *GENIDEntry) SetConditions(c ...condition.Condition) { + r.Status.SetConditions(c...) +} + +func (r *GENIDEntry) ValidateSyntax(s string) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +func (r *GENIDEntry) GetIndex() string { return r.Spec.Index } +func (r *GENIDEntry) GetClaimType() backend.ClaimType { return r.Spec.ClaimType } +func (r *GENIDEntry) GetSpecID() string { return r.Spec.ID } + +func GENIDEntryFromRuntime(ru runtime.Object) (backend.EntryObject, error) { + entry, ok := ru.(*GENIDEntry) + if !ok { + return nil, errors.New("runtime object not ASIndex") + } + return entry, nil +} + +func GetGENIDEntry(k store.Key, vrange, id string, labels map[string]string) backend.EntryObject { + index := k.Name + ns := k.Namespace + + spec := &GENIDEntrySpec{ + Index: index, + ClaimType: backend.GetClaimTypeFromString(labels[backend.KuidClaimTypeKey]), + ID: id, + } + // filter the system defined labels from the labels to prepare for the user defined labels + udLabels := map[string]string{} + for k, v := range labels { + if !backend.BackendSystemKeys.Has(k) { + udLabels[k] = v + } + } + spec.UserDefinedLabels.Labels = udLabels + + id = strings.ReplaceAll(id, "/", "-") + name := fmt.Sprintf("%s.%s", index, id) + if vrange != "" { + name = fmt.Sprintf("%s.%s", vrange, id) + } + + return BuildGENIDEntry( + metav1.ObjectMeta{ + Name: name, + Namespace: ns, + OwnerReferences: []metav1.OwnerReference{ + { + APIVersion: SchemeGroupVersion.Identifier(), + Kind: labels[backend.KuidOwnerKindKey], + Name: labels[backend.KuidClaimNameKey], + UID: types.UID(labels[backend.KuidClaimUIDKey]), + }, + }, + }, + spec, + nil, + ) +} + +func BuildGENIDEntry(meta metav1.ObjectMeta, spec *GENIDEntrySpec, status *GENIDEntryStatus) backend.EntryObject { + vlanspec := GENIDEntrySpec{} + if spec != nil { + vlanspec = *spec + } + vlanstatus := GENIDEntryStatus{} + if status != nil { + vlanstatus = *status + } + return &GENIDEntry{ + TypeMeta: metav1.TypeMeta{ + APIVersion: SchemeGroupVersion.Identifier(), + Kind: GENIDEntryKind, + }, + ObjectMeta: meta, + Spec: vlanspec, + Status: vlanstatus, + } +} diff --git a/apis/backend/genid/genidentry_resource.go b/apis/backend/genid/genidentry_resource.go new file mode 100644 index 0000000..4eacdd1 --- /dev/null +++ b/apis/backend/genid/genidentry_resource.go @@ -0,0 +1,315 @@ +/* +Copyright 2024 Nokia. + +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 genid + +import ( + "context" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + apiequality "k8s.io/apimachinery/pkg/api/equality" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/util/validation/field" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +const ( + GENIDEntryPlural = "vlanentries" + GENIDEntrySingular = "GENIDEntry" +) + +var ( + GENIDEntryShortNames = []string{} + GENIDEntryCategories = []string{"kuid", "knet"} +) + +// +k8s:deepcopy-gen=false +var _ resource.InternalObject = &GENIDEntry{} +var _ resource.ObjectList = &GENIDEntryList{} +var _ resource.ObjectWithStatusSubResource = &GENIDEntry{} +var _ resource.StatusSubResource = &GENIDEntryStatus{} + +func (GENIDEntry) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: GENIDEntryPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (GENIDEntry) IsStorageVersion() bool { + return true +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (GENIDEntry) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *GENIDEntry) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// GetSingularName returns the singular name of the resource +// GetSingularName implements resource.Object +func (GENIDEntry) GetSingularName() string { + return GENIDEntrySingular +} + +// GetShortNames returns the shortnames for the resource +// GetShortNames implements resource.Object +func (GENIDEntry) GetShortNames() []string { + return GENIDEntryShortNames +} + +// GetCategories return the categories of the resource +// GetCategories implements resource.Object +func (GENIDEntry) GetCategories() []string { + return GENIDEntryCategories +} + +// New return an empty resource +// New implements resource.Object +func (GENIDEntry) New() runtime.Object { + return &GENIDEntry{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (GENIDEntry) NewList() runtime.Object { + return &GENIDEntryList{} +} + +// IsEqual returns a bool indicating if the desired state of both resources is equal or not +func (r *GENIDEntry) IsEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*GENIDEntry) + oldobj := old.(*GENIDEntry) + + if !apiequality.Semantic.DeepEqual(oldobj.ObjectMeta, newobj.ObjectMeta) { + return false + } + // if equal we also test the spec + return apiequality.Semantic.DeepEqual(oldobj.Spec, newobj.Spec) +} + +// GetStatus return the resource.StatusSubResource interface +func (r *GENIDEntry) GetStatus() resource.StatusSubResource { + return r.Status +} + +// IsStatusEqual returns a bool indicating if the status of both resources is equal or not +func (r *GENIDEntry) IsStatusEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*GENIDEntry) + oldobj := old.(*GENIDEntry) + return apiequality.Semantic.DeepEqual(oldobj.Status, newobj.Status) +} + +// PrepareForStatusUpdate prepares the status update +func (r *GENIDEntry) PrepareForStatusUpdate(ctx context.Context, obj, old runtime.Object) { + newObj := obj.(*GENIDEntry) + oldObj := old.(*GENIDEntry) + newObj.Spec = oldObj.Spec + + // Status updates are for only for updating status, not objectmeta. + metav1.ResetObjectMetaForStatus(&newObj.ObjectMeta, &newObj.ObjectMeta) +} + +// ValidateStatusUpdate validates status updates +func (r *GENIDEntry) ValidateStatusUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +// SubResourceName resturns the name of the subresource +// SubResourceName implements the resource.StatusSubResource +func (GENIDEntryStatus) SubResourceName() string { + return fmt.Sprintf("%s/%s", GENIDEntryPlural, "status") +} + +// CopyTo copies the content of the status subresource to a parent resource. +// CopyTo implements the resource.StatusSubResource +func (r GENIDEntryStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { + parent, ok := obj.(*GENIDEntry) + if ok { + parent.Status = r + } +} + +// GetListMeta returns the ListMeta +// GetListMeta implements the resource.ObjectList +func (r *GENIDEntryList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// TableConvertor return the table format of the resource +func (r *GENIDEntry) TableConvertor() func(gr schema.GroupResource) rest.TableConvertor { + return func(gr schema.GroupResource) rest.TableConvertor { + return registry.NewTableConverter( + gr, + func(obj runtime.Object) []interface{} { + entry, ok := obj.(*GENIDEntry) + if !ok { + return nil + } + return []interface{}{ + entry.GetName(), + //entry.GetCondition(condition.ConditionTypeReady).Status, + entry.GetIndex(), + entry.GetClaimType(), + entry.GetSpecID(), + } + }, + []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + //{Name: "Ready", Type: "string"}, + {Name: "Index", Type: "string"}, + {Name: "ClaimType", Type: "string"}, + {Name: "ID", Type: "string"}, + }, + ) + } +} + +// FieldLabelConversion is the schema conversion function for normalizing the FieldSelector for the resource +func (r *GENIDEntry) FieldLabelConversion() runtime.FieldLabelConversionFunc { + return func(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } + } +} + +func (r *GENIDEntry) FieldSelector() func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + return func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + var filter *GENIDEntryFilter + + // add the namespace to the list + namespace, ok := genericapirequest.NamespaceFrom(ctx) + if fieldSelector == nil { + if ok { + return &GENIDEntryFilter{Namespace: namespace}, nil + } + return filter, nil + } + requirements := fieldSelector.Requirements() + for _, requirement := range requirements { + filter = &GENIDEntryFilter{} + switch requirement.Operator { + case selection.Equals, selection.DoesNotExist: + if requirement.Value == "" { + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) + } + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) + } + + switch requirement.Field { + case "metadata.name": + filter.Name = requirement.Value + case "metadata.namespace": + filter.Namespace = requirement.Value + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) + } + } + // add namespace to the filter selector if specified + if ok { + if filter != nil { + filter.Namespace = namespace + } else { + filter = &GENIDEntryFilter{Namespace: namespace} + } + return filter, nil + } + + return &GENIDEntryFilter{}, nil + } + +} + +type GENIDEntryFilter struct { + // Name filters by the name of the objects + Name string `protobuf:"bytes,1,opt,name=name"` + + // Namespace filters by the namespace of the objects + Namespace string `protobuf:"bytes,2,opt,name=namespace"` +} + +func (r *GENIDEntryFilter) Filter(ctx context.Context, obj runtime.Object) bool { + f := false // result of the previous filter + o, ok := obj.(*GENIDEntry) + if !ok { + return f + } + if r == nil { + return false + } + if r.Name != "" { + if o.GetName() == r.Name { + f = false + } else { + f = true + } + } + if r.Namespace != "" { + if o.GetNamespace() == r.Namespace { + f = false + } else { + f = true + } + } + return f +} + +func (r *GENIDEntry) PrepareForCreate(ctx context.Context, obj runtime.Object) { + // status cannot be set upon create -> reset it + newobj := obj.(*GENIDEntry) + newobj.Status = GENIDEntryStatus{} +} + +// ValidateCreate statically validates +func (r *GENIDEntry) ValidateCreate(ctx context.Context, obj runtime.Object) field.ErrorList { + return r.ValidateSyntax("") +} + +func (r *GENIDEntry) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { + // ensure the sttaus dont get updated + newobj := obj.(*GENIDEntry) + oldObj := old.(*GENIDEntry) + newobj.Status = oldObj.Status +} + +func (r *GENIDEntry) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + return r.ValidateSyntax("") +} diff --git a/apis/backend/genid/genidentry_types.go b/apis/backend/genid/genidentry_types.go new file mode 100644 index 0000000..af2c349 --- /dev/null +++ b/apis/backend/genid/genidentry_types.go @@ -0,0 +1,71 @@ +/* +Copyright 2024 Nokia. + +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 "VLAN IS" BVLANIS, +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 genid + +import ( + "reflect" + + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/backend" + "github.com/kuidio/kuid/apis/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// GENIDEntrySpec defines the desired state of GENIDEntry +type GENIDEntrySpec struct { + // Index defines the index for the resource + Index string `json:"index" yaml:"index" protobuf:"bytes,1,opt,name=index"` + // ClaimType defines the claimType of the resource + ClaimType backend.ClaimType `json:"claimType,omitempty" yaml:"claimType,omitempty" protobuf:"bytes,2,opt,name=claimType"` + // ID defines the id of the resource in the tree + ID string `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,3,opt,name=id"` + // ClaimLabels define the user defined labels and selector labels used + // in resource claim + common.ClaimLabels `json:",inline" yaml:",inline" protobuf:"bytes,5,opt,name=claimLabels"` +} + +// GENIDEntryStatus defines the observed state of GENIDEntry +type GENIDEntryStatus struct { + // ConditionedStatus provides the status of the GENIDEntry using conditions + // - a ready condition indicates the overall status of the resource + condition.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// GENIDEntry is the Schema for the GENIDEntry API +type GENIDEntry struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec GENIDEntrySpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status GENIDEntryStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// GENIDEntryList contains a list of VLANEntries +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type GENIDEntryList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []GENIDEntry `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + GENIDEntryKind = reflect.TypeOf(GENIDEntry{}).Name() + GENIDEntryListKind = reflect.TypeOf(GENIDEntryList{}).Name() +) diff --git a/apis/backend/genid/genidindex_helpers.go b/apis/backend/genid/genidindex_helpers.go new file mode 100644 index 0000000..987ffe6 --- /dev/null +++ b/apis/backend/genid/genidindex_helpers.go @@ -0,0 +1,98 @@ +/* +Copyright 2024 Nokia. + +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 genid + +import ( + "fmt" + + "github.com/kform-dev/choreo/apis/condition" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +// GetCondition returns the condition based on the condition kind +func (r *GENIDIndex) GetCondition(t condition.ConditionType) condition.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *GENIDIndex) SetConditions(c ...condition.Condition) { + r.Status.SetConditions(c...) +} + +func (r *GENIDIndex) ValidateSyntax(s string) field.ErrorList { + var allErrs field.ErrorList + + if GetGenIDType(r.Spec.Type) == GENIDType_Invalid { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.type"), + r, + fmt.Errorf("invalid GENID Type %s", r.Spec.Type).Error(), + )) + } + + if r.Spec.MinID != nil { + if err := validateGENIDID(GetGenIDType(r.Spec.Type), *r.Spec.MinID); err != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.minID"), + r, + fmt.Errorf("invalid GENID ID %d", *r.Spec.MinID).Error(), + )) + } + } + if r.Spec.MaxID != nil { + if err := validateGENIDID(GetGenIDType(r.Spec.Type), *r.Spec.MaxID); err != nil { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.maxID"), + r, + fmt.Errorf("invalid GENID ID %d", *r.Spec.MaxID).Error(), + )) + } + } + if r.Spec.MinID != nil && r.Spec.MaxID != nil { + if *r.Spec.MinID > *r.Spec.MaxID { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.maxID"), + r, + fmt.Errorf("min GENID ID %d cannot be bigger than max GENID ID %d", *r.Spec.MinID, *r.Spec.MaxID).Error(), + )) + } + } + return allErrs +} + +// BuildGENIDIndex returns a reource from a client Object a Spec/Status +func BuildGENIDIndex(meta metav1.ObjectMeta, spec *GENIDIndexSpec, status *GENIDIndexStatus) *GENIDIndex { + aspec := GENIDIndexSpec{} + if spec != nil { + aspec = *spec + } + astatus := GENIDIndexStatus{} + if status != nil { + astatus = *status + } + return &GENIDIndex{ + TypeMeta: metav1.TypeMeta{ + APIVersion: SchemeGroupVersion.Identifier(), + Kind: GENIDIndexKind, + }, + ObjectMeta: meta, + Spec: aspec, + Status: astatus, + } +} diff --git a/apis/backend/genid/genidindex_object.go b/apis/backend/genid/genidindex_object.go new file mode 100644 index 0000000..32419a8 --- /dev/null +++ b/apis/backend/genid/genidindex_object.go @@ -0,0 +1,173 @@ +/* +Copyright 2024 Nokia. + +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 genid + +import ( + "errors" + "fmt" + + "github.com/henderiw/idxtable/pkg/tree/gtree" + "github.com/henderiw/idxtable/pkg/tree/tree16" + "github.com/henderiw/idxtable/pkg/tree/tree32" + "github.com/henderiw/idxtable/pkg/tree/tree64" + "github.com/henderiw/store" + "github.com/kuidio/kuid/apis/backend" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" + "k8s.io/utils/ptr" +) + +var _ backend.IndexObject = &GENIDIndex{} + +func (r *GENIDIndex) GetKey() store.Key { + return store.KeyFromNSN(r.GetNamespacedName()) +} + +func (r *GENIDIndex) GetNamespacedName() types.NamespacedName { + return types.NamespacedName{ + Namespace: r.GetNamespace(), + Name: r.GetName(), + } +} + +func (r *GENIDIndex) GetTree() gtree.GTree { + switch GetGenIDType(r.Spec.Type) { + case GENIDType_16bit: + tree, err := tree16.New(16) + if err != nil { + return nil + } + return tree + case GENIDType_32bit: + tree, err := tree32.New(32) + if err != nil { + return nil + } + return tree + case GENIDType_48bit: + tree, err := tree64.New(48) + if err != nil { + return nil + } + return tree + case GENIDType_64bit: + tree, err := tree64.New(64) + if err != nil { + return nil + } + return tree + default: + return nil + } +} + +func (r *GENIDIndex) GetType() string { + return r.Spec.Type +} + +func (r *GENIDIndex) GetMinID() *uint64 { + if r.Spec.MinID == nil { + return nil + } + return ptr.To(uint64(*r.Spec.MinID)) +} + +func (r *GENIDIndex) GetMaxID() *uint64 { + if r.Spec.MaxID == nil { + return nil + } + return ptr.To(uint64(*r.Spec.MaxID)) +} + +func (r *GENIDIndex) GetMax() uint64 { + return GENIDID_MaxValue[GetGenIDType(r.Spec.Type)] +} + +func GetMinClaimRange(id uint64) string { + return fmt.Sprintf("%d-%d", GENIDID_Min, id-1) +} + +func GetMaxClaimRange(genidType GENIDType, id uint64) string { + return fmt.Sprintf("%d-%d", id+1, GENIDID_MaxValue[genidType]) +} + +func (r *GENIDIndex) GetMinClaimNSN() types.NamespacedName { + return types.NamespacedName{ + Namespace: r.Namespace, + Name: fmt.Sprintf("%s.%s", r.Name, backend.IndexReservedMinName), + } +} + +func (r *GENIDIndex) GetMaxClaimNSN() types.NamespacedName { + return types.NamespacedName{ + Namespace: r.Namespace, + Name: fmt.Sprintf("%s.%s", r.Name, backend.IndexReservedMaxName), + } +} + +func (r *GENIDIndex) GetMinClaim() backend.ClaimObject { + return BuildGENIDClaim( + metav1.ObjectMeta{ + Namespace: r.GetNamespace(), + Name: r.GetMinClaimNSN().Name, + OwnerReferences: []metav1.OwnerReference{ + { + APIVersion: r.APIVersion, + Kind: r.Kind, + Name: r.Name, + UID: r.UID, + }, + }, + }, + &GENIDClaimSpec{ + Index: r.Name, + Range: ptr.To(GetMinClaimRange(*r.Spec.MinID)), + }, + nil, + ) +} + +func (r *GENIDIndex) GetMaxClaim() backend.ClaimObject { + return BuildGENIDClaim( + metav1.ObjectMeta{ + Namespace: r.GetNamespace(), + Name: r.GetMaxClaimNSN().Name, + OwnerReferences: []metav1.OwnerReference{ + { + APIVersion: r.APIVersion, + Kind: r.Kind, + Name: r.Name, + UID: r.UID, + }, + }, + }, + &GENIDClaimSpec{ + Index: r.Name, + Range: ptr.To(GetMaxClaimRange(GetGenIDType(r.Spec.Type), *r.Spec.MaxID)), + }, + nil, + ) +} + +func GENIDIndexFromRuntime(ru runtime.Object) (backend.IndexObject, error) { + index, ok := ru.(*GENIDIndex) + if !ok { + return nil, errors.New("runtime object not GENIDIndex") + } + return index, nil +} diff --git a/apis/backend/genid/genidindex_resource.go b/apis/backend/genid/genidindex_resource.go new file mode 100644 index 0000000..6d7fa62 --- /dev/null +++ b/apis/backend/genid/genidindex_resource.go @@ -0,0 +1,314 @@ +/* +Copyright 2024 Nokia. + +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 genid + +import ( + "context" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/kform-dev/choreo/apis/condition" + apiequality "k8s.io/apimachinery/pkg/api/equality" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/util/validation/field" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +const ( + GENIDIndexPlural = "genidindices" + GENIDIndexSingular = "genidindex" +) + +var ( + GENIDIndexShortNames = []string{} + GENIDIndexCategories = []string{"kuid", "knet"} +) + +// +k8s:deepcopy-gen=false +var _ resource.InternalObject = &GENIDIndex{} +var _ resource.ObjectList = &GENIDIndexList{} +var _ resource.ObjectWithStatusSubResource = &GENIDIndex{} +var _ resource.StatusSubResource = &GENIDIndexStatus{} + +func (GENIDIndex) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: GENIDIndexPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (GENIDIndex) IsStorageVersion() bool { + return true +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (GENIDIndex) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *GENIDIndex) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// GetSingularName returns the singular name of the resource +// GetSingularName implements resource.Object +func (GENIDIndex) GetSingularName() string { + return GENIDIndexSingular +} + +// GetShortNames returns the shortnames for the resource +// GetShortNames implements resource.Object +func (GENIDIndex) GetShortNames() []string { + return GENIDIndexShortNames +} + +// GetCategories return the categories of the resource +// GetCategories implements resource.Object +func (GENIDIndex) GetCategories() []string { + return GENIDIndexCategories +} + +// New return an empty resource +// New implements resource.Object +func (GENIDIndex) New() runtime.Object { + return &GENIDIndex{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (GENIDIndex) NewList() runtime.Object { + return &GENIDIndexList{} +} + +// IsEqual returns a bool indicating if the desired state of both resources is equal or not +func (r *GENIDIndex) IsEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*GENIDIndex) + oldobj := old.(*GENIDIndex) + + if !apiequality.Semantic.DeepEqual(oldobj.ObjectMeta, newobj.ObjectMeta) { + return false + } + // if equal we also test the spec + return apiequality.Semantic.DeepEqual(oldobj.Spec, newobj.Spec) +} + +// GetStatus return the resource.StatusSubResource interface +func (r *GENIDIndex) GetStatus() resource.StatusSubResource { + return r.Status +} + +// IsStatusEqual returns a bool indicating if the status of both resources is equal or not +func (r *GENIDIndex) IsStatusEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*GENIDIndex) + oldobj := old.(*GENIDIndex) + return apiequality.Semantic.DeepEqual(oldobj.Status, newobj.Status) +} + +// PrepareForStatusUpdate prepares the status update +func (r *GENIDIndex) PrepareForStatusUpdate(ctx context.Context, obj, old runtime.Object) { + newObj := obj.(*GENIDIndex) + oldObj := old.(*GENIDIndex) + newObj.Spec = oldObj.Spec + + // Status updates are for only for updating status, not objectmeta. + metav1.ResetObjectMetaForStatus(&newObj.ObjectMeta, &newObj.ObjectMeta) +} + +// ValidateStatusUpdate validates status updates +func (r *GENIDIndex) ValidateStatusUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +// SubResourceName resturns the name of the subresource +// SubResourceName implements the resource.StatusSubResource +func (GENIDIndexStatus) SubResourceName() string { + return fmt.Sprintf("%s/%s", GENIDIndexPlural, "status") +} + +// CopyTo copies the content of the status subresource to a parent resource. +// CopyTo implements the resource.StatusSubResource +func (r GENIDIndexStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { + parent, ok := obj.(*GENIDIndex) + if ok { + parent.Status = r + } +} + +// GetListMeta returns the ListMeta +// GetListMeta implements the resource.ObjectList +func (r *GENIDIndexList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// TableConvertor return the table format of the resource +func (r *GENIDIndex) TableConvertor() func(gr schema.GroupResource) rest.TableConvertor { + return func(gr schema.GroupResource) rest.TableConvertor { + return registry.NewTableConverter( + gr, + func(obj runtime.Object) []interface{} { + index, ok := obj.(*GENIDIndex) + if !ok { + return nil + } + return []interface{}{ + index.GetName(), + index.GetCondition(condition.ConditionTypeReady).Status, + index.GetMinID(), + index.GetMaxID(), + } + }, + []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + {Name: "Ready", Type: "string"}, + {Name: "MinID", Type: "integer"}, + {Name: "MaxID", Type: "integer"}, + }, + ) + } +} + +// FieldLabelConversion is the schema conversion function for normalizing the FieldSelector for the resource +func (r *GENIDIndex) FieldLabelConversion() runtime.FieldLabelConversionFunc { + return func(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } + } +} + +func (r *GENIDIndex) FieldSelector() func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + return func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + var filter *GENIDIndexFilter + + // add the namespace to the list + namespace, ok := genericapirequest.NamespaceFrom(ctx) + if fieldSelector == nil { + if ok { + return &GENIDIndexFilter{Namespace: namespace}, nil + } + return filter, nil + } + requirements := fieldSelector.Requirements() + for _, requirement := range requirements { + filter = &GENIDIndexFilter{} + switch requirement.Operator { + case selection.Equals, selection.DoesNotExist: + if requirement.Value == "" { + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) + } + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) + } + + switch requirement.Field { + case "metadata.name": + filter.Name = requirement.Value + case "metadata.namespace": + filter.Namespace = requirement.Value + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) + } + } + // add namespace to the filter selector if specified + if ok { + if filter != nil { + filter.Namespace = namespace + } else { + filter = &GENIDIndexFilter{Namespace: namespace} + } + return filter, nil + } + + return &GENIDIndexFilter{}, nil + } + +} + +type GENIDIndexFilter struct { + // Name filters by the name of the objects + Name string `protobuf:"bytes,1,opt,name=name"` + + // Namespace filters by the namespace of the objects + Namespace string `protobuf:"bytes,2,opt,name=namespace"` +} + +func (r *GENIDIndexFilter) Filter(ctx context.Context, obj runtime.Object) bool { + f := false // result of the previous filter + o, ok := obj.(*GENIDIndex) + if !ok { + return f + } + if r == nil { + return false + } + if r.Name != "" { + if o.GetName() == r.Name { + f = false + } else { + f = true + } + } + if r.Namespace != "" { + if o.GetNamespace() == r.Namespace { + f = false + } else { + f = true + } + } + return f +} + +func (r *GENIDIndex) PrepareForCreate(ctx context.Context, obj runtime.Object) { + // status cannot be set upon create -> reset it + newobj := obj.(*GENIDIndex) + newobj.Status = GENIDIndexStatus{} +} + +// ValidateCreate statically validates +func (r *GENIDIndex) ValidateCreate(ctx context.Context, obj runtime.Object) field.ErrorList { + return r.ValidateSyntax("") +} + +func (r *GENIDIndex) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { + // ensure the sttaus dont get updated + newobj := obj.(*GENIDIndex) + oldObj := old.(*GENIDIndex) + newobj.Status = oldObj.Status +} + +func (r *GENIDIndex) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + return r.ValidateSyntax("") +} diff --git a/apis/backend/genid/genidindex_types.go b/apis/backend/genid/genidindex_types.go new file mode 100644 index 0000000..9862272 --- /dev/null +++ b/apis/backend/genid/genidindex_types.go @@ -0,0 +1,79 @@ +/* +Copyright 2024 Nokia. + +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 "VLAN IS" BVLANIS, +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 genid + +import ( + "reflect" + + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// GENIDIndexSpec defines the desired state of GENIDIndex +type GENIDIndexSpec struct { + // MinID defines the min ID the index supports + // +optional + MinID *uint64 `json:"minID,omitempty" yaml:"minID,omitempty" protobuf:"bytes,1,opt,name=minID"` + // MaxID defines the max ID the index supports + // +optional + MaxID *uint64 `json:"maxID,omitempty" yaml:"maxID,omitempty" protobuf:"bytes,2,opt,name=maxID"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + common.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` + // Type defines the type of the GENID + // 16bit, 32bit, 48bit, 64bit + Type string `json:"type,omitempty" yaml:"type,omitempty" protobuf:"bytes,4,opt,name=type"` +} + +// GENIDIndexStatus defines the observed state of GENIDIndex +type GENIDIndexStatus struct { + // MinID defines the min ID the index supports + // +optional + MinID *uint64 `json:"minID,omitempty" yaml:"minID,omitempty" protobuf:"bytes,1,opt,name=minID"` + // MaxID defines the max ID the index supports + // +optional + MaxID *uint64 `json:"maxID,omitempty" yaml:"maxID,omitempty" protobuf:"bytes,2,opt,name=maxID"` + // ConditionedStatus provides the status of the GENIDIndex using conditions + // - a ready condition indicates the overall status of the resource + condition.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// GENIDIndex is the Schema for the GENIDIndex API +type GENIDIndex struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec GENIDIndexSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status GENIDIndexStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// GENIDIndexList contains a list of GENIDIndexs +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type GENIDIndexList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []GENIDIndex `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + GENIDIndexKind = reflect.TypeOf(GENIDIndex{}).Name() + GENIDIndexListKind = reflect.TypeOf(GENIDIndexList{}).Name() +) diff --git a/apis/backend/genid/helper.go b/apis/backend/genid/helper.go new file mode 100644 index 0000000..098f0ce --- /dev/null +++ b/apis/backend/genid/helper.go @@ -0,0 +1,49 @@ +/* +Copyright 2024 Nokia. + +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 genid + +import ( + "fmt" +) + +const GENIDID_Min = 0 + +var GENIDID_MaxBits = map[GENIDType]int{ + GENIDType_Invalid: 0, + GENIDType_16bit: 16, + GENIDType_32bit: 32, + GENIDType_48bit: 48, + GENIDType_64bit: 64, +} + +var GENIDID_MaxValue = map[GENIDType]uint64{ + GENIDType_Invalid: 0, + GENIDType_16bit: 1< GENIDID_MaxValue[genidType] { + return fmt.Errorf("invalid id, got %d", id) + } + return nil +} diff --git a/apis/backend/genid/register.go b/apis/backend/genid/register.go new file mode 100644 index 0000000..2a16345 --- /dev/null +++ b/apis/backend/genid/register.go @@ -0,0 +1,52 @@ +// Copyright 2022 The kpt 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. + +package genid + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +const ( + GroupName = "genid.be.kuid.dev" + Version = runtime.APIVersionInternal +) + +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: Version} + +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme +) + +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &GENIDIndex{}, + &GENIDIndexList{}, + &GENIDClaim{}, + &GENIDClaimList{}, + &GENIDEntry{}, + &GENIDEntryList{}, + ) + return nil +} diff --git a/apis/backend/genid/register/register.go b/apis/backend/genid/register/register.go new file mode 100644 index 0000000..1329138 --- /dev/null +++ b/apis/backend/genid/register/register.go @@ -0,0 +1,113 @@ +/* +Copyright 2024 Nokia. + +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 register + +import ( + "context" + + "github.com/henderiw/apiserver-builder/pkg/builder" + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-builder/pkg/builder/rest" + "github.com/kuidio/kuid/apis/backend/genid" + genidbev1alpha1 "github.com/kuidio/kuid/apis/backend/genid/v1alpha1" + bebackend "github.com/kuidio/kuid/pkg/backend" + genericbackend "github.com/kuidio/kuid/pkg/backend/generic" + "github.com/kuidio/kuid/pkg/config" + genericregistry "github.com/kuidio/kuid/pkg/registry/generic" + "github.com/kuidio/kuid/pkg/registry/options" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apiserver/pkg/registry/generic" +) + +func init() { + config.Register( + genid.SchemeGroupVersion.Group, + genidbev1alpha1.AddToScheme, + NewBackend, + ApplyStorageToBackend, + []*config.ResourceConfig{ + {StorageProviderFn: NewIndexStorageProvider, Internal: &genid.GENIDIndex{}, ResourceVersions: []resource.Object{&genid.GENIDIndex{}, &genidbev1alpha1.GENIDIndex{}}}, + {StorageProviderFn: NewClaimStorageProvider, Internal: &genid.GENIDClaim{}, ResourceVersions: []resource.Object{&genid.GENIDClaim{}, &genidbev1alpha1.GENIDClaim{}}}, + {StorageProviderFn: NewStorageProvider, Internal: &genid.GENIDEntry{}, ResourceVersions: []resource.Object{&genid.GENIDEntry{}, &genidbev1alpha1.GENIDEntry{}}}, + }, + ) +} + +func NewBackend() bebackend.Backend { + return genericbackend.New( + genid.GENIDClaimKind, + genid.GENIDIndexFromRuntime, + genid.GENIDClaimFromRuntime, + genid.GENIDEntryFromRuntime, + genid.GetGENIDEntry, + ) +} + +func NewIndexStorageProvider(ctx context.Context, obj resource.InternalObject, be bebackend.Backend, sync bool, options *options.Options) *rest.StorageProvider { + opts := *options + if sync { + opts.BackendInvoker = bebackend.NewIndexInvoker(be) + return genericregistry.NewStorageProvider(ctx, obj, &opts) + } + return genericregistry.NewStorageProvider(ctx, obj, &opts) +} + +func NewClaimStorageProvider(ctx context.Context, obj resource.InternalObject, be bebackend.Backend, sync bool, options *options.Options) *rest.StorageProvider { + opts := *options + if sync { + opts.BackendInvoker = bebackend.NewClaimInvoker(be) + return genericregistry.NewStorageProvider(ctx, obj, &opts) + } + return genericregistry.NewStorageProvider(ctx, obj, &opts) +} + +func NewStorageProvider(ctx context.Context, obj resource.InternalObject, be bebackend.Backend, sync bool, options *options.Options) *rest.StorageProvider { + return genericregistry.NewStorageProvider(ctx, obj, options) +} + +func ApplyStorageToBackend(ctx context.Context, be bebackend.Backend, apiServer *builder.Server) error { + claimStorageProvider := apiServer.StorageProvider[schema.GroupResource{ + Group: genid.SchemeGroupVersion.Group, + Resource: genid.GENIDClaimPlural, + }] + + claimStorage, err := claimStorageProvider.Get(ctx, apiServer.Schemes[0], &Getter{}) + if err != nil { + return err + } + + entryStorageProvider := apiServer.StorageProvider[schema.GroupResource{ + Group: genid.SchemeGroupVersion.Group, + Resource: genid.GENIDEntryPlural, + }] + + entryStorage, err := entryStorageProvider.Get(ctx, apiServer.Schemes[0], &Getter{}) + if err != nil { + return err + } + + return be.AddStorage(entryStorage, claimStorage) +} + +var _ generic.RESTOptionsGetter = &Getter{} + +type Getter struct{} + +func (r *Getter) GetRESTOptions(resource schema.GroupResource, example runtime.Object) (generic.RESTOptions, error) { + return generic.RESTOptions{}, nil +} diff --git a/apis/backend/genid/v1alpha1/doc.go b/apis/backend/genid/v1alpha1/doc.go new file mode 100644 index 0000000..5225978 --- /dev/null +++ b/apis/backend/genid/v1alpha1/doc.go @@ -0,0 +1,28 @@ +/* +Copyright 2024 Nokia. + +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. +*/ + +//go:generate deepcopy-gen -O zz_generated.deepcopy -i . -h ../../../../boilerplate.go.txt +//go:generate defaulter-gen -O zz_generated.defaults -i . -h ../../../../boilerplate.go.txt +//go:generate conversion-gen -O zz_generated.conversion -i . -h ../../../../boilerplate.go.txt + +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen=package,register +// +k8s:conversion-gen=github.com/kuidio/kuid/apis/backend/genid +// +k8s:defaulter-gen=TypeMeta +// +groupName=genid.be.kuid.dev + +// v1alpha1 is the v1alpha1 version of the API. +package v1alpha1 diff --git a/apis/backend/genid/v1alpha1/genidclaim_resource.go b/apis/backend/genid/v1alpha1/genidclaim_resource.go new file mode 100644 index 0000000..2c77e51 --- /dev/null +++ b/apis/backend/genid/v1alpha1/genidclaim_resource.go @@ -0,0 +1,80 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/kuidio/kuid/apis/backend/genid" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +k8s:deepcopy-gen=false +var _ resource.Object = &GENIDClaim{} +var _ resource.ObjectList = &GENIDClaimList{} +var _ resource.MultiVersionObject = &GENIDClaim{} + +func (GENIDClaim) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: genid.GENIDClaimPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (GENIDClaim) IsStorageVersion() bool { + return false +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (GENIDClaim) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *GENIDClaim) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// New return an empty resource +// New implements resource.Object +func (GENIDClaim) New() runtime.Object { + return &GENIDClaim{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (GENIDClaim) NewList() runtime.Object { + return &GENIDClaimList{} +} + +// GetListMeta returns the ListMeta +// GetListMeta implements resource.ObjectList +func (r *GENIDClaimList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// RegisterConversions registers the conversions. +// RegisterConversions implements resource.MultiVersionObject +func (GENIDClaim) RegisterConversions() func(s *runtime.Scheme) error { + return RegisterConversions +} diff --git a/apis/backend/genid/v1alpha1/genidclaim_types.go b/apis/backend/genid/v1alpha1/genidclaim_types.go new file mode 100644 index 0000000..8b261c5 --- /dev/null +++ b/apis/backend/genid/v1alpha1/genidclaim_types.go @@ -0,0 +1,82 @@ +/* +Copyright 2024 Nokia. + +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 "VLAN IS" BVLANIS, +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 v1alpha1 + +import ( + "reflect" + + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// GENIDClaimSpec defines the desired state of GENIDClaim +type GENIDClaimSpec struct { + // Index defines the index for the resource + Index string `json:"index" yaml:"index" protobuf:"bytes,1,opt,name=index"` + // ID defines the id of the resource + ID *uint64 `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,2,opt,name=id"` + // Range defines the VLAN range of the resource + // The following notation is used: start-end - + // the VLANs in the range must be consecutive + Range *string `json:"range,omitempty" yaml:"range,omitempty" protobuf:"bytes,3,opt,name=range"` + // ClaimLabels define the user defined labels and selector labels used + // in resource claim + commonv1alpha1.ClaimLabels `json:",inline" yaml:",inline" protobuf:"bytes,4,opt,name=claimLabels"` +} + +// GENIDClaimStatus defines the observed state of GENIDClaim +type GENIDClaimStatus struct { + // ConditionedStatus provides the status of the VLANClain using conditions + // - a ready condition indicates the overall status of the resource + condv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` + // ID defines the ID assigned to the resource + // +optional + ID *uint64 `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,2,opt,name=id"` + // Range defines the range assigned to the resource + // +optional + Range *string `json:"range,omitempty" yaml:"range,omitempty" protobuf:"bytes,3,opt,name=range"` + // ExpiryTime defines when the claim expires + // +kubebuilder:validation:Optional + // +optional + ExpiryTime *string `json:"expiryTime,omitempty" yaml:"expiryTime,omitempty" protobuf:"bytes,4,opt,name=expiryTime"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// GENIDClaim is the Schema for the GENIDClaim API +type GENIDClaim struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec GENIDClaimSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status GENIDClaimStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// GENIDClaimList contains a list of GENIDClaims +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type GENIDClaimList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []GENIDClaim `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + GENIDClaimKind = reflect.TypeOf(GENIDClaim{}).Name() + GENIDClaimListKind = reflect.TypeOf(GENIDClaimList{}).Name() +) diff --git a/apis/backend/genid/v1alpha1/genidentry_resource.go b/apis/backend/genid/v1alpha1/genidentry_resource.go new file mode 100644 index 0000000..03d0ab8 --- /dev/null +++ b/apis/backend/genid/v1alpha1/genidentry_resource.go @@ -0,0 +1,80 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/kuidio/kuid/apis/backend/genid" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +k8s:deepcopy-gen=false +var _ resource.Object = &GENIDEntry{} +var _ resource.ObjectList = &GENIDEntryList{} +var _ resource.MultiVersionObject = &GENIDEntry{} + +func (GENIDEntry) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: genid.GENIDEntryPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (GENIDEntry) IsStorageVersion() bool { + return false +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (GENIDEntry) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *GENIDEntry) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// New return an empty resource +// New implements resource.Object +func (GENIDEntry) New() runtime.Object { + return &GENIDEntry{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (GENIDEntry) NewList() runtime.Object { + return &GENIDEntryList{} +} + +// GetListMeta returns the ListMeta +// GetListMeta implements resource.ObjectList +func (r *GENIDEntryList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// RegisterConversions registers the conversions. +// RegisterConversions implements resource.MultiVersionObject +func (GENIDEntry) RegisterConversions() func(s *runtime.Scheme) error { + return RegisterConversions +} diff --git a/apis/backend/genid/v1alpha1/genidentry_types.go b/apis/backend/genid/v1alpha1/genidentry_types.go new file mode 100644 index 0000000..3fe0182 --- /dev/null +++ b/apis/backend/genid/v1alpha1/genidentry_types.go @@ -0,0 +1,71 @@ +/* +Copyright 2024 Nokia. + +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 "VLAN IS" BVLANIS, +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 v1alpha1 + +import ( + "reflect" + + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + "github.com/kuidio/kuid/apis/backend" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// GENIDEntrySpec defines the desired state of GENIDEntry +type GENIDEntrySpec struct { + // Index defines the index for the resource + Index string `json:"index" yaml:"index" protobuf:"bytes,1,opt,name=index"` + // ClaimType defines the claimType of the resource + ClaimType backend.ClaimType `json:"claimType,omitempty" yaml:"claimType,omitempty" protobuf:"bytes,2,opt,name=claimType"` + // ID defines the id of the resource in the tree + ID string `json:"id,omitempty" yaml:"id,omitempty" protobuf:"bytes,3,opt,name=id"` + // ClaimLabels define the user defined labels and selector labels used + // in resource claim + commonv1alpha1.ClaimLabels `json:",inline" yaml:",inline" protobuf:"bytes,5,opt,name=claimLabels"` +} + +// GENIDEntryStatus defines the observed state of GENIDEntry +type GENIDEntryStatus struct { + // ConditionedStatus provides the status of the GENIDEntry using conditions + // - a ready condition indicates the overall status of the resource + condv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// GENIDEntry is the Schema for the GENIDEntry API +type GENIDEntry struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec GENIDEntrySpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status GENIDEntryStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// GENIDEntryList contains a list of VLANEntries +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type GENIDEntryList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []GENIDEntry `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + GENIDEntryKind = reflect.TypeOf(GENIDEntry{}).Name() + GENIDEntryListKind = reflect.TypeOf(GENIDEntryList{}).Name() +) diff --git a/apis/backend/genid/v1alpha1/genidindex_resource.go b/apis/backend/genid/v1alpha1/genidindex_resource.go new file mode 100644 index 0000000..541cec6 --- /dev/null +++ b/apis/backend/genid/v1alpha1/genidindex_resource.go @@ -0,0 +1,80 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/kuidio/kuid/apis/backend/genid" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +k8s:deepcopy-gen=false +var _ resource.Object = &GENIDIndex{} +var _ resource.ObjectList = &GENIDIndexList{} +var _ resource.MultiVersionObject = &GENIDIndex{} + +func (GENIDIndex) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: genid.GENIDIndexPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (GENIDIndex) IsStorageVersion() bool { + return false +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (GENIDIndex) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *GENIDIndex) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// New return an empty resource +// New implements resource.Object +func (GENIDIndex) New() runtime.Object { + return &GENIDIndex{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (GENIDIndex) NewList() runtime.Object { + return &GENIDIndexList{} +} + +// GetListMeta returns the ListMeta +// GetListMeta implements resource.ObjectList +func (r *GENIDIndexList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// RegisterConversions registers the conversions. +// RegisterConversions implements resource.MultiVersionObject +func (GENIDIndex) RegisterConversions() func(s *runtime.Scheme) error { + return RegisterConversions +} diff --git a/apis/backend/genid/v1alpha1/genidindex_types.go b/apis/backend/genid/v1alpha1/genidindex_types.go new file mode 100644 index 0000000..6a9498c --- /dev/null +++ b/apis/backend/genid/v1alpha1/genidindex_types.go @@ -0,0 +1,79 @@ +/* +Copyright 2024 Nokia. + +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 "VLAN IS" BVLANIS, +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 v1alpha1 + +import ( + "reflect" + + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// GENIDIndexSpec defines the desired state of GENIDIndex +type GENIDIndexSpec struct { + // MinID defines the min ID the index supports + // +optional + MinID *uint64 `json:"minID,omitempty" yaml:"minID,omitempty" protobuf:"bytes,1,opt,name=minID"` + // MaxID defines the max ID the index supports + // +optional + MaxID *uint64 `json:"maxID,omitempty" yaml:"maxID,omitempty" protobuf:"bytes,2,opt,name=maxID"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` + // Type defines the type of the GENID + // 16bit, 32bit, 48bit, 64bit + Type string `json:"type,omitempty" yaml:"type,omitempty" protobuf:"bytes,4,opt,name=type"` +} + +// GENIDIndexStatus defines the observed state of GENIDIndex +type GENIDIndexStatus struct { + // MinID defines the min ID the index supports + // +optional + MinID *uint64 `json:"minID,omitempty" yaml:"minID,omitempty" protobuf:"bytes,1,opt,name=minID"` + // MaxID defines the max ID the index supports + // +optional + MaxID *uint64 `json:"maxID,omitempty" yaml:"maxID,omitempty" protobuf:"bytes,2,opt,name=maxID"` + // ConditionedStatus provides the status of the GENIDIndex using conditions + // - a ready condition indicates the overall status of the resource + condv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// GENIDIndex is the Schema for the GENIDIndex API +type GENIDIndex struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec GENIDIndexSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status GENIDIndexStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// GENIDIndexList contains a list of GENIDIndexs +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type GENIDIndexList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []GENIDIndex `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + GENIDIndexKind = reflect.TypeOf(GENIDIndex{}).Name() + GENIDIndexListKind = reflect.TypeOf(GENIDIndexList{}).Name() +) diff --git a/apis/backend/genid/v1alpha1/register.go b/apis/backend/genid/v1alpha1/register.go new file mode 100644 index 0000000..dd85081 --- /dev/null +++ b/apis/backend/genid/v1alpha1/register.go @@ -0,0 +1,67 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "github.com/kuidio/kuid/apis/backend/genid" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +const ( + Version = "v1alpha1" +) + +var ( + // SchemeGroupVersion contains the API group and version information for the types in this package. + SchemeGroupVersion = schema.GroupVersion{Group: genid.GroupName, Version: Version} + // AddToScheme applies all the stored functions to the scheme. A non-nil error + // indicates that one function failed and the attempt was abandoned. + //AddToScheme = (&runtime.SchemeBuilder{}).AddToScheme + AddToScheme = localSchemeBuilder.AddToScheme + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + schemeBuilder runtime.SchemeBuilder + localSchemeBuilder = &schemeBuilder +) + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +func init() { + localSchemeBuilder.Register(addKnownTypes) +} + +// Adds the list of known types to the given scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + // +kubebuilder:scaffold:install + + scheme.AddKnownTypes(SchemeGroupVersion, + &GENIDIndex{}, + &GENIDIndexList{}, + &GENIDClaim{}, + &GENIDClaimList{}, + &GENIDEntry{}, + &GENIDEntryList{}, + ) + + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/apis/backend/genid/v1alpha1/zz_generated.conversion.go b/apis/backend/genid/v1alpha1/zz_generated.conversion.go new file mode 100644 index 0000000..d39d929 --- /dev/null +++ b/apis/backend/genid/v1alpha1/zz_generated.conversion.go @@ -0,0 +1,555 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2024 Nokia. + +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 conversion-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + unsafe "unsafe" + + backend "github.com/kuidio/kuid/apis/backend" + asv1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" + genid "github.com/kuidio/kuid/apis/backend/genid" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +func init() { + localSchemeBuilder.Register(RegisterConversions) +} + +// RegisterConversions adds conversion functions to the given scheme. +// Public to allow building arbitrary schemes. +func RegisterConversions(s *runtime.Scheme) error { + if err := s.AddGeneratedConversionFunc((*GENIDClaim)(nil), (*genid.GENIDClaim)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_GENIDClaim_To_genid_GENIDClaim(a.(*GENIDClaim), b.(*genid.GENIDClaim), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*genid.GENIDClaim)(nil), (*GENIDClaim)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_genid_GENIDClaim_To_v1alpha1_GENIDClaim(a.(*genid.GENIDClaim), b.(*GENIDClaim), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*GENIDClaimList)(nil), (*genid.GENIDClaimList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_GENIDClaimList_To_genid_GENIDClaimList(a.(*GENIDClaimList), b.(*genid.GENIDClaimList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*genid.GENIDClaimList)(nil), (*GENIDClaimList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_genid_GENIDClaimList_To_v1alpha1_GENIDClaimList(a.(*genid.GENIDClaimList), b.(*GENIDClaimList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*GENIDClaimSpec)(nil), (*genid.GENIDClaimSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_GENIDClaimSpec_To_genid_GENIDClaimSpec(a.(*GENIDClaimSpec), b.(*genid.GENIDClaimSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*genid.GENIDClaimSpec)(nil), (*GENIDClaimSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_genid_GENIDClaimSpec_To_v1alpha1_GENIDClaimSpec(a.(*genid.GENIDClaimSpec), b.(*GENIDClaimSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*GENIDClaimStatus)(nil), (*genid.GENIDClaimStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_GENIDClaimStatus_To_genid_GENIDClaimStatus(a.(*GENIDClaimStatus), b.(*genid.GENIDClaimStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*genid.GENIDClaimStatus)(nil), (*GENIDClaimStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_genid_GENIDClaimStatus_To_v1alpha1_GENIDClaimStatus(a.(*genid.GENIDClaimStatus), b.(*GENIDClaimStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*GENIDEntry)(nil), (*genid.GENIDEntry)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_GENIDEntry_To_genid_GENIDEntry(a.(*GENIDEntry), b.(*genid.GENIDEntry), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*genid.GENIDEntry)(nil), (*GENIDEntry)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_genid_GENIDEntry_To_v1alpha1_GENIDEntry(a.(*genid.GENIDEntry), b.(*GENIDEntry), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*GENIDEntryList)(nil), (*genid.GENIDEntryList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_GENIDEntryList_To_genid_GENIDEntryList(a.(*GENIDEntryList), b.(*genid.GENIDEntryList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*genid.GENIDEntryList)(nil), (*GENIDEntryList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_genid_GENIDEntryList_To_v1alpha1_GENIDEntryList(a.(*genid.GENIDEntryList), b.(*GENIDEntryList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*GENIDEntrySpec)(nil), (*genid.GENIDEntrySpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_GENIDEntrySpec_To_genid_GENIDEntrySpec(a.(*GENIDEntrySpec), b.(*genid.GENIDEntrySpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*genid.GENIDEntrySpec)(nil), (*GENIDEntrySpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_genid_GENIDEntrySpec_To_v1alpha1_GENIDEntrySpec(a.(*genid.GENIDEntrySpec), b.(*GENIDEntrySpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*GENIDEntryStatus)(nil), (*genid.GENIDEntryStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_GENIDEntryStatus_To_genid_GENIDEntryStatus(a.(*GENIDEntryStatus), b.(*genid.GENIDEntryStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*genid.GENIDEntryStatus)(nil), (*GENIDEntryStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_genid_GENIDEntryStatus_To_v1alpha1_GENIDEntryStatus(a.(*genid.GENIDEntryStatus), b.(*GENIDEntryStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*GENIDIndex)(nil), (*genid.GENIDIndex)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_GENIDIndex_To_genid_GENIDIndex(a.(*GENIDIndex), b.(*genid.GENIDIndex), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*genid.GENIDIndex)(nil), (*GENIDIndex)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_genid_GENIDIndex_To_v1alpha1_GENIDIndex(a.(*genid.GENIDIndex), b.(*GENIDIndex), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*GENIDIndexList)(nil), (*genid.GENIDIndexList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_GENIDIndexList_To_genid_GENIDIndexList(a.(*GENIDIndexList), b.(*genid.GENIDIndexList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*genid.GENIDIndexList)(nil), (*GENIDIndexList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_genid_GENIDIndexList_To_v1alpha1_GENIDIndexList(a.(*genid.GENIDIndexList), b.(*GENIDIndexList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*GENIDIndexSpec)(nil), (*genid.GENIDIndexSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_GENIDIndexSpec_To_genid_GENIDIndexSpec(a.(*GENIDIndexSpec), b.(*genid.GENIDIndexSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*genid.GENIDIndexSpec)(nil), (*GENIDIndexSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_genid_GENIDIndexSpec_To_v1alpha1_GENIDIndexSpec(a.(*genid.GENIDIndexSpec), b.(*GENIDIndexSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*GENIDIndexStatus)(nil), (*genid.GENIDIndexStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_GENIDIndexStatus_To_genid_GENIDIndexStatus(a.(*GENIDIndexStatus), b.(*genid.GENIDIndexStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*genid.GENIDIndexStatus)(nil), (*GENIDIndexStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_genid_GENIDIndexStatus_To_v1alpha1_GENIDIndexStatus(a.(*genid.GENIDIndexStatus), b.(*GENIDIndexStatus), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1alpha1_GENIDClaim_To_genid_GENIDClaim(in *GENIDClaim, out *genid.GENIDClaim, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_GENIDClaimSpec_To_genid_GENIDClaimSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_GENIDClaimStatus_To_genid_GENIDClaimStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_GENIDClaim_To_genid_GENIDClaim is an autogenerated conversion function. +func Convert_v1alpha1_GENIDClaim_To_genid_GENIDClaim(in *GENIDClaim, out *genid.GENIDClaim, s conversion.Scope) error { + return autoConvert_v1alpha1_GENIDClaim_To_genid_GENIDClaim(in, out, s) +} + +func autoConvert_genid_GENIDClaim_To_v1alpha1_GENIDClaim(in *genid.GENIDClaim, out *GENIDClaim, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_genid_GENIDClaimSpec_To_v1alpha1_GENIDClaimSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_genid_GENIDClaimStatus_To_v1alpha1_GENIDClaimStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_genid_GENIDClaim_To_v1alpha1_GENIDClaim is an autogenerated conversion function. +func Convert_genid_GENIDClaim_To_v1alpha1_GENIDClaim(in *genid.GENIDClaim, out *GENIDClaim, s conversion.Scope) error { + return autoConvert_genid_GENIDClaim_To_v1alpha1_GENIDClaim(in, out, s) +} + +func autoConvert_v1alpha1_GENIDClaimList_To_genid_GENIDClaimList(in *GENIDClaimList, out *genid.GENIDClaimList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]genid.GENIDClaim, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_GENIDClaim_To_genid_GENIDClaim(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_GENIDClaimList_To_genid_GENIDClaimList is an autogenerated conversion function. +func Convert_v1alpha1_GENIDClaimList_To_genid_GENIDClaimList(in *GENIDClaimList, out *genid.GENIDClaimList, s conversion.Scope) error { + return autoConvert_v1alpha1_GENIDClaimList_To_genid_GENIDClaimList(in, out, s) +} + +func autoConvert_genid_GENIDClaimList_To_v1alpha1_GENIDClaimList(in *genid.GENIDClaimList, out *GENIDClaimList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]GENIDClaim, len(*in)) + for i := range *in { + if err := Convert_genid_GENIDClaim_To_v1alpha1_GENIDClaim(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_genid_GENIDClaimList_To_v1alpha1_GENIDClaimList is an autogenerated conversion function. +func Convert_genid_GENIDClaimList_To_v1alpha1_GENIDClaimList(in *genid.GENIDClaimList, out *GENIDClaimList, s conversion.Scope) error { + return autoConvert_genid_GENIDClaimList_To_v1alpha1_GENIDClaimList(in, out, s) +} + +func autoConvert_v1alpha1_GENIDClaimSpec_To_genid_GENIDClaimSpec(in *GENIDClaimSpec, out *genid.GENIDClaimSpec, s conversion.Scope) error { + out.Index = in.Index + out.ID = (*uint64)(unsafe.Pointer(in.ID)) + out.Range = (*string)(unsafe.Pointer(in.Range)) + if err := asv1alpha1.Convert_v1alpha1_ClaimLabels_To_common_ClaimLabels(&in.ClaimLabels, &out.ClaimLabels, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_GENIDClaimSpec_To_genid_GENIDClaimSpec is an autogenerated conversion function. +func Convert_v1alpha1_GENIDClaimSpec_To_genid_GENIDClaimSpec(in *GENIDClaimSpec, out *genid.GENIDClaimSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_GENIDClaimSpec_To_genid_GENIDClaimSpec(in, out, s) +} + +func autoConvert_genid_GENIDClaimSpec_To_v1alpha1_GENIDClaimSpec(in *genid.GENIDClaimSpec, out *GENIDClaimSpec, s conversion.Scope) error { + out.Index = in.Index + out.ID = (*uint64)(unsafe.Pointer(in.ID)) + out.Range = (*string)(unsafe.Pointer(in.Range)) + if err := asv1alpha1.Convert_common_ClaimLabels_To_v1alpha1_ClaimLabels(&in.ClaimLabels, &out.ClaimLabels, s); err != nil { + return err + } + return nil +} + +// Convert_genid_GENIDClaimSpec_To_v1alpha1_GENIDClaimSpec is an autogenerated conversion function. +func Convert_genid_GENIDClaimSpec_To_v1alpha1_GENIDClaimSpec(in *genid.GENIDClaimSpec, out *GENIDClaimSpec, s conversion.Scope) error { + return autoConvert_genid_GENIDClaimSpec_To_v1alpha1_GENIDClaimSpec(in, out, s) +} + +func autoConvert_v1alpha1_GENIDClaimStatus_To_genid_GENIDClaimStatus(in *GENIDClaimStatus, out *genid.GENIDClaimStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + out.ID = (*uint64)(unsafe.Pointer(in.ID)) + out.Range = (*string)(unsafe.Pointer(in.Range)) + out.ExpiryTime = (*string)(unsafe.Pointer(in.ExpiryTime)) + return nil +} + +// Convert_v1alpha1_GENIDClaimStatus_To_genid_GENIDClaimStatus is an autogenerated conversion function. +func Convert_v1alpha1_GENIDClaimStatus_To_genid_GENIDClaimStatus(in *GENIDClaimStatus, out *genid.GENIDClaimStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_GENIDClaimStatus_To_genid_GENIDClaimStatus(in, out, s) +} + +func autoConvert_genid_GENIDClaimStatus_To_v1alpha1_GENIDClaimStatus(in *genid.GENIDClaimStatus, out *GENIDClaimStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + out.ID = (*uint64)(unsafe.Pointer(in.ID)) + out.Range = (*string)(unsafe.Pointer(in.Range)) + out.ExpiryTime = (*string)(unsafe.Pointer(in.ExpiryTime)) + return nil +} + +// Convert_genid_GENIDClaimStatus_To_v1alpha1_GENIDClaimStatus is an autogenerated conversion function. +func Convert_genid_GENIDClaimStatus_To_v1alpha1_GENIDClaimStatus(in *genid.GENIDClaimStatus, out *GENIDClaimStatus, s conversion.Scope) error { + return autoConvert_genid_GENIDClaimStatus_To_v1alpha1_GENIDClaimStatus(in, out, s) +} + +func autoConvert_v1alpha1_GENIDEntry_To_genid_GENIDEntry(in *GENIDEntry, out *genid.GENIDEntry, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_GENIDEntrySpec_To_genid_GENIDEntrySpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_GENIDEntryStatus_To_genid_GENIDEntryStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_GENIDEntry_To_genid_GENIDEntry is an autogenerated conversion function. +func Convert_v1alpha1_GENIDEntry_To_genid_GENIDEntry(in *GENIDEntry, out *genid.GENIDEntry, s conversion.Scope) error { + return autoConvert_v1alpha1_GENIDEntry_To_genid_GENIDEntry(in, out, s) +} + +func autoConvert_genid_GENIDEntry_To_v1alpha1_GENIDEntry(in *genid.GENIDEntry, out *GENIDEntry, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_genid_GENIDEntrySpec_To_v1alpha1_GENIDEntrySpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_genid_GENIDEntryStatus_To_v1alpha1_GENIDEntryStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_genid_GENIDEntry_To_v1alpha1_GENIDEntry is an autogenerated conversion function. +func Convert_genid_GENIDEntry_To_v1alpha1_GENIDEntry(in *genid.GENIDEntry, out *GENIDEntry, s conversion.Scope) error { + return autoConvert_genid_GENIDEntry_To_v1alpha1_GENIDEntry(in, out, s) +} + +func autoConvert_v1alpha1_GENIDEntryList_To_genid_GENIDEntryList(in *GENIDEntryList, out *genid.GENIDEntryList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]genid.GENIDEntry, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_GENIDEntry_To_genid_GENIDEntry(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_GENIDEntryList_To_genid_GENIDEntryList is an autogenerated conversion function. +func Convert_v1alpha1_GENIDEntryList_To_genid_GENIDEntryList(in *GENIDEntryList, out *genid.GENIDEntryList, s conversion.Scope) error { + return autoConvert_v1alpha1_GENIDEntryList_To_genid_GENIDEntryList(in, out, s) +} + +func autoConvert_genid_GENIDEntryList_To_v1alpha1_GENIDEntryList(in *genid.GENIDEntryList, out *GENIDEntryList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]GENIDEntry, len(*in)) + for i := range *in { + if err := Convert_genid_GENIDEntry_To_v1alpha1_GENIDEntry(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_genid_GENIDEntryList_To_v1alpha1_GENIDEntryList is an autogenerated conversion function. +func Convert_genid_GENIDEntryList_To_v1alpha1_GENIDEntryList(in *genid.GENIDEntryList, out *GENIDEntryList, s conversion.Scope) error { + return autoConvert_genid_GENIDEntryList_To_v1alpha1_GENIDEntryList(in, out, s) +} + +func autoConvert_v1alpha1_GENIDEntrySpec_To_genid_GENIDEntrySpec(in *GENIDEntrySpec, out *genid.GENIDEntrySpec, s conversion.Scope) error { + out.Index = in.Index + out.ClaimType = backend.ClaimType(in.ClaimType) + out.ID = in.ID + if err := asv1alpha1.Convert_v1alpha1_ClaimLabels_To_common_ClaimLabels(&in.ClaimLabels, &out.ClaimLabels, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_GENIDEntrySpec_To_genid_GENIDEntrySpec is an autogenerated conversion function. +func Convert_v1alpha1_GENIDEntrySpec_To_genid_GENIDEntrySpec(in *GENIDEntrySpec, out *genid.GENIDEntrySpec, s conversion.Scope) error { + return autoConvert_v1alpha1_GENIDEntrySpec_To_genid_GENIDEntrySpec(in, out, s) +} + +func autoConvert_genid_GENIDEntrySpec_To_v1alpha1_GENIDEntrySpec(in *genid.GENIDEntrySpec, out *GENIDEntrySpec, s conversion.Scope) error { + out.Index = in.Index + out.ClaimType = backend.ClaimType(in.ClaimType) + out.ID = in.ID + if err := asv1alpha1.Convert_common_ClaimLabels_To_v1alpha1_ClaimLabels(&in.ClaimLabels, &out.ClaimLabels, s); err != nil { + return err + } + return nil +} + +// Convert_genid_GENIDEntrySpec_To_v1alpha1_GENIDEntrySpec is an autogenerated conversion function. +func Convert_genid_GENIDEntrySpec_To_v1alpha1_GENIDEntrySpec(in *genid.GENIDEntrySpec, out *GENIDEntrySpec, s conversion.Scope) error { + return autoConvert_genid_GENIDEntrySpec_To_v1alpha1_GENIDEntrySpec(in, out, s) +} + +func autoConvert_v1alpha1_GENIDEntryStatus_To_genid_GENIDEntryStatus(in *GENIDEntryStatus, out *genid.GENIDEntryStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_GENIDEntryStatus_To_genid_GENIDEntryStatus is an autogenerated conversion function. +func Convert_v1alpha1_GENIDEntryStatus_To_genid_GENIDEntryStatus(in *GENIDEntryStatus, out *genid.GENIDEntryStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_GENIDEntryStatus_To_genid_GENIDEntryStatus(in, out, s) +} + +func autoConvert_genid_GENIDEntryStatus_To_v1alpha1_GENIDEntryStatus(in *genid.GENIDEntryStatus, out *GENIDEntryStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_genid_GENIDEntryStatus_To_v1alpha1_GENIDEntryStatus is an autogenerated conversion function. +func Convert_genid_GENIDEntryStatus_To_v1alpha1_GENIDEntryStatus(in *genid.GENIDEntryStatus, out *GENIDEntryStatus, s conversion.Scope) error { + return autoConvert_genid_GENIDEntryStatus_To_v1alpha1_GENIDEntryStatus(in, out, s) +} + +func autoConvert_v1alpha1_GENIDIndex_To_genid_GENIDIndex(in *GENIDIndex, out *genid.GENIDIndex, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_GENIDIndexSpec_To_genid_GENIDIndexSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_GENIDIndexStatus_To_genid_GENIDIndexStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_GENIDIndex_To_genid_GENIDIndex is an autogenerated conversion function. +func Convert_v1alpha1_GENIDIndex_To_genid_GENIDIndex(in *GENIDIndex, out *genid.GENIDIndex, s conversion.Scope) error { + return autoConvert_v1alpha1_GENIDIndex_To_genid_GENIDIndex(in, out, s) +} + +func autoConvert_genid_GENIDIndex_To_v1alpha1_GENIDIndex(in *genid.GENIDIndex, out *GENIDIndex, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_genid_GENIDIndexSpec_To_v1alpha1_GENIDIndexSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_genid_GENIDIndexStatus_To_v1alpha1_GENIDIndexStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_genid_GENIDIndex_To_v1alpha1_GENIDIndex is an autogenerated conversion function. +func Convert_genid_GENIDIndex_To_v1alpha1_GENIDIndex(in *genid.GENIDIndex, out *GENIDIndex, s conversion.Scope) error { + return autoConvert_genid_GENIDIndex_To_v1alpha1_GENIDIndex(in, out, s) +} + +func autoConvert_v1alpha1_GENIDIndexList_To_genid_GENIDIndexList(in *GENIDIndexList, out *genid.GENIDIndexList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]genid.GENIDIndex, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_GENIDIndex_To_genid_GENIDIndex(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_GENIDIndexList_To_genid_GENIDIndexList is an autogenerated conversion function. +func Convert_v1alpha1_GENIDIndexList_To_genid_GENIDIndexList(in *GENIDIndexList, out *genid.GENIDIndexList, s conversion.Scope) error { + return autoConvert_v1alpha1_GENIDIndexList_To_genid_GENIDIndexList(in, out, s) +} + +func autoConvert_genid_GENIDIndexList_To_v1alpha1_GENIDIndexList(in *genid.GENIDIndexList, out *GENIDIndexList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]GENIDIndex, len(*in)) + for i := range *in { + if err := Convert_genid_GENIDIndex_To_v1alpha1_GENIDIndex(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_genid_GENIDIndexList_To_v1alpha1_GENIDIndexList is an autogenerated conversion function. +func Convert_genid_GENIDIndexList_To_v1alpha1_GENIDIndexList(in *genid.GENIDIndexList, out *GENIDIndexList, s conversion.Scope) error { + return autoConvert_genid_GENIDIndexList_To_v1alpha1_GENIDIndexList(in, out, s) +} + +func autoConvert_v1alpha1_GENIDIndexSpec_To_genid_GENIDIndexSpec(in *GENIDIndexSpec, out *genid.GENIDIndexSpec, s conversion.Scope) error { + out.MinID = (*uint64)(unsafe.Pointer(in.MinID)) + out.MaxID = (*uint64)(unsafe.Pointer(in.MaxID)) + if err := asv1alpha1.Convert_v1alpha1_UserDefinedLabels_To_common_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + out.Type = in.Type + return nil +} + +// Convert_v1alpha1_GENIDIndexSpec_To_genid_GENIDIndexSpec is an autogenerated conversion function. +func Convert_v1alpha1_GENIDIndexSpec_To_genid_GENIDIndexSpec(in *GENIDIndexSpec, out *genid.GENIDIndexSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_GENIDIndexSpec_To_genid_GENIDIndexSpec(in, out, s) +} + +func autoConvert_genid_GENIDIndexSpec_To_v1alpha1_GENIDIndexSpec(in *genid.GENIDIndexSpec, out *GENIDIndexSpec, s conversion.Scope) error { + out.MinID = (*uint64)(unsafe.Pointer(in.MinID)) + out.MaxID = (*uint64)(unsafe.Pointer(in.MaxID)) + if err := asv1alpha1.Convert_common_UserDefinedLabels_To_v1alpha1_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + out.Type = in.Type + return nil +} + +// Convert_genid_GENIDIndexSpec_To_v1alpha1_GENIDIndexSpec is an autogenerated conversion function. +func Convert_genid_GENIDIndexSpec_To_v1alpha1_GENIDIndexSpec(in *genid.GENIDIndexSpec, out *GENIDIndexSpec, s conversion.Scope) error { + return autoConvert_genid_GENIDIndexSpec_To_v1alpha1_GENIDIndexSpec(in, out, s) +} + +func autoConvert_v1alpha1_GENIDIndexStatus_To_genid_GENIDIndexStatus(in *GENIDIndexStatus, out *genid.GENIDIndexStatus, s conversion.Scope) error { + out.MinID = (*uint64)(unsafe.Pointer(in.MinID)) + out.MaxID = (*uint64)(unsafe.Pointer(in.MaxID)) + if err := asv1alpha1.Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_GENIDIndexStatus_To_genid_GENIDIndexStatus is an autogenerated conversion function. +func Convert_v1alpha1_GENIDIndexStatus_To_genid_GENIDIndexStatus(in *GENIDIndexStatus, out *genid.GENIDIndexStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_GENIDIndexStatus_To_genid_GENIDIndexStatus(in, out, s) +} + +func autoConvert_genid_GENIDIndexStatus_To_v1alpha1_GENIDIndexStatus(in *genid.GENIDIndexStatus, out *GENIDIndexStatus, s conversion.Scope) error { + out.MinID = (*uint64)(unsafe.Pointer(in.MinID)) + out.MaxID = (*uint64)(unsafe.Pointer(in.MaxID)) + if err := asv1alpha1.Convert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_genid_GENIDIndexStatus_To_v1alpha1_GENIDIndexStatus is an autogenerated conversion function. +func Convert_genid_GENIDIndexStatus_To_v1alpha1_GENIDIndexStatus(in *genid.GENIDIndexStatus, out *GENIDIndexStatus, s conversion.Scope) error { + return autoConvert_genid_GENIDIndexStatus_To_v1alpha1_GENIDIndexStatus(in, out, s) +} diff --git a/apis/backend/genid/v1alpha1/zz_generated.deepcopy.go b/apis/backend/genid/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 0000000..359020d --- /dev/null +++ b/apis/backend/genid/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,355 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +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 *GENIDClaim) DeepCopyInto(out *GENIDClaim) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDClaim. +func (in *GENIDClaim) DeepCopy() *GENIDClaim { + if in == nil { + return nil + } + out := new(GENIDClaim) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GENIDClaim) 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 *GENIDClaimList) DeepCopyInto(out *GENIDClaimList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]GENIDClaim, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDClaimList. +func (in *GENIDClaimList) DeepCopy() *GENIDClaimList { + if in == nil { + return nil + } + out := new(GENIDClaimList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GENIDClaimList) 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 *GENIDClaimSpec) DeepCopyInto(out *GENIDClaimSpec) { + *out = *in + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(uint64) + **out = **in + } + if in.Range != nil { + in, out := &in.Range, &out.Range + *out = new(string) + **out = **in + } + in.ClaimLabels.DeepCopyInto(&out.ClaimLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDClaimSpec. +func (in *GENIDClaimSpec) DeepCopy() *GENIDClaimSpec { + if in == nil { + return nil + } + out := new(GENIDClaimSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GENIDClaimStatus) DeepCopyInto(out *GENIDClaimStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(uint64) + **out = **in + } + if in.Range != nil { + in, out := &in.Range, &out.Range + *out = new(string) + **out = **in + } + if in.ExpiryTime != nil { + in, out := &in.ExpiryTime, &out.ExpiryTime + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDClaimStatus. +func (in *GENIDClaimStatus) DeepCopy() *GENIDClaimStatus { + if in == nil { + return nil + } + out := new(GENIDClaimStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GENIDEntry) DeepCopyInto(out *GENIDEntry) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDEntry. +func (in *GENIDEntry) DeepCopy() *GENIDEntry { + if in == nil { + return nil + } + out := new(GENIDEntry) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GENIDEntry) 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 *GENIDEntryList) DeepCopyInto(out *GENIDEntryList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]GENIDEntry, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDEntryList. +func (in *GENIDEntryList) DeepCopy() *GENIDEntryList { + if in == nil { + return nil + } + out := new(GENIDEntryList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GENIDEntryList) 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 *GENIDEntrySpec) DeepCopyInto(out *GENIDEntrySpec) { + *out = *in + in.ClaimLabels.DeepCopyInto(&out.ClaimLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDEntrySpec. +func (in *GENIDEntrySpec) DeepCopy() *GENIDEntrySpec { + if in == nil { + return nil + } + out := new(GENIDEntrySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GENIDEntryStatus) DeepCopyInto(out *GENIDEntryStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDEntryStatus. +func (in *GENIDEntryStatus) DeepCopy() *GENIDEntryStatus { + if in == nil { + return nil + } + out := new(GENIDEntryStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GENIDIndex) DeepCopyInto(out *GENIDIndex) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDIndex. +func (in *GENIDIndex) DeepCopy() *GENIDIndex { + if in == nil { + return nil + } + out := new(GENIDIndex) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GENIDIndex) 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 *GENIDIndexList) DeepCopyInto(out *GENIDIndexList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]GENIDIndex, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDIndexList. +func (in *GENIDIndexList) DeepCopy() *GENIDIndexList { + if in == nil { + return nil + } + out := new(GENIDIndexList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GENIDIndexList) 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 *GENIDIndexSpec) DeepCopyInto(out *GENIDIndexSpec) { + *out = *in + if in.MinID != nil { + in, out := &in.MinID, &out.MinID + *out = new(uint64) + **out = **in + } + if in.MaxID != nil { + in, out := &in.MaxID, &out.MaxID + *out = new(uint64) + **out = **in + } + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDIndexSpec. +func (in *GENIDIndexSpec) DeepCopy() *GENIDIndexSpec { + if in == nil { + return nil + } + out := new(GENIDIndexSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GENIDIndexStatus) DeepCopyInto(out *GENIDIndexStatus) { + *out = *in + if in.MinID != nil { + in, out := &in.MinID, &out.MinID + *out = new(uint64) + **out = **in + } + if in.MaxID != nil { + in, out := &in.MaxID, &out.MaxID + *out = new(uint64) + **out = **in + } + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDIndexStatus. +func (in *GENIDIndexStatus) DeepCopy() *GENIDIndexStatus { + if in == nil { + return nil + } + out := new(GENIDIndexStatus) + in.DeepCopyInto(out) + return out +} diff --git a/apis/backend/genid/zz_generated.deepcopy.go b/apis/backend/genid/zz_generated.deepcopy.go new file mode 100644 index 0000000..4b8ff1d --- /dev/null +++ b/apis/backend/genid/zz_generated.deepcopy.go @@ -0,0 +1,451 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2024 Nokia. + +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 genid + +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 *GENIDClaim) DeepCopyInto(out *GENIDClaim) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDClaim. +func (in *GENIDClaim) DeepCopy() *GENIDClaim { + if in == nil { + return nil + } + out := new(GENIDClaim) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GENIDClaim) 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 *GENIDClaimFilter) DeepCopyInto(out *GENIDClaimFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDClaimFilter. +func (in *GENIDClaimFilter) DeepCopy() *GENIDClaimFilter { + if in == nil { + return nil + } + out := new(GENIDClaimFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GENIDClaimList) DeepCopyInto(out *GENIDClaimList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]GENIDClaim, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDClaimList. +func (in *GENIDClaimList) DeepCopy() *GENIDClaimList { + if in == nil { + return nil + } + out := new(GENIDClaimList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GENIDClaimList) 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 *GENIDClaimSpec) DeepCopyInto(out *GENIDClaimSpec) { + *out = *in + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(uint64) + **out = **in + } + if in.Range != nil { + in, out := &in.Range, &out.Range + *out = new(string) + **out = **in + } + in.ClaimLabels.DeepCopyInto(&out.ClaimLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDClaimSpec. +func (in *GENIDClaimSpec) DeepCopy() *GENIDClaimSpec { + if in == nil { + return nil + } + out := new(GENIDClaimSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GENIDClaimStatus) DeepCopyInto(out *GENIDClaimStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(uint64) + **out = **in + } + if in.Range != nil { + in, out := &in.Range, &out.Range + *out = new(string) + **out = **in + } + if in.ExpiryTime != nil { + in, out := &in.ExpiryTime, &out.ExpiryTime + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDClaimStatus. +func (in *GENIDClaimStatus) DeepCopy() *GENIDClaimStatus { + if in == nil { + return nil + } + out := new(GENIDClaimStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GENIDDynamicIDSyntaxValidator) DeepCopyInto(out *GENIDDynamicIDSyntaxValidator) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDDynamicIDSyntaxValidator. +func (in *GENIDDynamicIDSyntaxValidator) DeepCopy() *GENIDDynamicIDSyntaxValidator { + if in == nil { + return nil + } + out := new(GENIDDynamicIDSyntaxValidator) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GENIDEntry) DeepCopyInto(out *GENIDEntry) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDEntry. +func (in *GENIDEntry) DeepCopy() *GENIDEntry { + if in == nil { + return nil + } + out := new(GENIDEntry) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GENIDEntry) 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 *GENIDEntryFilter) DeepCopyInto(out *GENIDEntryFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDEntryFilter. +func (in *GENIDEntryFilter) DeepCopy() *GENIDEntryFilter { + if in == nil { + return nil + } + out := new(GENIDEntryFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GENIDEntryList) DeepCopyInto(out *GENIDEntryList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]GENIDEntry, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDEntryList. +func (in *GENIDEntryList) DeepCopy() *GENIDEntryList { + if in == nil { + return nil + } + out := new(GENIDEntryList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GENIDEntryList) 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 *GENIDEntrySpec) DeepCopyInto(out *GENIDEntrySpec) { + *out = *in + in.ClaimLabels.DeepCopyInto(&out.ClaimLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDEntrySpec. +func (in *GENIDEntrySpec) DeepCopy() *GENIDEntrySpec { + if in == nil { + return nil + } + out := new(GENIDEntrySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GENIDEntryStatus) DeepCopyInto(out *GENIDEntryStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDEntryStatus. +func (in *GENIDEntryStatus) DeepCopy() *GENIDEntryStatus { + if in == nil { + return nil + } + out := new(GENIDEntryStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GENIDIndex) DeepCopyInto(out *GENIDIndex) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDIndex. +func (in *GENIDIndex) DeepCopy() *GENIDIndex { + if in == nil { + return nil + } + out := new(GENIDIndex) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GENIDIndex) 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 *GENIDIndexFilter) DeepCopyInto(out *GENIDIndexFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDIndexFilter. +func (in *GENIDIndexFilter) DeepCopy() *GENIDIndexFilter { + if in == nil { + return nil + } + out := new(GENIDIndexFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GENIDIndexList) DeepCopyInto(out *GENIDIndexList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]GENIDIndex, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDIndexList. +func (in *GENIDIndexList) DeepCopy() *GENIDIndexList { + if in == nil { + return nil + } + out := new(GENIDIndexList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GENIDIndexList) 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 *GENIDIndexSpec) DeepCopyInto(out *GENIDIndexSpec) { + *out = *in + if in.MinID != nil { + in, out := &in.MinID, &out.MinID + *out = new(uint64) + **out = **in + } + if in.MaxID != nil { + in, out := &in.MaxID, &out.MaxID + *out = new(uint64) + **out = **in + } + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDIndexSpec. +func (in *GENIDIndexSpec) DeepCopy() *GENIDIndexSpec { + if in == nil { + return nil + } + out := new(GENIDIndexSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GENIDIndexStatus) DeepCopyInto(out *GENIDIndexStatus) { + *out = *in + if in.MinID != nil { + in, out := &in.MinID, &out.MinID + *out = new(uint64) + **out = **in + } + if in.MaxID != nil { + in, out := &in.MaxID, &out.MaxID + *out = new(uint64) + **out = **in + } + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDIndexStatus. +func (in *GENIDIndexStatus) DeepCopy() *GENIDIndexStatus { + if in == nil { + return nil + } + out := new(GENIDIndexStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GENIDRangeSyntaxValidator) DeepCopyInto(out *GENIDRangeSyntaxValidator) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDRangeSyntaxValidator. +func (in *GENIDRangeSyntaxValidator) DeepCopy() *GENIDRangeSyntaxValidator { + if in == nil { + return nil + } + out := new(GENIDRangeSyntaxValidator) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GENIDStaticIDSyntaxValidator) DeepCopyInto(out *GENIDStaticIDSyntaxValidator) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GENIDStaticIDSyntaxValidator. +func (in *GENIDStaticIDSyntaxValidator) DeepCopy() *GENIDStaticIDSyntaxValidator { + if in == nil { + return nil + } + out := new(GENIDStaticIDSyntaxValidator) + in.DeepCopyInto(out) + return out +} diff --git a/apis/infra/v1alpha1/zz_generated.conversion.go b/apis/infra/v1alpha1/zz_generated.conversion.go index 608b6a8..df6734c 100644 --- a/apis/infra/v1alpha1/zz_generated.conversion.go +++ b/apis/infra/v1alpha1/zz_generated.conversion.go @@ -991,7 +991,6 @@ func Convert_infra_EndpointSetList_To_v1alpha1_EndpointSetList(in *infra.Endpoin return autoConvert_infra_EndpointSetList_To_v1alpha1_EndpointSetList(in, out, s) } - func autoConvert_v1alpha1_EndpointSetStatus_To_infra_EndpointSetStatus(in *EndpointSetStatus, out *infra.EndpointSetStatus, s conversion.Scope) error { if err := asv1alpha1.Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { return err diff --git a/pkg/config/config.go b/pkg/config/config.go index 6a2975c..8feadbc 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -47,7 +47,7 @@ type KuidGroupConfig struct { } type KuidConfig struct { - Storage StorageType `json:"Storage"` + Storage StorageType `json:"Storage"` Groups []*KuidGroupConfig `json:"groups"` } @@ -74,6 +74,8 @@ func getDefaultConfig() *KuidConfig { {Group: "as.be.kuid.dev", Enabled: true, Sync: true}, {Group: "vlan.be.kuid.dev", Enabled: true, Sync: true}, {Group: "ipam.be.kuid.dev", Enabled: true, Sync: true}, + {Group: "genid.be.kuid.dev", Enabled: true, Sync: true}, + {Group: "extcomm.be.kuid.dev", Enabled: true, Sync: true}, }, } } diff --git a/pkg/generated/clientset/versioned/clientset.go b/pkg/generated/clientset/versioned/clientset.go index cab0c9a..b5dd6df 100644 --- a/pkg/generated/clientset/versioned/clientset.go +++ b/pkg/generated/clientset/versioned/clientset.go @@ -22,6 +22,7 @@ import ( "net/http" asv1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/as/v1alpha1" + extcommv1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1" infrav1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/infra/v1alpha1" ipamv1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/ipam/v1alpha1" vlanv1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/vlan/v1alpha1" @@ -33,6 +34,7 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface AsV1alpha1() asv1alpha1.AsV1alpha1Interface + ExtcommV1alpha1() extcommv1alpha1.ExtcommV1alpha1Interface InfraV1alpha1() infrav1alpha1.InfraV1alpha1Interface IpamV1alpha1() ipamv1alpha1.IpamV1alpha1Interface VlanV1alpha1() vlanv1alpha1.VlanV1alpha1Interface @@ -41,10 +43,11 @@ type Interface interface { // Clientset contains the clients for groups. type Clientset struct { *discovery.DiscoveryClient - asV1alpha1 *asv1alpha1.AsV1alpha1Client - infraV1alpha1 *infrav1alpha1.InfraV1alpha1Client - ipamV1alpha1 *ipamv1alpha1.IpamV1alpha1Client - vlanV1alpha1 *vlanv1alpha1.VlanV1alpha1Client + asV1alpha1 *asv1alpha1.AsV1alpha1Client + extcommV1alpha1 *extcommv1alpha1.ExtcommV1alpha1Client + infraV1alpha1 *infrav1alpha1.InfraV1alpha1Client + ipamV1alpha1 *ipamv1alpha1.IpamV1alpha1Client + vlanV1alpha1 *vlanv1alpha1.VlanV1alpha1Client } // AsV1alpha1 retrieves the AsV1alpha1Client @@ -52,6 +55,11 @@ func (c *Clientset) AsV1alpha1() asv1alpha1.AsV1alpha1Interface { return c.asV1alpha1 } +// ExtcommV1alpha1 retrieves the ExtcommV1alpha1Client +func (c *Clientset) ExtcommV1alpha1() extcommv1alpha1.ExtcommV1alpha1Interface { + return c.extcommV1alpha1 +} + // InfraV1alpha1 retrieves the InfraV1alpha1Client func (c *Clientset) InfraV1alpha1() infrav1alpha1.InfraV1alpha1Interface { return c.infraV1alpha1 @@ -115,6 +123,10 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, if err != nil { return nil, err } + cs.extcommV1alpha1, err = extcommv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } cs.infraV1alpha1, err = infrav1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err @@ -149,6 +161,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { func New(c rest.Interface) *Clientset { var cs Clientset cs.asV1alpha1 = asv1alpha1.New(c) + cs.extcommV1alpha1 = extcommv1alpha1.New(c) cs.infraV1alpha1 = infrav1alpha1.New(c) cs.ipamV1alpha1 = ipamv1alpha1.New(c) cs.vlanV1alpha1 = vlanv1alpha1.New(c) diff --git a/pkg/generated/clientset/versioned/fake/clientset_generated.go b/pkg/generated/clientset/versioned/fake/clientset_generated.go index d37c69a..05de22d 100644 --- a/pkg/generated/clientset/versioned/fake/clientset_generated.go +++ b/pkg/generated/clientset/versioned/fake/clientset_generated.go @@ -21,6 +21,8 @@ import ( clientset "github.com/kuidio/kuid/pkg/generated/clientset/versioned" asv1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/as/v1alpha1" fakeasv1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/as/v1alpha1/fake" + extcommv1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1" + fakeextcommv1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/fake" infrav1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/infra/v1alpha1" fakeinfrav1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake" ipamv1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/ipam/v1alpha1" @@ -93,6 +95,11 @@ func (c *Clientset) AsV1alpha1() asv1alpha1.AsV1alpha1Interface { return &fakeasv1alpha1.FakeAsV1alpha1{Fake: &c.Fake} } +// ExtcommV1alpha1 retrieves the ExtcommV1alpha1Client +func (c *Clientset) ExtcommV1alpha1() extcommv1alpha1.ExtcommV1alpha1Interface { + return &fakeextcommv1alpha1.FakeExtcommV1alpha1{Fake: &c.Fake} +} + // InfraV1alpha1 retrieves the InfraV1alpha1Client func (c *Clientset) InfraV1alpha1() infrav1alpha1.InfraV1alpha1Interface { return &fakeinfrav1alpha1.FakeInfraV1alpha1{Fake: &c.Fake} diff --git a/pkg/generated/clientset/versioned/fake/register.go b/pkg/generated/clientset/versioned/fake/register.go index 1846a9c..32e7636 100644 --- a/pkg/generated/clientset/versioned/fake/register.go +++ b/pkg/generated/clientset/versioned/fake/register.go @@ -19,6 +19,7 @@ package fake import ( asv1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" + extcommv1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" ipamv1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" vlanv1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" infrav1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" @@ -34,6 +35,7 @@ var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ asv1alpha1.AddToScheme, + extcommv1alpha1.AddToScheme, infrav1alpha1.AddToScheme, ipamv1alpha1.AddToScheme, vlanv1alpha1.AddToScheme, diff --git a/pkg/generated/clientset/versioned/scheme/register.go b/pkg/generated/clientset/versioned/scheme/register.go index 710000a..33de502 100644 --- a/pkg/generated/clientset/versioned/scheme/register.go +++ b/pkg/generated/clientset/versioned/scheme/register.go @@ -19,6 +19,7 @@ package scheme import ( asv1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" + extcommv1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" ipamv1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" vlanv1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" infrav1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" @@ -34,6 +35,7 @@ var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ asv1alpha1.AddToScheme, + extcommv1alpha1.AddToScheme, infrav1alpha1.AddToScheme, ipamv1alpha1.AddToScheme, vlanv1alpha1.AddToScheme, diff --git a/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/doc.go b/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/doc.go new file mode 100644 index 0000000..cda7d5a --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 diff --git a/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/extcomm_client.go b/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/extcomm_client.go new file mode 100644 index 0000000..1bc07e3 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/extcomm_client.go @@ -0,0 +1,116 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "net/http" + + v1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" + "github.com/kuidio/kuid/pkg/generated/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" +) + +type ExtcommV1alpha1Interface interface { + RESTClient() rest.Interface + EXTCOMMClaimsGetter + EXTCOMMEntriesGetter + EXTCOMMIndexesGetter +} + +// ExtcommV1alpha1Client is used to interact with features provided by the extcomm.be.kuid.dev group. +type ExtcommV1alpha1Client struct { + restClient rest.Interface +} + +func (c *ExtcommV1alpha1Client) EXTCOMMClaims(namespace string) EXTCOMMClaimInterface { + return newEXTCOMMClaims(c, namespace) +} + +func (c *ExtcommV1alpha1Client) EXTCOMMEntries(namespace string) EXTCOMMEntryInterface { + return newEXTCOMMEntries(c, namespace) +} + +func (c *ExtcommV1alpha1Client) EXTCOMMIndexes(namespace string) EXTCOMMIndexInterface { + return newEXTCOMMIndexes(c, namespace) +} + +// NewForConfig creates a new ExtcommV1alpha1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*ExtcommV1alpha1Client, 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 ExtcommV1alpha1Client 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) (*ExtcommV1alpha1Client, 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 &ExtcommV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new ExtcommV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *ExtcommV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new ExtcommV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *ExtcommV1alpha1Client { + return &ExtcommV1alpha1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha1.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 *ExtcommV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/extcommclaim.go b/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/extcommclaim.go new file mode 100644 index 0000000..065fd14 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/extcommclaim.go @@ -0,0 +1,68 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + + v1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" + scheme "github.com/kuidio/kuid/pkg/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// EXTCOMMClaimsGetter has a method to return a EXTCOMMClaimInterface. +// A group's client should implement this interface. +type EXTCOMMClaimsGetter interface { + EXTCOMMClaims(namespace string) EXTCOMMClaimInterface +} + +// EXTCOMMClaimInterface has methods to work with EXTCOMMClaim resources. +type EXTCOMMClaimInterface interface { + Create(ctx context.Context, eXTCOMMClaim *v1alpha1.EXTCOMMClaim, opts v1.CreateOptions) (*v1alpha1.EXTCOMMClaim, error) + Update(ctx context.Context, eXTCOMMClaim *v1alpha1.EXTCOMMClaim, opts v1.UpdateOptions) (*v1alpha1.EXTCOMMClaim, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, eXTCOMMClaim *v1alpha1.EXTCOMMClaim, opts v1.UpdateOptions) (*v1alpha1.EXTCOMMClaim, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.EXTCOMMClaim, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.EXTCOMMClaimList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.EXTCOMMClaim, err error) + EXTCOMMClaimExpansion +} + +// eXTCOMMClaims implements EXTCOMMClaimInterface +type eXTCOMMClaims struct { + *gentype.ClientWithList[*v1alpha1.EXTCOMMClaim, *v1alpha1.EXTCOMMClaimList] +} + +// newEXTCOMMClaims returns a EXTCOMMClaims +func newEXTCOMMClaims(c *ExtcommV1alpha1Client, namespace string) *eXTCOMMClaims { + return &eXTCOMMClaims{ + gentype.NewClientWithList[*v1alpha1.EXTCOMMClaim, *v1alpha1.EXTCOMMClaimList]( + "extcommclaims", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.EXTCOMMClaim { return &v1alpha1.EXTCOMMClaim{} }, + func() *v1alpha1.EXTCOMMClaimList { return &v1alpha1.EXTCOMMClaimList{} }), + } +} diff --git a/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/extcommentry.go b/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/extcommentry.go new file mode 100644 index 0000000..229f672 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/extcommentry.go @@ -0,0 +1,68 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + + v1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" + scheme "github.com/kuidio/kuid/pkg/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// EXTCOMMEntriesGetter has a method to return a EXTCOMMEntryInterface. +// A group's client should implement this interface. +type EXTCOMMEntriesGetter interface { + EXTCOMMEntries(namespace string) EXTCOMMEntryInterface +} + +// EXTCOMMEntryInterface has methods to work with EXTCOMMEntry resources. +type EXTCOMMEntryInterface interface { + Create(ctx context.Context, eXTCOMMEntry *v1alpha1.EXTCOMMEntry, opts v1.CreateOptions) (*v1alpha1.EXTCOMMEntry, error) + Update(ctx context.Context, eXTCOMMEntry *v1alpha1.EXTCOMMEntry, opts v1.UpdateOptions) (*v1alpha1.EXTCOMMEntry, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, eXTCOMMEntry *v1alpha1.EXTCOMMEntry, opts v1.UpdateOptions) (*v1alpha1.EXTCOMMEntry, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.EXTCOMMEntry, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.EXTCOMMEntryList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.EXTCOMMEntry, err error) + EXTCOMMEntryExpansion +} + +// eXTCOMMEntries implements EXTCOMMEntryInterface +type eXTCOMMEntries struct { + *gentype.ClientWithList[*v1alpha1.EXTCOMMEntry, *v1alpha1.EXTCOMMEntryList] +} + +// newEXTCOMMEntries returns a EXTCOMMEntries +func newEXTCOMMEntries(c *ExtcommV1alpha1Client, namespace string) *eXTCOMMEntries { + return &eXTCOMMEntries{ + gentype.NewClientWithList[*v1alpha1.EXTCOMMEntry, *v1alpha1.EXTCOMMEntryList]( + "extcommentries", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.EXTCOMMEntry { return &v1alpha1.EXTCOMMEntry{} }, + func() *v1alpha1.EXTCOMMEntryList { return &v1alpha1.EXTCOMMEntryList{} }), + } +} diff --git a/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/extcommindex.go b/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/extcommindex.go new file mode 100644 index 0000000..60f1539 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/extcommindex.go @@ -0,0 +1,68 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + + v1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" + scheme "github.com/kuidio/kuid/pkg/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// EXTCOMMIndexesGetter has a method to return a EXTCOMMIndexInterface. +// A group's client should implement this interface. +type EXTCOMMIndexesGetter interface { + EXTCOMMIndexes(namespace string) EXTCOMMIndexInterface +} + +// EXTCOMMIndexInterface has methods to work with EXTCOMMIndex resources. +type EXTCOMMIndexInterface interface { + Create(ctx context.Context, eXTCOMMIndex *v1alpha1.EXTCOMMIndex, opts v1.CreateOptions) (*v1alpha1.EXTCOMMIndex, error) + Update(ctx context.Context, eXTCOMMIndex *v1alpha1.EXTCOMMIndex, opts v1.UpdateOptions) (*v1alpha1.EXTCOMMIndex, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, eXTCOMMIndex *v1alpha1.EXTCOMMIndex, opts v1.UpdateOptions) (*v1alpha1.EXTCOMMIndex, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.EXTCOMMIndex, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.EXTCOMMIndexList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.EXTCOMMIndex, err error) + EXTCOMMIndexExpansion +} + +// eXTCOMMIndexes implements EXTCOMMIndexInterface +type eXTCOMMIndexes struct { + *gentype.ClientWithList[*v1alpha1.EXTCOMMIndex, *v1alpha1.EXTCOMMIndexList] +} + +// newEXTCOMMIndexes returns a EXTCOMMIndexes +func newEXTCOMMIndexes(c *ExtcommV1alpha1Client, namespace string) *eXTCOMMIndexes { + return &eXTCOMMIndexes{ + gentype.NewClientWithList[*v1alpha1.EXTCOMMIndex, *v1alpha1.EXTCOMMIndexList]( + "extcommindexes", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.EXTCOMMIndex { return &v1alpha1.EXTCOMMIndex{} }, + func() *v1alpha1.EXTCOMMIndexList { return &v1alpha1.EXTCOMMIndexList{} }), + } +} diff --git a/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/doc.go b/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/doc.go new file mode 100644 index 0000000..d4601f1 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2024 Nokia. + +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/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/fake_extcomm_client.go b/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/fake_extcomm_client.go new file mode 100644 index 0000000..ebf5678 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/fake_extcomm_client.go @@ -0,0 +1,47 @@ +/* +Copyright 2024 Nokia. + +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 ( + v1alpha1 "github.com/kuidio/kuid/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeExtcommV1alpha1 struct { + *testing.Fake +} + +func (c *FakeExtcommV1alpha1) EXTCOMMClaims(namespace string) v1alpha1.EXTCOMMClaimInterface { + return &FakeEXTCOMMClaims{c, namespace} +} + +func (c *FakeExtcommV1alpha1) EXTCOMMEntries(namespace string) v1alpha1.EXTCOMMEntryInterface { + return &FakeEXTCOMMEntries{c, namespace} +} + +func (c *FakeExtcommV1alpha1) EXTCOMMIndexes(namespace string) v1alpha1.EXTCOMMIndexInterface { + return &FakeEXTCOMMIndexes{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeExtcommV1alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/fake_extcommclaim.go b/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/fake_extcommclaim.go new file mode 100644 index 0000000..6746002 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/fake_extcommclaim.go @@ -0,0 +1,146 @@ +/* +Copyright 2024 Nokia. + +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" + + v1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" + v1 "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" +) + +// FakeEXTCOMMClaims implements EXTCOMMClaimInterface +type FakeEXTCOMMClaims struct { + Fake *FakeExtcommV1alpha1 + ns string +} + +var extcommclaimsResource = v1alpha1.SchemeGroupVersion.WithResource("extcommclaims") + +var extcommclaimsKind = v1alpha1.SchemeGroupVersion.WithKind("EXTCOMMClaim") + +// Get takes name of the eXTCOMMClaim, and returns the corresponding eXTCOMMClaim object, and an error if there is any. +func (c *FakeEXTCOMMClaims) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.EXTCOMMClaim, err error) { + emptyResult := &v1alpha1.EXTCOMMClaim{} + obj, err := c.Fake. + Invokes(testing.NewGetActionWithOptions(extcommclaimsResource, c.ns, name, options), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.EXTCOMMClaim), err +} + +// List takes label and field selectors, and returns the list of EXTCOMMClaims that match those selectors. +func (c *FakeEXTCOMMClaims) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.EXTCOMMClaimList, err error) { + emptyResult := &v1alpha1.EXTCOMMClaimList{} + obj, err := c.Fake. + Invokes(testing.NewListActionWithOptions(extcommclaimsResource, extcommclaimsKind, c.ns, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.EXTCOMMClaimList{ListMeta: obj.(*v1alpha1.EXTCOMMClaimList).ListMeta} + for _, item := range obj.(*v1alpha1.EXTCOMMClaimList).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 eXTCOMMClaims. +func (c *FakeEXTCOMMClaims) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchActionWithOptions(extcommclaimsResource, c.ns, opts)) + +} + +// Create takes the representation of a eXTCOMMClaim and creates it. Returns the server's representation of the eXTCOMMClaim, and an error, if there is any. +func (c *FakeEXTCOMMClaims) Create(ctx context.Context, eXTCOMMClaim *v1alpha1.EXTCOMMClaim, opts v1.CreateOptions) (result *v1alpha1.EXTCOMMClaim, err error) { + emptyResult := &v1alpha1.EXTCOMMClaim{} + obj, err := c.Fake. + Invokes(testing.NewCreateActionWithOptions(extcommclaimsResource, c.ns, eXTCOMMClaim, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.EXTCOMMClaim), err +} + +// Update takes the representation of a eXTCOMMClaim and updates it. Returns the server's representation of the eXTCOMMClaim, and an error, if there is any. +func (c *FakeEXTCOMMClaims) Update(ctx context.Context, eXTCOMMClaim *v1alpha1.EXTCOMMClaim, opts v1.UpdateOptions) (result *v1alpha1.EXTCOMMClaim, err error) { + emptyResult := &v1alpha1.EXTCOMMClaim{} + obj, err := c.Fake. + Invokes(testing.NewUpdateActionWithOptions(extcommclaimsResource, c.ns, eXTCOMMClaim, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.EXTCOMMClaim), 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 *FakeEXTCOMMClaims) UpdateStatus(ctx context.Context, eXTCOMMClaim *v1alpha1.EXTCOMMClaim, opts v1.UpdateOptions) (result *v1alpha1.EXTCOMMClaim, err error) { + emptyResult := &v1alpha1.EXTCOMMClaim{} + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceActionWithOptions(extcommclaimsResource, "status", c.ns, eXTCOMMClaim, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.EXTCOMMClaim), err +} + +// Delete takes name of the eXTCOMMClaim and deletes it. Returns an error if one occurs. +func (c *FakeEXTCOMMClaims) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(extcommclaimsResource, c.ns, name, opts), &v1alpha1.EXTCOMMClaim{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeEXTCOMMClaims) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(extcommclaimsResource, c.ns, opts, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.EXTCOMMClaimList{}) + return err +} + +// Patch applies the patch and returns the patched eXTCOMMClaim. +func (c *FakeEXTCOMMClaims) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.EXTCOMMClaim, err error) { + emptyResult := &v1alpha1.EXTCOMMClaim{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(extcommclaimsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.EXTCOMMClaim), err +} diff --git a/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/fake_extcommentry.go b/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/fake_extcommentry.go new file mode 100644 index 0000000..77acf83 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/fake_extcommentry.go @@ -0,0 +1,146 @@ +/* +Copyright 2024 Nokia. + +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" + + v1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" + v1 "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" +) + +// FakeEXTCOMMEntries implements EXTCOMMEntryInterface +type FakeEXTCOMMEntries struct { + Fake *FakeExtcommV1alpha1 + ns string +} + +var extcommentriesResource = v1alpha1.SchemeGroupVersion.WithResource("extcommentries") + +var extcommentriesKind = v1alpha1.SchemeGroupVersion.WithKind("EXTCOMMEntry") + +// Get takes name of the eXTCOMMEntry, and returns the corresponding eXTCOMMEntry object, and an error if there is any. +func (c *FakeEXTCOMMEntries) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.EXTCOMMEntry, err error) { + emptyResult := &v1alpha1.EXTCOMMEntry{} + obj, err := c.Fake. + Invokes(testing.NewGetActionWithOptions(extcommentriesResource, c.ns, name, options), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.EXTCOMMEntry), err +} + +// List takes label and field selectors, and returns the list of EXTCOMMEntries that match those selectors. +func (c *FakeEXTCOMMEntries) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.EXTCOMMEntryList, err error) { + emptyResult := &v1alpha1.EXTCOMMEntryList{} + obj, err := c.Fake. + Invokes(testing.NewListActionWithOptions(extcommentriesResource, extcommentriesKind, c.ns, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.EXTCOMMEntryList{ListMeta: obj.(*v1alpha1.EXTCOMMEntryList).ListMeta} + for _, item := range obj.(*v1alpha1.EXTCOMMEntryList).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 eXTCOMMEntries. +func (c *FakeEXTCOMMEntries) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchActionWithOptions(extcommentriesResource, c.ns, opts)) + +} + +// Create takes the representation of a eXTCOMMEntry and creates it. Returns the server's representation of the eXTCOMMEntry, and an error, if there is any. +func (c *FakeEXTCOMMEntries) Create(ctx context.Context, eXTCOMMEntry *v1alpha1.EXTCOMMEntry, opts v1.CreateOptions) (result *v1alpha1.EXTCOMMEntry, err error) { + emptyResult := &v1alpha1.EXTCOMMEntry{} + obj, err := c.Fake. + Invokes(testing.NewCreateActionWithOptions(extcommentriesResource, c.ns, eXTCOMMEntry, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.EXTCOMMEntry), err +} + +// Update takes the representation of a eXTCOMMEntry and updates it. Returns the server's representation of the eXTCOMMEntry, and an error, if there is any. +func (c *FakeEXTCOMMEntries) Update(ctx context.Context, eXTCOMMEntry *v1alpha1.EXTCOMMEntry, opts v1.UpdateOptions) (result *v1alpha1.EXTCOMMEntry, err error) { + emptyResult := &v1alpha1.EXTCOMMEntry{} + obj, err := c.Fake. + Invokes(testing.NewUpdateActionWithOptions(extcommentriesResource, c.ns, eXTCOMMEntry, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.EXTCOMMEntry), 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 *FakeEXTCOMMEntries) UpdateStatus(ctx context.Context, eXTCOMMEntry *v1alpha1.EXTCOMMEntry, opts v1.UpdateOptions) (result *v1alpha1.EXTCOMMEntry, err error) { + emptyResult := &v1alpha1.EXTCOMMEntry{} + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceActionWithOptions(extcommentriesResource, "status", c.ns, eXTCOMMEntry, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.EXTCOMMEntry), err +} + +// Delete takes name of the eXTCOMMEntry and deletes it. Returns an error if one occurs. +func (c *FakeEXTCOMMEntries) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(extcommentriesResource, c.ns, name, opts), &v1alpha1.EXTCOMMEntry{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeEXTCOMMEntries) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(extcommentriesResource, c.ns, opts, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.EXTCOMMEntryList{}) + return err +} + +// Patch applies the patch and returns the patched eXTCOMMEntry. +func (c *FakeEXTCOMMEntries) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.EXTCOMMEntry, err error) { + emptyResult := &v1alpha1.EXTCOMMEntry{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(extcommentriesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.EXTCOMMEntry), err +} diff --git a/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/fake_extcommindex.go b/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/fake_extcommindex.go new file mode 100644 index 0000000..2d6f413 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/fake/fake_extcommindex.go @@ -0,0 +1,146 @@ +/* +Copyright 2024 Nokia. + +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" + + v1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" + v1 "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" +) + +// FakeEXTCOMMIndexes implements EXTCOMMIndexInterface +type FakeEXTCOMMIndexes struct { + Fake *FakeExtcommV1alpha1 + ns string +} + +var extcommindexesResource = v1alpha1.SchemeGroupVersion.WithResource("extcommindexes") + +var extcommindexesKind = v1alpha1.SchemeGroupVersion.WithKind("EXTCOMMIndex") + +// Get takes name of the eXTCOMMIndex, and returns the corresponding eXTCOMMIndex object, and an error if there is any. +func (c *FakeEXTCOMMIndexes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.EXTCOMMIndex, err error) { + emptyResult := &v1alpha1.EXTCOMMIndex{} + obj, err := c.Fake. + Invokes(testing.NewGetActionWithOptions(extcommindexesResource, c.ns, name, options), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.EXTCOMMIndex), err +} + +// List takes label and field selectors, and returns the list of EXTCOMMIndexes that match those selectors. +func (c *FakeEXTCOMMIndexes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.EXTCOMMIndexList, err error) { + emptyResult := &v1alpha1.EXTCOMMIndexList{} + obj, err := c.Fake. + Invokes(testing.NewListActionWithOptions(extcommindexesResource, extcommindexesKind, c.ns, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.EXTCOMMIndexList{ListMeta: obj.(*v1alpha1.EXTCOMMIndexList).ListMeta} + for _, item := range obj.(*v1alpha1.EXTCOMMIndexList).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 eXTCOMMIndexes. +func (c *FakeEXTCOMMIndexes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchActionWithOptions(extcommindexesResource, c.ns, opts)) + +} + +// Create takes the representation of a eXTCOMMIndex and creates it. Returns the server's representation of the eXTCOMMIndex, and an error, if there is any. +func (c *FakeEXTCOMMIndexes) Create(ctx context.Context, eXTCOMMIndex *v1alpha1.EXTCOMMIndex, opts v1.CreateOptions) (result *v1alpha1.EXTCOMMIndex, err error) { + emptyResult := &v1alpha1.EXTCOMMIndex{} + obj, err := c.Fake. + Invokes(testing.NewCreateActionWithOptions(extcommindexesResource, c.ns, eXTCOMMIndex, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.EXTCOMMIndex), err +} + +// Update takes the representation of a eXTCOMMIndex and updates it. Returns the server's representation of the eXTCOMMIndex, and an error, if there is any. +func (c *FakeEXTCOMMIndexes) Update(ctx context.Context, eXTCOMMIndex *v1alpha1.EXTCOMMIndex, opts v1.UpdateOptions) (result *v1alpha1.EXTCOMMIndex, err error) { + emptyResult := &v1alpha1.EXTCOMMIndex{} + obj, err := c.Fake. + Invokes(testing.NewUpdateActionWithOptions(extcommindexesResource, c.ns, eXTCOMMIndex, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.EXTCOMMIndex), 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 *FakeEXTCOMMIndexes) UpdateStatus(ctx context.Context, eXTCOMMIndex *v1alpha1.EXTCOMMIndex, opts v1.UpdateOptions) (result *v1alpha1.EXTCOMMIndex, err error) { + emptyResult := &v1alpha1.EXTCOMMIndex{} + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceActionWithOptions(extcommindexesResource, "status", c.ns, eXTCOMMIndex, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.EXTCOMMIndex), err +} + +// Delete takes name of the eXTCOMMIndex and deletes it. Returns an error if one occurs. +func (c *FakeEXTCOMMIndexes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(extcommindexesResource, c.ns, name, opts), &v1alpha1.EXTCOMMIndex{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeEXTCOMMIndexes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(extcommindexesResource, c.ns, opts, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.EXTCOMMIndexList{}) + return err +} + +// Patch applies the patch and returns the patched eXTCOMMIndex. +func (c *FakeEXTCOMMIndexes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.EXTCOMMIndex, err error) { + emptyResult := &v1alpha1.EXTCOMMIndex{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(extcommindexesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.EXTCOMMIndex), err +} diff --git a/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/generated_expansion.go b/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/generated_expansion.go new file mode 100644 index 0000000..d4af5c7 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/extcomm/v1alpha1/generated_expansion.go @@ -0,0 +1,24 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +type EXTCOMMClaimExpansion interface{} + +type EXTCOMMEntryExpansion interface{} + +type EXTCOMMIndexExpansion interface{} diff --git a/pkg/generated/informers/externalversions/extcomm/interface.go b/pkg/generated/informers/externalversions/extcomm/interface.go new file mode 100644 index 0000000..8968656 --- /dev/null +++ b/pkg/generated/informers/externalversions/extcomm/interface.go @@ -0,0 +1,45 @@ +/* +Copyright 2024 Nokia. + +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 extcomm + +import ( + v1alpha1 "github.com/kuidio/kuid/pkg/generated/informers/externalversions/extcomm/v1alpha1" + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() v1alpha1.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} +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/generated/informers/externalversions/extcomm/v1alpha1/extcommclaim.go b/pkg/generated/informers/externalversions/extcomm/v1alpha1/extcommclaim.go new file mode 100644 index 0000000..07f2e1a --- /dev/null +++ b/pkg/generated/informers/externalversions/extcomm/v1alpha1/extcommclaim.go @@ -0,0 +1,89 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + time "time" + + extcommv1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" + versioned "github.com/kuidio/kuid/pkg/generated/clientset/versioned" + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kuidio/kuid/pkg/generated/listers/extcomm/v1alpha1" + v1 "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" +) + +// EXTCOMMClaimInformer provides access to a shared informer and lister for +// EXTCOMMClaims. +type EXTCOMMClaimInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.EXTCOMMClaimLister +} + +type eXTCOMMClaimInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEXTCOMMClaimInformer constructs a new informer for EXTCOMMClaim 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 NewEXTCOMMClaimInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEXTCOMMClaimInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredEXTCOMMClaimInformer constructs a new informer for EXTCOMMClaim 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 NewFilteredEXTCOMMClaimInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtcommV1alpha1().EXTCOMMClaims(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtcommV1alpha1().EXTCOMMClaims(namespace).Watch(context.TODO(), options) + }, + }, + &extcommv1alpha1.EXTCOMMClaim{}, + resyncPeriod, + indexers, + ) +} + +func (f *eXTCOMMClaimInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEXTCOMMClaimInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *eXTCOMMClaimInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&extcommv1alpha1.EXTCOMMClaim{}, f.defaultInformer) +} + +func (f *eXTCOMMClaimInformer) Lister() v1alpha1.EXTCOMMClaimLister { + return v1alpha1.NewEXTCOMMClaimLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/informers/externalversions/extcomm/v1alpha1/extcommentry.go b/pkg/generated/informers/externalversions/extcomm/v1alpha1/extcommentry.go new file mode 100644 index 0000000..824319c --- /dev/null +++ b/pkg/generated/informers/externalversions/extcomm/v1alpha1/extcommentry.go @@ -0,0 +1,89 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + time "time" + + extcommv1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" + versioned "github.com/kuidio/kuid/pkg/generated/clientset/versioned" + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kuidio/kuid/pkg/generated/listers/extcomm/v1alpha1" + v1 "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" +) + +// EXTCOMMEntryInformer provides access to a shared informer and lister for +// EXTCOMMEntries. +type EXTCOMMEntryInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.EXTCOMMEntryLister +} + +type eXTCOMMEntryInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEXTCOMMEntryInformer constructs a new informer for EXTCOMMEntry 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 NewEXTCOMMEntryInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEXTCOMMEntryInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredEXTCOMMEntryInformer constructs a new informer for EXTCOMMEntry 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 NewFilteredEXTCOMMEntryInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtcommV1alpha1().EXTCOMMEntries(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtcommV1alpha1().EXTCOMMEntries(namespace).Watch(context.TODO(), options) + }, + }, + &extcommv1alpha1.EXTCOMMEntry{}, + resyncPeriod, + indexers, + ) +} + +func (f *eXTCOMMEntryInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEXTCOMMEntryInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *eXTCOMMEntryInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&extcommv1alpha1.EXTCOMMEntry{}, f.defaultInformer) +} + +func (f *eXTCOMMEntryInformer) Lister() v1alpha1.EXTCOMMEntryLister { + return v1alpha1.NewEXTCOMMEntryLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/informers/externalversions/extcomm/v1alpha1/extcommindex.go b/pkg/generated/informers/externalversions/extcomm/v1alpha1/extcommindex.go new file mode 100644 index 0000000..24a6540 --- /dev/null +++ b/pkg/generated/informers/externalversions/extcomm/v1alpha1/extcommindex.go @@ -0,0 +1,89 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + time "time" + + extcommv1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" + versioned "github.com/kuidio/kuid/pkg/generated/clientset/versioned" + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kuidio/kuid/pkg/generated/listers/extcomm/v1alpha1" + v1 "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" +) + +// EXTCOMMIndexInformer provides access to a shared informer and lister for +// EXTCOMMIndexes. +type EXTCOMMIndexInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.EXTCOMMIndexLister +} + +type eXTCOMMIndexInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEXTCOMMIndexInformer constructs a new informer for EXTCOMMIndex 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 NewEXTCOMMIndexInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEXTCOMMIndexInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredEXTCOMMIndexInformer constructs a new informer for EXTCOMMIndex 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 NewFilteredEXTCOMMIndexInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtcommV1alpha1().EXTCOMMIndexes(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtcommV1alpha1().EXTCOMMIndexes(namespace).Watch(context.TODO(), options) + }, + }, + &extcommv1alpha1.EXTCOMMIndex{}, + resyncPeriod, + indexers, + ) +} + +func (f *eXTCOMMIndexInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEXTCOMMIndexInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *eXTCOMMIndexInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&extcommv1alpha1.EXTCOMMIndex{}, f.defaultInformer) +} + +func (f *eXTCOMMIndexInformer) Lister() v1alpha1.EXTCOMMIndexLister { + return v1alpha1.NewEXTCOMMIndexLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/informers/externalversions/extcomm/v1alpha1/interface.go b/pkg/generated/informers/externalversions/extcomm/v1alpha1/interface.go new file mode 100644 index 0000000..4fd088f --- /dev/null +++ b/pkg/generated/informers/externalversions/extcomm/v1alpha1/interface.go @@ -0,0 +1,58 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // EXTCOMMClaims returns a EXTCOMMClaimInformer. + EXTCOMMClaims() EXTCOMMClaimInformer + // EXTCOMMEntries returns a EXTCOMMEntryInformer. + EXTCOMMEntries() EXTCOMMEntryInformer + // EXTCOMMIndexes returns a EXTCOMMIndexInformer. + EXTCOMMIndexes() EXTCOMMIndexInformer +} + +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} +} + +// EXTCOMMClaims returns a EXTCOMMClaimInformer. +func (v *version) EXTCOMMClaims() EXTCOMMClaimInformer { + return &eXTCOMMClaimInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// EXTCOMMEntries returns a EXTCOMMEntryInformer. +func (v *version) EXTCOMMEntries() EXTCOMMEntryInformer { + return &eXTCOMMEntryInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// EXTCOMMIndexes returns a EXTCOMMIndexInformer. +func (v *version) EXTCOMMIndexes() EXTCOMMIndexInformer { + return &eXTCOMMIndexInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/generated/informers/externalversions/factory.go b/pkg/generated/informers/externalversions/factory.go index c54648a..7ae7568 100644 --- a/pkg/generated/informers/externalversions/factory.go +++ b/pkg/generated/informers/externalversions/factory.go @@ -24,6 +24,7 @@ import ( versioned "github.com/kuidio/kuid/pkg/generated/clientset/versioned" as "github.com/kuidio/kuid/pkg/generated/informers/externalversions/as" + extcomm "github.com/kuidio/kuid/pkg/generated/informers/externalversions/extcomm" infra "github.com/kuidio/kuid/pkg/generated/informers/externalversions/infra" internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" ipam "github.com/kuidio/kuid/pkg/generated/informers/externalversions/ipam" @@ -257,6 +258,7 @@ type SharedInformerFactory interface { InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer As() as.Interface + Extcomm() extcomm.Interface Infra() infra.Interface Ipam() ipam.Interface Vlan() vlan.Interface @@ -266,6 +268,10 @@ func (f *sharedInformerFactory) As() as.Interface { return as.New(f, f.namespace, f.tweakListOptions) } +func (f *sharedInformerFactory) Extcomm() extcomm.Interface { + return extcomm.New(f, f.namespace, f.tweakListOptions) +} + func (f *sharedInformerFactory) Infra() infra.Interface { return infra.New(f, f.namespace, f.tweakListOptions) } diff --git a/pkg/generated/informers/externalversions/generic.go b/pkg/generated/informers/externalversions/generic.go index 044e866..836858f 100644 --- a/pkg/generated/informers/externalversions/generic.go +++ b/pkg/generated/informers/externalversions/generic.go @@ -21,6 +21,7 @@ import ( "fmt" v1alpha1 "github.com/kuidio/kuid/apis/backend/as/v1alpha1" + extcommv1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" ipamv1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" vlanv1alpha1 "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1" infrav1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" @@ -62,6 +63,14 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case v1alpha1.SchemeGroupVersion.WithResource("asindexes"): return &genericInformer{resource: resource.GroupResource(), informer: f.As().V1alpha1().ASIndexes().Informer()}, nil + // Group=extcomm.be.kuid.dev, Version=v1alpha1 + case extcommv1alpha1.SchemeGroupVersion.WithResource("extcommclaims"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Extcomm().V1alpha1().EXTCOMMClaims().Informer()}, nil + case extcommv1alpha1.SchemeGroupVersion.WithResource("extcommentries"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Extcomm().V1alpha1().EXTCOMMEntries().Informer()}, nil + case extcommv1alpha1.SchemeGroupVersion.WithResource("extcommindexes"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Extcomm().V1alpha1().EXTCOMMIndexes().Informer()}, nil + // Group=infra.kuid.dev, Version=v1alpha1 case infrav1alpha1.SchemeGroupVersion.WithResource("clusters"): return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().Clusters().Informer()}, nil diff --git a/pkg/generated/listers/extcomm/v1alpha1/expansion_generated.go b/pkg/generated/listers/extcomm/v1alpha1/expansion_generated.go new file mode 100644 index 0000000..fe22f88 --- /dev/null +++ b/pkg/generated/listers/extcomm/v1alpha1/expansion_generated.go @@ -0,0 +1,42 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +// EXTCOMMClaimListerExpansion allows custom methods to be added to +// EXTCOMMClaimLister. +type EXTCOMMClaimListerExpansion interface{} + +// EXTCOMMClaimNamespaceListerExpansion allows custom methods to be added to +// EXTCOMMClaimNamespaceLister. +type EXTCOMMClaimNamespaceListerExpansion interface{} + +// EXTCOMMEntryListerExpansion allows custom methods to be added to +// EXTCOMMEntryLister. +type EXTCOMMEntryListerExpansion interface{} + +// EXTCOMMEntryNamespaceListerExpansion allows custom methods to be added to +// EXTCOMMEntryNamespaceLister. +type EXTCOMMEntryNamespaceListerExpansion interface{} + +// EXTCOMMIndexListerExpansion allows custom methods to be added to +// EXTCOMMIndexLister. +type EXTCOMMIndexListerExpansion interface{} + +// EXTCOMMIndexNamespaceListerExpansion allows custom methods to be added to +// EXTCOMMIndexNamespaceLister. +type EXTCOMMIndexNamespaceListerExpansion interface{} diff --git a/pkg/generated/listers/extcomm/v1alpha1/extcommclaim.go b/pkg/generated/listers/extcomm/v1alpha1/extcommclaim.go new file mode 100644 index 0000000..b8df182 --- /dev/null +++ b/pkg/generated/listers/extcomm/v1alpha1/extcommclaim.go @@ -0,0 +1,69 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + v1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" + "k8s.io/client-go/tools/cache" +) + +// EXTCOMMClaimLister helps list EXTCOMMClaims. +// All objects returned here must be treated as read-only. +type EXTCOMMClaimLister interface { + // List lists all EXTCOMMClaims in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.EXTCOMMClaim, err error) + // EXTCOMMClaims returns an object that can list and get EXTCOMMClaims. + EXTCOMMClaims(namespace string) EXTCOMMClaimNamespaceLister + EXTCOMMClaimListerExpansion +} + +// eXTCOMMClaimLister implements the EXTCOMMClaimLister interface. +type eXTCOMMClaimLister struct { + listers.ResourceIndexer[*v1alpha1.EXTCOMMClaim] +} + +// NewEXTCOMMClaimLister returns a new EXTCOMMClaimLister. +func NewEXTCOMMClaimLister(indexer cache.Indexer) EXTCOMMClaimLister { + return &eXTCOMMClaimLister{listers.New[*v1alpha1.EXTCOMMClaim](indexer, v1alpha1.Resource("extcommclaim"))} +} + +// EXTCOMMClaims returns an object that can list and get EXTCOMMClaims. +func (s *eXTCOMMClaimLister) EXTCOMMClaims(namespace string) EXTCOMMClaimNamespaceLister { + return eXTCOMMClaimNamespaceLister{listers.NewNamespaced[*v1alpha1.EXTCOMMClaim](s.ResourceIndexer, namespace)} +} + +// EXTCOMMClaimNamespaceLister helps list and get EXTCOMMClaims. +// All objects returned here must be treated as read-only. +type EXTCOMMClaimNamespaceLister interface { + // List lists all EXTCOMMClaims in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.EXTCOMMClaim, err error) + // Get retrieves the EXTCOMMClaim from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.EXTCOMMClaim, error) + EXTCOMMClaimNamespaceListerExpansion +} + +// eXTCOMMClaimNamespaceLister implements the EXTCOMMClaimNamespaceLister +// interface. +type eXTCOMMClaimNamespaceLister struct { + listers.ResourceIndexer[*v1alpha1.EXTCOMMClaim] +} diff --git a/pkg/generated/listers/extcomm/v1alpha1/extcommentry.go b/pkg/generated/listers/extcomm/v1alpha1/extcommentry.go new file mode 100644 index 0000000..fca756b --- /dev/null +++ b/pkg/generated/listers/extcomm/v1alpha1/extcommentry.go @@ -0,0 +1,69 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + v1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" + "k8s.io/client-go/tools/cache" +) + +// EXTCOMMEntryLister helps list EXTCOMMEntries. +// All objects returned here must be treated as read-only. +type EXTCOMMEntryLister interface { + // List lists all EXTCOMMEntries in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.EXTCOMMEntry, err error) + // EXTCOMMEntries returns an object that can list and get EXTCOMMEntries. + EXTCOMMEntries(namespace string) EXTCOMMEntryNamespaceLister + EXTCOMMEntryListerExpansion +} + +// eXTCOMMEntryLister implements the EXTCOMMEntryLister interface. +type eXTCOMMEntryLister struct { + listers.ResourceIndexer[*v1alpha1.EXTCOMMEntry] +} + +// NewEXTCOMMEntryLister returns a new EXTCOMMEntryLister. +func NewEXTCOMMEntryLister(indexer cache.Indexer) EXTCOMMEntryLister { + return &eXTCOMMEntryLister{listers.New[*v1alpha1.EXTCOMMEntry](indexer, v1alpha1.Resource("extcommentry"))} +} + +// EXTCOMMEntries returns an object that can list and get EXTCOMMEntries. +func (s *eXTCOMMEntryLister) EXTCOMMEntries(namespace string) EXTCOMMEntryNamespaceLister { + return eXTCOMMEntryNamespaceLister{listers.NewNamespaced[*v1alpha1.EXTCOMMEntry](s.ResourceIndexer, namespace)} +} + +// EXTCOMMEntryNamespaceLister helps list and get EXTCOMMEntries. +// All objects returned here must be treated as read-only. +type EXTCOMMEntryNamespaceLister interface { + // List lists all EXTCOMMEntries in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.EXTCOMMEntry, err error) + // Get retrieves the EXTCOMMEntry from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.EXTCOMMEntry, error) + EXTCOMMEntryNamespaceListerExpansion +} + +// eXTCOMMEntryNamespaceLister implements the EXTCOMMEntryNamespaceLister +// interface. +type eXTCOMMEntryNamespaceLister struct { + listers.ResourceIndexer[*v1alpha1.EXTCOMMEntry] +} diff --git a/pkg/generated/listers/extcomm/v1alpha1/extcommindex.go b/pkg/generated/listers/extcomm/v1alpha1/extcommindex.go new file mode 100644 index 0000000..8c28125 --- /dev/null +++ b/pkg/generated/listers/extcomm/v1alpha1/extcommindex.go @@ -0,0 +1,69 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + v1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" + "k8s.io/client-go/tools/cache" +) + +// EXTCOMMIndexLister helps list EXTCOMMIndexes. +// All objects returned here must be treated as read-only. +type EXTCOMMIndexLister interface { + // List lists all EXTCOMMIndexes in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.EXTCOMMIndex, err error) + // EXTCOMMIndexes returns an object that can list and get EXTCOMMIndexes. + EXTCOMMIndexes(namespace string) EXTCOMMIndexNamespaceLister + EXTCOMMIndexListerExpansion +} + +// eXTCOMMIndexLister implements the EXTCOMMIndexLister interface. +type eXTCOMMIndexLister struct { + listers.ResourceIndexer[*v1alpha1.EXTCOMMIndex] +} + +// NewEXTCOMMIndexLister returns a new EXTCOMMIndexLister. +func NewEXTCOMMIndexLister(indexer cache.Indexer) EXTCOMMIndexLister { + return &eXTCOMMIndexLister{listers.New[*v1alpha1.EXTCOMMIndex](indexer, v1alpha1.Resource("extcommindex"))} +} + +// EXTCOMMIndexes returns an object that can list and get EXTCOMMIndexes. +func (s *eXTCOMMIndexLister) EXTCOMMIndexes(namespace string) EXTCOMMIndexNamespaceLister { + return eXTCOMMIndexNamespaceLister{listers.NewNamespaced[*v1alpha1.EXTCOMMIndex](s.ResourceIndexer, namespace)} +} + +// EXTCOMMIndexNamespaceLister helps list and get EXTCOMMIndexes. +// All objects returned here must be treated as read-only. +type EXTCOMMIndexNamespaceLister interface { + // List lists all EXTCOMMIndexes in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.EXTCOMMIndex, err error) + // Get retrieves the EXTCOMMIndex from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.EXTCOMMIndex, error) + EXTCOMMIndexNamespaceListerExpansion +} + +// eXTCOMMIndexNamespaceLister implements the EXTCOMMIndexNamespaceLister +// interface. +type eXTCOMMIndexNamespaceLister struct { + listers.ResourceIndexer[*v1alpha1.EXTCOMMIndex] +} diff --git a/pkg/generated/openapi/zz_generated.openapi.go b/pkg/generated/openapi/zz_generated.openapi.go index 42f2ee4..e7e6e4a 100644 --- a/pkg/generated/openapi/zz_generated.openapi.go +++ b/pkg/generated/openapi/zz_generated.openapi.go @@ -29,170 +29,194 @@ import ( func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { return map[string]common.OpenAPIDefinition{ - "github.com/kform-dev/choreo/apis/condition.Condition": schema_kform_dev_choreo_apis_condition_Condition(ref), - "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition": schema_choreo_apis_condition_v1alpha1_Condition(ref), - "github.com/kform-dev/choreo/apis/condition/v1alpha1.ConditionedStatus": schema_choreo_apis_condition_v1alpha1_ConditionedStatus(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaim": schema_apis_backend_as_v1alpha1_ASClaim(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaimList": schema_apis_backend_as_v1alpha1_ASClaimList(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaimSpec": schema_apis_backend_as_v1alpha1_ASClaimSpec(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaimStatus": schema_apis_backend_as_v1alpha1_ASClaimStatus(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntry": schema_apis_backend_as_v1alpha1_ASEntry(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntryList": schema_apis_backend_as_v1alpha1_ASEntryList(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntrySpec": schema_apis_backend_as_v1alpha1_ASEntrySpec(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntryStatus": schema_apis_backend_as_v1alpha1_ASEntryStatus(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndex": schema_apis_backend_as_v1alpha1_ASIndex(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndexList": schema_apis_backend_as_v1alpha1_ASIndexList(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndexSpec": schema_apis_backend_as_v1alpha1_ASIndexSpec(ref), - "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndexStatus": schema_apis_backend_as_v1alpha1_ASIndexStatus(ref), - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPClaim": schema_apis_backend_ipam_v1alpha1_IPClaim(ref), - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPClaimList": schema_apis_backend_ipam_v1alpha1_IPClaimList(ref), - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPClaimSpec": schema_apis_backend_ipam_v1alpha1_IPClaimSpec(ref), - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPClaimStatus": schema_apis_backend_ipam_v1alpha1_IPClaimStatus(ref), - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPEntry": schema_apis_backend_ipam_v1alpha1_IPEntry(ref), - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPEntryList": schema_apis_backend_ipam_v1alpha1_IPEntryList(ref), - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPEntrySpec": schema_apis_backend_ipam_v1alpha1_IPEntrySpec(ref), - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPEntryStatus": schema_apis_backend_ipam_v1alpha1_IPEntryStatus(ref), - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPIndex": schema_apis_backend_ipam_v1alpha1_IPIndex(ref), - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPIndexList": schema_apis_backend_ipam_v1alpha1_IPIndexList(ref), - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPIndexSpec": schema_apis_backend_ipam_v1alpha1_IPIndexSpec(ref), - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPIndexStatus": schema_apis_backend_ipam_v1alpha1_IPIndexStatus(ref), - "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.Prefix": schema_apis_backend_ipam_v1alpha1_Prefix(ref), - "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANClaim": schema_apis_backend_vlan_v1alpha1_VLANClaim(ref), - "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANClaimList": schema_apis_backend_vlan_v1alpha1_VLANClaimList(ref), - "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANClaimSpec": schema_apis_backend_vlan_v1alpha1_VLANClaimSpec(ref), - "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANClaimStatus": schema_apis_backend_vlan_v1alpha1_VLANClaimStatus(ref), - "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANEntry": schema_apis_backend_vlan_v1alpha1_VLANEntry(ref), - "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANEntryList": schema_apis_backend_vlan_v1alpha1_VLANEntryList(ref), - "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANEntrySpec": schema_apis_backend_vlan_v1alpha1_VLANEntrySpec(ref), - "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANEntryStatus": schema_apis_backend_vlan_v1alpha1_VLANEntryStatus(ref), - "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANIndex": schema_apis_backend_vlan_v1alpha1_VLANIndex(ref), - "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANIndexList": schema_apis_backend_vlan_v1alpha1_VLANIndexList(ref), - "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANIndexSpec": schema_apis_backend_vlan_v1alpha1_VLANIndexSpec(ref), - "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANIndexStatus": schema_apis_backend_vlan_v1alpha1_VLANIndexStatus(ref), - "github.com/kuidio/kuid/apis/common/v1alpha1.ClaimLabels": schema_kuid_apis_common_v1alpha1_ClaimLabels(ref), - "github.com/kuidio/kuid/apis/common/v1alpha1.UserDefinedLabels": schema_kuid_apis_common_v1alpha1_UserDefinedLabels(ref), - "github.com/kuidio/kuid/apis/id/v1alpha1.AdaptorID": schema_kuid_apis_id_v1alpha1_AdaptorID(ref), - "github.com/kuidio/kuid/apis/id/v1alpha1.ClusterID": schema_kuid_apis_id_v1alpha1_ClusterID(ref), - "github.com/kuidio/kuid/apis/id/v1alpha1.EndpointID": schema_kuid_apis_id_v1alpha1_EndpointID(ref), - "github.com/kuidio/kuid/apis/id/v1alpha1.NodeID": schema_kuid_apis_id_v1alpha1_NodeID(ref), - "github.com/kuidio/kuid/apis/id/v1alpha1.PartitionAttachmentID": schema_kuid_apis_id_v1alpha1_PartitionAttachmentID(ref), - "github.com/kuidio/kuid/apis/id/v1alpha1.PartitionClusterID": schema_kuid_apis_id_v1alpha1_PartitionClusterID(ref), - "github.com/kuidio/kuid/apis/id/v1alpha1.PartitionEndpointID": schema_kuid_apis_id_v1alpha1_PartitionEndpointID(ref), - "github.com/kuidio/kuid/apis/id/v1alpha1.PartitionNodeID": schema_kuid_apis_id_v1alpha1_PartitionNodeID(ref), - "github.com/kuidio/kuid/apis/id/v1alpha1.PortID": schema_kuid_apis_id_v1alpha1_PortID(ref), - "github.com/kuidio/kuid/apis/id/v1alpha1.SiteID": schema_kuid_apis_id_v1alpha1_SiteID(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.Cluster": schema_kuid_apis_infra_v1alpha1_Cluster(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.ClusterList": schema_kuid_apis_infra_v1alpha1_ClusterList(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.ClusterSpec": schema_kuid_apis_infra_v1alpha1_ClusterSpec(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.ClusterStatus": schema_kuid_apis_infra_v1alpha1_ClusterStatus(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.Endpoint": schema_kuid_apis_infra_v1alpha1_Endpoint(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.EndpointList": schema_kuid_apis_infra_v1alpha1_EndpointList(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.EndpointSet": schema_kuid_apis_infra_v1alpha1_EndpointSet(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.EndpointSetList": schema_kuid_apis_infra_v1alpha1_EndpointSetList(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.EndpointSetSpec": schema_kuid_apis_infra_v1alpha1_EndpointSetSpec(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.EndpointSetStatus": schema_kuid_apis_infra_v1alpha1_EndpointSetStatus(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.EndpointSpec": schema_kuid_apis_infra_v1alpha1_EndpointSpec(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.EndpointStatus": schema_kuid_apis_infra_v1alpha1_EndpointStatus(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.Link": schema_kuid_apis_infra_v1alpha1_Link(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.LinkList": schema_kuid_apis_infra_v1alpha1_LinkList(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.LinkSet": schema_kuid_apis_infra_v1alpha1_LinkSet(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.LinkSetList": schema_kuid_apis_infra_v1alpha1_LinkSetList(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.LinkSetSpec": schema_kuid_apis_infra_v1alpha1_LinkSetSpec(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.LinkSetStatus": schema_kuid_apis_infra_v1alpha1_LinkSetStatus(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.LinkSpec": schema_kuid_apis_infra_v1alpha1_LinkSpec(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.LinkStatus": schema_kuid_apis_infra_v1alpha1_LinkStatus(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.Location": schema_kuid_apis_infra_v1alpha1_Location(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.Module": schema_kuid_apis_infra_v1alpha1_Module(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.ModuleBay": schema_kuid_apis_infra_v1alpha1_ModuleBay(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.ModuleBayList": schema_kuid_apis_infra_v1alpha1_ModuleBayList(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.ModuleBaySpec": schema_kuid_apis_infra_v1alpha1_ModuleBaySpec(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.ModuleBayStatus": schema_kuid_apis_infra_v1alpha1_ModuleBayStatus(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.ModuleList": schema_kuid_apis_infra_v1alpha1_ModuleList(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.ModuleSpec": schema_kuid_apis_infra_v1alpha1_ModuleSpec(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.ModuleStatus": schema_kuid_apis_infra_v1alpha1_ModuleStatus(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.Node": schema_kuid_apis_infra_v1alpha1_Node(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeItem": schema_kuid_apis_infra_v1alpha1_NodeItem(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeItemList": schema_kuid_apis_infra_v1alpha1_NodeItemList(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeItemSpec": schema_kuid_apis_infra_v1alpha1_NodeItemSpec(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeItemStatus": schema_kuid_apis_infra_v1alpha1_NodeItemStatus(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeList": schema_kuid_apis_infra_v1alpha1_NodeList(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeSet": schema_kuid_apis_infra_v1alpha1_NodeSet(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeSetList": schema_kuid_apis_infra_v1alpha1_NodeSetList(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeSetSpec": schema_kuid_apis_infra_v1alpha1_NodeSetSpec(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeSetStatus": schema_kuid_apis_infra_v1alpha1_NodeSetStatus(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeSpec": schema_kuid_apis_infra_v1alpha1_NodeSpec(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeStatus": schema_kuid_apis_infra_v1alpha1_NodeStatus(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.Partition": schema_kuid_apis_infra_v1alpha1_Partition(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.PartitionList": schema_kuid_apis_infra_v1alpha1_PartitionList(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.PartitionSpec": schema_kuid_apis_infra_v1alpha1_PartitionSpec(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.PartitionStatus": schema_kuid_apis_infra_v1alpha1_PartitionStatus(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.Rack": schema_kuid_apis_infra_v1alpha1_Rack(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.RackList": schema_kuid_apis_infra_v1alpha1_RackList(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.RackSpec": schema_kuid_apis_infra_v1alpha1_RackSpec(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.RackStatus": schema_kuid_apis_infra_v1alpha1_RackStatus(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.Region": schema_kuid_apis_infra_v1alpha1_Region(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.RegionList": schema_kuid_apis_infra_v1alpha1_RegionList(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.RegionSpec": schema_kuid_apis_infra_v1alpha1_RegionSpec(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.RegionStatus": schema_kuid_apis_infra_v1alpha1_RegionStatus(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.Site": schema_kuid_apis_infra_v1alpha1_Site(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.SiteList": schema_kuid_apis_infra_v1alpha1_SiteList(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.SiteSpec": schema_kuid_apis_infra_v1alpha1_SiteSpec(ref), - "github.com/kuidio/kuid/apis/infra/v1alpha1.SiteStatus": schema_kuid_apis_infra_v1alpha1_SiteStatus(ref), - "k8s.io/apimachinery/pkg/api/resource.Quantity": schema_apimachinery_pkg_api_resource_Quantity(ref), - "k8s.io/apimachinery/pkg/api/resource.int64Amount": schema_apimachinery_pkg_api_resource_int64Amount(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.APIGroup": schema_pkg_apis_meta_v1_APIGroup(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.APIGroupList": schema_pkg_apis_meta_v1_APIGroupList(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.APIResource": schema_pkg_apis_meta_v1_APIResource(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.APIResourceList": schema_pkg_apis_meta_v1_APIResourceList(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.APIVersions": schema_pkg_apis_meta_v1_APIVersions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.ApplyOptions": schema_pkg_apis_meta_v1_ApplyOptions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.Condition": schema_pkg_apis_meta_v1_Condition(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.CreateOptions": schema_pkg_apis_meta_v1_CreateOptions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.DeleteOptions": schema_pkg_apis_meta_v1_DeleteOptions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.Duration": schema_pkg_apis_meta_v1_Duration(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.FieldSelectorRequirement": schema_pkg_apis_meta_v1_FieldSelectorRequirement(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.FieldsV1": schema_pkg_apis_meta_v1_FieldsV1(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.GetOptions": schema_pkg_apis_meta_v1_GetOptions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.GroupKind": schema_pkg_apis_meta_v1_GroupKind(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.GroupResource": schema_pkg_apis_meta_v1_GroupResource(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersion": schema_pkg_apis_meta_v1_GroupVersion(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionForDiscovery": schema_pkg_apis_meta_v1_GroupVersionForDiscovery(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionKind": schema_pkg_apis_meta_v1_GroupVersionKind(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionResource": schema_pkg_apis_meta_v1_GroupVersionResource(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.InternalEvent": schema_pkg_apis_meta_v1_InternalEvent(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector": schema_pkg_apis_meta_v1_LabelSelector(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelectorRequirement": schema_pkg_apis_meta_v1_LabelSelectorRequirement(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.List": schema_pkg_apis_meta_v1_List(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta": schema_pkg_apis_meta_v1_ListMeta(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.ListOptions": schema_pkg_apis_meta_v1_ListOptions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.ManagedFieldsEntry": schema_pkg_apis_meta_v1_ManagedFieldsEntry(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.MicroTime": schema_pkg_apis_meta_v1_MicroTime(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta": schema_pkg_apis_meta_v1_ObjectMeta(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.OwnerReference": schema_pkg_apis_meta_v1_OwnerReference(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.PartialObjectMetadata": schema_pkg_apis_meta_v1_PartialObjectMetadata(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.PartialObjectMetadataList": schema_pkg_apis_meta_v1_PartialObjectMetadataList(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.Patch": schema_pkg_apis_meta_v1_Patch(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.PatchOptions": schema_pkg_apis_meta_v1_PatchOptions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.Preconditions": schema_pkg_apis_meta_v1_Preconditions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.RootPaths": schema_pkg_apis_meta_v1_RootPaths(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR": schema_pkg_apis_meta_v1_ServerAddressByClientCIDR(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.Status": schema_pkg_apis_meta_v1_Status(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.StatusCause": schema_pkg_apis_meta_v1_StatusCause(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.StatusDetails": schema_pkg_apis_meta_v1_StatusDetails(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.Table": schema_pkg_apis_meta_v1_Table(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.TableColumnDefinition": schema_pkg_apis_meta_v1_TableColumnDefinition(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.TableOptions": schema_pkg_apis_meta_v1_TableOptions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.TableRow": schema_pkg_apis_meta_v1_TableRow(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.TableRowCondition": schema_pkg_apis_meta_v1_TableRowCondition(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.Time": schema_pkg_apis_meta_v1_Time(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.Timestamp": schema_pkg_apis_meta_v1_Timestamp(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta": schema_pkg_apis_meta_v1_TypeMeta(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.UpdateOptions": schema_pkg_apis_meta_v1_UpdateOptions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.WatchEvent": schema_pkg_apis_meta_v1_WatchEvent(ref), - "k8s.io/apimachinery/pkg/runtime.RawExtension": schema_k8sio_apimachinery_pkg_runtime_RawExtension(ref), - "k8s.io/apimachinery/pkg/runtime.TypeMeta": schema_k8sio_apimachinery_pkg_runtime_TypeMeta(ref), - "k8s.io/apimachinery/pkg/runtime.Unknown": schema_k8sio_apimachinery_pkg_runtime_Unknown(ref), - "k8s.io/apimachinery/pkg/version.Info": schema_k8sio_apimachinery_pkg_version_Info(ref), + "github.com/kform-dev/choreo/apis/condition.Condition": schema_kform_dev_choreo_apis_condition_Condition(ref), + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition": schema_choreo_apis_condition_v1alpha1_Condition(ref), + "github.com/kform-dev/choreo/apis/condition/v1alpha1.ConditionedStatus": schema_choreo_apis_condition_v1alpha1_ConditionedStatus(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaim": schema_apis_backend_as_v1alpha1_ASClaim(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaimList": schema_apis_backend_as_v1alpha1_ASClaimList(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaimSpec": schema_apis_backend_as_v1alpha1_ASClaimSpec(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASClaimStatus": schema_apis_backend_as_v1alpha1_ASClaimStatus(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntry": schema_apis_backend_as_v1alpha1_ASEntry(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntryList": schema_apis_backend_as_v1alpha1_ASEntryList(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntrySpec": schema_apis_backend_as_v1alpha1_ASEntrySpec(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASEntryStatus": schema_apis_backend_as_v1alpha1_ASEntryStatus(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndex": schema_apis_backend_as_v1alpha1_ASIndex(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndexList": schema_apis_backend_as_v1alpha1_ASIndexList(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndexSpec": schema_apis_backend_as_v1alpha1_ASIndexSpec(ref), + "github.com/kuidio/kuid/apis/backend/as/v1alpha1.ASIndexStatus": schema_apis_backend_as_v1alpha1_ASIndexStatus(ref), + "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMClaim": schema_apis_backend_extcomm_v1alpha1_EXTCOMMClaim(ref), + "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMClaimList": schema_apis_backend_extcomm_v1alpha1_EXTCOMMClaimList(ref), + "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMClaimSpec": schema_apis_backend_extcomm_v1alpha1_EXTCOMMClaimSpec(ref), + "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMClaimStatus": schema_apis_backend_extcomm_v1alpha1_EXTCOMMClaimStatus(ref), + "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMEntry": schema_apis_backend_extcomm_v1alpha1_EXTCOMMEntry(ref), + "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMEntryList": schema_apis_backend_extcomm_v1alpha1_EXTCOMMEntryList(ref), + "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMEntrySpec": schema_apis_backend_extcomm_v1alpha1_EXTCOMMEntrySpec(ref), + "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMEntryStatus": schema_apis_backend_extcomm_v1alpha1_EXTCOMMEntryStatus(ref), + "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMIndex": schema_apis_backend_extcomm_v1alpha1_EXTCOMMIndex(ref), + "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMIndexList": schema_apis_backend_extcomm_v1alpha1_EXTCOMMIndexList(ref), + "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMIndexSpec": schema_apis_backend_extcomm_v1alpha1_EXTCOMMIndexSpec(ref), + "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMIndexStatus": schema_apis_backend_extcomm_v1alpha1_EXTCOMMIndexStatus(ref), + "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDClaim": schema_apis_backend_genid_v1alpha1_GENIDClaim(ref), + "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDClaimList": schema_apis_backend_genid_v1alpha1_GENIDClaimList(ref), + "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDClaimSpec": schema_apis_backend_genid_v1alpha1_GENIDClaimSpec(ref), + "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDClaimStatus": schema_apis_backend_genid_v1alpha1_GENIDClaimStatus(ref), + "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDEntry": schema_apis_backend_genid_v1alpha1_GENIDEntry(ref), + "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDEntryList": schema_apis_backend_genid_v1alpha1_GENIDEntryList(ref), + "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDEntrySpec": schema_apis_backend_genid_v1alpha1_GENIDEntrySpec(ref), + "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDEntryStatus": schema_apis_backend_genid_v1alpha1_GENIDEntryStatus(ref), + "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDIndex": schema_apis_backend_genid_v1alpha1_GENIDIndex(ref), + "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDIndexList": schema_apis_backend_genid_v1alpha1_GENIDIndexList(ref), + "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDIndexSpec": schema_apis_backend_genid_v1alpha1_GENIDIndexSpec(ref), + "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDIndexStatus": schema_apis_backend_genid_v1alpha1_GENIDIndexStatus(ref), + "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPClaim": schema_apis_backend_ipam_v1alpha1_IPClaim(ref), + "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPClaimList": schema_apis_backend_ipam_v1alpha1_IPClaimList(ref), + "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPClaimSpec": schema_apis_backend_ipam_v1alpha1_IPClaimSpec(ref), + "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPClaimStatus": schema_apis_backend_ipam_v1alpha1_IPClaimStatus(ref), + "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPEntry": schema_apis_backend_ipam_v1alpha1_IPEntry(ref), + "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPEntryList": schema_apis_backend_ipam_v1alpha1_IPEntryList(ref), + "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPEntrySpec": schema_apis_backend_ipam_v1alpha1_IPEntrySpec(ref), + "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPEntryStatus": schema_apis_backend_ipam_v1alpha1_IPEntryStatus(ref), + "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPIndex": schema_apis_backend_ipam_v1alpha1_IPIndex(ref), + "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPIndexList": schema_apis_backend_ipam_v1alpha1_IPIndexList(ref), + "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPIndexSpec": schema_apis_backend_ipam_v1alpha1_IPIndexSpec(ref), + "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.IPIndexStatus": schema_apis_backend_ipam_v1alpha1_IPIndexStatus(ref), + "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1.Prefix": schema_apis_backend_ipam_v1alpha1_Prefix(ref), + "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANClaim": schema_apis_backend_vlan_v1alpha1_VLANClaim(ref), + "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANClaimList": schema_apis_backend_vlan_v1alpha1_VLANClaimList(ref), + "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANClaimSpec": schema_apis_backend_vlan_v1alpha1_VLANClaimSpec(ref), + "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANClaimStatus": schema_apis_backend_vlan_v1alpha1_VLANClaimStatus(ref), + "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANEntry": schema_apis_backend_vlan_v1alpha1_VLANEntry(ref), + "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANEntryList": schema_apis_backend_vlan_v1alpha1_VLANEntryList(ref), + "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANEntrySpec": schema_apis_backend_vlan_v1alpha1_VLANEntrySpec(ref), + "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANEntryStatus": schema_apis_backend_vlan_v1alpha1_VLANEntryStatus(ref), + "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANIndex": schema_apis_backend_vlan_v1alpha1_VLANIndex(ref), + "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANIndexList": schema_apis_backend_vlan_v1alpha1_VLANIndexList(ref), + "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANIndexSpec": schema_apis_backend_vlan_v1alpha1_VLANIndexSpec(ref), + "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANIndexStatus": schema_apis_backend_vlan_v1alpha1_VLANIndexStatus(ref), + "github.com/kuidio/kuid/apis/common/v1alpha1.ClaimLabels": schema_kuid_apis_common_v1alpha1_ClaimLabels(ref), + "github.com/kuidio/kuid/apis/common/v1alpha1.UserDefinedLabels": schema_kuid_apis_common_v1alpha1_UserDefinedLabels(ref), + "github.com/kuidio/kuid/apis/id/v1alpha1.AdaptorID": schema_kuid_apis_id_v1alpha1_AdaptorID(ref), + "github.com/kuidio/kuid/apis/id/v1alpha1.ClusterID": schema_kuid_apis_id_v1alpha1_ClusterID(ref), + "github.com/kuidio/kuid/apis/id/v1alpha1.EndpointID": schema_kuid_apis_id_v1alpha1_EndpointID(ref), + "github.com/kuidio/kuid/apis/id/v1alpha1.NodeID": schema_kuid_apis_id_v1alpha1_NodeID(ref), + "github.com/kuidio/kuid/apis/id/v1alpha1.PartitionAttachmentID": schema_kuid_apis_id_v1alpha1_PartitionAttachmentID(ref), + "github.com/kuidio/kuid/apis/id/v1alpha1.PartitionClusterID": schema_kuid_apis_id_v1alpha1_PartitionClusterID(ref), + "github.com/kuidio/kuid/apis/id/v1alpha1.PartitionEndpointID": schema_kuid_apis_id_v1alpha1_PartitionEndpointID(ref), + "github.com/kuidio/kuid/apis/id/v1alpha1.PartitionNodeID": schema_kuid_apis_id_v1alpha1_PartitionNodeID(ref), + "github.com/kuidio/kuid/apis/id/v1alpha1.PortID": schema_kuid_apis_id_v1alpha1_PortID(ref), + "github.com/kuidio/kuid/apis/id/v1alpha1.SiteID": schema_kuid_apis_id_v1alpha1_SiteID(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.Cluster": schema_kuid_apis_infra_v1alpha1_Cluster(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.ClusterList": schema_kuid_apis_infra_v1alpha1_ClusterList(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.ClusterSpec": schema_kuid_apis_infra_v1alpha1_ClusterSpec(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.ClusterStatus": schema_kuid_apis_infra_v1alpha1_ClusterStatus(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.Endpoint": schema_kuid_apis_infra_v1alpha1_Endpoint(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.EndpointList": schema_kuid_apis_infra_v1alpha1_EndpointList(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.EndpointSet": schema_kuid_apis_infra_v1alpha1_EndpointSet(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.EndpointSetList": schema_kuid_apis_infra_v1alpha1_EndpointSetList(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.EndpointSetSpec": schema_kuid_apis_infra_v1alpha1_EndpointSetSpec(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.EndpointSetStatus": schema_kuid_apis_infra_v1alpha1_EndpointSetStatus(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.EndpointSpec": schema_kuid_apis_infra_v1alpha1_EndpointSpec(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.EndpointStatus": schema_kuid_apis_infra_v1alpha1_EndpointStatus(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.Link": schema_kuid_apis_infra_v1alpha1_Link(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.LinkList": schema_kuid_apis_infra_v1alpha1_LinkList(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.LinkSet": schema_kuid_apis_infra_v1alpha1_LinkSet(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.LinkSetList": schema_kuid_apis_infra_v1alpha1_LinkSetList(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.LinkSetSpec": schema_kuid_apis_infra_v1alpha1_LinkSetSpec(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.LinkSetStatus": schema_kuid_apis_infra_v1alpha1_LinkSetStatus(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.LinkSpec": schema_kuid_apis_infra_v1alpha1_LinkSpec(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.LinkStatus": schema_kuid_apis_infra_v1alpha1_LinkStatus(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.Location": schema_kuid_apis_infra_v1alpha1_Location(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.Module": schema_kuid_apis_infra_v1alpha1_Module(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.ModuleBay": schema_kuid_apis_infra_v1alpha1_ModuleBay(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.ModuleBayList": schema_kuid_apis_infra_v1alpha1_ModuleBayList(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.ModuleBaySpec": schema_kuid_apis_infra_v1alpha1_ModuleBaySpec(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.ModuleBayStatus": schema_kuid_apis_infra_v1alpha1_ModuleBayStatus(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.ModuleList": schema_kuid_apis_infra_v1alpha1_ModuleList(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.ModuleSpec": schema_kuid_apis_infra_v1alpha1_ModuleSpec(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.ModuleStatus": schema_kuid_apis_infra_v1alpha1_ModuleStatus(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.Node": schema_kuid_apis_infra_v1alpha1_Node(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeItem": schema_kuid_apis_infra_v1alpha1_NodeItem(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeItemList": schema_kuid_apis_infra_v1alpha1_NodeItemList(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeItemSpec": schema_kuid_apis_infra_v1alpha1_NodeItemSpec(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeItemStatus": schema_kuid_apis_infra_v1alpha1_NodeItemStatus(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeList": schema_kuid_apis_infra_v1alpha1_NodeList(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeSet": schema_kuid_apis_infra_v1alpha1_NodeSet(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeSetList": schema_kuid_apis_infra_v1alpha1_NodeSetList(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeSetSpec": schema_kuid_apis_infra_v1alpha1_NodeSetSpec(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeSetStatus": schema_kuid_apis_infra_v1alpha1_NodeSetStatus(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeSpec": schema_kuid_apis_infra_v1alpha1_NodeSpec(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.NodeStatus": schema_kuid_apis_infra_v1alpha1_NodeStatus(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.Partition": schema_kuid_apis_infra_v1alpha1_Partition(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.PartitionList": schema_kuid_apis_infra_v1alpha1_PartitionList(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.PartitionSpec": schema_kuid_apis_infra_v1alpha1_PartitionSpec(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.PartitionStatus": schema_kuid_apis_infra_v1alpha1_PartitionStatus(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.Rack": schema_kuid_apis_infra_v1alpha1_Rack(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.RackList": schema_kuid_apis_infra_v1alpha1_RackList(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.RackSpec": schema_kuid_apis_infra_v1alpha1_RackSpec(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.RackStatus": schema_kuid_apis_infra_v1alpha1_RackStatus(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.Region": schema_kuid_apis_infra_v1alpha1_Region(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.RegionList": schema_kuid_apis_infra_v1alpha1_RegionList(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.RegionSpec": schema_kuid_apis_infra_v1alpha1_RegionSpec(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.RegionStatus": schema_kuid_apis_infra_v1alpha1_RegionStatus(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.Site": schema_kuid_apis_infra_v1alpha1_Site(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.SiteList": schema_kuid_apis_infra_v1alpha1_SiteList(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.SiteSpec": schema_kuid_apis_infra_v1alpha1_SiteSpec(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.SiteStatus": schema_kuid_apis_infra_v1alpha1_SiteStatus(ref), + "k8s.io/apimachinery/pkg/api/resource.Quantity": schema_apimachinery_pkg_api_resource_Quantity(ref), + "k8s.io/apimachinery/pkg/api/resource.int64Amount": schema_apimachinery_pkg_api_resource_int64Amount(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIGroup": schema_pkg_apis_meta_v1_APIGroup(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIGroupList": schema_pkg_apis_meta_v1_APIGroupList(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIResource": schema_pkg_apis_meta_v1_APIResource(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIResourceList": schema_pkg_apis_meta_v1_APIResourceList(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIVersions": schema_pkg_apis_meta_v1_APIVersions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ApplyOptions": schema_pkg_apis_meta_v1_ApplyOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Condition": schema_pkg_apis_meta_v1_Condition(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.CreateOptions": schema_pkg_apis_meta_v1_CreateOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.DeleteOptions": schema_pkg_apis_meta_v1_DeleteOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Duration": schema_pkg_apis_meta_v1_Duration(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.FieldSelectorRequirement": schema_pkg_apis_meta_v1_FieldSelectorRequirement(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.FieldsV1": schema_pkg_apis_meta_v1_FieldsV1(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GetOptions": schema_pkg_apis_meta_v1_GetOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupKind": schema_pkg_apis_meta_v1_GroupKind(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupResource": schema_pkg_apis_meta_v1_GroupResource(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersion": schema_pkg_apis_meta_v1_GroupVersion(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionForDiscovery": schema_pkg_apis_meta_v1_GroupVersionForDiscovery(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionKind": schema_pkg_apis_meta_v1_GroupVersionKind(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionResource": schema_pkg_apis_meta_v1_GroupVersionResource(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.InternalEvent": schema_pkg_apis_meta_v1_InternalEvent(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector": schema_pkg_apis_meta_v1_LabelSelector(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelectorRequirement": schema_pkg_apis_meta_v1_LabelSelectorRequirement(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.List": schema_pkg_apis_meta_v1_List(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta": schema_pkg_apis_meta_v1_ListMeta(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ListOptions": schema_pkg_apis_meta_v1_ListOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ManagedFieldsEntry": schema_pkg_apis_meta_v1_ManagedFieldsEntry(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.MicroTime": schema_pkg_apis_meta_v1_MicroTime(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta": schema_pkg_apis_meta_v1_ObjectMeta(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.OwnerReference": schema_pkg_apis_meta_v1_OwnerReference(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.PartialObjectMetadata": schema_pkg_apis_meta_v1_PartialObjectMetadata(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.PartialObjectMetadataList": schema_pkg_apis_meta_v1_PartialObjectMetadataList(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Patch": schema_pkg_apis_meta_v1_Patch(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.PatchOptions": schema_pkg_apis_meta_v1_PatchOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Preconditions": schema_pkg_apis_meta_v1_Preconditions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.RootPaths": schema_pkg_apis_meta_v1_RootPaths(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR": schema_pkg_apis_meta_v1_ServerAddressByClientCIDR(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Status": schema_pkg_apis_meta_v1_Status(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.StatusCause": schema_pkg_apis_meta_v1_StatusCause(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.StatusDetails": schema_pkg_apis_meta_v1_StatusDetails(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Table": schema_pkg_apis_meta_v1_Table(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.TableColumnDefinition": schema_pkg_apis_meta_v1_TableColumnDefinition(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.TableOptions": schema_pkg_apis_meta_v1_TableOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.TableRow": schema_pkg_apis_meta_v1_TableRow(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.TableRowCondition": schema_pkg_apis_meta_v1_TableRowCondition(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Time": schema_pkg_apis_meta_v1_Time(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Timestamp": schema_pkg_apis_meta_v1_Timestamp(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta": schema_pkg_apis_meta_v1_TypeMeta(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.UpdateOptions": schema_pkg_apis_meta_v1_UpdateOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.WatchEvent": schema_pkg_apis_meta_v1_WatchEvent(ref), + "k8s.io/apimachinery/pkg/runtime.RawExtension": schema_k8sio_apimachinery_pkg_runtime_RawExtension(ref), + "k8s.io/apimachinery/pkg/runtime.TypeMeta": schema_k8sio_apimachinery_pkg_runtime_TypeMeta(ref), + "k8s.io/apimachinery/pkg/runtime.Unknown": schema_k8sio_apimachinery_pkg_runtime_Unknown(ref), + "k8s.io/apimachinery/pkg/version.Info": schema_k8sio_apimachinery_pkg_version_Info(ref), } } @@ -918,6 +942,1198 @@ func schema_apis_backend_as_v1alpha1_ASIndexStatus(ref common.ReferenceCallback) } } +func schema_apis_backend_extcomm_v1alpha1_EXTCOMMClaim(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "EXTCOMMClaim is the Schema for the EXTCOMMClaim API", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMClaimSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMClaimStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMClaimSpec", "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMClaimStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_apis_backend_extcomm_v1alpha1_EXTCOMMClaimList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "EXTCOMMClaimList contains a list of EXTCOMMClaims", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMClaim"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMClaim", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_apis_backend_extcomm_v1alpha1_EXTCOMMClaimSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "EXTCOMMClaimSpec defines the dEXTCOMMred state of EXTCOMMClaim", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "index": { + SchemaProps: spec.SchemaProps{ + Description: "EXTCOMMIndex defines the EXTCOMM index for the EXTCOMM Claim", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "id": { + SchemaProps: spec.SchemaProps{ + Description: "EXTCOMMID defines the EXTCOMM for the EXTCOMM claim", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "range": { + SchemaProps: spec.SchemaProps{ + Description: "Range defines the EXTCOMM range for the EXTCOMM claim The following notation is used: start-end - the EXTCOMMs in the range must be consecutive", + Type: []string{"string"}, + Format: "", + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels as user defined labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "selector": { + SchemaProps: spec.SchemaProps{ + Description: "Selector defines the selector criterias", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), + }, + }, + }, + Required: []string{"index"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, + } +} + +func schema_apis_backend_extcomm_v1alpha1_EXTCOMMClaimStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "EXTCOMMClaimStatus defines the observed state of EXTCOMMClaim", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"), + }, + }, + }, + }, + }, + "id": { + SchemaProps: spec.SchemaProps{ + Description: "EXTCOMMID defines the EXTCOMM for the EXTCOMM claim", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "range": { + SchemaProps: spec.SchemaProps{ + Description: "EXTCOMMRange defines the EXTCOMM range for the EXTCOMM claim", + Type: []string{"string"}, + Format: "", + }, + }, + "expiryTime": { + SchemaProps: spec.SchemaProps{ + Description: "ExpiryTime defines when the claim expires", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"}, + } +} + +func schema_apis_backend_extcomm_v1alpha1_EXTCOMMEntry(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "EXTCOMMEntry is the Schema for the EXTCOMMentry API", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMEntrySpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMEntryStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMEntrySpec", "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMEntryStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_apis_backend_extcomm_v1alpha1_EXTCOMMEntryList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "EXTCOMMEntryList contains a list of EXTCOMMEntries", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMEntry"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMEntry", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_apis_backend_extcomm_v1alpha1_EXTCOMMEntrySpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "EXTCOMMEntrySpec defines the dEXTCOMMred state of EXTCOMMEntry", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "index": { + SchemaProps: spec.SchemaProps{ + Description: "EXTCOMMIndex defines the EXTCOMM index for the EXTCOMM Claim", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "claimType": { + SchemaProps: spec.SchemaProps{ + Description: "ClaimType defines the claimType of the EXTCOMM Entry", + Type: []string{"string"}, + Format: "", + }, + }, + "id": { + SchemaProps: spec.SchemaProps{ + Description: "ID defines the id of the EXTCOMM entry in the tree", + Type: []string{"string"}, + Format: "", + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels as user defined labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "selector": { + SchemaProps: spec.SchemaProps{ + Description: "Selector defines the selector criterias", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), + }, + }, + "claim": { + SchemaProps: spec.SchemaProps{ + Description: "Claim defines the name of the claim that is the origin of this entry", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"index", "claim"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, + } +} + +func schema_apis_backend_extcomm_v1alpha1_EXTCOMMEntryStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "EXTCOMMEntryStatus defines the observed state of EXTCOMMEntry", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"}, + } +} + +func schema_apis_backend_extcomm_v1alpha1_EXTCOMMIndex(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "EXTCOMMIndex is the Schema for the EXTCOMMIndex API", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMIndexSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMIndexStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMIndexSpec", "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMIndexStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_apis_backend_extcomm_v1alpha1_EXTCOMMIndexList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "EXTCOMMIndexList contains a list of EXTCOMMIndexs", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMIndex"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1.EXTCOMMIndex", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_apis_backend_extcomm_v1alpha1_EXTCOMMIndexSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "EXTCOMMIndexSpec defines the dEXTCOMMred state of EXTCOMMIndex", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "minID": { + SchemaProps: spec.SchemaProps{ + Description: "MinID defines the min EXTCOMM ID the index supports", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "maxID": { + SchemaProps: spec.SchemaProps{ + Description: "MaxID defines the max EXTCOMM ID the index supports", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels as user defined labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "transitive": { + SchemaProps: spec.SchemaProps{ + Description: "Transitive defines the transative nature of the extended community", + Type: []string{"boolean"}, + Format: "", + }, + }, + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Type defines the type of the extended community 2byteAS, 4byteAS, ipv4Address, opaque", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "subType": { + SchemaProps: spec.SchemaProps{ + Description: "SubType defines the subTyoe of the extended community routeTarget, routeOrigin;", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "globalID": { + SchemaProps: spec.SchemaProps{ + Description: "GlobalID is interpreted dependeing on the type AS in case of 2byteAS, 4byteAS IPV4 addrress irrelevant for the opaque type", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"type", "subType"}, + }, + }, + } +} + +func schema_apis_backend_extcomm_v1alpha1_EXTCOMMIndexStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "EXTCOMMIndexStatus defines the observed state of EXTCOMMIndex", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "minID": { + SchemaProps: spec.SchemaProps{ + Description: "MinID defines the min EXTCOMM ID the index supports", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "maxID": { + SchemaProps: spec.SchemaProps{ + Description: "MaxID defines the max EXTCOMM ID the index supports", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"}, + } +} + +func schema_apis_backend_genid_v1alpha1_GENIDClaim(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GENIDClaim is the Schema for the GENIDClaim API", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDClaimSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDClaimStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDClaimSpec", "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDClaimStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_apis_backend_genid_v1alpha1_GENIDClaimList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GENIDClaimList contains a list of GENIDClaims", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDClaim"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDClaim", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_apis_backend_genid_v1alpha1_GENIDClaimSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GENIDClaimSpec defines the desired state of GENIDClaim", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "index": { + SchemaProps: spec.SchemaProps{ + Description: "Index defines the index for the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "id": { + SchemaProps: spec.SchemaProps{ + Description: "ID defines the id of the resource", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "range": { + SchemaProps: spec.SchemaProps{ + Description: "Range defines the VLAN range of the resource The following notation is used: start-end - the VLANs in the range must be consecutive", + Type: []string{"string"}, + Format: "", + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels as user defined labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "selector": { + SchemaProps: spec.SchemaProps{ + Description: "Selector defines the selector criterias", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), + }, + }, + }, + Required: []string{"index"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, + } +} + +func schema_apis_backend_genid_v1alpha1_GENIDClaimStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GENIDClaimStatus defines the observed state of GENIDClaim", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"), + }, + }, + }, + }, + }, + "id": { + SchemaProps: spec.SchemaProps{ + Description: "ID defines the ID assigned to the resource", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "range": { + SchemaProps: spec.SchemaProps{ + Description: "Range defines the range assigned to the resource", + Type: []string{"string"}, + Format: "", + }, + }, + "expiryTime": { + SchemaProps: spec.SchemaProps{ + Description: "ExpiryTime defines when the claim expires", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"}, + } +} + +func schema_apis_backend_genid_v1alpha1_GENIDEntry(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GENIDEntry is the Schema for the GENIDEntry API", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDEntrySpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDEntryStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDEntrySpec", "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDEntryStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_apis_backend_genid_v1alpha1_GENIDEntryList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GENIDEntryList contains a list of VLANEntries", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDEntry"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDEntry", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_apis_backend_genid_v1alpha1_GENIDEntrySpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GENIDEntrySpec defines the desired state of GENIDEntry", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "index": { + SchemaProps: spec.SchemaProps{ + Description: "Index defines the index for the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "claimType": { + SchemaProps: spec.SchemaProps{ + Description: "ClaimType defines the claimType of the resource", + Type: []string{"string"}, + Format: "", + }, + }, + "id": { + SchemaProps: spec.SchemaProps{ + Description: "ID defines the id of the resource in the tree", + Type: []string{"string"}, + Format: "", + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels as user defined labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "selector": { + SchemaProps: spec.SchemaProps{ + Description: "Selector defines the selector criterias", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), + }, + }, + }, + Required: []string{"index"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, + } +} + +func schema_apis_backend_genid_v1alpha1_GENIDEntryStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GENIDEntryStatus defines the observed state of GENIDEntry", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"}, + } +} + +func schema_apis_backend_genid_v1alpha1_GENIDIndex(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GENIDIndex is the Schema for the GENIDIndex API", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDIndexSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDIndexStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDIndexSpec", "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDIndexStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_apis_backend_genid_v1alpha1_GENIDIndexList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GENIDIndexList contains a list of GENIDIndexs", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDIndex"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/backend/genid/v1alpha1.GENIDIndex", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_apis_backend_genid_v1alpha1_GENIDIndexSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GENIDIndexSpec defines the desired state of GENIDIndex", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "minID": { + SchemaProps: spec.SchemaProps{ + Description: "MinID defines the min ID the index supports", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "maxID": { + SchemaProps: spec.SchemaProps{ + Description: "MaxID defines the max ID the index supports", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels as user defined labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Type defines the type of the GENID 16bit, 32bit, 48bit, 64bit", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_apis_backend_genid_v1alpha1_GENIDIndexStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GENIDIndexStatus defines the observed state of GENIDIndex", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "minID": { + SchemaProps: spec.SchemaProps{ + Description: "MinID defines the min ID the index supports", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "maxID": { + SchemaProps: spec.SchemaProps{ + Description: "MaxID defines the max ID the index supports", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"}, + } +} + func schema_apis_backend_ipam_v1alpha1_IPClaim(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ From a18de5a864775e3d51f24c33a455adf28eec5674 Mon Sep 17 00:00:00 2001 From: Wim Henderickx Date: Mon, 28 Oct 2024 09:30:13 +0100 Subject: [PATCH 13/23] added todo --- SYNC.md | 2 -- TODO.md | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 TODO.md diff --git a/SYNC.md b/SYNC.md index 0e99b2c..c568e71 100644 --- a/SYNC.md +++ b/SYNC.md @@ -20,5 +20,3 @@ 4. order is important - sync: when something fails the client need to handle this; once accepted it remains in the system - async: reconciler tries to recover - -5. \ No newline at end of file diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..330caf7 --- /dev/null +++ b/TODO.md @@ -0,0 +1,5 @@ +# TODO + +- rework generic backend to also update MIN/MAX as aprt of index creation (similar to ipam) +- proto generation (also needed for configserver) +- add reconcilers for non IPAM resources \ No newline at end of file From 2daccf3d77bf50b920143a8f54cdc6fada66edc9 Mon Sep 17 00:00:00 2001 From: Wim Henderickx Date: Mon, 28 Oct 2024 12:31:50 +0100 Subject: [PATCH 14/23] updated imports --- crds/extcomm.be.kuid.dev_extcommclaims.yaml | 364 +++++++++++++++ crds/extcomm.be.kuid.dev_extcommentries.yaml | 344 ++++++++++++++ crds/extcomm.be.kuid.dev_extcommindexes.yaml | 298 ++++++++++++ crds/genid.be.kuid.dev_genidclaims.yaml | 360 +++++++++++++++ crds/genid.be.kuid.dev_genidentries.yaml | 332 ++++++++++++++ crds/genid.be.kuid.dev_genidindexes.yaml | 260 +++++++++++ crds/ipam.be.kuid.dev_ipclaims.yaml | 450 +++++++++++++++++++ crds/ipam.be.kuid.dev_ipentries.yaml | 308 +++++++++++++ crds/ipam.be.kuid.dev_ipindices.yaml | 334 ++++++++++++++ crds/vlan.be.kuid.dev_vlanclaims.yaml | 360 +++++++++++++++ crds/vlan.be.kuid.dev_vlanentries.yaml | 332 ++++++++++++++ crds/vlan.be.kuid.dev_vlanindices.yaml | 250 +++++++++++ pkg/backend/ipam/applicator_static_prefix.go | 2 +- pkg/backend/ipam/applicator_static_range.go | 2 +- pkg/backend/ipam/applicator_util.go | 2 +- 15 files changed, 3995 insertions(+), 3 deletions(-) create mode 100644 crds/extcomm.be.kuid.dev_extcommclaims.yaml create mode 100644 crds/extcomm.be.kuid.dev_extcommentries.yaml create mode 100644 crds/extcomm.be.kuid.dev_extcommindexes.yaml create mode 100644 crds/genid.be.kuid.dev_genidclaims.yaml create mode 100644 crds/genid.be.kuid.dev_genidentries.yaml create mode 100644 crds/genid.be.kuid.dev_genidindexes.yaml create mode 100644 crds/ipam.be.kuid.dev_ipclaims.yaml create mode 100644 crds/ipam.be.kuid.dev_ipentries.yaml create mode 100644 crds/ipam.be.kuid.dev_ipindices.yaml create mode 100644 crds/vlan.be.kuid.dev_vlanclaims.yaml create mode 100644 crds/vlan.be.kuid.dev_vlanentries.yaml create mode 100644 crds/vlan.be.kuid.dev_vlanindices.yaml diff --git a/crds/extcomm.be.kuid.dev_extcommclaims.yaml b/crds/extcomm.be.kuid.dev_extcommclaims.yaml new file mode 100644 index 0000000..e267917 --- /dev/null +++ b/crds/extcomm.be.kuid.dev_extcommclaims.yaml @@ -0,0 +1,364 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: extcommclaims.extcomm.be.kuid.dev +spec: + group: extcomm.be.kuid.dev + names: + kind: EXTCOMMClaim + listKind: EXTCOMMClaimList + plural: extcommclaims + singular: extcommclaim + scope: Namespaced + versions: + - name: extcomm + schema: + openAPIV3Schema: + description: EXTCOMMClaim is the Schema for the EXTCOMMClaim API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: EXTCOMMClaimSpec defines the dEXTCOMMred state of EXTCOMMClaim + properties: + id: + description: EXTCOMMID defines the EXTCOMM for the EXTCOMM claim + format: int64 + type: integer + index: + description: EXTCOMMIndex defines the EXTCOMM index for the EXTCOMM + Claim + type: string + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + range: + description: |- + Range defines the EXTCOMM range for the EXTCOMM claim + The following notation is used: start-end - + the EXTCOMMs in the range must be consecutive + type: string + selector: + description: Selector defines the selector criterias + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. + The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector applies + to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + required: + - index + type: object + status: + description: EXTCOMMClaimStatus defines the observed state of EXTCOMMClaim + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + expiryTime: + description: ExpiryTime defines when the claim expires + type: string + id: + description: EXTCOMMID defines the EXTCOMM for the EXTCOMM claim + format: int64 + type: integer + range: + description: EXTCOMMRange defines the EXTCOMM range for the EXTCOMM + claim + type: string + type: object + type: object + served: true + storage: false + - name: v1alpha1 + schema: + openAPIV3Schema: + description: EXTCOMMClaim is the Schema for the EXTCOMMClaim API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: EXTCOMMClaimSpec defines the dEXTCOMMred state of EXTCOMMClaim + properties: + id: + description: EXTCOMMID defines the EXTCOMM for the EXTCOMM claim + format: int64 + type: integer + index: + description: EXTCOMMIndex defines the EXTCOMM index for the EXTCOMM + Claim + type: string + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + range: + description: |- + Range defines the EXTCOMM range for the EXTCOMM claim + The following notation is used: start-end - + the EXTCOMMs in the range must be consecutive + type: string + selector: + description: Selector defines the selector criterias + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. + The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector applies + to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + required: + - index + type: object + status: + description: EXTCOMMClaimStatus defines the observed state of EXTCOMMClaim + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + expiryTime: + description: ExpiryTime defines when the claim expires + type: string + id: + description: EXTCOMMID defines the EXTCOMM for the EXTCOMM claim + format: int64 + type: integer + range: + description: EXTCOMMRange defines the EXTCOMM range for the EXTCOMM + claim + type: string + type: object + type: object + served: true + storage: false diff --git a/crds/extcomm.be.kuid.dev_extcommentries.yaml b/crds/extcomm.be.kuid.dev_extcommentries.yaml new file mode 100644 index 0000000..cb25af6 --- /dev/null +++ b/crds/extcomm.be.kuid.dev_extcommentries.yaml @@ -0,0 +1,344 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: extcommentries.extcomm.be.kuid.dev +spec: + group: extcomm.be.kuid.dev + names: + kind: EXTCOMMEntry + listKind: EXTCOMMEntryList + plural: extcommentries + singular: extcommentry + scope: Namespaced + versions: + - name: extcomm + schema: + openAPIV3Schema: + description: EXTCOMMEntry is the Schema for the EXTCOMMentry API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: EXTCOMMEntrySpec defines the dEXTCOMMred state of EXTCOMMEntry + properties: + claim: + description: Claim defines the name of the claim that is the origin + of this entry + type: string + claimType: + description: ClaimType defines the claimType of the EXTCOMM Entry + type: string + id: + description: ID defines the id of the EXTCOMM entry in the tree + type: string + index: + description: EXTCOMMIndex defines the EXTCOMM index for the EXTCOMM + Claim + type: string + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + selector: + description: Selector defines the selector criterias + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. + The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector applies + to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + required: + - claim + - index + type: object + status: + description: EXTCOMMEntryStatus defines the observed state of EXTCOMMEntry + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: false + - name: v1alpha1 + schema: + openAPIV3Schema: + description: EXTCOMMEntry is the Schema for the EXTCOMMentry API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: EXTCOMMEntrySpec defines the dEXTCOMMred state of EXTCOMMEntry + properties: + claim: + description: Claim defines the name of the claim that is the origin + of this entry + type: string + claimType: + description: ClaimType defines the claimType of the EXTCOMM Entry + type: string + id: + description: ID defines the id of the EXTCOMM entry in the tree + type: string + index: + description: EXTCOMMIndex defines the EXTCOMM index for the EXTCOMM + Claim + type: string + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + selector: + description: Selector defines the selector criterias + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. + The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector applies + to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + required: + - claim + - index + type: object + status: + description: EXTCOMMEntryStatus defines the observed state of EXTCOMMEntry + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: false diff --git a/crds/extcomm.be.kuid.dev_extcommindexes.yaml b/crds/extcomm.be.kuid.dev_extcommindexes.yaml new file mode 100644 index 0000000..ceadcf7 --- /dev/null +++ b/crds/extcomm.be.kuid.dev_extcommindexes.yaml @@ -0,0 +1,298 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: extcommindexes.extcomm.be.kuid.dev +spec: + group: extcomm.be.kuid.dev + names: + kind: EXTCOMMIndex + listKind: EXTCOMMIndexList + plural: extcommindexes + singular: extcommindex + scope: Namespaced + versions: + - name: extcomm + schema: + openAPIV3Schema: + description: EXTCOMMIndex is the Schema for the EXTCOMMIndex API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: EXTCOMMIndexSpec defines the dEXTCOMMred state of EXTCOMMIndex + properties: + globalID: + description: |- + GlobalID is interpreted dependeing on the type + AS in case of 2byteAS, 4byteAS + IPV4 addrress + irrelevant for the opaque type + type: string + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + maxID: + description: MaxID defines the max EXTCOMM ID the index supports + format: int64 + type: integer + minID: + description: MinID defines the min EXTCOMM ID the index supports + format: int64 + type: integer + subType: + description: |- + SubType defines the subTyoe of the extended community + routeTarget, routeOrigin; + type: string + transitive: + description: Transitive defines the transative nature of the extended + community + type: boolean + type: + description: |- + Type defines the type of the extended community + 2byteAS, 4byteAS, ipv4Address, opaque + type: string + required: + - subType + - type + type: object + status: + description: EXTCOMMIndexStatus defines the observed state of EXTCOMMIndex + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + maxID: + description: MaxID defines the max EXTCOMM ID the index supports + format: int64 + type: integer + minID: + description: MinID defines the min EXTCOMM ID the index supports + format: int64 + type: integer + type: object + type: object + served: true + storage: false + - name: v1alpha1 + schema: + openAPIV3Schema: + description: EXTCOMMIndex is the Schema for the EXTCOMMIndex API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: EXTCOMMIndexSpec defines the dEXTCOMMred state of EXTCOMMIndex + properties: + globalID: + description: |- + GlobalID is interpreted dependeing on the type + AS in case of 2byteAS, 4byteAS + IPV4 addrress + irrelevant for the opaque type + type: string + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + maxID: + description: MaxID defines the max EXTCOMM ID the index supports + format: int64 + type: integer + minID: + description: MinID defines the min EXTCOMM ID the index supports + format: int64 + type: integer + subType: + description: |- + SubType defines the subTyoe of the extended community + routeTarget, routeOrigin; + type: string + transitive: + description: Transitive defines the transative nature of the extended + community + type: boolean + type: + description: |- + Type defines the type of the extended community + 2byteAS, 4byteAS, ipv4Address, opaque + type: string + required: + - subType + - type + type: object + status: + description: EXTCOMMIndexStatus defines the observed state of EXTCOMMIndex + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + maxID: + description: MaxID defines the max EXTCOMM ID the index supports + format: int64 + type: integer + minID: + description: MinID defines the min EXTCOMM ID the index supports + format: int64 + type: integer + type: object + type: object + served: true + storage: false diff --git a/crds/genid.be.kuid.dev_genidclaims.yaml b/crds/genid.be.kuid.dev_genidclaims.yaml new file mode 100644 index 0000000..1e4d348 --- /dev/null +++ b/crds/genid.be.kuid.dev_genidclaims.yaml @@ -0,0 +1,360 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: genidclaims.genid.be.kuid.dev +spec: + group: genid.be.kuid.dev + names: + kind: GENIDClaim + listKind: GENIDClaimList + plural: genidclaims + singular: genidclaim + scope: Namespaced + versions: + - name: genid + schema: + openAPIV3Schema: + description: GENIDClaim is the Schema for the GENIDClaim API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: GENIDClaimSpec defines the desired state of GENIDClaim + properties: + id: + description: ID defines the id of the resource + format: int64 + type: integer + index: + description: Index defines the index for the resource + type: string + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + range: + description: |- + Range defines the VLAN range of the resource + The following notation is used: start-end - + the VLANs in the range must be consecutive + type: string + selector: + description: Selector defines the selector criterias + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. + The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector applies + to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + required: + - index + type: object + status: + description: GENIDClaimStatus defines the observed state of GENIDClaim + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + expiryTime: + description: ExpiryTime defines when the claim expires + type: string + id: + description: ID defines the ID assigned to the resource + format: int64 + type: integer + range: + description: Range defines the range assigned to the resource + type: string + type: object + type: object + served: true + storage: false + - name: v1alpha1 + schema: + openAPIV3Schema: + description: GENIDClaim is the Schema for the GENIDClaim API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: GENIDClaimSpec defines the desired state of GENIDClaim + properties: + id: + description: ID defines the id of the resource + format: int64 + type: integer + index: + description: Index defines the index for the resource + type: string + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + range: + description: |- + Range defines the VLAN range of the resource + The following notation is used: start-end - + the VLANs in the range must be consecutive + type: string + selector: + description: Selector defines the selector criterias + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. + The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector applies + to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + required: + - index + type: object + status: + description: GENIDClaimStatus defines the observed state of GENIDClaim + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + expiryTime: + description: ExpiryTime defines when the claim expires + type: string + id: + description: ID defines the ID assigned to the resource + format: int64 + type: integer + range: + description: Range defines the range assigned to the resource + type: string + type: object + type: object + served: true + storage: false diff --git a/crds/genid.be.kuid.dev_genidentries.yaml b/crds/genid.be.kuid.dev_genidentries.yaml new file mode 100644 index 0000000..99d520f --- /dev/null +++ b/crds/genid.be.kuid.dev_genidentries.yaml @@ -0,0 +1,332 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: genidentries.genid.be.kuid.dev +spec: + group: genid.be.kuid.dev + names: + kind: GENIDEntry + listKind: GENIDEntryList + plural: genidentries + singular: genidentry + scope: Namespaced + versions: + - name: genid + schema: + openAPIV3Schema: + description: GENIDEntry is the Schema for the GENIDEntry API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: GENIDEntrySpec defines the desired state of GENIDEntry + properties: + claimType: + description: ClaimType defines the claimType of the resource + type: string + id: + description: ID defines the id of the resource in the tree + type: string + index: + description: Index defines the index for the resource + type: string + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + selector: + description: Selector defines the selector criterias + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. + The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector applies + to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + required: + - index + type: object + status: + description: GENIDEntryStatus defines the observed state of GENIDEntry + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: false + - name: v1alpha1 + schema: + openAPIV3Schema: + description: GENIDEntry is the Schema for the GENIDEntry API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: GENIDEntrySpec defines the desired state of GENIDEntry + properties: + claimType: + description: ClaimType defines the claimType of the resource + type: string + id: + description: ID defines the id of the resource in the tree + type: string + index: + description: Index defines the index for the resource + type: string + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + selector: + description: Selector defines the selector criterias + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. + The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector applies + to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + required: + - index + type: object + status: + description: GENIDEntryStatus defines the observed state of GENIDEntry + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: false diff --git a/crds/genid.be.kuid.dev_genidindexes.yaml b/crds/genid.be.kuid.dev_genidindexes.yaml new file mode 100644 index 0000000..7614eb7 --- /dev/null +++ b/crds/genid.be.kuid.dev_genidindexes.yaml @@ -0,0 +1,260 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: genidindexes.genid.be.kuid.dev +spec: + group: genid.be.kuid.dev + names: + kind: GENIDIndex + listKind: GENIDIndexList + plural: genidindexes + singular: genidindex + scope: Namespaced + versions: + - name: genid + schema: + openAPIV3Schema: + description: GENIDIndex is the Schema for the GENIDIndex API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: GENIDIndexSpec defines the desired state of GENIDIndex + properties: + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + maxID: + description: MaxID defines the max ID the index supports + format: int64 + type: integer + minID: + description: MinID defines the min ID the index supports + format: int64 + type: integer + type: + description: |- + Type defines the type of the GENID + 16bit, 32bit, 48bit, 64bit + type: string + type: object + status: + description: GENIDIndexStatus defines the observed state of GENIDIndex + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + maxID: + description: MaxID defines the max ID the index supports + format: int64 + type: integer + minID: + description: MinID defines the min ID the index supports + format: int64 + type: integer + type: object + type: object + served: true + storage: false + - name: v1alpha1 + schema: + openAPIV3Schema: + description: GENIDIndex is the Schema for the GENIDIndex API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: GENIDIndexSpec defines the desired state of GENIDIndex + properties: + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + maxID: + description: MaxID defines the max ID the index supports + format: int64 + type: integer + minID: + description: MinID defines the min ID the index supports + format: int64 + type: integer + type: + description: |- + Type defines the type of the GENID + 16bit, 32bit, 48bit, 64bit + type: string + type: object + status: + description: GENIDIndexStatus defines the observed state of GENIDIndex + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + maxID: + description: MaxID defines the max ID the index supports + format: int64 + type: integer + minID: + description: MinID defines the min ID the index supports + format: int64 + type: integer + type: object + type: object + served: true + storage: false diff --git a/crds/ipam.be.kuid.dev_ipclaims.yaml b/crds/ipam.be.kuid.dev_ipclaims.yaml new file mode 100644 index 0000000..53415e3 --- /dev/null +++ b/crds/ipam.be.kuid.dev_ipclaims.yaml @@ -0,0 +1,450 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: ipclaims.ipam.be.kuid.dev +spec: + group: ipam.be.kuid.dev + names: + kind: IPClaim + listKind: IPClaimList + plural: ipclaims + singular: ipclaim + scope: Namespaced + versions: + - name: ipam + schema: + openAPIV3Schema: + description: IPClaim is the Schema for the ipclaim API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: IPClaimSpec defines the desired state of IPClaim + properties: + address: + description: Address defines the address for the IP claim + type: string + addressFamily: + description: AddressFamily defines the address family for the IP claim + enum: + - ipv4 + - ipv6 + type: string + createPrefix: + description: |- + CreatePrefix defines if this prefix must be created. Only used for dynamic prefixes + e.g. non /32 ipv4 and non /128 ipv6 prefixes + type: boolean + defaultGateway: + description: DefaultGateway defines if the address acts as a default + gateway + type: boolean + idx: + description: |- + Index defines the index of the IP Claim, used to get a deterministic IP from a prefix + If not present we claim a random prefix from a prefix + format: int32 + type: integer + index: + description: Index defines the index for the IP Entry + type: string + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + prefix: + description: Prefix defines the prefix for the IP claim + type: string + prefixLength: + description: |- + PrefixLength defines the prefix length for the IP Claim, Must be set when CreatePrefic is set + If not present we use assume /32 for ipv4 and /128 for ipv6 + format: int32 + type: integer + prefixType: + description: |- + PrefixType defines the prefixtype of IPEntry; for address and range claims this is not relevant + - network kind is used for physical, virtual nics on a device + - pool kind is used for allocating dedicated IP addresses + - aggregate kind is used for claiming an aggregate prefix; only used for networkInstance prefixes + enum: + - network + - aggregate + - pool + type: string + range: + description: Range defines the range for the IP claim + type: string + selector: + description: Selector defines the selector criterias + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. + The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector applies + to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + required: + - index + type: object + status: + description: IPClaimStatus defines the observed state of IPClaim + properties: + address: + description: Address defines the address, claimed through the IPAM + backend + type: string + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + defaultGateway: + description: |- + DefaultGateway defines the default gateway IP for the claimed prefix + DefaultGateway is only relevant for prefix kind = network + type: string + expiryTime: + description: ExpiryTime defines when the claim expires + type: string + prefix: + description: Prefix defines the prefix, claimed through the IPAM backend + type: string + range: + description: Range defines the range, claimed through the IPAM backend + type: string + type: object + type: object + served: true + storage: false + - name: v1alpha1 + schema: + openAPIV3Schema: + description: IPClaim is the Schema for the ipclaim API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: IPClaimSpec defines the desired state of IPClaim + properties: + address: + description: Address defines the address for the IP claim + type: string + addressFamily: + description: AddressFamily defines the address family for the IP claim + enum: + - ipv4 + - ipv6 + type: string + createPrefix: + description: |- + CreatePrefix defines if this prefix must be created. Only used for dynamic prefixes + e.g. non /32 ipv4 and non /128 ipv6 prefixes + type: boolean + defaultGateway: + description: DefaultGateway defines if the address acts as a default + gateway + type: boolean + idx: + description: |- + Index defines the index of the IP Claim, used to get a deterministic IP from a prefix + If not present we claim a random prefix from a prefix + format: int32 + type: integer + index: + description: Index defines the index for the IP Entry + type: string + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + prefix: + description: Prefix defines the prefix for the IP claim + type: string + prefixLength: + description: |- + PrefixLength defines the prefix length for the IP Claim, Must be set when CreatePrefic is set + If not present we use assume /32 for ipv4 and /128 for ipv6 + format: int32 + type: integer + prefixType: + description: |- + PrefixType defines the prefixtype of IPEntry; for address and range claims this is not relevant + - network kind is used for physical, virtual nics on a device + - pool kind is used for allocating dedicated IP addresses + - aggregate kind is used for claiming an aggregate prefix; only used for networkInstance prefixes + enum: + - network + - aggregate + - pool + type: string + range: + description: Range defines the range for the IP claim + type: string + selector: + description: Selector defines the selector criterias + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. + The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector applies + to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + required: + - index + type: object + status: + description: IPClaimStatus defines the observed state of IPClaim + properties: + address: + description: Address defines the address, claimed through the IPAM + backend + type: string + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + defaultGateway: + description: |- + DefaultGateway defines the default gateway IP for the claimed prefix + DefaultGateway is only relevant for prefix kind = network + type: string + expiryTime: + description: ExpiryTime defines when the claim expires + type: string + prefix: + description: Prefix defines the prefix, claimed through the IPAM backend + type: string + range: + description: Range defines the range, claimed through the IPAM backend + type: string + type: object + type: object + served: true + storage: false diff --git a/crds/ipam.be.kuid.dev_ipentries.yaml b/crds/ipam.be.kuid.dev_ipentries.yaml new file mode 100644 index 0000000..4bd9315 --- /dev/null +++ b/crds/ipam.be.kuid.dev_ipentries.yaml @@ -0,0 +1,308 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: ipentries.ipam.be.kuid.dev +spec: + group: ipam.be.kuid.dev + names: + kind: IPEntry + listKind: IPEntryList + plural: ipentries + singular: ipentry + scope: Namespaced + versions: + - name: ipam + schema: + openAPIV3Schema: + description: IPEntry is the Schema for the ipentry API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: IPEntrySpec defines the desired state of IPEntry + properties: + addressFamily: + description: AddressFamily defines the address family for the IP claim + enum: + - ipv4 + - ipv6 + type: string + claimType: + description: ClaimType defines the claimType of the IP Entry + enum: + - staticAddress + - staticPrefix + - staticRange + - dynamicPrefix + - dynamicAddress + type: string + defaultGateway: + description: DefaultGateway defines if the address acts as a default + gateway + type: boolean + index: + description: Index defines the index for the IP Entry + type: string + indexEntry: + description: IndexEntry identifies if the entry is originated from + an IP Index + type: boolean + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + prefix: + description: Prefix defines the prefix for the IP entry; which can + be an expanded prefix from the prefix, range or address + type: string + prefixType: + description: |- + PrefixType defines the prefixtype of IPEntry; for address and range claims this is not relevant + - network kind is used for physical, virtual nics on a device + - pool kind is used for allocating dedicated IP addresses + - aggregate kind is used for claiming an aggregate prefix; only used for networkInstance prefixes + enum: + - network + - aggregate + - pool + type: string + required: + - index + - indexEntry + - prefix + type: object + status: + description: IPEntryStatus defines the observed state of IPEntry + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: false + - name: v1alpha1 + schema: + openAPIV3Schema: + description: IPEntry is the Schema for the ipentry API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: IPEntrySpec defines the desired state of IPEntry + properties: + addressFamily: + description: AddressFamily defines the address family for the IP claim + enum: + - ipv4 + - ipv6 + type: string + claimType: + description: ClaimType defines the claimType of the IP Entry + enum: + - staticAddress + - staticPrefix + - staticRange + - dynamicPrefix + - dynamicAddress + type: string + defaultGateway: + description: DefaultGateway defines if the address acts as a default + gateway + type: boolean + index: + description: Index defines the index for the IP Entry + type: string + indexEntry: + description: IndexEntry identifies if the entry is originated from + an IP Index + type: boolean + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + prefix: + description: Prefix defines the prefix for the IP entry; which can + be an expanded prefix from the prefix, range or address + type: string + prefixType: + description: |- + PrefixType defines the prefixtype of IPEntry; for address and range claims this is not relevant + - network kind is used for physical, virtual nics on a device + - pool kind is used for allocating dedicated IP addresses + - aggregate kind is used for claiming an aggregate prefix; only used for networkInstance prefixes + enum: + - network + - aggregate + - pool + type: string + required: + - index + - indexEntry + - prefix + type: object + status: + description: IPEntryStatus defines the observed state of IPEntry + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: false diff --git a/crds/ipam.be.kuid.dev_ipindices.yaml b/crds/ipam.be.kuid.dev_ipindices.yaml new file mode 100644 index 0000000..cb3cc7c --- /dev/null +++ b/crds/ipam.be.kuid.dev_ipindices.yaml @@ -0,0 +1,334 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: ipindices.ipam.be.kuid.dev +spec: + group: ipam.be.kuid.dev + names: + kind: IPIndex + listKind: IPIndexList + plural: ipindices + singular: ipindex + scope: Namespaced + versions: + - name: ipam + schema: + openAPIV3Schema: + description: IPIndex is the Schema for the IPIndex API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: IPIndexSpec defines the desired state of IPIndex + properties: + prefixes: + description: |- + Prefixes define the aggregate prefixes for the network instance + A Network instance needs at least 1 prefix to be defined to become operational + items: + properties: + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + prefix: + description: Prefix defines the ip cidr in prefix notation. + pattern: (([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))|((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8]))) + type: string + prefixType: + default: aggregate + description: |- + PrefixType defines the prefixtype of IPIndex; + - network kind is used for physical, virtual nics on a device + - pool kind is used for allocating dedicated IP addresses + - aggregate kind is used for claiming an aggregate prefix; only used for networkInstance prefixes + enum: + - network + - aggregate + - pool + type: string + required: + - prefix + type: object + type: array + required: + - prefixes + type: object + status: + description: IPIndexStatus defines the observed state of IPIndex + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + prefixes: + description: Prefixes defines the prefixes, claimed through the IPAM + backend + items: + properties: + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + prefix: + description: Prefix defines the ip cidr in prefix notation. + pattern: (([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))|((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8]))) + type: string + prefixType: + default: aggregate + description: |- + PrefixType defines the prefixtype of IPIndex; + - network kind is used for physical, virtual nics on a device + - pool kind is used for allocating dedicated IP addresses + - aggregate kind is used for claiming an aggregate prefix; only used for networkInstance prefixes + enum: + - network + - aggregate + - pool + type: string + required: + - prefix + type: object + type: array + type: object + type: object + served: true + storage: false + - name: v1alpha1 + schema: + openAPIV3Schema: + description: IPIndex is the Schema for the IPIndex API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: IPIndexSpec defines the desired state of IPIndex + properties: + prefixes: + description: |- + Prefixes define the aggregate prefixes for the network instance + A Network instance needs at least 1 prefix to be defined to become operational + items: + properties: + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + prefix: + description: Prefix defines the ip cidr in prefix notation. + pattern: (([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))|((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8]))) + type: string + prefixType: + default: aggregate + description: |- + PrefixType defines the prefixtype of IPIndex; + - network kind is used for physical, virtual nics on a device + - pool kind is used for allocating dedicated IP addresses + - aggregate kind is used for claiming an aggregate prefix; only used for networkInstance prefixes + enum: + - network + - aggregate + - pool + type: string + required: + - prefix + type: object + type: array + required: + - prefixes + type: object + status: + description: IPIndexStatus defines the observed state of IPIndex + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + prefixes: + description: Prefixes defines the prefixes, claimed through the IPAM + backend + items: + properties: + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + prefix: + description: Prefix defines the ip cidr in prefix notation. + pattern: (([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))|((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8]))) + type: string + prefixType: + default: aggregate + description: |- + PrefixType defines the prefixtype of IPIndex; + - network kind is used for physical, virtual nics on a device + - pool kind is used for allocating dedicated IP addresses + - aggregate kind is used for claiming an aggregate prefix; only used for networkInstance prefixes + enum: + - network + - aggregate + - pool + type: string + required: + - prefix + type: object + type: array + type: object + type: object + served: true + storage: false diff --git a/crds/vlan.be.kuid.dev_vlanclaims.yaml b/crds/vlan.be.kuid.dev_vlanclaims.yaml new file mode 100644 index 0000000..8062df0 --- /dev/null +++ b/crds/vlan.be.kuid.dev_vlanclaims.yaml @@ -0,0 +1,360 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: vlanclaims.vlan.be.kuid.dev +spec: + group: vlan.be.kuid.dev + names: + kind: VLANClaim + listKind: VLANClaimList + plural: vlanclaims + singular: vlanclaim + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: VLANClaim is the Schema for the VLANClaim API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: VLANClaimSpec defines the desired state of VLANClaim + properties: + id: + description: ID defines the id of the resource + format: int32 + type: integer + index: + description: Index defines the index for the resource + type: string + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + range: + description: |- + Range defines the VLAN range of the resource + The following notation is used: start-end - + the VLANs in the range must be consecutive + type: string + selector: + description: Selector defines the selector criterias + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. + The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector applies + to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + required: + - index + type: object + status: + description: VLANClaimStatus defines the observed state of VLANClaim + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + expiryTime: + description: ExpiryTime defines when the claim expires + type: string + id: + description: VLANID defines the VLAN for the VLAN claim + format: int32 + type: integer + range: + description: VLANRange defines the VLAN range for the VLAN claim + type: string + type: object + type: object + served: true + storage: false + - name: vlan + schema: + openAPIV3Schema: + description: VLANClaim is the Schema for the VLANClaim API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: VLANClaimSpec defines the desired state of VLANClaim + properties: + id: + description: ID defines the id of the resource + format: int32 + type: integer + index: + description: Index defines the index for the resource + type: string + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + range: + description: |- + Range defines the VLAN range of the resource + The following notation is used: start-end - + the VLANs in the range must be consecutive + type: string + selector: + description: Selector defines the selector criterias + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. + The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector applies + to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + required: + - index + type: object + status: + description: VLANClaimStatus defines the observed state of VLANClaim + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + expiryTime: + description: ExpiryTime defines when the claim expires + type: string + id: + description: VLANID defines the VLAN for the VLAN claim + format: int32 + type: integer + range: + description: VLANRange defines the VLAN range for the VLAN claim + type: string + type: object + type: object + served: true + storage: false diff --git a/crds/vlan.be.kuid.dev_vlanentries.yaml b/crds/vlan.be.kuid.dev_vlanentries.yaml new file mode 100644 index 0000000..819cbca --- /dev/null +++ b/crds/vlan.be.kuid.dev_vlanentries.yaml @@ -0,0 +1,332 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: vlanentries.vlan.be.kuid.dev +spec: + group: vlan.be.kuid.dev + names: + kind: VLANEntry + listKind: VLANEntryList + plural: vlanentries + singular: vlanentry + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: VLANEntry is the Schema for the VLANentry API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: VLANEntrySpec defines the desired state of VLANEntry + properties: + claimType: + description: ClaimType defines the claimType of the resource + type: string + id: + description: ID defines the id of the resource in the tree + type: string + index: + description: Index defines the index for the resource + type: string + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + selector: + description: Selector defines the selector criterias + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. + The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector applies + to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + required: + - index + type: object + status: + description: VLANEntryStatus defines the observed state of VLANEntry + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: false + - name: vlan + schema: + openAPIV3Schema: + description: VLANEntry is the Schema for the VLANentry API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: VLANEntrySpec defines the desired state of VLANEntry + properties: + claimType: + description: ClaimType defines the claimType of the resource + type: string + id: + description: ID defines the id of the resource in the tree + type: string + index: + description: Index defines the index for the resource + type: string + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + selector: + description: Selector defines the selector criterias + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. + The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector applies + to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + required: + - index + type: object + status: + description: VLANEntryStatus defines the observed state of VLANEntry + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: false diff --git a/crds/vlan.be.kuid.dev_vlanindices.yaml b/crds/vlan.be.kuid.dev_vlanindices.yaml new file mode 100644 index 0000000..29083af --- /dev/null +++ b/crds/vlan.be.kuid.dev_vlanindices.yaml @@ -0,0 +1,250 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: vlanindices.vlan.be.kuid.dev +spec: + group: vlan.be.kuid.dev + names: + kind: VLANIndex + listKind: VLANIndexList + plural: vlanindices + singular: vlanindex + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: VLANIndex is the Schema for the VLANIndex API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: VLANIndexSpec defines the desired state of VLANIndex + properties: + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + maxID: + description: MaxID defines the max VLAN ID the index supports + format: int32 + type: integer + minID: + description: MinID defines the min VLAN ID the index supports + format: int32 + type: integer + type: object + status: + description: VLANIndexStatus defines the observed state of VLANIndex + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + maxID: + description: MaxID defines the max VLAN ID the index supports + format: int32 + type: integer + minID: + description: MinID defines the min VLAN ID the index supports + format: int32 + type: integer + type: object + type: object + served: true + storage: false + - name: vlan + schema: + openAPIV3Schema: + description: VLANIndex is the Schema for the VLANIndex API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: VLANIndexSpec defines the desired state of VLANIndex + properties: + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + maxID: + description: MaxID defines the max VLAN ID the index supports + format: int32 + type: integer + minID: + description: MinID defines the min VLAN ID the index supports + format: int32 + type: integer + type: object + status: + description: VLANIndexStatus defines the observed state of VLANIndex + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + maxID: + description: MaxID defines the max VLAN ID the index supports + format: int32 + type: integer + minID: + description: MinID defines the min VLAN ID the index supports + format: int32 + type: integer + type: object + type: object + served: true + storage: false diff --git a/pkg/backend/ipam/applicator_static_prefix.go b/pkg/backend/ipam/applicator_static_prefix.go index 4b0c859..9d6785a 100644 --- a/pkg/backend/ipam/applicator_static_prefix.go +++ b/pkg/backend/ipam/applicator_static_prefix.go @@ -23,7 +23,7 @@ import ( "github.com/hansthienpondt/nipam/pkg/table" "github.com/henderiw/iputil" "github.com/henderiw/logger/log" - "github.com/kform-dev/choreo/apis/kuid/backend" + "github.com/kuidio/kuid/apis/backend" "github.com/kuidio/kuid/apis/backend/ipam" ) diff --git a/pkg/backend/ipam/applicator_static_range.go b/pkg/backend/ipam/applicator_static_range.go index 4e52655..81b49e5 100644 --- a/pkg/backend/ipam/applicator_static_range.go +++ b/pkg/backend/ipam/applicator_static_range.go @@ -23,7 +23,7 @@ import ( "github.com/hansthienpondt/nipam/pkg/table" "github.com/henderiw/iputil" "github.com/henderiw/logger/log" - "github.com/kform-dev/choreo/apis/kuid/backend" + "github.com/kuidio/kuid/apis/backend" "github.com/kuidio/kuid/apis/backend/ipam" "go4.org/netipx" ) diff --git a/pkg/backend/ipam/applicator_util.go b/pkg/backend/ipam/applicator_util.go index 4da166e..8fb523f 100644 --- a/pkg/backend/ipam/applicator_util.go +++ b/pkg/backend/ipam/applicator_util.go @@ -18,7 +18,7 @@ package ipam import ( "github.com/hansthienpondt/nipam/pkg/table" - "github.com/kform-dev/choreo/apis/kuid/backend" + "github.com/kuidio/kuid/apis/backend" ) func isParentRouteSelectable(route table.Route, prefixLength uint8) bool { From e1f80b5e7c42f046365c5acd9ea759000b6cde23 Mon Sep 17 00:00:00 2001 From: Wim Henderickx Date: Mon, 28 Oct 2024 19:52:51 +0100 Subject: [PATCH 15/23] more generic backend interface - storage agnostic --- apis/backend/as/register/register.go | 12 +- apis/backend/extcomm/register/register.go | 12 +- apis/backend/genid/register/register.go | 12 +- apis/backend/ipam/register/register.go | 13 +- apis/backend/vlan/register/register.go | 30 +-- pkg/backend/backend_interface.go | 4 +- pkg/backend/generic/backend.go | 32 ++- pkg/backend/generic/backend_store.go | 165 ++++++------ pkg/backend/generic/interface.go | 139 ++++++++++ pkg/backend/ipam/backend.go | 33 ++- pkg/backend/ipam/backend_store.go | 294 +++++++++++++--------- pkg/backend/ipam/interface.go | 215 ++++++++++++++++ pkg/backend/storage_providers.go | 2 +- 13 files changed, 718 insertions(+), 245 deletions(-) create mode 100644 pkg/backend/generic/interface.go create mode 100644 pkg/backend/ipam/interface.go diff --git a/apis/backend/as/register/register.go b/apis/backend/as/register/register.go index 170f4ed..563dc68 100644 --- a/apis/backend/as/register/register.go +++ b/apis/backend/as/register/register.go @@ -18,6 +18,7 @@ package register import ( "context" + "fmt" "github.com/henderiw/apiserver-builder/pkg/builder" "github.com/henderiw/apiserver-builder/pkg/builder/resource" @@ -32,6 +33,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apiserver/pkg/registry/generic" + "github.com/henderiw/apiserver-store/pkg/generic/registry" ) func init() { @@ -90,6 +92,10 @@ func ApplyStorageToBackend(ctx context.Context, be bebackend.Backend, apiServer if err != nil { return err } + claimStore, ok := claimStorage.(*registry.Store) + if !ok { + return fmt.Errorf("claimstore is not a registry store") + } entryStorageProvider := apiServer.StorageProvider[schema.GroupResource{ Group: as.SchemeGroupVersion.Group, @@ -100,8 +106,12 @@ func ApplyStorageToBackend(ctx context.Context, be bebackend.Backend, apiServer if err != nil { return err } + entryStore, ok := entryStorage.(*registry.Store) + if !ok { + return fmt.Errorf("entrystore is not a registry store") + } - return be.AddStorage(entryStorage, claimStorage) + return be.AddStorageInterfaces(genericbackend.NewKuidBackendstorage(entryStore, claimStore)) } var _ generic.RESTOptionsGetter = &Getter{} diff --git a/apis/backend/extcomm/register/register.go b/apis/backend/extcomm/register/register.go index 2cd94e4..fa4c9da 100644 --- a/apis/backend/extcomm/register/register.go +++ b/apis/backend/extcomm/register/register.go @@ -18,10 +18,12 @@ package register import ( "context" + "fmt" "github.com/henderiw/apiserver-builder/pkg/builder" "github.com/henderiw/apiserver-builder/pkg/builder/resource" "github.com/henderiw/apiserver-builder/pkg/builder/rest" + "github.com/henderiw/apiserver-store/pkg/generic/registry" "github.com/kuidio/kuid/apis/backend/extcomm" extcommbev1alpha1 "github.com/kuidio/kuid/apis/backend/extcomm/v1alpha1" bebackend "github.com/kuidio/kuid/pkg/backend" @@ -90,6 +92,10 @@ func ApplyStorageToBackend(ctx context.Context, be bebackend.Backend, apiServer if err != nil { return err } + claimStore, ok := claimStorage.(*registry.Store) + if !ok { + return fmt.Errorf("claimstore is not a registry store") + } entryStorageProvider := apiServer.StorageProvider[schema.GroupResource{ Group: extcomm.SchemeGroupVersion.Group, @@ -100,8 +106,12 @@ func ApplyStorageToBackend(ctx context.Context, be bebackend.Backend, apiServer if err != nil { return err } + entryStore, ok := entryStorage.(*registry.Store) + if !ok { + return fmt.Errorf("entrystore is not a registry store") + } - return be.AddStorage(entryStorage, claimStorage) + return be.AddStorageInterfaces(genericbackend.NewKuidBackendstorage(entryStore, claimStore)) } var _ generic.RESTOptionsGetter = &Getter{} diff --git a/apis/backend/genid/register/register.go b/apis/backend/genid/register/register.go index 1329138..b5913b9 100644 --- a/apis/backend/genid/register/register.go +++ b/apis/backend/genid/register/register.go @@ -18,10 +18,12 @@ package register import ( "context" + "fmt" "github.com/henderiw/apiserver-builder/pkg/builder" "github.com/henderiw/apiserver-builder/pkg/builder/resource" "github.com/henderiw/apiserver-builder/pkg/builder/rest" + "github.com/henderiw/apiserver-store/pkg/generic/registry" "github.com/kuidio/kuid/apis/backend/genid" genidbev1alpha1 "github.com/kuidio/kuid/apis/backend/genid/v1alpha1" bebackend "github.com/kuidio/kuid/pkg/backend" @@ -90,6 +92,10 @@ func ApplyStorageToBackend(ctx context.Context, be bebackend.Backend, apiServer if err != nil { return err } + claimStore, ok := claimStorage.(*registry.Store) + if !ok { + return fmt.Errorf("claimstore is not a registry store") + } entryStorageProvider := apiServer.StorageProvider[schema.GroupResource{ Group: genid.SchemeGroupVersion.Group, @@ -100,8 +106,12 @@ func ApplyStorageToBackend(ctx context.Context, be bebackend.Backend, apiServer if err != nil { return err } + entryStore, ok := entryStorage.(*registry.Store) + if !ok { + return fmt.Errorf("entrystore is not a registry store") + } - return be.AddStorage(entryStorage, claimStorage) + return be.AddStorageInterfaces(genericbackend.NewKuidBackendstorage(entryStore, claimStore)) } var _ generic.RESTOptionsGetter = &Getter{} diff --git a/apis/backend/ipam/register/register.go b/apis/backend/ipam/register/register.go index 5dae5c9..c417f15 100644 --- a/apis/backend/ipam/register/register.go +++ b/apis/backend/ipam/register/register.go @@ -18,10 +18,12 @@ package register import ( "context" + "fmt" "github.com/henderiw/apiserver-builder/pkg/builder" "github.com/henderiw/apiserver-builder/pkg/builder/resource" "github.com/henderiw/apiserver-builder/pkg/builder/rest" + "github.com/henderiw/apiserver-store/pkg/generic/registry" "github.com/kuidio/kuid/apis/backend/ipam" ipambev1alpha1 "github.com/kuidio/kuid/apis/backend/ipam/v1alpha1" bebackend "github.com/kuidio/kuid/pkg/backend" @@ -84,6 +86,10 @@ func ApplyStorageToBackend(ctx context.Context, be bebackend.Backend, apiServer if err != nil { return err } + claimStore, ok := claimStorage.(*registry.Store) + if !ok { + return fmt.Errorf("claimStorage is not a registry store") + } entryStorageProvider := apiServer.StorageProvider[schema.GroupResource{ Group: ipam.SchemeGroupVersion.Group, @@ -94,8 +100,12 @@ func ApplyStorageToBackend(ctx context.Context, be bebackend.Backend, apiServer if err != nil { return err } + entryStore, ok := entryStorage.(*registry.Store) + if !ok { + return fmt.Errorf("entryStorage is not a registry store") + } - return be.AddStorage(entryStorage, claimStorage) + return be.AddStorageInterfaces(ipambe.NewKuidBackendstorage(entryStore, claimStore)) } var _ generic.RESTOptionsGetter = &Getter{} @@ -105,4 +115,3 @@ type Getter struct{} func (r *Getter) GetRESTOptions(resource schema.GroupResource, example runtime.Object) (generic.RESTOptions, error) { return generic.RESTOptions{}, nil } - diff --git a/apis/backend/vlan/register/register.go b/apis/backend/vlan/register/register.go index 331e117..ee20a08 100644 --- a/apis/backend/vlan/register/register.go +++ b/apis/backend/vlan/register/register.go @@ -18,6 +18,7 @@ package register import ( "context" + "fmt" "github.com/henderiw/apiserver-builder/pkg/builder" "github.com/henderiw/apiserver-builder/pkg/builder/resource" @@ -32,6 +33,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apiserver/pkg/registry/generic" + "github.com/henderiw/apiserver-store/pkg/generic/registry" ) func init() { @@ -86,36 +88,36 @@ func ApplyStorageToBackend(ctx context.Context, be bebackend.Backend, apiServer Resource: vlan.VLANClaimPlural, }] - claimStorage, err := claimStorageProvider.Get(ctx, apiServer.Schemes[0], &ClaimGetter{}) + claimStorage, err := claimStorageProvider.Get(ctx, apiServer.Schemes[0], &Getter{}) if err != nil { return err } + claimStore, ok := claimStorage.(*registry.Store) + if !ok { + return fmt.Errorf("claimstore is not a registry store") + } entryStorageProvider := apiServer.StorageProvider[schema.GroupResource{ Group: vlan.SchemeGroupVersion.Group, Resource: vlan.VLANEntryPlural, }] - entryStorage, err := entryStorageProvider.Get(ctx, apiServer.Schemes[0], &EntryGetter{}) + entryStorage, err := entryStorageProvider.Get(ctx, apiServer.Schemes[0], &Getter{}) if err != nil { return err } + entryStore, ok := entryStorage.(*registry.Store) + if !ok { + return fmt.Errorf("entrystore is not a registry store") + } - return be.AddStorage(entryStorage, claimStorage) -} - -var _ generic.RESTOptionsGetter = &ClaimGetter{} - -type ClaimGetter struct{} - -func (r *ClaimGetter) GetRESTOptions(resource schema.GroupResource, example runtime.Object) (generic.RESTOptions, error) { - return generic.RESTOptions{}, nil + return be.AddStorageInterfaces(genericbackend.NewKuidBackendstorage(entryStore, claimStore)) } -var _ generic.RESTOptionsGetter = &EntryGetter{} +var _ generic.RESTOptionsGetter = &Getter{} -type EntryGetter struct{} +type Getter struct{} -func (r *EntryGetter) GetRESTOptions(resource schema.GroupResource, example runtime.Object) (generic.RESTOptions, error) { +func (r *Getter) GetRESTOptions(resource schema.GroupResource, example runtime.Object) (generic.RESTOptions, error) { return generic.RESTOptions{}, nil } diff --git a/pkg/backend/backend_interface.go b/pkg/backend/backend_interface.go index 5e8b0b6..a0d5c56 100644 --- a/pkg/backend/backend_interface.go +++ b/pkg/backend/backend_interface.go @@ -20,11 +20,11 @@ import ( "context" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apiserver/pkg/registry/rest" ) type Backend interface { - AddStorage(entryStorage, claimStorage rest.Storage) error + // AddStorageInterfaces + AddStorageInterfaces(bestorage any) error // CreateIndex creates a backend index CreateIndex(ctx context.Context, obj runtime.Object) error // DeleteIndex deletes a backend index diff --git a/pkg/backend/generic/backend.go b/pkg/backend/generic/backend.go index 11fb568..4309547 100644 --- a/pkg/backend/generic/backend.go +++ b/pkg/backend/generic/backend.go @@ -6,14 +6,12 @@ import ( "reflect" "sync" - "github.com/henderiw/apiserver-store/pkg/generic/registry" "github.com/henderiw/logger/log" "github.com/henderiw/store" "github.com/kform-dev/choreo/apis/condition" "github.com/kuidio/kuid/apis/backend" bebackend "github.com/kuidio/kuid/pkg/backend" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apiserver/pkg/registry/rest" ) func New( @@ -45,8 +43,9 @@ type be struct { entryObjectFn func(runtime.Object) (backend.EntryObject, error) entryFromCacheFn func(k store.Key, vrange, id string, labels map[string]string) backend.EntryObject // added later - entryStorage *registry.Store - claimStorage *registry.Store + //entryStorage *registry.Store + //claimStorage *registry.Store + bestorage BackendStorage } func (r *be) PrintEntries(ctx context.Context, index string) { @@ -57,6 +56,28 @@ func (r *be) PrintEntries(ctx context.Context, index string) { } } +func (r *be) AddStorageInterfaces(bes any) error { + bestorage, ok := bes.(BackendStorage) + if !ok { + return fmt.Errorf("AddStorageInterfaces did not supply a generic BackendStorage interface, got: %s", reflect.TypeOf(bes).Name()) + } + r.bestorage = bestorage + /* + entrystore, ok := entryStorage.(*registry.Store) + if !ok { + return errors.New("entry store is not a *registry.Store") + } + r.entryStorage = entrystore + claimstore, ok := claimStorage.(*registry.Store) + if !ok { + return errors.New("claim store is not a *registry.Store") + } + r.claimStorage = claimstore + */ + return nil +} + +/* func (r *be) AddStorage(entryStorage, claimStorage rest.Storage) error { entrystore, ok := entryStorage.(*registry.Store) if !ok { @@ -70,10 +91,13 @@ func (r *be) AddStorage(entryStorage, claimStorage rest.Storage) error { r.claimStorage = claimstore return nil } +*/ +/* func (r *be) GetClaimStorage() *registry.Store { return r.claimStorage } +*/ // CreateIndex creates a backend index func (r *be) CreateIndex(ctx context.Context, obj runtime.Object) error { diff --git a/pkg/backend/generic/backend_store.go b/pkg/backend/generic/backend_store.go index 27f2dd4..18a4e19 100644 --- a/pkg/backend/generic/backend_store.go +++ b/pkg/backend/generic/backend_store.go @@ -2,7 +2,6 @@ package generic import ( "context" - "errors" "fmt" "reflect" @@ -11,15 +10,9 @@ import ( "github.com/henderiw/store" "github.com/kuidio/kuid/apis/backend" bebackend "github.com/kuidio/kuid/pkg/backend" - "k8s.io/apimachinery/pkg/api/meta" - "k8s.io/apimachinery/pkg/apis/meta/internalversion" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/sets" - genericapirequest "k8s.io/apiserver/pkg/endpoints/request" - "k8s.io/apiserver/pkg/registry/rest" ) func (r *be) restore(ctx context.Context, index backend.IndexObject) error { @@ -93,29 +86,22 @@ func (r *be) saveAll(ctx context.Context, k store.Key) error { } } - ctx = genericapirequest.WithNamespace(ctx, newEntry.GetNamespace()) if !found { - if _, err := r.entryStorage.Create(ctx, newEntry, nil, &metav1.CreateOptions{ - FieldManager: "backend", - }); err != nil { + if err := r.bestorage.CreateEntry(ctx, newEntry); err != nil { log.Error("saveAll create failed", "name", newEntry.GetName(), "error", err.Error()) return err } continue } - - defaultObjInfo := rest.DefaultUpdatedObjectInfo(oldEntry, EntryTransformer) - if _, _, err := r.entryStorage.Update(ctx, oldEntry.GetName(), defaultObjInfo, nil, nil, false, &metav1.UpdateOptions{ - FieldManager: "backend", - }); err != nil { - fmt.Println("update err", err) + if err := r.bestorage.UpdateEntry(ctx, newEntry, oldEntry); err != nil { + log.Error("saveAll update failed", "name", newEntry.GetName(), "error", err.Error()) return err } } for _, curEntry := range curEntries { - ctx = genericapirequest.WithNamespace(ctx, curEntry.GetNamespace()) - if _, _, err := r.entryStorage.Delete(ctx, curEntry.GetName(), nil, &metav1.DeleteOptions{}); err != nil { + if err := r.bestorage.DeleteEntry(ctx, curEntry); err != nil { + log.Error("saveAll delete failed", "name", curEntry.GetName(), "error", err.Error()) return err } } @@ -163,59 +149,59 @@ func (r *be) deleteEntries(ctx context.Context, k store.Key) error { } var errm error - for _, entry := range entries { - ctx = genericapirequest.WithNamespace(ctx, entry.GetNamespace()) - if _, _, err := r.entryStorage.Delete(ctx, entry.GetName(), nil, &metav1.DeleteOptions{}); err != nil { - log.Error("cannot delete entry", "error", err) - errm = errors.Join(errm, err) - continue + for _, curEntry := range entries { + if err := r.bestorage.DeleteEntry(ctx, curEntry); err != nil { + log.Error("saveAll delete failed", "name", curEntry.GetName(), "error", err.Error()) + return err } } return errm } func (r *be) listEntries(ctx context.Context, k store.Key) ([]backend.EntryObject, error) { - log := log.FromContext(ctx).With("key", k.String()) + //log := log.FromContext(ctx).With("key", k.String()) + return r.bestorage.ListEntries(ctx, k) + + // selector, err := selector.ExprSelectorAsSelector( + // &selectorv1alpha1.ExpressionSelector{ + // Match: map[string]string{ + // "spec.index": k.Name, + // }, + // }, + // ) + // if err != nil { + // return nil, err + // } /* - selector, err := selector.ExprSelectorAsSelector( - &selectorv1alpha1.ExpressionSelector{ - Match: map[string]string{ - "spec.index": k.Name, - }, - }, - ) + list, err := r.entryStorage.List(ctx, &internalversion.ListOptions{}) if err != nil { return nil, err } - */ - list, err := r.entryStorage.List(ctx, &internalversion.ListOptions{}) - if err != nil { - return nil, err - } - - items, err := meta.ExtractList(list) - if err != nil { - return nil, err - } - entryList := make([]backend.EntryObject, 0) - var errm error - for _, obj := range items { - entryObj, ok := obj.(backend.EntryObject) - if !ok { - log.Error("obj is not an EntryObject", "obj", reflect.TypeOf(obj).Name()) - errm = errors.Join(errm, err) - continue + items, err := meta.ExtractList(list) + if err != nil { + return nil, err } - if entryObj.GetIndex() == k.Name { - entryList = append(entryList, entryObj) + + entryList := make([]backend.EntryObject, 0) + var errm error + for _, obj := range items { + entryObj, ok := obj.(backend.EntryObject) + if !ok { + log.Error("obj is not an EntryObject", "obj", reflect.TypeOf(obj).Name()) + errm = errors.Join(errm, err) + continue + } + if entryObj.GetIndex() == k.Name { + entryList = append(entryList, entryObj) + } } - } - return entryList, errm + return entryList, errm + */ } func (r *be) listClaims(ctx context.Context, k store.Key) (map[string]backend.ClaimObject, error) { - log := log.FromContext(ctx).With("key", k.String()) + //log := log.FromContext(ctx).With("key", k.String()) /* selector, err := selector.ExprSelectorAsSelector( &selectorv1alpha1.ExpressionSelector{ @@ -228,31 +214,35 @@ func (r *be) listClaims(ctx context.Context, k store.Key) (map[string]backend.Cl return nil, err } */ - list, err := r.claimStorage.List(ctx, &internalversion.ListOptions{}) - if err != nil { - return nil, err - } - - items, err := meta.ExtractList(list) - if err != nil { - return nil, err - } + return r.bestorage.ListClaims(ctx, k) - claimMap := make(map[string]backend.ClaimObject) - var errm error - for _, obj := range items { - claimObj, ok := obj.(backend.ClaimObject) - if !ok { - log.Error("obj is not an ClaimObject", "obj", reflect.TypeOf(obj).Name()) - errm = errors.Join(errm, err) - continue + /* + list, err := r.claimStorage.List(ctx, &internalversion.ListOptions{}) + if err != nil { + return nil, err } - if claimObj.GetIndex() == k.Name { - claimMap[claimObj.GetNamespacedName().String()] = claimObj + + items, err := meta.ExtractList(list) + if err != nil { + return nil, err } - } - return claimMap, errm + claimMap := make(map[string]backend.ClaimObject) + var errm error + for _, obj := range items { + claimObj, ok := obj.(backend.ClaimObject) + if !ok { + log.Error("obj is not an ClaimObject", "obj", reflect.TypeOf(obj).Name()) + errm = errors.Join(errm, err) + continue + } + if claimObj.GetIndex() == k.Name { + claimMap[claimObj.GetNamespacedName().String()] = claimObj + } + + } + return claimMap, errm + */ } func (r *be) restoreMinMaxRanges(ctx context.Context, cacheInstanceCtx *CacheInstanceContext, entries []backend.EntryObject, index backend.IndexObject) error { @@ -289,20 +279,17 @@ func (r *be) restoreMinMaxRanges(ctx context.Context, cacheInstanceCtx *CacheIns return err } for _, entry := range entries { - uobj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(entry) - if err != nil { - return err - } - u := &unstructured.Unstructured{ - Object: uobj, - } - ctx = genericapirequest.WithNamespace(ctx, u.GetNamespace()) - - if _, err := r.entryStorage.Create(ctx, u, nil, &metav1.CreateOptions{ - FieldManager: "backend", - }); err != nil { + if err := r.bestorage.CreateEntry(ctx, entry); err != nil { return err } + /* + ctx = genericapirequest.WithNamespace(ctx, entry.GetNamespace()) + if _, err := r.entryStorage.Create(ctx, entry, nil, &metav1.CreateOptions{ + FieldManager: "backend", + }); err != nil { + return err + } + */ } } return nil diff --git a/pkg/backend/generic/interface.go b/pkg/backend/generic/interface.go new file mode 100644 index 0000000..ea5eaad --- /dev/null +++ b/pkg/backend/generic/interface.go @@ -0,0 +1,139 @@ +/* +Copyright 2024 Nokia. + +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 generic + +import ( + "context" + "errors" + "reflect" + + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/henderiw/logger/log" + "github.com/henderiw/store" + "github.com/kuidio/kuid/apis/backend" + "k8s.io/apimachinery/pkg/api/meta" + "k8s.io/apimachinery/pkg/apis/meta/internalversion" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +type BackendStorage interface { + ListEntries(ctx context.Context, k store.Key) ([]backend.EntryObject, error) + CreateEntry(ctx context.Context, obj backend.EntryObject) error + UpdateEntry(ctx context.Context, obj, old backend.EntryObject) error + DeleteEntry(ctx context.Context, obj backend.EntryObject) error + ListClaims(ctx context.Context, k store.Key) (map[string]backend.ClaimObject, error) +} + +func NewKuidBackendstorage(entryStorage, claimStorage *registry.Store) BackendStorage { + return &kuidbe{ + entryStorage: entryStorage, + claimStorage: claimStorage, + } +} + +type kuidbe struct { + entryStorage *registry.Store + claimStorage *registry.Store +} + +func (r *kuidbe) ListEntries(ctx context.Context, k store.Key) ([]backend.EntryObject, error) { + log := log.FromContext(ctx).With("key", k.String()) + list, err := r.entryStorage.List(ctx, &internalversion.ListOptions{}) + if err != nil { + return nil, err + } + + items, err := meta.ExtractList(list) + if err != nil { + return nil, err + } + + entryList := make([]backend.EntryObject, 0) + var errm error + for _, obj := range items { + entryObj, ok := obj.(backend.EntryObject) + if !ok { + log.Error("obj is not an EntryObject", "obj", reflect.TypeOf(obj).Name()) + errm = errors.Join(errm, err) + continue + } + if entryObj.GetIndex() == k.Name { + entryList = append(entryList, entryObj) + } + } + return entryList, errm +} + +func (r *kuidbe) CreateEntry(ctx context.Context, obj backend.EntryObject) error { + ctx = genericapirequest.WithNamespace(ctx, obj.GetNamespace()) + if _, err := r.entryStorage.Create(ctx, obj, nil, &metav1.CreateOptions{ + FieldManager: "backend", + }); err != nil { + return err + } + return nil +} +func (r *kuidbe) UpdateEntry(ctx context.Context, obj, old backend.EntryObject) error { + ctx = genericapirequest.WithNamespace(ctx, obj.GetNamespace()) + defaultObjInfo := rest.DefaultUpdatedObjectInfo(old, EntryTransformer) + if _, _, err := r.entryStorage.Update(ctx, old.GetName(), defaultObjInfo, nil, nil, false, &metav1.UpdateOptions{ + FieldManager: "backend", + }); err != nil { + return err + } + return nil +} + +func (r *kuidbe) DeleteEntry(ctx context.Context, obj backend.EntryObject) error { + ctx = genericapirequest.WithNamespace(ctx, obj.GetNamespace()) + if _, _, err := r.entryStorage.Delete(ctx, obj.GetName(), nil, &metav1.DeleteOptions{}); err != nil { + return err + } + return nil +} + +func (r *kuidbe) ListClaims(ctx context.Context, k store.Key) (map[string]backend.ClaimObject, error) { + log := log.FromContext(ctx).With("key", k.String()) + + list, err := r.claimStorage.List(ctx, &internalversion.ListOptions{}) + if err != nil { + return nil, err + } + + items, err := meta.ExtractList(list) + if err != nil { + return nil, err + } + + claimMap := make(map[string]backend.ClaimObject) + var errm error + for _, obj := range items { + claimObj, ok := obj.(backend.ClaimObject) + if !ok { + log.Error("obj is not an ClaimObject", "obj", reflect.TypeOf(obj).Name()) + errm = errors.Join(errm, err) + continue + } + if claimObj.GetIndex() == k.Name { + claimMap[claimObj.GetNamespacedName().String()] = claimObj + } + + } + return claimMap, errm +} diff --git a/pkg/backend/ipam/backend.go b/pkg/backend/ipam/backend.go index 0e65a6d..f66c463 100644 --- a/pkg/backend/ipam/backend.go +++ b/pkg/backend/ipam/backend.go @@ -20,16 +20,15 @@ import ( "context" "errors" "fmt" + "reflect" "sync" - "github.com/henderiw/apiserver-store/pkg/generic/registry" "github.com/henderiw/logger/log" "github.com/henderiw/store" "github.com/kform-dev/choreo/apis/condition" "github.com/kuidio/kuid/apis/backend/ipam" bebackend "github.com/kuidio/kuid/pkg/backend" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apiserver/pkg/registry/rest" ) func New() bebackend.Backend { @@ -43,8 +42,9 @@ type be struct { cache bebackend.Cache[*CacheInstanceContext] m sync.RWMutex // added later - entryStorage *registry.Store - claimStorage *registry.Store + //entryStorage *registry.Store + //claimStorage *registry.Store + bestorage BackendStorage } func (r *be) PrintEntries(ctx context.Context, index string) { @@ -55,17 +55,24 @@ func (r *be) PrintEntries(ctx context.Context, index string) { } } -func (r *be) AddStorage(entryStorage, claimStorage rest.Storage) error { - entrystore, ok := entryStorage.(*registry.Store) +func (r *be) AddStorageInterfaces(bes any) error { + bestorage, ok := bes.(BackendStorage) if !ok { - return errors.New("entry store is not a *registry.Store") + return fmt.Errorf("AddStorageInterfaces did not supply a ipam BackendStorage interface, got: %s", reflect.TypeOf(bes).Name()) } - r.entryStorage = entrystore - claimstore, ok := claimStorage.(*registry.Store) - if !ok { - return errors.New("claim store is not a *registry.Store") - } - r.claimStorage = claimstore + r.bestorage = bestorage + /* + entrystore, ok := entryStorage.(*registry.Store) + if !ok { + return errors.New("entry store is not a *registry.Store") + } + r.entryStorage = entrystore + claimstore, ok := claimStorage.(*registry.Store) + if !ok { + return errors.New("claim store is not a *registry.Store") + } + r.claimStorage = claimstore + */ return nil } diff --git a/pkg/backend/ipam/backend_store.go b/pkg/backend/ipam/backend_store.go index ea145d0..44c992e 100644 --- a/pkg/backend/ipam/backend_store.go +++ b/pkg/backend/ipam/backend_store.go @@ -27,13 +27,9 @@ import ( "github.com/henderiw/logger/log" "github.com/henderiw/store" "github.com/kuidio/kuid/apis/backend/ipam" - "k8s.io/apimachinery/pkg/api/meta" - "k8s.io/apimachinery/pkg/apis/meta/internalversion" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" genericapirequest "k8s.io/apiserver/pkg/endpoints/request" - "k8s.io/apiserver/pkg/registry/rest" ) func (r *be) restore(ctx context.Context, index *ipam.IPIndex) error { @@ -138,28 +134,46 @@ func (r *be) saveAll(ctx context.Context, k store.Key) error { ctx = genericapirequest.WithNamespace(ctx, newEntry.GetNamespace()) if !found { - if _, err := r.entryStorage.Create(ctx, newEntry, nil, &metav1.CreateOptions{ - FieldManager: "backend", - }); err != nil { + if err := r.bestorage.CreateEntry(ctx, newEntry); err != nil { log.Error("saveAll create failed", "name", newEntry.GetName(), "error", err.Error()) return err } + + /* + if _, err := r.entryStorage.Create(ctx, newEntry, nil, &metav1.CreateOptions{ + FieldManager: "backend", + }); err != nil { + + } + */ continue } - - defaultObjInfo := rest.DefaultUpdatedObjectInfo(oldEntry, EntryTransformer) - if _, _, err := r.entryStorage.Update(ctx, oldEntry.GetName(), defaultObjInfo, nil, nil, false, &metav1.UpdateOptions{ - FieldManager: "backend", - }); err != nil { - fmt.Println("update err", err) + if err := r.bestorage.UpdateEntry(ctx, newEntry, oldEntry); err != nil { + log.Error("saveAll update failed", "name", newEntry.GetName(), "error", err.Error()) return err } + + /* + defaultObjInfo := rest.DefaultUpdatedObjectInfo(oldEntry, EntryTransformer) + if _, _, err := r.entryStorage.Update(ctx, oldEntry.GetName(), defaultObjInfo, nil, nil, false, &metav1.UpdateOptions{ + FieldManager: "backend", + }); err != nil { + fmt.Println("update err", err) + return err + } + */ } for _, curEntry := range curEntries { - ctx = genericapirequest.WithNamespace(ctx, curEntry.GetNamespace()) - if _, _, err := r.entryStorage.Delete(ctx, curEntry.GetName(), nil, &metav1.DeleteOptions{}); err != nil { + if err := r.bestorage.DeleteEntry(ctx, curEntry); err != nil { + log.Error("saveAll update failed", "name", curEntry.GetName(), "error", err.Error()) return err } + /* + ctx = genericapirequest.WithNamespace(ctx, curEntry.GetNamespace()) + if _, _, err := r.entryStorage.Delete(ctx, curEntry.GetName(), nil, &metav1.DeleteOptions{}); err != nil { + return err + } + */ } return nil } @@ -207,13 +221,19 @@ func (r *be) deleteEntries(ctx context.Context, k store.Key) error { } var errm error - for _, entry := range entries { - ctx = genericapirequest.WithNamespace(ctx, entry.GetNamespace()) - if _, _, err := r.entryStorage.Delete(ctx, entry.GetName(), nil, &metav1.DeleteOptions{}); err != nil { - log.Error("cannot delete entry", "error", err) - errm = errors.Join(errm, err) - continue + for _, curEntry := range entries { + if err := r.bestorage.DeleteEntry(ctx, curEntry); err != nil { + log.Error("delete entry failed", "name", curEntry.GetName(), "error", err.Error()) + return err } + /* + ctx = genericapirequest.WithNamespace(ctx, entry.GetNamespace()) + if _, _, err := r.entryStorage.Delete(ctx, entry.GetName(), nil, &metav1.DeleteOptions{}); err != nil { + log.Error("cannot delete entry", "error", err) + errm = errors.Join(errm, err) + continue + } + */ } return errm } @@ -231,90 +251,102 @@ func (r *be) deleteClaims(ctx context.Context, k store.Key) error { var errm error for _, claim := range claims { log.Debug("deleteClaim from storage", "claim", claim.GetName()) - ctx = genericapirequest.WithNamespace(ctx, claim.GetNamespace()) - if _, _, err := r.claimStorage.Delete(ctx, claim.GetName(), nil, &metav1.DeleteOptions{ - DryRun: []string{"recursion"}, - }); err != nil { + + if err := r.bestorage.DeleteClaim(ctx, claim); err != nil { log.Error("cannot delete claim", "error", err) errm = errors.Join(errm, err) continue } + + /* + ctx = genericapirequest.WithNamespace(ctx, claim.GetNamespace()) + if _, _, err := r.claimStorage.Delete(ctx, claim.GetName(), nil, &metav1.DeleteOptions{ + DryRun: []string{"recursion"}, + }); err != nil { + log.Error("cannot delete claim", "error", err) + errm = errors.Join(errm, err) + continue + } + */ } return errm } func (r *be) listEntries(ctx context.Context, k store.Key) ([]*ipam.IPEntry, error) { - log := log.FromContext(ctx).With("key", k.String()) + //log := log.FromContext(ctx).With("key", k.String()) + return r.bestorage.ListEntries(ctx, k) + + // selector, err := selector.ExprSelectorAsSelector( + // &selectorv1alpha1.ExpressionSelector{ + // Match: map[string]string{ + // "spec.index": k.Name, + // }, + // }, + // ) + // if err != nil { + // return nil, err + // } /* - selector, err := selector.ExprSelectorAsSelector( - &selectorv1alpha1.ExpressionSelector{ - Match: map[string]string{ - "spec.index": k.Name, - }, - }, - ) + log.Debug("list entries from storage") + list, err := r.entryStorage.List(ctx, &internalversion.ListOptions{}) if err != nil { return nil, err } - */ - log.Debug("list entries from storage") - list, err := r.entryStorage.List(ctx, &internalversion.ListOptions{}) - if err != nil { - return nil, err - } - items, err := meta.ExtractList(list) - if err != nil { - return nil, err - } - entryList := make([]*ipam.IPEntry, 0) - var errm error - for _, obj := range items { - entryObj, ok := obj.(*ipam.IPEntry) - if !ok { - log.Error("obj is not an IPEntry", "obj", reflect.TypeOf(obj).Name()) - errm = errors.Join(errm, err) - continue + items, err := meta.ExtractList(list) + if err != nil { + return nil, err } - if entryObj.GetIndex() == k.Name { - entryList = append(entryList, entryObj) + entryList := make([]*ipam.IPEntry, 0) + var errm error + for _, obj := range items { + entryObj, ok := obj.(*ipam.IPEntry) + if !ok { + log.Error("obj is not an IPEntry", "obj", reflect.TypeOf(obj).Name()) + errm = errors.Join(errm, err) + continue + } + if entryObj.GetIndex() == k.Name { + entryList = append(entryList, entryObj) + } } - } - return entryList, nil + return entryList, nil + */ } func (r *be) listClaims(ctx context.Context, k store.Key) (map[string]*ipam.IPClaim, error) { - log := log.FromContext(ctx).With("key", k.String()) + //log := log.FromContext(ctx).With("key", k.String()) + return r.bestorage.ListClaims(ctx, k) + // selector, err := selector.ExprSelectorAsSelector( + // &selectorv1alpha1.ExpressionSelector{ + // Match: match, + // }, + // ) + // if err != nil { + // return nil, err + // } /* - selector, err := selector.ExprSelectorAsSelector( - &selectorv1alpha1.ExpressionSelector{ - Match: match, - }, - ) + log.Debug("list claims from storage") + list, err := r.claimStorage.List(ctx, &internalversion.ListOptions{}) if err != nil { return nil, err } - */ - log.Debug("list claims from storage") - list, err := r.claimStorage.List(ctx, &internalversion.ListOptions{}) - if err != nil { - return nil, err - } - items, err := meta.ExtractList(list) - if err != nil { - return nil, err - } - claimMap := map[string]*ipam.IPClaim{} - var errm error - for _, obj := range items { - claimObj, ok := obj.(*ipam.IPClaim) - if !ok { - log.Error("obj is not an IPClaim", "obj", reflect.TypeOf(obj).Name()) - errm = errors.Join(errm, err) - continue + items, err := meta.ExtractList(list) + if err != nil { + return nil, err } - claimMap[claimObj.GetNamespacedName().String()] = claimObj - } - return claimMap, errm + claimMap := map[string]*ipam.IPClaim{} + var errm error + for _, obj := range items { + claimObj, ok := obj.(*ipam.IPClaim) + if !ok { + log.Error("obj is not an IPClaim", "obj", reflect.TypeOf(obj).Name()) + errm = errors.Join(errm, err) + continue + } + claimMap[claimObj.GetNamespacedName().String()] = claimObj + } + return claimMap, errm + */ } func (r *be) restoreClaims(ctx context.Context, cacheInstanceCtx *CacheInstanceContext, entries []*ipam.IPEntry, kind string, claimType ipam.IPClaimType, ipclaimmap map[string]*ipam.IPClaim) error { @@ -389,35 +421,58 @@ func (r *be) updateIPIndexClaims(ctx context.Context, index *ipam.IPIndex) error ctx = genericapirequest.WithNamespace(ctx, newClaim.GetNamespace()) oldClaim, exists := existingClaims[newClaim.GetNamespacedName().String()] if !exists { - if _, err := r.claimStorage.Create(ctx, newClaim, nil, &metav1.CreateOptions{ - FieldManager: "backend", - DryRun: []string{"recursion"}, - }); err != nil { + if err := r.bestorage.CreateClaim(ctx, newClaim); err != nil { log.Error("updateIPIndexClaims create failed", "name", newClaim.GetName(), "error", err.Error()) errm = errors.Join(errm, err) continue } + /* + if _, err := r.claimStorage.Create(ctx, newClaim, nil, &metav1.CreateOptions{ + FieldManager: "backend", + DryRun: []string{"recursion"}, + }); err != nil { + log.Error("updateIPIndexClaims create failed", "name", newClaim.GetName(), "error", err.Error()) + errm = errors.Join(errm, err) + continue + } + */ continue } - defaultObjInfo := rest.DefaultUpdatedObjectInfo(oldClaim, ClaimTransformer) - if _, _, err := r.claimStorage.Update(ctx, oldClaim.GetName(), defaultObjInfo, nil, nil, false, &metav1.UpdateOptions{ - FieldManager: "backend", - DryRun: []string{"recursion"}, - }); err != nil { - log.Error("updateIPIndexClaims update failed", "name", newClaim.GetName(), "error", err.Error()) + if err := r.bestorage.UpdateClaim(ctx, newClaim, oldClaim); err != nil { + log.Error("updateIPIndexClaims create failed", "name", newClaim.GetName(), "error", err.Error()) errm = errors.Join(errm, err) continue } + + /* + defaultObjInfo := rest.DefaultUpdatedObjectInfo(oldClaim, ClaimTransformer) + if _, _, err := r.claimStorage.Update(ctx, oldClaim.GetName(), defaultObjInfo, nil, nil, false, &metav1.UpdateOptions{ + FieldManager: "backend", + DryRun: []string{"recursion"}, + }); err != nil { + log.Error("updateIPIndexClaims update failed", "name", newClaim.GetName(), "error", err.Error()) + errm = errors.Join(errm, err) + continue + } + */ delete(existingClaims, newClaim.GetNamespacedName().String()) } for _, claim := range existingClaims { - ctx = genericapirequest.WithNamespace(ctx, claim.GetNamespace()) - if _, _, err := r.entryStorage.Delete(ctx, claim.GetName(), nil, &metav1.DeleteOptions{}); err != nil { + if err := r.bestorage.DeleteClaim(ctx, claim); err != nil { log.Error("updateIPIndexClaims delete failed", "name", claim.GetName(), "error", err.Error()) errm = errors.Join(errm, err) continue } + + /* + ctx = genericapirequest.WithNamespace(ctx, claim.GetNamespace()) + if _, _, err := r.entryStorage.Delete(ctx, claim.GetName(), nil, &metav1.DeleteOptions{}); err != nil { + log.Error("updateIPIndexClaims delete failed", "name", claim.GetName(), "error", err.Error()) + errm = errors.Join(errm, err) + continue + } + */ } if errm != nil { @@ -462,31 +517,36 @@ func ClaimTransformer(_ context.Context, newObj runtime.Object, oldObj runtime.O } func (r *be) listIndexClaims(ctx context.Context, k store.Key) (map[string]*ipam.IPClaim, error) { - log := log.FromContext(ctx).With("key", k.String()) - list, err := r.claimStorage.List(ctx, &internalversion.ListOptions{}) - if err != nil { - return nil, err - } - items, err := meta.ExtractList(list) - if err != nil { - return nil, err - } - claimMap := map[string]*ipam.IPClaim{} - var errm error - for _, obj := range items { - claim, ok := obj.(*ipam.IPClaim) - if !ok { - log.Error("obj is not an IPClaim", "obj", reflect.TypeOf(obj).Name()) - errm = errors.Join(errm, err) - continue + return r.bestorage.ListClaims(ctx, k, &ListOptions{ + OwnerKind: ipam.IPIndexKind, + }) + /* + log := log.FromContext(ctx).With("key", k.String()) + list, err := r.claimStorage.List(ctx, &internalversion.ListOptions{}) + if err != nil { + return nil, err + } + items, err := meta.ExtractList(list) + if err != nil { + return nil, err } - if claim.GetIndex() == k.Name { - for _, ownerRef := range claim.OwnerReferences { - if ownerRef.Kind == ipam.IPIndexKind { - claimMap[claim.GetNamespacedName().String()] = claim + claimMap := map[string]*ipam.IPClaim{} + var errm error + for _, obj := range items { + claim, ok := obj.(*ipam.IPClaim) + if !ok { + log.Error("obj is not an IPClaim", "obj", reflect.TypeOf(obj).Name()) + errm = errors.Join(errm, err) + continue + } + if claim.GetIndex() == k.Name { + for _, ownerRef := range claim.OwnerReferences { + if ownerRef.Kind == ipam.IPIndexKind { + claimMap[claim.GetNamespacedName().String()] = claim + } } } } - } - return claimMap, errm + return claimMap, errm + */ } diff --git a/pkg/backend/ipam/interface.go b/pkg/backend/ipam/interface.go new file mode 100644 index 0000000..d2426c2 --- /dev/null +++ b/pkg/backend/ipam/interface.go @@ -0,0 +1,215 @@ +/* +Copyright 2024 Nokia. + +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 ipam + +import ( + "context" + "errors" + "reflect" + + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/henderiw/logger/log" + "github.com/henderiw/store" + "github.com/kuidio/kuid/apis/backend/ipam" + "k8s.io/apimachinery/pkg/api/meta" + "k8s.io/apimachinery/pkg/apis/meta/internalversion" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +type BackendStorage interface { + ListEntries(ctx context.Context, k store.Key) ([]*ipam.IPEntry, error) + CreateEntry(ctx context.Context, obj *ipam.IPEntry) error + UpdateEntry(ctx context.Context, obj, old *ipam.IPEntry) error + DeleteEntry(ctx context.Context, obj *ipam.IPEntry) error + ListClaims(ctx context.Context, k store.Key, opts ...ListOption) (map[string]*ipam.IPClaim, error) + CreateClaim(ctx context.Context, obj *ipam.IPClaim) error + UpdateClaim(ctx context.Context, obj, old *ipam.IPClaim) error + DeleteClaim(ctx context.Context, obj *ipam.IPClaim) error +} + +type ListOption interface { + // ApplyToGet applies this configuration to the given get options. + ApplyToList(*ListOptions) +} + +var _ ListOption = &ListOptions{} + +type ListOptions struct { + OwnerKind string +} + +func (o *ListOptions) ApplyToList(lo *ListOptions) { + lo.OwnerKind = o.OwnerKind +} + +// ApplyOptions applies the given get options on these options, +// and then returns itself (for convenient chaining). +func (o *ListOptions) ApplyOptions(opts []ListOption) *ListOptions { + for _, opt := range opts { + opt.ApplyToList(o) + } + return o +} + +func NewKuidBackendstorage(entryStorage, claimStorage *registry.Store) BackendStorage { + return &kuidbe{ + entryStorage: entryStorage, + claimStorage: claimStorage, + } +} + +type kuidbe struct { + entryStorage *registry.Store + claimStorage *registry.Store +} + +func (r *kuidbe) ListEntries(ctx context.Context, k store.Key) ([]*ipam.IPEntry, error) { + log := log.FromContext(ctx).With("key", k.String()) + log.Debug("list entries from storage") + list, err := r.entryStorage.List(ctx, &internalversion.ListOptions{}) + if err != nil { + return nil, err + } + items, err := meta.ExtractList(list) + if err != nil { + return nil, err + } + entryList := make([]*ipam.IPEntry, 0) + var errm error + for _, obj := range items { + entryObj, ok := obj.(*ipam.IPEntry) + if !ok { + log.Error("obj is not an IPEntry", "obj", reflect.TypeOf(obj).Name()) + errm = errors.Join(errm, err) + continue + } + if entryObj.GetIndex() == k.Name { + entryList = append(entryList, entryObj) + } + } + return entryList, nil +} + +func (r *kuidbe) CreateEntry(ctx context.Context, obj *ipam.IPEntry) error { + log := log.FromContext(ctx) + ctx = genericapirequest.WithNamespace(ctx, obj.GetNamespace()) + if _, err := r.entryStorage.Create(ctx, obj, nil, &metav1.CreateOptions{}); err != nil { + log.Error("cannot create entry", "error", err) + return err + } + return nil +} + +func (r *kuidbe) UpdateEntry(ctx context.Context, obj, old *ipam.IPEntry) error { + log := log.FromContext(ctx) + ctx = genericapirequest.WithNamespace(ctx, obj.GetNamespace()) + defaultObjInfo := rest.DefaultUpdatedObjectInfo(old, EntryTransformer) + if _, _, err := r.entryStorage.Update(ctx, old.GetName(), defaultObjInfo, nil, nil, false, &metav1.UpdateOptions{ + FieldManager: "backend", + }); err != nil { + log.Error("cannot update entry", "error", err) + return err + } + return nil +} + +func (r *kuidbe) DeleteEntry(ctx context.Context, obj *ipam.IPEntry) error { + log := log.FromContext(ctx) + ctx = genericapirequest.WithNamespace(ctx, obj.GetNamespace()) + if _, _, err := r.entryStorage.Delete(ctx, obj.GetName(), nil, &metav1.DeleteOptions{}); err != nil { + log.Error("cannot delete entry", "error", err) + return err + } + return nil +} + +func (r *kuidbe) ListClaims(ctx context.Context, k store.Key, opts ...ListOption) (map[string]*ipam.IPClaim, error) { + o := &ListOptions{} + o.ApplyOptions(opts) + + log := log.FromContext(ctx).With("key", k.String()) + log.Debug("list claims from storage") + list, err := r.claimStorage.List(ctx, &internalversion.ListOptions{}) + if err != nil { + return nil, err + } + items, err := meta.ExtractList(list) + if err != nil { + return nil, err + } + claimMap := map[string]*ipam.IPClaim{} + var errm error + for _, obj := range items { + claimObj, ok := obj.(*ipam.IPClaim) + if !ok { + log.Error("obj is not an IPClaim", "obj", reflect.TypeOf(obj).Name()) + errm = errors.Join(errm, err) + continue + } + if o.OwnerKind != "" { + for _, ownerref := range claimObj.OwnerReferences { + if ownerref.Kind == o.OwnerKind { + claimMap[claimObj.GetNamespacedName().String()] = claimObj + } + } + } else { + claimMap[claimObj.GetNamespacedName().String()] = claimObj + } + + } + return claimMap, errm +} + +func (r *kuidbe) CreateClaim(ctx context.Context, obj *ipam.IPClaim) error { + log := log.FromContext(ctx) + ctx = genericapirequest.WithNamespace(ctx, obj.GetNamespace()) + if _, err := r.claimStorage.Create(ctx, obj, nil, &metav1.CreateOptions{ + FieldManager: "backend", + DryRun: []string{"recursion"}, + }); err != nil { + log.Error("create claim failed", "name", obj.GetName(), "error", err.Error()) + return err + } + return nil +} + +func (r *kuidbe) UpdateClaim(ctx context.Context, obj, old *ipam.IPClaim) error { + log := log.FromContext(ctx) + defaultObjInfo := rest.DefaultUpdatedObjectInfo(old, ClaimTransformer) + if _, _, err := r.claimStorage.Update(ctx, old.GetName(), defaultObjInfo, nil, nil, false, &metav1.UpdateOptions{ + FieldManager: "backend", + DryRun: []string{"recursion"}, + }); err != nil { + log.Error("update claim failed", "name", obj.GetName(), "error", err.Error()) + return err + } + return nil +} + +func (r *kuidbe) DeleteClaim(ctx context.Context, obj *ipam.IPClaim) error { + log := log.FromContext(ctx) + ctx = genericapirequest.WithNamespace(ctx, obj.GetNamespace()) + if _, _, err := r.claimStorage.Delete(ctx, obj.GetName(), nil, &metav1.DeleteOptions{ + DryRun: []string{"recursion"}, + }); err != nil { + log.Error("cannot delete claim", "error", err) + return err + } + return nil +} diff --git a/pkg/backend/storage_providers.go b/pkg/backend/storage_providers.go index 58f552f..f4dc46d 100644 --- a/pkg/backend/storage_providers.go +++ b/pkg/backend/storage_providers.go @@ -23,7 +23,7 @@ import ( "github.com/henderiw/apiserver-builder/pkg/builder/rest" ) -type StorageProviders interface { +type StorageProviders[T1 any] interface { GetIndexStorageProvider() *rest.StorageProvider GetClaimStorageProvider() *rest.StorageProvider GetEntryStorageProvider() *rest.StorageProvider From 4fd54ccbaacf1effe898b872d8cd71496bb05431 Mon Sep 17 00:00:00 2001 From: Wim Henderickx Date: Mon, 28 Oct 2024 20:48:52 +0100 Subject: [PATCH 16/23] added convertor fns --- apis/backend/as/asentry_object.go | 9 +++++++++ apis/backend/extcomm/extcommentry_object.go | 9 +++++++++ apis/backend/genid/genidentry_object.go | 9 +++++++++ apis/backend/vlan/vlanentry_object.go | 9 +++++++++ 4 files changed, 36 insertions(+) diff --git a/apis/backend/as/asentry_object.go b/apis/backend/as/asentry_object.go index dcfaca2..1785b9c 100644 --- a/apis/backend/as/asentry_object.go +++ b/apis/backend/as/asentry_object.go @@ -70,6 +70,15 @@ func ASEntryFromRuntime(ru runtime.Object) (backend.EntryObject, error) { return entry, nil } +func ASEntryFromUnstructured(ru runtime.Unstructured) (backend.EntryObject, error) { + obj := &ASEntry{} + err := runtime.DefaultUnstructuredConverter.FromUnstructured(ru.UnstructuredContent(), obj) + if err != nil { + return nil, fmt.Errorf("error converting unstructured: %v", err) + } + return obj, nil +} + func GetASEntry(k store.Key, vrange, id string, labels map[string]string) backend.EntryObject { index := k.Name ns := k.Namespace diff --git a/apis/backend/extcomm/extcommentry_object.go b/apis/backend/extcomm/extcommentry_object.go index ede7ec1..f79be46 100644 --- a/apis/backend/extcomm/extcommentry_object.go +++ b/apis/backend/extcomm/extcommentry_object.go @@ -70,6 +70,15 @@ func EXTCOMMEntryFromRuntime(ru runtime.Object) (backend.EntryObject, error) { return entry, nil } +func EXTCOMMEntryFromUnstructured(ru runtime.Unstructured) (backend.EntryObject, error) { + obj := &EXTCOMMEntry{} + err := runtime.DefaultUnstructuredConverter.FromUnstructured(ru.UnstructuredContent(), obj) + if err != nil { + return nil, fmt.Errorf("error converting unstructured: %v", err) + } + return obj, nil +} + func GetEXTCOMMEntry(k store.Key, vrange, id string, labels map[string]string) backend.EntryObject { index := k.Name ns := k.Namespace diff --git a/apis/backend/genid/genidentry_object.go b/apis/backend/genid/genidentry_object.go index ccc5e1b..e49bce8 100644 --- a/apis/backend/genid/genidentry_object.go +++ b/apis/backend/genid/genidentry_object.go @@ -70,6 +70,15 @@ func GENIDEntryFromRuntime(ru runtime.Object) (backend.EntryObject, error) { return entry, nil } +func GENIDEntryFromUnstructured(ru runtime.Unstructured) (backend.EntryObject, error) { + obj := &GENIDEntry{} + err := runtime.DefaultUnstructuredConverter.FromUnstructured(ru.UnstructuredContent(), obj) + if err != nil { + return nil, fmt.Errorf("error converting unstructured: %v", err) + } + return obj, nil +} + func GetGENIDEntry(k store.Key, vrange, id string, labels map[string]string) backend.EntryObject { index := k.Name ns := k.Namespace diff --git a/apis/backend/vlan/vlanentry_object.go b/apis/backend/vlan/vlanentry_object.go index 6dc92b5..00337ab 100644 --- a/apis/backend/vlan/vlanentry_object.go +++ b/apis/backend/vlan/vlanentry_object.go @@ -70,6 +70,15 @@ func VLANEntryFromRuntime(ru runtime.Object) (backend.EntryObject, error) { return entry, nil } +func VLANEntryFromUnstructured(ru runtime.Unstructured) (backend.EntryObject, error) { + obj := &VLANEntry{} + err := runtime.DefaultUnstructuredConverter.FromUnstructured(ru.UnstructuredContent(), obj) + if err != nil { + return nil, fmt.Errorf("error converting unstructured: %v", err) + } + return obj, nil +} + func GetVLANEntry(k store.Key, vrange, id string, labels map[string]string) backend.EntryObject { index := k.Name ns := k.Namespace From ab9d041cb825dcd726e880e55de29f3a2bcee43d Mon Sep 17 00:00:00 2001 From: Wim Henderickx Date: Tue, 29 Oct 2024 05:58:52 +0100 Subject: [PATCH 17/23] added specific invokers --- apis/backend/as/v1alpha1/invoker_claim.go | 121 ++++++++++++++++++ apis/backend/as/v1alpha1/invoker_index.go | 121 ++++++++++++++++++ ...m_resource.go => extcommclaim_resource.go} | 0 ...y_resource.go => extcommentry_resource.go} | 0 ...x_resource.go => extcommindex_resource.go} | 0 .../backend/extcomm/v1alpha1/invoker_claim.go | 121 ++++++++++++++++++ .../backend/extcomm/v1alpha1/invoker_index.go | 121 ++++++++++++++++++ apis/backend/genid/v1alpha1/invoker_claim.go | 121 ++++++++++++++++++ apis/backend/genid/v1alpha1/invoker_index.go | 121 ++++++++++++++++++ apis/backend/ipam/v1alpha1/invoker_claim.go | 121 ++++++++++++++++++ apis/backend/ipam/v1alpha1/invoker_index.go | 121 ++++++++++++++++++ apis/backend/vlan/v1alpha1/invoker_claim.go | 121 ++++++++++++++++++ apis/backend/vlan/v1alpha1/invoker_index.go | 121 ++++++++++++++++++ pkg/registry/generic/invoker.go | 3 + 14 files changed, 1213 insertions(+) create mode 100644 apis/backend/as/v1alpha1/invoker_claim.go create mode 100644 apis/backend/as/v1alpha1/invoker_index.go rename apis/backend/extcomm/v1alpha1/{genidclaim_resource.go => extcommclaim_resource.go} (100%) rename apis/backend/extcomm/v1alpha1/{genidentry_resource.go => extcommentry_resource.go} (100%) rename apis/backend/extcomm/v1alpha1/{genidindex_resource.go => extcommindex_resource.go} (100%) create mode 100644 apis/backend/extcomm/v1alpha1/invoker_claim.go create mode 100644 apis/backend/extcomm/v1alpha1/invoker_index.go create mode 100644 apis/backend/genid/v1alpha1/invoker_claim.go create mode 100644 apis/backend/genid/v1alpha1/invoker_index.go create mode 100644 apis/backend/ipam/v1alpha1/invoker_claim.go create mode 100644 apis/backend/ipam/v1alpha1/invoker_index.go create mode 100644 apis/backend/vlan/v1alpha1/invoker_claim.go create mode 100644 apis/backend/vlan/v1alpha1/invoker_index.go diff --git a/apis/backend/as/v1alpha1/invoker_claim.go b/apis/backend/as/v1alpha1/invoker_claim.go new file mode 100644 index 0000000..bb281a3 --- /dev/null +++ b/apis/backend/as/v1alpha1/invoker_claim.go @@ -0,0 +1,121 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + "fmt" + "reflect" + + "github.com/kuidio/kuid/apis/backend/as" + "github.com/kuidio/kuid/pkg/backend" + "github.com/kuidio/kuid/pkg/registry/options" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime" +) + +func NewChoreoClaimInvoker(be backend.Backend) options.BackendInvoker { + return &claiminvoker{ + be: be, + } +} + +type claiminvoker struct { + be backend.Backend +} + +func claimConvertToInternal(obj runtime.Object) (*as.ASClaim, error) { + ru, ok := obj.(runtime.Unstructured) + if !ok { + return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) + } + claim := &ASClaim{} + if err := runtime.DefaultUnstructuredConverter.FromUnstructured(ru.UnstructuredContent(), claim); err != nil { + return nil, fmt.Errorf("unable to convert unstructured object to ipclaim: %v", err) + } + claimInternal := &as.ASClaim{} + if err := Convert_v1alpha1_ASClaim_To_as_ASClaim(claim, claimInternal, nil); err != nil { + return nil, fmt.Errorf("unable to convert unstructured object to ipclaim: %v", err) + } + return claimInternal, nil +} + +func claimConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error) { + claimInternal, ok := obj.(*as.ASClaim) + if !ok { + return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) + } + claim := &ASClaim{} + if err := Convert_as_ASClaim_To_v1alpha1_ASClaim(claimInternal, claim, nil); err != nil { + return nil, fmt.Errorf("unable to convert unstructured object to ipclaim: %v", err) + } + + uobj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(claim) + if err != nil { + return nil, fmt.Errorf("unable to convert to unstructured: %v", err) + } + + return &unstructured.Unstructured{Object: uobj}, nil +} + +func (r *claiminvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error { + claim, err := claimConvertToInternal(obj) + if err != nil { + return err + } + if err := r.be.Claim(ctx, claim, recursion); err != nil { + return err + } + newClaim, err := claimConvertFromInternal(claim) + if err != nil { + return err + } + obj = newClaim + return nil +} + +func (r *claiminvoker) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error { + claim, err := claimConvertToInternal(obj) + if err != nil { + return err + } + if err := r.be.Claim(ctx, claim, recursion); err != nil { + return err + } + newClaim, err := claimConvertFromInternal(claim) + if err != nil { + return err + } + obj = newClaim + return nil +} + +func (r *claiminvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error { + claim, err := claimConvertToInternal(obj) + if err != nil { + return err + } + if err := r.be.Release(ctx, claim, recursion); err != nil { + return err + } + newClaim, err := claimConvertFromInternal(claim) + if err != nil { + return err + } + obj = newClaim + return nil +} diff --git a/apis/backend/as/v1alpha1/invoker_index.go b/apis/backend/as/v1alpha1/invoker_index.go new file mode 100644 index 0000000..f5896e1 --- /dev/null +++ b/apis/backend/as/v1alpha1/invoker_index.go @@ -0,0 +1,121 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + "fmt" + "reflect" + + "github.com/kuidio/kuid/apis/backend/as" + "github.com/kuidio/kuid/pkg/backend" + "github.com/kuidio/kuid/pkg/registry/options" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime" +) + +func NewChoreoIndexInvoker(be backend.Backend) options.BackendInvoker { + return &idxinvoker{ + be: be, + } +} + +type idxinvoker struct { + be backend.Backend +} + +func indexConvertToInternal(obj runtime.Object) (*as.ASIndex, error) { + ru, ok := obj.(runtime.Unstructured) + if !ok { + return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) + } + index := &ASIndex{} + if err := runtime.DefaultUnstructuredConverter.FromUnstructured(ru.UnstructuredContent(), index); err != nil { + return nil, fmt.Errorf("unable to convert unstructured object to index: %v", err) + } + indexInternal := &as.ASIndex{} + if err := Convert_v1alpha1_ASIndex_To_as_ASIndex(index, indexInternal, nil); err != nil { + return nil, fmt.Errorf("unable to convert unstructured object to index: %v", err) + } + return indexInternal, nil +} + +func indexConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error) { + indexInternal, ok := obj.(*as.ASIndex) + if !ok { + return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) + } + index := &ASIndex{} + if err := Convert_as_ASIndex_To_v1alpha1_ASIndex(indexInternal, index, nil); err != nil { + return nil, fmt.Errorf("unable to convert unstructured object to index: %v", err) + } + + uobj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(index) + if err != nil { + return nil, fmt.Errorf("unable to convert to unstructured: %v", err) + } + + return &unstructured.Unstructured{Object: uobj}, nil +} + +func (r *idxinvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error { + index, err := indexConvertToInternal(obj) + if err != nil { + return err + } + if err := r.be.CreateIndex(ctx, index); err != nil { + return err + } + newIndex, err := indexConvertFromInternal(index) + if err != nil { + return err + } + obj = newIndex + return nil +} + +func (r *idxinvoker) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error { + index, err := indexConvertToInternal(obj) + if err != nil { + return err + } + if err := r.be.CreateIndex(ctx, index); err != nil { + return err + } + newIndex, err := indexConvertFromInternal(index) + if err != nil { + return err + } + obj = newIndex + return nil +} + +func (r *idxinvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error { + index, err := indexConvertToInternal(obj) + if err != nil { + return err + } + if err := r.be.DeleteIndex(ctx, index); err != nil { + return err + } + newIndex, err := indexConvertFromInternal(index) + if err != nil { + return err + } + obj = newIndex + return nil +} diff --git a/apis/backend/extcomm/v1alpha1/genidclaim_resource.go b/apis/backend/extcomm/v1alpha1/extcommclaim_resource.go similarity index 100% rename from apis/backend/extcomm/v1alpha1/genidclaim_resource.go rename to apis/backend/extcomm/v1alpha1/extcommclaim_resource.go diff --git a/apis/backend/extcomm/v1alpha1/genidentry_resource.go b/apis/backend/extcomm/v1alpha1/extcommentry_resource.go similarity index 100% rename from apis/backend/extcomm/v1alpha1/genidentry_resource.go rename to apis/backend/extcomm/v1alpha1/extcommentry_resource.go diff --git a/apis/backend/extcomm/v1alpha1/genidindex_resource.go b/apis/backend/extcomm/v1alpha1/extcommindex_resource.go similarity index 100% rename from apis/backend/extcomm/v1alpha1/genidindex_resource.go rename to apis/backend/extcomm/v1alpha1/extcommindex_resource.go diff --git a/apis/backend/extcomm/v1alpha1/invoker_claim.go b/apis/backend/extcomm/v1alpha1/invoker_claim.go new file mode 100644 index 0000000..685cf5b --- /dev/null +++ b/apis/backend/extcomm/v1alpha1/invoker_claim.go @@ -0,0 +1,121 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + "fmt" + "reflect" + + "github.com/kuidio/kuid/apis/backend/extcomm" + "github.com/kuidio/kuid/pkg/backend" + "github.com/kuidio/kuid/pkg/registry/options" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime" +) + +func NewChoreoClaimInvoker(be backend.Backend) options.BackendInvoker { + return &claiminvoker{ + be: be, + } +} + +type claiminvoker struct { + be backend.Backend +} + +func claimConvertToInternal(obj runtime.Object) (*extcomm.EXTCOMMClaim, error) { + ru, ok := obj.(runtime.Unstructured) + if !ok { + return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) + } + claim := &EXTCOMMClaim{} + if err := runtime.DefaultUnstructuredConverter.FromUnstructured(ru.UnstructuredContent(), claim); err != nil { + return nil, fmt.Errorf("unable to convert unstructured object to ipclaim: %v", err) + } + claimInternal := &extcomm.EXTCOMMClaim{} + if err := Convert_v1alpha1_EXTCOMMClaim_To_extcomm_EXTCOMMClaim(claim, claimInternal, nil); err != nil { + return nil, fmt.Errorf("unable to convert unstructured object to ipclaim: %v", err) + } + return claimInternal, nil +} + +func claimConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error) { + claimInternal, ok := obj.(*extcomm.EXTCOMMClaim) + if !ok { + return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) + } + claim := &EXTCOMMClaim{} + if err := Convert_extcomm_EXTCOMMClaim_To_v1alpha1_EXTCOMMClaim(claimInternal, claim, nil); err != nil { + return nil, fmt.Errorf("unable to convert unstructured object to ipclaim: %v", err) + } + + uobj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(claim) + if err != nil { + return nil, fmt.Errorf("unable to convert to unstructured: %v", err) + } + + return &unstructured.Unstructured{Object: uobj}, nil +} + +func (r *claiminvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error { + claim, err := claimConvertToInternal(obj) + if err != nil { + return err + } + if err := r.be.Claim(ctx, claim, recursion); err != nil { + return err + } + newClaim, err := claimConvertFromInternal(claim) + if err != nil { + return err + } + obj = newClaim + return nil +} + +func (r *claiminvoker) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error { + claim, err := claimConvertToInternal(obj) + if err != nil { + return err + } + if err := r.be.Claim(ctx, claim, recursion); err != nil { + return err + } + newClaim, err := claimConvertFromInternal(claim) + if err != nil { + return err + } + obj = newClaim + return nil +} + +func (r *claiminvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error { + claim, err := claimConvertToInternal(obj) + if err != nil { + return err + } + if err := r.be.Release(ctx, claim, recursion); err != nil { + return err + } + newClaim, err := claimConvertFromInternal(claim) + if err != nil { + return err + } + obj = newClaim + return nil +} diff --git a/apis/backend/extcomm/v1alpha1/invoker_index.go b/apis/backend/extcomm/v1alpha1/invoker_index.go new file mode 100644 index 0000000..c00efa6 --- /dev/null +++ b/apis/backend/extcomm/v1alpha1/invoker_index.go @@ -0,0 +1,121 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + "fmt" + "reflect" + + "github.com/kuidio/kuid/apis/backend/extcomm" + "github.com/kuidio/kuid/pkg/backend" + "github.com/kuidio/kuid/pkg/registry/options" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime" +) + +func NewChoreoIndexInvoker(be backend.Backend) options.BackendInvoker { + return &idxinvoker{ + be: be, + } +} + +type idxinvoker struct { + be backend.Backend +} + +func indexConvertToInternal(obj runtime.Object) (*extcomm.EXTCOMMIndex, error) { + ru, ok := obj.(runtime.Unstructured) + if !ok { + return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) + } + index := &EXTCOMMIndex{} + if err := runtime.DefaultUnstructuredConverter.FromUnstructured(ru.UnstructuredContent(), index); err != nil { + return nil, fmt.Errorf("unable to convert unstructured object to index: %v", err) + } + indexInternal := &extcomm.EXTCOMMIndex{} + if err := Convert_v1alpha1_EXTCOMMIndex_To_extcomm_EXTCOMMIndex(index, indexInternal, nil); err != nil { + return nil, fmt.Errorf("unable to convert unstructured object to index: %v", err) + } + return indexInternal, nil +} + +func indexConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error) { + indexInternal, ok := obj.(*extcomm.EXTCOMMIndex) + if !ok { + return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) + } + index := &EXTCOMMIndex{} + if err := Convert_extcomm_EXTCOMMIndex_To_v1alpha1_EXTCOMMIndex(indexInternal, index, nil); err != nil { + return nil, fmt.Errorf("unable to convert unstructured object to index: %v", err) + } + + uobj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(index) + if err != nil { + return nil, fmt.Errorf("unable to convert to unstructured: %v", err) + } + + return &unstructured.Unstructured{Object: uobj}, nil +} + +func (r *idxinvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error { + index, err := indexConvertToInternal(obj) + if err != nil { + return err + } + if err := r.be.CreateIndex(ctx, index); err != nil { + return err + } + newIndex, err := indexConvertFromInternal(index) + if err != nil { + return err + } + obj = newIndex + return nil +} + +func (r *idxinvoker) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error { + index, err := indexConvertToInternal(obj) + if err != nil { + return err + } + if err := r.be.CreateIndex(ctx, index); err != nil { + return err + } + newIndex, err := indexConvertFromInternal(index) + if err != nil { + return err + } + obj = newIndex + return nil +} + +func (r *idxinvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error { + index, err := indexConvertToInternal(obj) + if err != nil { + return err + } + if err := r.be.DeleteIndex(ctx, index); err != nil { + return err + } + newIndex, err := indexConvertFromInternal(index) + if err != nil { + return err + } + obj = newIndex + return nil +} diff --git a/apis/backend/genid/v1alpha1/invoker_claim.go b/apis/backend/genid/v1alpha1/invoker_claim.go new file mode 100644 index 0000000..d4007b2 --- /dev/null +++ b/apis/backend/genid/v1alpha1/invoker_claim.go @@ -0,0 +1,121 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + "fmt" + "reflect" + + "github.com/kuidio/kuid/apis/backend/genid" + "github.com/kuidio/kuid/pkg/backend" + "github.com/kuidio/kuid/pkg/registry/options" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime" +) + +func NewChoreoClaimInvoker(be backend.Backend) options.BackendInvoker { + return &claiminvoker{ + be: be, + } +} + +type claiminvoker struct { + be backend.Backend +} + +func claimConvertToInternal(obj runtime.Object) (*genid.GENIDClaim, error) { + ru, ok := obj.(runtime.Unstructured) + if !ok { + return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) + } + claim := &GENIDClaim{} + if err := runtime.DefaultUnstructuredConverter.FromUnstructured(ru.UnstructuredContent(), claim); err != nil { + return nil, fmt.Errorf("unable to convert unstructured object to ipclaim: %v", err) + } + claimInternal := &genid.GENIDClaim{} + if err := Convert_v1alpha1_GENIDClaim_To_genid_GENIDClaim(claim, claimInternal, nil); err != nil { + return nil, fmt.Errorf("unable to convert unstructured object to ipclaim: %v", err) + } + return claimInternal, nil +} + +func claimConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error) { + claimInternal, ok := obj.(*genid.GENIDClaim) + if !ok { + return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) + } + claim := &GENIDClaim{} + if err := Convert_genid_GENIDClaim_To_v1alpha1_GENIDClaim(claimInternal, claim, nil); err != nil { + return nil, fmt.Errorf("unable to convert unstructured object to ipclaim: %v", err) + } + + uobj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(claim) + if err != nil { + return nil, fmt.Errorf("unable to convert to unstructured: %v", err) + } + + return &unstructured.Unstructured{Object: uobj}, nil +} + +func (r *claiminvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error { + claim, err := claimConvertToInternal(obj) + if err != nil { + return err + } + if err := r.be.Claim(ctx, claim, recursion); err != nil { + return err + } + newClaim, err := claimConvertFromInternal(claim) + if err != nil { + return err + } + obj = newClaim + return nil +} + +func (r *claiminvoker) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error { + claim, err := claimConvertToInternal(obj) + if err != nil { + return err + } + if err := r.be.Claim(ctx, claim, recursion); err != nil { + return err + } + newClaim, err := claimConvertFromInternal(claim) + if err != nil { + return err + } + obj = newClaim + return nil +} + +func (r *claiminvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error { + claim, err := claimConvertToInternal(obj) + if err != nil { + return err + } + if err := r.be.Release(ctx, claim, recursion); err != nil { + return err + } + newClaim, err := claimConvertFromInternal(claim) + if err != nil { + return err + } + obj = newClaim + return nil +} diff --git a/apis/backend/genid/v1alpha1/invoker_index.go b/apis/backend/genid/v1alpha1/invoker_index.go new file mode 100644 index 0000000..c70f728 --- /dev/null +++ b/apis/backend/genid/v1alpha1/invoker_index.go @@ -0,0 +1,121 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + "fmt" + "reflect" + + "github.com/kuidio/kuid/apis/backend/genid" + "github.com/kuidio/kuid/pkg/backend" + "github.com/kuidio/kuid/pkg/registry/options" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime" +) + +func NewChoreoIndexInvoker(be backend.Backend) options.BackendInvoker { + return &idxinvoker{ + be: be, + } +} + +type idxinvoker struct { + be backend.Backend +} + +func indexConvertToInternal(obj runtime.Object) (*genid.GENIDIndex, error) { + ru, ok := obj.(runtime.Unstructured) + if !ok { + return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) + } + index := &GENIDIndex{} + if err := runtime.DefaultUnstructuredConverter.FromUnstructured(ru.UnstructuredContent(), index); err != nil { + return nil, fmt.Errorf("unable to convert unstructured object to index: %v", err) + } + indexInternal := &genid.GENIDIndex{} + if err := Convert_v1alpha1_GENIDIndex_To_genid_GENIDIndex(index, indexInternal, nil); err != nil { + return nil, fmt.Errorf("unable to convert unstructured object to index: %v", err) + } + return indexInternal, nil +} + +func indexConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error) { + indexInternal, ok := obj.(*genid.GENIDIndex) + if !ok { + return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) + } + index := &GENIDIndex{} + if err := Convert_genid_GENIDIndex_To_v1alpha1_GENIDIndex(indexInternal, index, nil); err != nil { + return nil, fmt.Errorf("unable to convert unstructured object to index: %v", err) + } + + uobj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(index) + if err != nil { + return nil, fmt.Errorf("unable to convert to unstructured: %v", err) + } + + return &unstructured.Unstructured{Object: uobj}, nil +} + +func (r *idxinvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error { + index, err := indexConvertToInternal(obj) + if err != nil { + return err + } + if err := r.be.CreateIndex(ctx, index); err != nil { + return err + } + newIndex, err := indexConvertFromInternal(index) + if err != nil { + return err + } + obj = newIndex + return nil +} + +func (r *idxinvoker) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error { + index, err := indexConvertToInternal(obj) + if err != nil { + return err + } + if err := r.be.CreateIndex(ctx, index); err != nil { + return err + } + newIndex, err := indexConvertFromInternal(index) + if err != nil { + return err + } + obj = newIndex + return nil +} + +func (r *idxinvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error { + index, err := indexConvertToInternal(obj) + if err != nil { + return err + } + if err := r.be.DeleteIndex(ctx, index); err != nil { + return err + } + newIndex, err := indexConvertFromInternal(index) + if err != nil { + return err + } + obj = newIndex + return nil +} diff --git a/apis/backend/ipam/v1alpha1/invoker_claim.go b/apis/backend/ipam/v1alpha1/invoker_claim.go new file mode 100644 index 0000000..e4022b5 --- /dev/null +++ b/apis/backend/ipam/v1alpha1/invoker_claim.go @@ -0,0 +1,121 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + "fmt" + "reflect" + + "github.com/kuidio/kuid/apis/backend/ipam" + "github.com/kuidio/kuid/pkg/backend" + "github.com/kuidio/kuid/pkg/registry/options" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime" +) + +func NewChoreoClaimInvoker(be backend.Backend) options.BackendInvoker { + return &claiminvoker{ + be: be, + } +} + +type claiminvoker struct { + be backend.Backend +} + +func claimConvertToInternal(obj runtime.Object) (*ipam.IPClaim, error) { + ru, ok := obj.(runtime.Unstructured) + if !ok { + return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) + } + claim := &IPClaim{} + if err := runtime.DefaultUnstructuredConverter.FromUnstructured(ru.UnstructuredContent(), claim); err != nil { + return nil, fmt.Errorf("unable to convert unstructured object to ipclaim: %v", err) + } + claimInternal := &ipam.IPClaim{} + if err := Convert_v1alpha1_IPClaim_To_ipam_IPClaim(claim, claimInternal, nil); err != nil { + return nil, fmt.Errorf("unable to convert unstructured object to ipclaim: %v", err) + } + return claimInternal, nil +} + +func claimConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error) { + claimInternal, ok := obj.(*ipam.IPClaim) + if !ok { + return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) + } + claim := &IPClaim{} + if err := Convert_ipam_IPClaim_To_v1alpha1_IPClaim(claimInternal, claim, nil); err != nil { + return nil, fmt.Errorf("unable to convert unstructured object to ipclaim: %v", err) + } + + uobj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(claim) + if err != nil { + return nil, fmt.Errorf("unable to convert to unstructured: %v", err) + } + + return &unstructured.Unstructured{Object: uobj}, nil +} + +func (r *claiminvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error { + claim, err := claimConvertToInternal(obj) + if err != nil { + return err + } + if err := r.be.Claim(ctx, claim, recursion); err != nil { + return err + } + newClaim, err := claimConvertFromInternal(claim) + if err != nil { + return err + } + obj = newClaim + return nil +} + +func (r *claiminvoker) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error { + claim, err := claimConvertToInternal(obj) + if err != nil { + return err + } + if err := r.be.Claim(ctx, claim, recursion); err != nil { + return err + } + newClaim, err := claimConvertFromInternal(claim) + if err != nil { + return err + } + obj = newClaim + return nil +} + +func (r *claiminvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error { + claim, err := claimConvertToInternal(obj) + if err != nil { + return err + } + if err := r.be.Release(ctx, claim, recursion); err != nil { + return err + } + newClaim, err := claimConvertFromInternal(claim) + if err != nil { + return err + } + obj = newClaim + return nil +} diff --git a/apis/backend/ipam/v1alpha1/invoker_index.go b/apis/backend/ipam/v1alpha1/invoker_index.go new file mode 100644 index 0000000..42c574b --- /dev/null +++ b/apis/backend/ipam/v1alpha1/invoker_index.go @@ -0,0 +1,121 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + "fmt" + "reflect" + + "github.com/kuidio/kuid/apis/backend/ipam" + "github.com/kuidio/kuid/pkg/backend" + "github.com/kuidio/kuid/pkg/registry/options" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime" +) + +func NewChoreoIndexInvoker(be backend.Backend) options.BackendInvoker { + return &idxinvoker{ + be: be, + } +} + +type idxinvoker struct { + be backend.Backend +} + +func indexConvertToInternal(obj runtime.Object) (*ipam.IPIndex, error) { + ru, ok := obj.(runtime.Unstructured) + if !ok { + return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) + } + index := &IPIndex{} + if err := runtime.DefaultUnstructuredConverter.FromUnstructured(ru.UnstructuredContent(), index); err != nil { + return nil, fmt.Errorf("unable to convert unstructured object to index: %v", err) + } + indexInternal := &ipam.IPIndex{} + if err := Convert_v1alpha1_IPIndex_To_ipam_IPIndex(index, indexInternal, nil); err != nil { + return nil, fmt.Errorf("unable to convert unstructured object to index: %v", err) + } + return indexInternal, nil +} + +func indexConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error) { + indexInternal, ok := obj.(*ipam.IPIndex) + if !ok { + return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) + } + index := &IPIndex{} + if err := Convert_ipam_IPIndex_To_v1alpha1_IPIndex(indexInternal, index, nil); err != nil { + return nil, fmt.Errorf("unable to convert unstructured object to index: %v", err) + } + + uobj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(index) + if err != nil { + return nil, fmt.Errorf("unable to convert to unstructured: %v", err) + } + + return &unstructured.Unstructured{Object: uobj}, nil +} + +func (r *idxinvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error { + index, err := indexConvertToInternal(obj) + if err != nil { + return err + } + if err := r.be.CreateIndex(ctx, index); err != nil { + return err + } + newIndex, err := indexConvertFromInternal(index) + if err != nil { + return err + } + obj = newIndex + return nil +} + +func (r *idxinvoker) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error { + index, err := indexConvertToInternal(obj) + if err != nil { + return err + } + if err := r.be.CreateIndex(ctx, index); err != nil { + return err + } + newIndex, err := indexConvertFromInternal(index) + if err != nil { + return err + } + obj = newIndex + return nil +} + +func (r *idxinvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error { + index, err := indexConvertToInternal(obj) + if err != nil { + return err + } + if err := r.be.DeleteIndex(ctx, index); err != nil { + return err + } + newIndex, err := indexConvertFromInternal(index) + if err != nil { + return err + } + obj = newIndex + return nil +} diff --git a/apis/backend/vlan/v1alpha1/invoker_claim.go b/apis/backend/vlan/v1alpha1/invoker_claim.go new file mode 100644 index 0000000..9107339 --- /dev/null +++ b/apis/backend/vlan/v1alpha1/invoker_claim.go @@ -0,0 +1,121 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + "fmt" + "reflect" + + "github.com/kuidio/kuid/apis/backend/vlan" + "github.com/kuidio/kuid/pkg/backend" + "github.com/kuidio/kuid/pkg/registry/options" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime" +) + +func NewChoreoClaimInvoker(be backend.Backend) options.BackendInvoker { + return &claiminvoker{ + be: be, + } +} + +type claiminvoker struct { + be backend.Backend +} + +func claimConvertToInternal(obj runtime.Object) (*vlan.VLANClaim, error) { + ru, ok := obj.(runtime.Unstructured) + if !ok { + return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) + } + claim := &VLANClaim{} + if err := runtime.DefaultUnstructuredConverter.FromUnstructured(ru.UnstructuredContent(), claim); err != nil { + return nil, fmt.Errorf("unable to convert unstructured object to VLANClaim: %v", err) + } + claimInternal := &vlan.VLANClaim{} + if err := Convert_v1alpha1_VLANClaim_To_vlan_VLANClaim(claim, claimInternal, nil); err != nil { + return nil, fmt.Errorf("unable to convert unstructured object to VLANClaim: %v", err) + } + return claimInternal, nil +} + +func claimConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error) { + claimInternal, ok := obj.(*vlan.VLANClaim) + if !ok { + return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) + } + claim := &VLANClaim{} + if err := Convert_vlan_VLANClaim_To_v1alpha1_VLANClaim(claimInternal, claim, nil); err != nil { + return nil, fmt.Errorf("unable to convert unstructured object to VLANClaim: %v", err) + } + + uobj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(claim) + if err != nil { + return nil, fmt.Errorf("unable to convert to unstructured: %v", err) + } + + return &unstructured.Unstructured{Object: uobj}, nil +} + +func (r *claiminvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error { + claim, err := claimConvertToInternal(obj) + if err != nil { + return err + } + if err := r.be.Claim(ctx, claim, recursion); err != nil { + return err + } + newClaim, err := claimConvertFromInternal(claim) + if err != nil { + return err + } + obj = newClaim + return nil +} + +func (r *claiminvoker) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error { + claim, err := claimConvertToInternal(obj) + if err != nil { + return err + } + if err := r.be.Claim(ctx, claim, recursion); err != nil { + return err + } + newClaim, err := claimConvertFromInternal(claim) + if err != nil { + return err + } + obj = newClaim + return nil +} + +func (r *claiminvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error { + claim, err := claimConvertToInternal(obj) + if err != nil { + return err + } + if err := r.be.Release(ctx, claim, recursion); err != nil { + return err + } + newClaim, err := claimConvertFromInternal(claim) + if err != nil { + return err + } + obj = newClaim + return nil +} diff --git a/apis/backend/vlan/v1alpha1/invoker_index.go b/apis/backend/vlan/v1alpha1/invoker_index.go new file mode 100644 index 0000000..655356c --- /dev/null +++ b/apis/backend/vlan/v1alpha1/invoker_index.go @@ -0,0 +1,121 @@ +/* +Copyright 2024 Nokia. + +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 v1alpha1 + +import ( + "context" + "fmt" + "reflect" + + "github.com/kuidio/kuid/apis/backend/vlan" + "github.com/kuidio/kuid/pkg/backend" + "github.com/kuidio/kuid/pkg/registry/options" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime" +) + +func NewChoreoIndexInvoker(be backend.Backend) options.BackendInvoker { + return &idxinvoker{ + be: be, + } +} + +type idxinvoker struct { + be backend.Backend +} + +func indexConvertToInternal(obj runtime.Object) (*vlan.VLANIndex, error) { + ru, ok := obj.(runtime.Unstructured) + if !ok { + return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) + } + index := &VLANIndex{} + if err := runtime.DefaultUnstructuredConverter.FromUnstructured(ru.UnstructuredContent(), index); err != nil { + return nil, fmt.Errorf("unable to convert unstructured object to index: %v", err) + } + indexInternal := &vlan.VLANIndex{} + if err := Convert_v1alpha1_VLANIndex_To_vlan_VLANIndex(index, indexInternal, nil); err != nil { + return nil, fmt.Errorf("unable to convert unstructured object to index: %v", err) + } + return indexInternal, nil +} + +func indexConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error) { + indexInternal, ok := obj.(*vlan.VLANIndex) + if !ok { + return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) + } + index := &VLANIndex{} + if err := Convert_vlan_VLANIndex_To_v1alpha1_VLANIndex(indexInternal, index, nil); err != nil { + return nil, fmt.Errorf("unable to convert unstructured object to index: %v", err) + } + + uobj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(index) + if err != nil { + return nil, fmt.Errorf("unable to convert to unstructured: %v", err) + } + + return &unstructured.Unstructured{Object: uobj}, nil +} + +func (r *idxinvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error { + index, err := indexConvertToInternal(obj) + if err != nil { + return err + } + if err := r.be.CreateIndex(ctx, index); err != nil { + return err + } + newIndex, err := indexConvertFromInternal(index) + if err != nil { + return err + } + obj = newIndex + return nil +} + +func (r *idxinvoker) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error { + index, err := indexConvertToInternal(obj) + if err != nil { + return err + } + if err := r.be.CreateIndex(ctx, index); err != nil { + return err + } + newIndex, err := indexConvertFromInternal(index) + if err != nil { + return err + } + obj = newIndex + return nil +} + +func (r *idxinvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error { + index, err := indexConvertToInternal(obj) + if err != nil { + return err + } + if err := r.be.DeleteIndex(ctx, index); err != nil { + return err + } + newIndex, err := indexConvertFromInternal(index) + if err != nil { + return err + } + obj = newIndex + return nil +} diff --git a/pkg/registry/generic/invoker.go b/pkg/registry/generic/invoker.go index 93a80e7..2f33f61 100644 --- a/pkg/registry/generic/invoker.go +++ b/pkg/registry/generic/invoker.go @@ -16,14 +16,17 @@ limitations under the License. package generic +/* import ( "context" "k8s.io/apimachinery/pkg/runtime" ) + type BackendInvoker interface { InvokeCreate(ctx context.Context, obj runtime.Object) error InvokeUpdate(ctx context.Context, obj, old runtime.Object) error InvokeDelete(ctx context.Context, obj runtime.Object) error } +*/ From 509e46e5a98a290eec417d15d51d017cb3f71930 Mon Sep 17 00:00:00 2001 From: Wim Henderickx Date: Tue, 29 Oct 2024 09:39:05 +0100 Subject: [PATCH 18/23] reworked invoker w/o conversion --- apis/backend/as/asclaim_types.go | 4 ++++ apis/backend/as/asentry_types.go | 4 ++++ apis/backend/as/asindex_types.go | 4 ++++ .../backend/as/{v1alpha1 => }/invoker_claim.go | 18 ++++-------------- .../backend/as/{v1alpha1 => }/invoker_index.go | 17 ++++------------- apis/backend/as/v1alpha1/asclaim_types.go | 2 -- apis/backend/as/v1alpha1/asentry_types.go | 2 -- apis/backend/as/v1alpha1/asindex_types.go | 1 - apis/backend/extcomm/extcommclaim_types.go | 7 ++++--- apis/backend/extcomm/extcommentry_types.go | 7 ++++--- apis/backend/extcomm/extcommindex_types.go | 7 ++++--- .../extcomm/{v1alpha1 => }/invoker_claim.go | 18 ++++-------------- .../extcomm/{v1alpha1 => }/invoker_index.go | 17 ++++------------- .../extcomm/v1alpha1/extcommclaim_types.go | 6 +++--- .../extcomm/v1alpha1/extcommentry_types.go | 6 +++--- .../extcomm/v1alpha1/extcommindex_types.go | 6 +++--- apis/backend/genid/genidclaim_types.go | 5 ++++- apis/backend/genid/genidentry_types.go | 5 ++++- apis/backend/genid/genidindex_types.go | 5 ++++- .../genid/{v1alpha1 => }/invoker_claim.go | 18 ++++-------------- .../genid/{v1alpha1 => }/invoker_index.go | 17 ++++------------- .../backend/genid/v1alpha1/genidclaim_types.go | 4 +++- .../backend/genid/v1alpha1/genidentry_types.go | 4 +++- .../backend/genid/v1alpha1/genidindex_types.go | 4 +++- .../ipam/{v1alpha1 => }/invoker_claim.go | 18 ++++-------------- .../ipam/{v1alpha1 => }/invoker_index.go | 17 ++++------------- apis/backend/ipam/ipclaim_types.go | 5 ++++- apis/backend/ipam/ipentry_types.go | 5 ++++- apis/backend/ipam/ipindex_types.go | 5 ++++- apis/backend/ipam/v1alpha1/ipclaim_types.go | 4 +++- apis/backend/ipam/v1alpha1/ipentry_types.go | 4 +++- apis/backend/ipam/v1alpha1/ipindex_types.go | 4 +++- .../vlan/{v1alpha1 => }/invoker_claim.go | 18 ++++-------------- .../vlan/{v1alpha1 => }/invoker_index.go | 17 ++++------------- apis/backend/vlan/v1alpha1/vlanclaim_types.go | 4 +++- apis/backend/vlan/v1alpha1/vlanentry_types.go | 4 +++- apis/backend/vlan/v1alpha1/vlanindex_types.go | 4 +++- apis/backend/vlan/vlanclaim_types.go | 5 ++++- apis/backend/vlan/vlanentry_types.go | 5 ++++- apis/backend/vlan/vlanindex_types.go | 5 ++++- apis/infra/v1alpha1/cluster_types.go | 1 - apis/infra/v1alpha1/endpoint_types.go | 5 ++++- apis/infra/v1alpha1/endpointset_types.go | 5 ++++- apis/infra/v1alpha1/link_types.go | 5 ++++- apis/infra/v1alpha1/linkset_types.go | 5 ++++- apis/infra/v1alpha1/module_types.go | 5 ++++- apis/infra/v1alpha1/modulebay_types.go | 5 ++++- apis/infra/v1alpha1/node_types.go | 5 ++++- apis/infra/v1alpha1/nodeitem_types.go | 5 ++++- apis/infra/v1alpha1/nodeset_types.go | 5 ++++- apis/infra/v1alpha1/partition_types.go | 6 ++++-- apis/infra/v1alpha1/rack_types.go | 6 ++++-- apis/infra/v1alpha1/region_types.go | 6 ++++-- apis/infra/v1alpha1/site_types.go | 6 ++++-- crds/as.be.kuid.dev_asclaims.yaml | 6 ++++-- crds/as.be.kuid.dev_asentries.yaml | 6 ++++-- crds/as.be.kuid.dev_asindexes.yaml | 6 ++++-- crds/extcomm.be.kuid.dev_extcommclaims.yaml | 8 +++++++- crds/extcomm.be.kuid.dev_extcommentries.yaml | 8 +++++++- crds/extcomm.be.kuid.dev_extcommindexes.yaml | 8 +++++++- crds/genid.be.kuid.dev_genidclaims.yaml | 8 +++++++- crds/genid.be.kuid.dev_genidentries.yaml | 8 +++++++- crds/genid.be.kuid.dev_genidindexes.yaml | 8 +++++++- crds/infra.kuid.dev_endpoints.yaml | 6 +++++- crds/infra.kuid.dev_endpointsets.yaml | 6 +++++- crds/infra.kuid.dev_links.yaml | 6 +++++- crds/infra.kuid.dev_linksets.yaml | 6 +++++- crds/infra.kuid.dev_modulebays.yaml | 6 +++++- crds/infra.kuid.dev_modules.yaml | 6 +++++- crds/infra.kuid.dev_nodeitems.yaml | 6 +++++- crds/infra.kuid.dev_nodes.yaml | 6 +++++- crds/infra.kuid.dev_nodesets.yaml | 6 +++++- crds/infra.kuid.dev_partitions.yaml | 6 +++++- crds/infra.kuid.dev_racks.yaml | 6 +++++- crds/infra.kuid.dev_regions.yaml | 6 +++++- crds/infra.kuid.dev_sites.yaml | 6 +++++- crds/ipam.be.kuid.dev_ipclaims.yaml | 8 +++++++- crds/ipam.be.kuid.dev_ipentries.yaml | 8 +++++++- crds/ipam.be.kuid.dev_ipindices.yaml | 8 +++++++- crds/vlan.be.kuid.dev_vlanclaims.yaml | 8 +++++++- crds/vlan.be.kuid.dev_vlanentries.yaml | 8 +++++++- crds/vlan.be.kuid.dev_vlanindices.yaml | 8 +++++++- 82 files changed, 349 insertions(+), 225 deletions(-) rename apis/backend/as/{v1alpha1 => }/invoker_claim.go (82%) rename apis/backend/as/{v1alpha1 => }/invoker_index.go (82%) rename apis/backend/extcomm/{v1alpha1 => }/invoker_claim.go (80%) rename apis/backend/extcomm/{v1alpha1 => }/invoker_index.go (80%) rename apis/backend/genid/{v1alpha1 => }/invoker_claim.go (81%) rename apis/backend/genid/{v1alpha1 => }/invoker_index.go (81%) rename apis/backend/ipam/{v1alpha1 => }/invoker_claim.go (81%) rename apis/backend/ipam/{v1alpha1 => }/invoker_index.go (81%) rename apis/backend/vlan/{v1alpha1 => }/invoker_claim.go (81%) rename apis/backend/vlan/{v1alpha1 => }/invoker_index.go (81%) diff --git a/apis/backend/as/asclaim_types.go b/apis/backend/as/asclaim_types.go index d218884..2e1e951 100644 --- a/apis/backend/as/asclaim_types.go +++ b/apis/backend/as/asclaim_types.go @@ -57,6 +57,10 @@ type ASClaimStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // ASClaim is the Schema for the ASClaim API type ASClaim struct { metav1.TypeMeta `json:",inline" yaml:",inline"` diff --git a/apis/backend/as/asentry_types.go b/apis/backend/as/asentry_types.go index f2408f4..3ced4aa 100644 --- a/apis/backend/as/asentry_types.go +++ b/apis/backend/as/asentry_types.go @@ -47,6 +47,10 @@ type ASEntryStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // ASEntry is the Schema for the ASentry API type ASEntry struct { metav1.TypeMeta `json:",inline" yaml:",inline"` diff --git a/apis/backend/as/asindex_types.go b/apis/backend/as/asindex_types.go index 8df0ce7..a5b1b75 100644 --- a/apis/backend/as/asindex_types.go +++ b/apis/backend/as/asindex_types.go @@ -52,6 +52,10 @@ type ASIndexStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // ASIndex is the Schema for the ASIndex API type ASIndex struct { metav1.TypeMeta `json:",inline" yaml:",inline"` diff --git a/apis/backend/as/v1alpha1/invoker_claim.go b/apis/backend/as/invoker_claim.go similarity index 82% rename from apis/backend/as/v1alpha1/invoker_claim.go rename to apis/backend/as/invoker_claim.go index bb281a3..5468e05 100644 --- a/apis/backend/as/v1alpha1/invoker_claim.go +++ b/apis/backend/as/invoker_claim.go @@ -14,14 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package as import ( "context" "fmt" "reflect" - "github.com/kuidio/kuid/apis/backend/as" "github.com/kuidio/kuid/pkg/backend" "github.com/kuidio/kuid/pkg/registry/options" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" @@ -38,7 +37,7 @@ type claiminvoker struct { be backend.Backend } -func claimConvertToInternal(obj runtime.Object) (*as.ASClaim, error) { +func claimConvertToInternal(obj runtime.Object) (*ASClaim, error) { ru, ok := obj.(runtime.Unstructured) if !ok { return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) @@ -47,28 +46,19 @@ func claimConvertToInternal(obj runtime.Object) (*as.ASClaim, error) { if err := runtime.DefaultUnstructuredConverter.FromUnstructured(ru.UnstructuredContent(), claim); err != nil { return nil, fmt.Errorf("unable to convert unstructured object to ipclaim: %v", err) } - claimInternal := &as.ASClaim{} - if err := Convert_v1alpha1_ASClaim_To_as_ASClaim(claim, claimInternal, nil); err != nil { - return nil, fmt.Errorf("unable to convert unstructured object to ipclaim: %v", err) - } - return claimInternal, nil + return claim, nil } func claimConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error) { - claimInternal, ok := obj.(*as.ASClaim) + claim, ok := obj.(*ASClaim) if !ok { return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) } - claim := &ASClaim{} - if err := Convert_as_ASClaim_To_v1alpha1_ASClaim(claimInternal, claim, nil); err != nil { - return nil, fmt.Errorf("unable to convert unstructured object to ipclaim: %v", err) - } uobj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(claim) if err != nil { return nil, fmt.Errorf("unable to convert to unstructured: %v", err) } - return &unstructured.Unstructured{Object: uobj}, nil } diff --git a/apis/backend/as/v1alpha1/invoker_index.go b/apis/backend/as/invoker_index.go similarity index 82% rename from apis/backend/as/v1alpha1/invoker_index.go rename to apis/backend/as/invoker_index.go index f5896e1..9b7e3a0 100644 --- a/apis/backend/as/v1alpha1/invoker_index.go +++ b/apis/backend/as/invoker_index.go @@ -14,14 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package as import ( "context" "fmt" "reflect" - "github.com/kuidio/kuid/apis/backend/as" "github.com/kuidio/kuid/pkg/backend" "github.com/kuidio/kuid/pkg/registry/options" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" @@ -38,7 +37,7 @@ type idxinvoker struct { be backend.Backend } -func indexConvertToInternal(obj runtime.Object) (*as.ASIndex, error) { +func indexConvertToInternal(obj runtime.Object) (*ASIndex, error) { ru, ok := obj.(runtime.Unstructured) if !ok { return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) @@ -47,22 +46,14 @@ func indexConvertToInternal(obj runtime.Object) (*as.ASIndex, error) { if err := runtime.DefaultUnstructuredConverter.FromUnstructured(ru.UnstructuredContent(), index); err != nil { return nil, fmt.Errorf("unable to convert unstructured object to index: %v", err) } - indexInternal := &as.ASIndex{} - if err := Convert_v1alpha1_ASIndex_To_as_ASIndex(index, indexInternal, nil); err != nil { - return nil, fmt.Errorf("unable to convert unstructured object to index: %v", err) - } - return indexInternal, nil + return index, nil } func indexConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error) { - indexInternal, ok := obj.(*as.ASIndex) + index, ok := obj.(*ASIndex) if !ok { return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) } - index := &ASIndex{} - if err := Convert_as_ASIndex_To_v1alpha1_ASIndex(indexInternal, index, nil); err != nil { - return nil, fmt.Errorf("unable to convert unstructured object to index: %v", err) - } uobj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(index) if err != nil { diff --git a/apis/backend/as/v1alpha1/asclaim_types.go b/apis/backend/as/v1alpha1/asclaim_types.go index 2272cdd..bb4ee63 100644 --- a/apis/backend/as/v1alpha1/asclaim_types.go +++ b/apis/backend/as/v1alpha1/asclaim_types.go @@ -59,10 +59,8 @@ type ASClaimStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +kubebuilder:object:root=true -// +kubebuilder:storageversion // +kubebuilder:subresource:status // +kubebuilder:resource:categories={kuid} - // ASClaim is the Schema for the ASClaim API type ASClaim struct { metav1.TypeMeta `json:",inline" yaml:",inline"` diff --git a/apis/backend/as/v1alpha1/asentry_types.go b/apis/backend/as/v1alpha1/asentry_types.go index fd5081d..3ec6c77 100644 --- a/apis/backend/as/v1alpha1/asentry_types.go +++ b/apis/backend/as/v1alpha1/asentry_types.go @@ -48,10 +48,8 @@ type ASEntryStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +kubebuilder:object:root=true -// +kubebuilder:storageversion // +kubebuilder:subresource:status // +kubebuilder:resource:categories={kuid} - // ASEntry is the Schema for the ASentry API type ASEntry struct { metav1.TypeMeta `json:",inline" yaml:",inline"` diff --git a/apis/backend/as/v1alpha1/asindex_types.go b/apis/backend/as/v1alpha1/asindex_types.go index b8a0af1..15402ef 100644 --- a/apis/backend/as/v1alpha1/asindex_types.go +++ b/apis/backend/as/v1alpha1/asindex_types.go @@ -53,7 +53,6 @@ type ASIndexStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +kubebuilder:object:root=true -// +kubebuilder:storageversion // +kubebuilder:subresource:status // +kubebuilder:resource:categories={kuid} // ASIndex is the Schema for the ASIndex API diff --git a/apis/backend/extcomm/extcommclaim_types.go b/apis/backend/extcomm/extcommclaim_types.go index 16ddf6c..e1d8b63 100644 --- a/apis/backend/extcomm/extcommclaim_types.go +++ b/apis/backend/extcomm/extcommclaim_types.go @@ -58,10 +58,11 @@ type EXTCOMMClaimStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // EXTCOMMClaim is the Schema for the EXTCOMMClaim API -// -// +k8s:openapi-gen=true type EXTCOMMClaim struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/apis/backend/extcomm/extcommentry_types.go b/apis/backend/extcomm/extcommentry_types.go index 13726ce..42ce366 100644 --- a/apis/backend/extcomm/extcommentry_types.go +++ b/apis/backend/extcomm/extcommentry_types.go @@ -49,10 +49,11 @@ type EXTCOMMEntryStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // EXTCOMMEntry is the Schema for the EXTCOMMentry API -// -// +k8s:openapi-gen=true type EXTCOMMEntry struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/apis/backend/extcomm/extcommindex_types.go b/apis/backend/extcomm/extcommindex_types.go index 810d0f4..5e1d560 100644 --- a/apis/backend/extcomm/extcommindex_types.go +++ b/apis/backend/extcomm/extcommindex_types.go @@ -65,10 +65,11 @@ type EXTCOMMIndexStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // EXTCOMMIndex is the Schema for the EXTCOMMIndex API -// -// +k8s:openapi-gen=true type EXTCOMMIndex struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/apis/backend/extcomm/v1alpha1/invoker_claim.go b/apis/backend/extcomm/invoker_claim.go similarity index 80% rename from apis/backend/extcomm/v1alpha1/invoker_claim.go rename to apis/backend/extcomm/invoker_claim.go index 685cf5b..2e76a75 100644 --- a/apis/backend/extcomm/v1alpha1/invoker_claim.go +++ b/apis/backend/extcomm/invoker_claim.go @@ -14,14 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package extcomm import ( "context" "fmt" "reflect" - "github.com/kuidio/kuid/apis/backend/extcomm" "github.com/kuidio/kuid/pkg/backend" "github.com/kuidio/kuid/pkg/registry/options" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" @@ -38,7 +37,7 @@ type claiminvoker struct { be backend.Backend } -func claimConvertToInternal(obj runtime.Object) (*extcomm.EXTCOMMClaim, error) { +func claimConvertToInternal(obj runtime.Object) (*EXTCOMMClaim, error) { ru, ok := obj.(runtime.Unstructured) if !ok { return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) @@ -47,28 +46,19 @@ func claimConvertToInternal(obj runtime.Object) (*extcomm.EXTCOMMClaim, error) { if err := runtime.DefaultUnstructuredConverter.FromUnstructured(ru.UnstructuredContent(), claim); err != nil { return nil, fmt.Errorf("unable to convert unstructured object to ipclaim: %v", err) } - claimInternal := &extcomm.EXTCOMMClaim{} - if err := Convert_v1alpha1_EXTCOMMClaim_To_extcomm_EXTCOMMClaim(claim, claimInternal, nil); err != nil { - return nil, fmt.Errorf("unable to convert unstructured object to ipclaim: %v", err) - } - return claimInternal, nil + return claim, nil } func claimConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error) { - claimInternal, ok := obj.(*extcomm.EXTCOMMClaim) + claim, ok := obj.(*EXTCOMMClaim) if !ok { return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) } - claim := &EXTCOMMClaim{} - if err := Convert_extcomm_EXTCOMMClaim_To_v1alpha1_EXTCOMMClaim(claimInternal, claim, nil); err != nil { - return nil, fmt.Errorf("unable to convert unstructured object to ipclaim: %v", err) - } uobj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(claim) if err != nil { return nil, fmt.Errorf("unable to convert to unstructured: %v", err) } - return &unstructured.Unstructured{Object: uobj}, nil } diff --git a/apis/backend/extcomm/v1alpha1/invoker_index.go b/apis/backend/extcomm/invoker_index.go similarity index 80% rename from apis/backend/extcomm/v1alpha1/invoker_index.go rename to apis/backend/extcomm/invoker_index.go index c00efa6..f097aa5 100644 --- a/apis/backend/extcomm/v1alpha1/invoker_index.go +++ b/apis/backend/extcomm/invoker_index.go @@ -14,14 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package extcomm import ( "context" "fmt" "reflect" - "github.com/kuidio/kuid/apis/backend/extcomm" "github.com/kuidio/kuid/pkg/backend" "github.com/kuidio/kuid/pkg/registry/options" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" @@ -38,7 +37,7 @@ type idxinvoker struct { be backend.Backend } -func indexConvertToInternal(obj runtime.Object) (*extcomm.EXTCOMMIndex, error) { +func indexConvertToInternal(obj runtime.Object) (*EXTCOMMIndex, error) { ru, ok := obj.(runtime.Unstructured) if !ok { return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) @@ -47,22 +46,14 @@ func indexConvertToInternal(obj runtime.Object) (*extcomm.EXTCOMMIndex, error) { if err := runtime.DefaultUnstructuredConverter.FromUnstructured(ru.UnstructuredContent(), index); err != nil { return nil, fmt.Errorf("unable to convert unstructured object to index: %v", err) } - indexInternal := &extcomm.EXTCOMMIndex{} - if err := Convert_v1alpha1_EXTCOMMIndex_To_extcomm_EXTCOMMIndex(index, indexInternal, nil); err != nil { - return nil, fmt.Errorf("unable to convert unstructured object to index: %v", err) - } - return indexInternal, nil + return index, nil } func indexConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error) { - indexInternal, ok := obj.(*extcomm.EXTCOMMIndex) + index, ok := obj.(*EXTCOMMIndex) if !ok { return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) } - index := &EXTCOMMIndex{} - if err := Convert_extcomm_EXTCOMMIndex_To_v1alpha1_EXTCOMMIndex(indexInternal, index, nil); err != nil { - return nil, fmt.Errorf("unable to convert unstructured object to index: %v", err) - } uobj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(index) if err != nil { diff --git a/apis/backend/extcomm/v1alpha1/extcommclaim_types.go b/apis/backend/extcomm/v1alpha1/extcommclaim_types.go index 48cb635..a540759 100644 --- a/apis/backend/extcomm/v1alpha1/extcommclaim_types.go +++ b/apis/backend/extcomm/v1alpha1/extcommclaim_types.go @@ -58,10 +58,10 @@ type EXTCOMMClaimStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // EXTCOMMClaim is the Schema for the EXTCOMMClaim API -// -// +k8s:openapi-gen=true type EXTCOMMClaim struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/apis/backend/extcomm/v1alpha1/extcommentry_types.go b/apis/backend/extcomm/v1alpha1/extcommentry_types.go index cc65fc1..29689c8 100644 --- a/apis/backend/extcomm/v1alpha1/extcommentry_types.go +++ b/apis/backend/extcomm/v1alpha1/extcommentry_types.go @@ -49,10 +49,10 @@ type EXTCOMMEntryStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // EXTCOMMEntry is the Schema for the EXTCOMMentry API -// -// +k8s:openapi-gen=true type EXTCOMMEntry struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/apis/backend/extcomm/v1alpha1/extcommindex_types.go b/apis/backend/extcomm/v1alpha1/extcommindex_types.go index 683a21b..877287b 100644 --- a/apis/backend/extcomm/v1alpha1/extcommindex_types.go +++ b/apis/backend/extcomm/v1alpha1/extcommindex_types.go @@ -65,10 +65,10 @@ type EXTCOMMIndexStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // EXTCOMMIndex is the Schema for the EXTCOMMIndex API -// -// +k8s:openapi-gen=true type EXTCOMMIndex struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/apis/backend/genid/genidclaim_types.go b/apis/backend/genid/genidclaim_types.go index b744704..e8e22e5 100644 --- a/apis/backend/genid/genidclaim_types.go +++ b/apis/backend/genid/genidclaim_types.go @@ -58,7 +58,10 @@ type GENIDClaimStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // GENIDClaim is the Schema for the GENIDClaim API type GENIDClaim struct { metav1.TypeMeta `json:",inline" yaml:",inline"` diff --git a/apis/backend/genid/genidentry_types.go b/apis/backend/genid/genidentry_types.go index af2c349..081606b 100644 --- a/apis/backend/genid/genidentry_types.go +++ b/apis/backend/genid/genidentry_types.go @@ -47,7 +47,10 @@ type GENIDEntryStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // GENIDEntry is the Schema for the GENIDEntry API type GENIDEntry struct { metav1.TypeMeta `json:",inline" yaml:",inline"` diff --git a/apis/backend/genid/genidindex_types.go b/apis/backend/genid/genidindex_types.go index 9862272..134f1dd 100644 --- a/apis/backend/genid/genidindex_types.go +++ b/apis/backend/genid/genidindex_types.go @@ -55,7 +55,10 @@ type GENIDIndexStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // GENIDIndex is the Schema for the GENIDIndex API type GENIDIndex struct { metav1.TypeMeta `json:",inline" yaml:",inline"` diff --git a/apis/backend/genid/v1alpha1/invoker_claim.go b/apis/backend/genid/invoker_claim.go similarity index 81% rename from apis/backend/genid/v1alpha1/invoker_claim.go rename to apis/backend/genid/invoker_claim.go index d4007b2..acfb9aa 100644 --- a/apis/backend/genid/v1alpha1/invoker_claim.go +++ b/apis/backend/genid/invoker_claim.go @@ -14,14 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package genid import ( "context" "fmt" "reflect" - "github.com/kuidio/kuid/apis/backend/genid" "github.com/kuidio/kuid/pkg/backend" "github.com/kuidio/kuid/pkg/registry/options" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" @@ -38,7 +37,7 @@ type claiminvoker struct { be backend.Backend } -func claimConvertToInternal(obj runtime.Object) (*genid.GENIDClaim, error) { +func claimConvertToInternal(obj runtime.Object) (*GENIDClaim, error) { ru, ok := obj.(runtime.Unstructured) if !ok { return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) @@ -47,28 +46,19 @@ func claimConvertToInternal(obj runtime.Object) (*genid.GENIDClaim, error) { if err := runtime.DefaultUnstructuredConverter.FromUnstructured(ru.UnstructuredContent(), claim); err != nil { return nil, fmt.Errorf("unable to convert unstructured object to ipclaim: %v", err) } - claimInternal := &genid.GENIDClaim{} - if err := Convert_v1alpha1_GENIDClaim_To_genid_GENIDClaim(claim, claimInternal, nil); err != nil { - return nil, fmt.Errorf("unable to convert unstructured object to ipclaim: %v", err) - } - return claimInternal, nil + return claim, nil } func claimConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error) { - claimInternal, ok := obj.(*genid.GENIDClaim) + claim, ok := obj.(*GENIDClaim) if !ok { return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) } - claim := &GENIDClaim{} - if err := Convert_genid_GENIDClaim_To_v1alpha1_GENIDClaim(claimInternal, claim, nil); err != nil { - return nil, fmt.Errorf("unable to convert unstructured object to ipclaim: %v", err) - } uobj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(claim) if err != nil { return nil, fmt.Errorf("unable to convert to unstructured: %v", err) } - return &unstructured.Unstructured{Object: uobj}, nil } diff --git a/apis/backend/genid/v1alpha1/invoker_index.go b/apis/backend/genid/invoker_index.go similarity index 81% rename from apis/backend/genid/v1alpha1/invoker_index.go rename to apis/backend/genid/invoker_index.go index c70f728..5b1548b 100644 --- a/apis/backend/genid/v1alpha1/invoker_index.go +++ b/apis/backend/genid/invoker_index.go @@ -14,14 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package genid import ( "context" "fmt" "reflect" - "github.com/kuidio/kuid/apis/backend/genid" "github.com/kuidio/kuid/pkg/backend" "github.com/kuidio/kuid/pkg/registry/options" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" @@ -38,7 +37,7 @@ type idxinvoker struct { be backend.Backend } -func indexConvertToInternal(obj runtime.Object) (*genid.GENIDIndex, error) { +func indexConvertToInternal(obj runtime.Object) (*GENIDIndex, error) { ru, ok := obj.(runtime.Unstructured) if !ok { return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) @@ -47,22 +46,14 @@ func indexConvertToInternal(obj runtime.Object) (*genid.GENIDIndex, error) { if err := runtime.DefaultUnstructuredConverter.FromUnstructured(ru.UnstructuredContent(), index); err != nil { return nil, fmt.Errorf("unable to convert unstructured object to index: %v", err) } - indexInternal := &genid.GENIDIndex{} - if err := Convert_v1alpha1_GENIDIndex_To_genid_GENIDIndex(index, indexInternal, nil); err != nil { - return nil, fmt.Errorf("unable to convert unstructured object to index: %v", err) - } - return indexInternal, nil + return index, nil } func indexConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error) { - indexInternal, ok := obj.(*genid.GENIDIndex) + index, ok := obj.(*GENIDIndex) if !ok { return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) } - index := &GENIDIndex{} - if err := Convert_genid_GENIDIndex_To_v1alpha1_GENIDIndex(indexInternal, index, nil); err != nil { - return nil, fmt.Errorf("unable to convert unstructured object to index: %v", err) - } uobj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(index) if err != nil { diff --git a/apis/backend/genid/v1alpha1/genidclaim_types.go b/apis/backend/genid/v1alpha1/genidclaim_types.go index 8b261c5..5718799 100644 --- a/apis/backend/genid/v1alpha1/genidclaim_types.go +++ b/apis/backend/genid/v1alpha1/genidclaim_types.go @@ -58,7 +58,9 @@ type GENIDClaimStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // GENIDClaim is the Schema for the GENIDClaim API type GENIDClaim struct { metav1.TypeMeta `json:",inline" yaml:",inline"` diff --git a/apis/backend/genid/v1alpha1/genidentry_types.go b/apis/backend/genid/v1alpha1/genidentry_types.go index 3fe0182..0b13f55 100644 --- a/apis/backend/genid/v1alpha1/genidentry_types.go +++ b/apis/backend/genid/v1alpha1/genidentry_types.go @@ -47,7 +47,9 @@ type GENIDEntryStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // GENIDEntry is the Schema for the GENIDEntry API type GENIDEntry struct { metav1.TypeMeta `json:",inline" yaml:",inline"` diff --git a/apis/backend/genid/v1alpha1/genidindex_types.go b/apis/backend/genid/v1alpha1/genidindex_types.go index 6a9498c..c9e9351 100644 --- a/apis/backend/genid/v1alpha1/genidindex_types.go +++ b/apis/backend/genid/v1alpha1/genidindex_types.go @@ -55,7 +55,9 @@ type GENIDIndexStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // GENIDIndex is the Schema for the GENIDIndex API type GENIDIndex struct { metav1.TypeMeta `json:",inline" yaml:",inline"` diff --git a/apis/backend/ipam/v1alpha1/invoker_claim.go b/apis/backend/ipam/invoker_claim.go similarity index 81% rename from apis/backend/ipam/v1alpha1/invoker_claim.go rename to apis/backend/ipam/invoker_claim.go index e4022b5..c8773c0 100644 --- a/apis/backend/ipam/v1alpha1/invoker_claim.go +++ b/apis/backend/ipam/invoker_claim.go @@ -14,14 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package ipam import ( "context" "fmt" "reflect" - "github.com/kuidio/kuid/apis/backend/ipam" "github.com/kuidio/kuid/pkg/backend" "github.com/kuidio/kuid/pkg/registry/options" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" @@ -38,7 +37,7 @@ type claiminvoker struct { be backend.Backend } -func claimConvertToInternal(obj runtime.Object) (*ipam.IPClaim, error) { +func claimConvertToInternal(obj runtime.Object) (*IPClaim, error) { ru, ok := obj.(runtime.Unstructured) if !ok { return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) @@ -47,28 +46,19 @@ func claimConvertToInternal(obj runtime.Object) (*ipam.IPClaim, error) { if err := runtime.DefaultUnstructuredConverter.FromUnstructured(ru.UnstructuredContent(), claim); err != nil { return nil, fmt.Errorf("unable to convert unstructured object to ipclaim: %v", err) } - claimInternal := &ipam.IPClaim{} - if err := Convert_v1alpha1_IPClaim_To_ipam_IPClaim(claim, claimInternal, nil); err != nil { - return nil, fmt.Errorf("unable to convert unstructured object to ipclaim: %v", err) - } - return claimInternal, nil + return claim, nil } func claimConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error) { - claimInternal, ok := obj.(*ipam.IPClaim) + claim, ok := obj.(*IPClaim) if !ok { return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) } - claim := &IPClaim{} - if err := Convert_ipam_IPClaim_To_v1alpha1_IPClaim(claimInternal, claim, nil); err != nil { - return nil, fmt.Errorf("unable to convert unstructured object to ipclaim: %v", err) - } uobj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(claim) if err != nil { return nil, fmt.Errorf("unable to convert to unstructured: %v", err) } - return &unstructured.Unstructured{Object: uobj}, nil } diff --git a/apis/backend/ipam/v1alpha1/invoker_index.go b/apis/backend/ipam/invoker_index.go similarity index 81% rename from apis/backend/ipam/v1alpha1/invoker_index.go rename to apis/backend/ipam/invoker_index.go index 42c574b..8a1d966 100644 --- a/apis/backend/ipam/v1alpha1/invoker_index.go +++ b/apis/backend/ipam/invoker_index.go @@ -14,14 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package ipam import ( "context" "fmt" "reflect" - "github.com/kuidio/kuid/apis/backend/ipam" "github.com/kuidio/kuid/pkg/backend" "github.com/kuidio/kuid/pkg/registry/options" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" @@ -38,7 +37,7 @@ type idxinvoker struct { be backend.Backend } -func indexConvertToInternal(obj runtime.Object) (*ipam.IPIndex, error) { +func indexConvertToInternal(obj runtime.Object) (*IPIndex, error) { ru, ok := obj.(runtime.Unstructured) if !ok { return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) @@ -47,22 +46,14 @@ func indexConvertToInternal(obj runtime.Object) (*ipam.IPIndex, error) { if err := runtime.DefaultUnstructuredConverter.FromUnstructured(ru.UnstructuredContent(), index); err != nil { return nil, fmt.Errorf("unable to convert unstructured object to index: %v", err) } - indexInternal := &ipam.IPIndex{} - if err := Convert_v1alpha1_IPIndex_To_ipam_IPIndex(index, indexInternal, nil); err != nil { - return nil, fmt.Errorf("unable to convert unstructured object to index: %v", err) - } - return indexInternal, nil + return index, nil } func indexConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error) { - indexInternal, ok := obj.(*ipam.IPIndex) + index, ok := obj.(*IPIndex) if !ok { return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) } - index := &IPIndex{} - if err := Convert_ipam_IPIndex_To_v1alpha1_IPIndex(indexInternal, index, nil); err != nil { - return nil, fmt.Errorf("unable to convert unstructured object to index: %v", err) - } uobj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(index) if err != nil { diff --git a/apis/backend/ipam/ipclaim_types.go b/apis/backend/ipam/ipclaim_types.go index 0755755..f1cdd11 100644 --- a/apis/backend/ipam/ipclaim_types.go +++ b/apis/backend/ipam/ipclaim_types.go @@ -97,7 +97,10 @@ type IPClaimStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // IPClaim is the Schema for the ipclaim API type IPClaim struct { metav1.TypeMeta `json:",inline" yaml:",inline"` diff --git a/apis/backend/ipam/ipentry_types.go b/apis/backend/ipam/ipentry_types.go index 9053562..aa8f309 100644 --- a/apis/backend/ipam/ipentry_types.go +++ b/apis/backend/ipam/ipentry_types.go @@ -64,7 +64,10 @@ type IPEntryStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // IPEntry is the Schema for the ipentry API type IPEntry struct { metav1.TypeMeta `json:",inline" yaml:",inline"` diff --git a/apis/backend/ipam/ipindex_types.go b/apis/backend/ipam/ipindex_types.go index f728ade..6ab4831 100644 --- a/apis/backend/ipam/ipindex_types.go +++ b/apis/backend/ipam/ipindex_types.go @@ -59,7 +59,10 @@ type IPIndexStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // IPIndex is the Schema for the IPIndex API type IPIndex struct { metav1.TypeMeta `json:",inline" yaml:",inline"` diff --git a/apis/backend/ipam/v1alpha1/ipclaim_types.go b/apis/backend/ipam/v1alpha1/ipclaim_types.go index 83d88a3..e0d9fc9 100644 --- a/apis/backend/ipam/v1alpha1/ipclaim_types.go +++ b/apis/backend/ipam/v1alpha1/ipclaim_types.go @@ -97,7 +97,9 @@ type IPClaimStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // IPClaim is the Schema for the ipclaim API type IPClaim struct { metav1.TypeMeta `json:",inline" yaml:",inline"` diff --git a/apis/backend/ipam/v1alpha1/ipentry_types.go b/apis/backend/ipam/v1alpha1/ipentry_types.go index d817173..bf3ea7a 100644 --- a/apis/backend/ipam/v1alpha1/ipentry_types.go +++ b/apis/backend/ipam/v1alpha1/ipentry_types.go @@ -64,7 +64,9 @@ type IPEntryStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // IPEntry is the Schema for the ipentry API type IPEntry struct { metav1.TypeMeta `json:",inline" yaml:",inline"` diff --git a/apis/backend/ipam/v1alpha1/ipindex_types.go b/apis/backend/ipam/v1alpha1/ipindex_types.go index a2d5cce..b4510ec 100644 --- a/apis/backend/ipam/v1alpha1/ipindex_types.go +++ b/apis/backend/ipam/v1alpha1/ipindex_types.go @@ -59,7 +59,9 @@ type IPIndexStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // IPIndex is the Schema for the IPIndex API type IPIndex struct { metav1.TypeMeta `json:",inline" yaml:",inline"` diff --git a/apis/backend/vlan/v1alpha1/invoker_claim.go b/apis/backend/vlan/invoker_claim.go similarity index 81% rename from apis/backend/vlan/v1alpha1/invoker_claim.go rename to apis/backend/vlan/invoker_claim.go index 9107339..3320520 100644 --- a/apis/backend/vlan/v1alpha1/invoker_claim.go +++ b/apis/backend/vlan/invoker_claim.go @@ -14,14 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package vlan import ( "context" "fmt" "reflect" - "github.com/kuidio/kuid/apis/backend/vlan" "github.com/kuidio/kuid/pkg/backend" "github.com/kuidio/kuid/pkg/registry/options" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" @@ -38,7 +37,7 @@ type claiminvoker struct { be backend.Backend } -func claimConvertToInternal(obj runtime.Object) (*vlan.VLANClaim, error) { +func claimConvertToInternal(obj runtime.Object) (*VLANClaim, error) { ru, ok := obj.(runtime.Unstructured) if !ok { return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) @@ -47,28 +46,19 @@ func claimConvertToInternal(obj runtime.Object) (*vlan.VLANClaim, error) { if err := runtime.DefaultUnstructuredConverter.FromUnstructured(ru.UnstructuredContent(), claim); err != nil { return nil, fmt.Errorf("unable to convert unstructured object to VLANClaim: %v", err) } - claimInternal := &vlan.VLANClaim{} - if err := Convert_v1alpha1_VLANClaim_To_vlan_VLANClaim(claim, claimInternal, nil); err != nil { - return nil, fmt.Errorf("unable to convert unstructured object to VLANClaim: %v", err) - } - return claimInternal, nil + return claim, nil } func claimConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error) { - claimInternal, ok := obj.(*vlan.VLANClaim) + claim, ok := obj.(*VLANClaim) if !ok { return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) } - claim := &VLANClaim{} - if err := Convert_vlan_VLANClaim_To_v1alpha1_VLANClaim(claimInternal, claim, nil); err != nil { - return nil, fmt.Errorf("unable to convert unstructured object to VLANClaim: %v", err) - } uobj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(claim) if err != nil { return nil, fmt.Errorf("unable to convert to unstructured: %v", err) } - return &unstructured.Unstructured{Object: uobj}, nil } diff --git a/apis/backend/vlan/v1alpha1/invoker_index.go b/apis/backend/vlan/invoker_index.go similarity index 81% rename from apis/backend/vlan/v1alpha1/invoker_index.go rename to apis/backend/vlan/invoker_index.go index 655356c..e734398 100644 --- a/apis/backend/vlan/v1alpha1/invoker_index.go +++ b/apis/backend/vlan/invoker_index.go @@ -14,14 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package vlan import ( "context" "fmt" "reflect" - "github.com/kuidio/kuid/apis/backend/vlan" "github.com/kuidio/kuid/pkg/backend" "github.com/kuidio/kuid/pkg/registry/options" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" @@ -38,7 +37,7 @@ type idxinvoker struct { be backend.Backend } -func indexConvertToInternal(obj runtime.Object) (*vlan.VLANIndex, error) { +func indexConvertToInternal(obj runtime.Object) (*VLANIndex, error) { ru, ok := obj.(runtime.Unstructured) if !ok { return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) @@ -47,22 +46,14 @@ func indexConvertToInternal(obj runtime.Object) (*vlan.VLANIndex, error) { if err := runtime.DefaultUnstructuredConverter.FromUnstructured(ru.UnstructuredContent(), index); err != nil { return nil, fmt.Errorf("unable to convert unstructured object to index: %v", err) } - indexInternal := &vlan.VLANIndex{} - if err := Convert_v1alpha1_VLANIndex_To_vlan_VLANIndex(index, indexInternal, nil); err != nil { - return nil, fmt.Errorf("unable to convert unstructured object to index: %v", err) - } - return indexInternal, nil + return index, nil } func indexConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error) { - indexInternal, ok := obj.(*vlan.VLANIndex) + index, ok := obj.(*VLANIndex) if !ok { return nil, fmt.Errorf("not an unstructured obj, got: %s", reflect.TypeOf(obj).Name()) } - index := &VLANIndex{} - if err := Convert_vlan_VLANIndex_To_v1alpha1_VLANIndex(indexInternal, index, nil); err != nil { - return nil, fmt.Errorf("unable to convert unstructured object to index: %v", err) - } uobj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(index) if err != nil { diff --git a/apis/backend/vlan/v1alpha1/vlanclaim_types.go b/apis/backend/vlan/v1alpha1/vlanclaim_types.go index 608ca13..42778cb 100644 --- a/apis/backend/vlan/v1alpha1/vlanclaim_types.go +++ b/apis/backend/vlan/v1alpha1/vlanclaim_types.go @@ -58,7 +58,9 @@ type VLANClaimStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // VLANClaim is the Schema for the VLANClaim API type VLANClaim struct { metav1.TypeMeta `json:",inline" yaml:",inline"` diff --git a/apis/backend/vlan/v1alpha1/vlanentry_types.go b/apis/backend/vlan/v1alpha1/vlanentry_types.go index 52e76a4..afdcd03 100644 --- a/apis/backend/vlan/v1alpha1/vlanentry_types.go +++ b/apis/backend/vlan/v1alpha1/vlanentry_types.go @@ -47,7 +47,9 @@ type VLANEntryStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // VLANEntry is the Schema for the VLANentry API type VLANEntry struct { metav1.TypeMeta `json:",inline" yaml:",inline"` diff --git a/apis/backend/vlan/v1alpha1/vlanindex_types.go b/apis/backend/vlan/v1alpha1/vlanindex_types.go index 69af271..f178834 100644 --- a/apis/backend/vlan/v1alpha1/vlanindex_types.go +++ b/apis/backend/vlan/v1alpha1/vlanindex_types.go @@ -52,7 +52,9 @@ type VLANIndexStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // VLANIndex is the Schema for the VLANIndex API type VLANIndex struct { metav1.TypeMeta `json:",inline" yaml:",inline"` diff --git a/apis/backend/vlan/vlanclaim_types.go b/apis/backend/vlan/vlanclaim_types.go index d15b766..faddb3d 100644 --- a/apis/backend/vlan/vlanclaim_types.go +++ b/apis/backend/vlan/vlanclaim_types.go @@ -58,7 +58,10 @@ type VLANClaimStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // VLANClaim is the Schema for the VLANClaim API type VLANClaim struct { metav1.TypeMeta `json:",inline" yaml:",inline"` diff --git a/apis/backend/vlan/vlanentry_types.go b/apis/backend/vlan/vlanentry_types.go index cfbba42..b339183 100644 --- a/apis/backend/vlan/vlanentry_types.go +++ b/apis/backend/vlan/vlanentry_types.go @@ -47,7 +47,10 @@ type VLANEntryStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // VLANEntry is the Schema for the VLANentry API type VLANEntry struct { metav1.TypeMeta `json:",inline" yaml:",inline"` diff --git a/apis/backend/vlan/vlanindex_types.go b/apis/backend/vlan/vlanindex_types.go index 3322784..a5c4ba6 100644 --- a/apis/backend/vlan/vlanindex_types.go +++ b/apis/backend/vlan/vlanindex_types.go @@ -52,7 +52,10 @@ type VLANIndexStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // VLANIndex is the Schema for the VLANIndex API type VLANIndex struct { metav1.TypeMeta `json:",inline" yaml:",inline"` diff --git a/apis/infra/v1alpha1/cluster_types.go b/apis/infra/v1alpha1/cluster_types.go index 8fb6e8c..cd2ae35 100644 --- a/apis/infra/v1alpha1/cluster_types.go +++ b/apis/infra/v1alpha1/cluster_types.go @@ -55,7 +55,6 @@ type ClusterStatus struct { // +kubebuilder:storageversion // +kubebuilder:subresource:status // +kubebuilder:resource:categories={kuid} - // A Cluster represents a kubernetes cluster and is typically used as a nodeGroup identifier. type Cluster struct { metav1.TypeMeta `json:",inline" yaml:",inline"` diff --git a/apis/infra/v1alpha1/endpoint_types.go b/apis/infra/v1alpha1/endpoint_types.go index de43b72..cd8d5ff 100644 --- a/apis/infra/v1alpha1/endpoint_types.go +++ b/apis/infra/v1alpha1/endpoint_types.go @@ -50,7 +50,10 @@ type EndpointStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // An Endpoint represents a communication interface or connection point within a Node, // facilitating network communication and data transfer between different components // or systems within the environment. `Endpoints` serve as gateways for transmitting and diff --git a/apis/infra/v1alpha1/endpointset_types.go b/apis/infra/v1alpha1/endpointset_types.go index 1c99929..0392bd0 100644 --- a/apis/infra/v1alpha1/endpointset_types.go +++ b/apis/infra/v1alpha1/endpointset_types.go @@ -58,7 +58,10 @@ type EndpointSetStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // A EndpointSet represents a set of endpoints that belong together within a nodeGroup. // E.g. it can be used to model a logical Link Aggregation group within // a node or it can be used to represent a logical multi-homing construction diff --git a/apis/infra/v1alpha1/link_types.go b/apis/infra/v1alpha1/link_types.go index c3e875e..59e02c9 100644 --- a/apis/infra/v1alpha1/link_types.go +++ b/apis/infra/v1alpha1/link_types.go @@ -56,7 +56,10 @@ type LinkStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // A link represents a physical/logical connection that enables communication and data transfer // between 2 endpoints of a node. // +k8s:openapi-gen=true diff --git a/apis/infra/v1alpha1/linkset_types.go b/apis/infra/v1alpha1/linkset_types.go index 2b7683d..30b884d 100644 --- a/apis/infra/v1alpha1/linkset_types.go +++ b/apis/infra/v1alpha1/linkset_types.go @@ -50,7 +50,10 @@ type LinkSetStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // A linkSet represents a set of links that belong together within a node group or accross nodeGroups. // E.g. it can be used to model a logical Link Aggregation group between 2 nodes or // it can be used to represent a logical multi-homing construction between a set of nodes diff --git a/apis/infra/v1alpha1/module_types.go b/apis/infra/v1alpha1/module_types.go index 4820a94..f613f30 100644 --- a/apis/infra/v1alpha1/module_types.go +++ b/apis/infra/v1alpha1/module_types.go @@ -45,7 +45,10 @@ type ModuleStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // A module refers to a hardware component or expansion module that can be installed within a ModuleBay of a Node. // Modules provide additional functionality and capabilities to the infrastructure environment, // allowing users to enhance and customize their deployments according to specific requirements. diff --git a/apis/infra/v1alpha1/modulebay_types.go b/apis/infra/v1alpha1/modulebay_types.go index 41b57aa..29620d3 100644 --- a/apis/infra/v1alpha1/modulebay_types.go +++ b/apis/infra/v1alpha1/modulebay_types.go @@ -45,7 +45,10 @@ type ModuleBayStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // A ModuleBay serves as a modular slot or enclosure within a Node, designed to accommodate additional modules. // ModuleBays provide a flexible and scalable approach to extending the capabilities of Nodes, // allowing users to customize and enhance their infrastructure deployments according to specific requirements. diff --git a/apis/infra/v1alpha1/node_types.go b/apis/infra/v1alpha1/node_types.go index 8a2fe1f..70d6b6c 100644 --- a/apis/infra/v1alpha1/node_types.go +++ b/apis/infra/v1alpha1/node_types.go @@ -67,7 +67,10 @@ type NodeStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // A Node represents a fundamental unit that implements compute, storage, and/or networking within your environment. // Nodes can embody physical, virtual, or containerized entities, offering versatility in deployment options to suit // diverse infrastructure requirements. diff --git a/apis/infra/v1alpha1/nodeitem_types.go b/apis/infra/v1alpha1/nodeitem_types.go index f9ea7af..6a06179 100644 --- a/apis/infra/v1alpha1/nodeitem_types.go +++ b/apis/infra/v1alpha1/nodeitem_types.go @@ -43,7 +43,10 @@ type NodeItemStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // A NodeItem represents a specific hardware component or accessory associated with a Node. // NodeItems represent a wide range of hardware elements, e.g Fan(s), PowerUnit(s), CPU(s), // and other peripheral devices essential for the operation of the Node. diff --git a/apis/infra/v1alpha1/nodeset_types.go b/apis/infra/v1alpha1/nodeset_types.go index b3cd949..c2a10bd 100644 --- a/apis/infra/v1alpha1/nodeset_types.go +++ b/apis/infra/v1alpha1/nodeset_types.go @@ -44,7 +44,10 @@ type NodeSetStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // A NodeSet represents a set of nodes. // E.g. it can be used to model a set of nodes in a NodeSet that share the same // charecteristics wrt, Numa, interfaces, etc. diff --git a/apis/infra/v1alpha1/partition_types.go b/apis/infra/v1alpha1/partition_types.go index 8ea4fec..38fc65a 100644 --- a/apis/infra/v1alpha1/partition_types.go +++ b/apis/infra/v1alpha1/partition_types.go @@ -40,8 +40,10 @@ type PartitionStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// +k8s:openapi-gen=true +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} type Partition struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/apis/infra/v1alpha1/rack_types.go b/apis/infra/v1alpha1/rack_types.go index 8b9dd60..0ab7537 100644 --- a/apis/infra/v1alpha1/rack_types.go +++ b/apis/infra/v1alpha1/rack_types.go @@ -50,10 +50,12 @@ type RackStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // A rack represents a physical equipment rack within your environment. Each rack is designed to accommodate // the installation of devices and equipment. -// +k8s:openapi-gen=true type Rack struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/apis/infra/v1alpha1/region_types.go b/apis/infra/v1alpha1/region_types.go index 7fe6798..ab0ea7e 100644 --- a/apis/infra/v1alpha1/region_types.go +++ b/apis/infra/v1alpha1/region_types.go @@ -40,10 +40,12 @@ type RegionStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // A region represent a geography in which multiple infrastructure resources are grouped // A region might represent a continent, country, city, campus, or other area depending on your environment. -// +k8s:openapi-gen=true type Region struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/apis/infra/v1alpha1/site_types.go b/apis/infra/v1alpha1/site_types.go index 8de0528..5c5e50c 100644 --- a/apis/infra/v1alpha1/site_types.go +++ b/apis/infra/v1alpha1/site_types.go @@ -46,11 +46,13 @@ type SiteStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} // A site serves as a fundamental organizational unit for managing infrastructure resources within your environment. // The utilization of sites may vary based on the organizational structure and requirements, // but in essence, each site typically corresponds to a distinct building or campus. -// +k8s:openapi-gen=true type Site struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/crds/as.be.kuid.dev_asclaims.yaml b/crds/as.be.kuid.dev_asclaims.yaml index 9e3b03d..e4de9ee 100644 --- a/crds/as.be.kuid.dev_asclaims.yaml +++ b/crds/as.be.kuid.dev_asclaims.yaml @@ -187,7 +187,9 @@ spec: type: object type: object served: true - storage: false + storage: true + subresources: + status: {} - name: v1alpha1 schema: openAPIV3Schema: @@ -359,6 +361,6 @@ spec: type: object type: object served: true - storage: true + storage: false subresources: status: {} diff --git a/crds/as.be.kuid.dev_asentries.yaml b/crds/as.be.kuid.dev_asentries.yaml index 1b1f16b..56f923e 100644 --- a/crds/as.be.kuid.dev_asentries.yaml +++ b/crds/as.be.kuid.dev_asentries.yaml @@ -173,7 +173,9 @@ spec: type: object type: object served: true - storage: false + storage: true + subresources: + status: {} - name: v1alpha1 schema: openAPIV3Schema: @@ -331,6 +333,6 @@ spec: type: object type: object served: true - storage: true + storage: false subresources: status: {} diff --git a/crds/as.be.kuid.dev_asindexes.yaml b/crds/as.be.kuid.dev_asindexes.yaml index 4820610..9a48796 100644 --- a/crds/as.be.kuid.dev_asindexes.yaml +++ b/crds/as.be.kuid.dev_asindexes.yaml @@ -132,7 +132,9 @@ spec: type: object type: object served: true - storage: false + storage: true + subresources: + status: {} - name: v1alpha1 schema: openAPIV3Schema: @@ -249,6 +251,6 @@ spec: type: object type: object served: true - storage: true + storage: false subresources: status: {} diff --git a/crds/extcomm.be.kuid.dev_extcommclaims.yaml b/crds/extcomm.be.kuid.dev_extcommclaims.yaml index e267917..3cc5e90 100644 --- a/crds/extcomm.be.kuid.dev_extcommclaims.yaml +++ b/crds/extcomm.be.kuid.dev_extcommclaims.yaml @@ -8,6 +8,8 @@ metadata: spec: group: extcomm.be.kuid.dev names: + categories: + - kuid kind: EXTCOMMClaim listKind: EXTCOMMClaimList plural: extcommclaims @@ -187,7 +189,9 @@ spec: type: object type: object served: true - storage: false + storage: true + subresources: + status: {} - name: v1alpha1 schema: openAPIV3Schema: @@ -362,3 +366,5 @@ spec: type: object served: true storage: false + subresources: + status: {} diff --git a/crds/extcomm.be.kuid.dev_extcommentries.yaml b/crds/extcomm.be.kuid.dev_extcommentries.yaml index cb25af6..b8c593a 100644 --- a/crds/extcomm.be.kuid.dev_extcommentries.yaml +++ b/crds/extcomm.be.kuid.dev_extcommentries.yaml @@ -8,6 +8,8 @@ metadata: spec: group: extcomm.be.kuid.dev names: + categories: + - kuid kind: EXTCOMMEntry listKind: EXTCOMMEntryList plural: extcommentries @@ -177,7 +179,9 @@ spec: type: object type: object served: true - storage: false + storage: true + subresources: + status: {} - name: v1alpha1 schema: openAPIV3Schema: @@ -342,3 +346,5 @@ spec: type: object served: true storage: false + subresources: + status: {} diff --git a/crds/extcomm.be.kuid.dev_extcommindexes.yaml b/crds/extcomm.be.kuid.dev_extcommindexes.yaml index ceadcf7..df3b53c 100644 --- a/crds/extcomm.be.kuid.dev_extcommindexes.yaml +++ b/crds/extcomm.be.kuid.dev_extcommindexes.yaml @@ -8,6 +8,8 @@ metadata: spec: group: extcomm.be.kuid.dev names: + categories: + - kuid kind: EXTCOMMIndex listKind: EXTCOMMIndexList plural: extcommindexes @@ -154,7 +156,9 @@ spec: type: object type: object served: true - storage: false + storage: true + subresources: + status: {} - name: v1alpha1 schema: openAPIV3Schema: @@ -296,3 +300,5 @@ spec: type: object served: true storage: false + subresources: + status: {} diff --git a/crds/genid.be.kuid.dev_genidclaims.yaml b/crds/genid.be.kuid.dev_genidclaims.yaml index 1e4d348..46b8023 100644 --- a/crds/genid.be.kuid.dev_genidclaims.yaml +++ b/crds/genid.be.kuid.dev_genidclaims.yaml @@ -8,6 +8,8 @@ metadata: spec: group: genid.be.kuid.dev names: + categories: + - kuid kind: GENIDClaim listKind: GENIDClaimList plural: genidclaims @@ -185,7 +187,9 @@ spec: type: object type: object served: true - storage: false + storage: true + subresources: + status: {} - name: v1alpha1 schema: openAPIV3Schema: @@ -358,3 +362,5 @@ spec: type: object served: true storage: false + subresources: + status: {} diff --git a/crds/genid.be.kuid.dev_genidentries.yaml b/crds/genid.be.kuid.dev_genidentries.yaml index 99d520f..433a265 100644 --- a/crds/genid.be.kuid.dev_genidentries.yaml +++ b/crds/genid.be.kuid.dev_genidentries.yaml @@ -8,6 +8,8 @@ metadata: spec: group: genid.be.kuid.dev names: + categories: + - kuid kind: GENIDEntry listKind: GENIDEntryList plural: genidentries @@ -171,7 +173,9 @@ spec: type: object type: object served: true - storage: false + storage: true + subresources: + status: {} - name: v1alpha1 schema: openAPIV3Schema: @@ -330,3 +334,5 @@ spec: type: object served: true storage: false + subresources: + status: {} diff --git a/crds/genid.be.kuid.dev_genidindexes.yaml b/crds/genid.be.kuid.dev_genidindexes.yaml index 7614eb7..d29c874 100644 --- a/crds/genid.be.kuid.dev_genidindexes.yaml +++ b/crds/genid.be.kuid.dev_genidindexes.yaml @@ -8,6 +8,8 @@ metadata: spec: group: genid.be.kuid.dev names: + categories: + - kuid kind: GENIDIndex listKind: GENIDIndexList plural: genidindexes @@ -135,7 +137,9 @@ spec: type: object type: object served: true - storage: false + storage: true + subresources: + status: {} - name: v1alpha1 schema: openAPIV3Schema: @@ -258,3 +262,5 @@ spec: type: object served: true storage: false + subresources: + status: {} diff --git a/crds/infra.kuid.dev_endpoints.yaml b/crds/infra.kuid.dev_endpoints.yaml index f9ffa2b..0722ba5 100644 --- a/crds/infra.kuid.dev_endpoints.yaml +++ b/crds/infra.kuid.dev_endpoints.yaml @@ -8,6 +8,8 @@ metadata: spec: group: infra.kuid.dev names: + categories: + - kuid kind: Endpoint listKind: EndpointList plural: endpoints @@ -313,4 +315,6 @@ spec: type: object type: object served: true - storage: false + storage: true + subresources: + status: {} diff --git a/crds/infra.kuid.dev_endpointsets.yaml b/crds/infra.kuid.dev_endpointsets.yaml index c8b5de6..127de78 100644 --- a/crds/infra.kuid.dev_endpointsets.yaml +++ b/crds/infra.kuid.dev_endpointsets.yaml @@ -8,6 +8,8 @@ metadata: spec: group: infra.kuid.dev names: + categories: + - kuid kind: EndpointSet listKind: EndpointSetList plural: endpointsets @@ -359,4 +361,6 @@ spec: type: object type: object served: true - storage: false + storage: true + subresources: + status: {} diff --git a/crds/infra.kuid.dev_links.yaml b/crds/infra.kuid.dev_links.yaml index db5d10f..19b512c 100644 --- a/crds/infra.kuid.dev_links.yaml +++ b/crds/infra.kuid.dev_links.yaml @@ -8,6 +8,8 @@ metadata: spec: group: infra.kuid.dev names: + categories: + - kuid kind: Link listKind: LinkList plural: links @@ -317,4 +319,6 @@ spec: type: object type: object served: true - storage: false + storage: true + subresources: + status: {} diff --git a/crds/infra.kuid.dev_linksets.yaml b/crds/infra.kuid.dev_linksets.yaml index f991cb0..e120cd5 100644 --- a/crds/infra.kuid.dev_linksets.yaml +++ b/crds/infra.kuid.dev_linksets.yaml @@ -8,6 +8,8 @@ metadata: spec: group: infra.kuid.dev names: + categories: + - kuid kind: LinkSet listKind: LinkSetList plural: linksets @@ -343,4 +345,6 @@ spec: type: object type: object served: true - storage: false + storage: true + subresources: + status: {} diff --git a/crds/infra.kuid.dev_modulebays.yaml b/crds/infra.kuid.dev_modulebays.yaml index e7e96a5..c39426a 100644 --- a/crds/infra.kuid.dev_modulebays.yaml +++ b/crds/infra.kuid.dev_modulebays.yaml @@ -8,6 +8,8 @@ metadata: spec: group: infra.kuid.dev names: + categories: + - kuid kind: ModuleBay listKind: ModuleBayList plural: modulebays @@ -267,4 +269,6 @@ spec: type: object type: object served: true - storage: false + storage: true + subresources: + status: {} diff --git a/crds/infra.kuid.dev_modules.yaml b/crds/infra.kuid.dev_modules.yaml index 12ccbca..aac4e7c 100644 --- a/crds/infra.kuid.dev_modules.yaml +++ b/crds/infra.kuid.dev_modules.yaml @@ -8,6 +8,8 @@ metadata: spec: group: infra.kuid.dev names: + categories: + - kuid kind: Module listKind: ModuleList plural: modules @@ -265,4 +267,6 @@ spec: type: object type: object served: true - storage: false + storage: true + subresources: + status: {} diff --git a/crds/infra.kuid.dev_nodeitems.yaml b/crds/infra.kuid.dev_nodeitems.yaml index 8e6274d..136456c 100644 --- a/crds/infra.kuid.dev_nodeitems.yaml +++ b/crds/infra.kuid.dev_nodeitems.yaml @@ -8,6 +8,8 @@ metadata: spec: group: infra.kuid.dev names: + categories: + - kuid kind: NodeItem listKind: NodeItemList plural: nodeitems @@ -259,4 +261,6 @@ spec: type: object type: object served: true - storage: false + storage: true + subresources: + status: {} diff --git a/crds/infra.kuid.dev_nodes.yaml b/crds/infra.kuid.dev_nodes.yaml index b4f3f2e..773f27a 100644 --- a/crds/infra.kuid.dev_nodes.yaml +++ b/crds/infra.kuid.dev_nodes.yaml @@ -8,6 +8,8 @@ metadata: spec: group: infra.kuid.dev names: + categories: + - kuid kind: Node listKind: NodeList plural: nodes @@ -327,4 +329,6 @@ spec: type: object type: object served: true - storage: false + storage: true + subresources: + status: {} diff --git a/crds/infra.kuid.dev_nodesets.yaml b/crds/infra.kuid.dev_nodesets.yaml index 2338d6b..c65dfa8 100644 --- a/crds/infra.kuid.dev_nodesets.yaml +++ b/crds/infra.kuid.dev_nodesets.yaml @@ -8,6 +8,8 @@ metadata: spec: group: infra.kuid.dev names: + categories: + - kuid kind: NodeSet listKind: NodeSetList plural: nodesets @@ -357,4 +359,6 @@ spec: type: object type: object served: true - storage: false + storage: true + subresources: + status: {} diff --git a/crds/infra.kuid.dev_partitions.yaml b/crds/infra.kuid.dev_partitions.yaml index dc40ea9..fbaa7db 100644 --- a/crds/infra.kuid.dev_partitions.yaml +++ b/crds/infra.kuid.dev_partitions.yaml @@ -8,6 +8,8 @@ metadata: spec: group: infra.kuid.dev names: + categories: + - kuid kind: Partition listKind: PartitionList plural: partitions @@ -213,4 +215,6 @@ spec: type: object type: object served: true - storage: false + storage: true + subresources: + status: {} diff --git a/crds/infra.kuid.dev_racks.yaml b/crds/infra.kuid.dev_racks.yaml index 8b383c5..9597960 100644 --- a/crds/infra.kuid.dev_racks.yaml +++ b/crds/infra.kuid.dev_racks.yaml @@ -8,6 +8,8 @@ metadata: spec: group: infra.kuid.dev names: + categories: + - kuid kind: Rack listKind: RackList plural: racks @@ -277,4 +279,6 @@ spec: type: object type: object served: true - storage: false + storage: true + subresources: + status: {} diff --git a/crds/infra.kuid.dev_regions.yaml b/crds/infra.kuid.dev_regions.yaml index 0184747..e7fd6e5 100644 --- a/crds/infra.kuid.dev_regions.yaml +++ b/crds/infra.kuid.dev_regions.yaml @@ -8,6 +8,8 @@ metadata: spec: group: infra.kuid.dev names: + categories: + - kuid kind: Region listKind: RegionList plural: regions @@ -219,4 +221,6 @@ spec: type: object type: object served: true - storage: false + storage: true + subresources: + status: {} diff --git a/crds/infra.kuid.dev_sites.yaml b/crds/infra.kuid.dev_sites.yaml index a6210f0..1ce7efd 100644 --- a/crds/infra.kuid.dev_sites.yaml +++ b/crds/infra.kuid.dev_sites.yaml @@ -8,6 +8,8 @@ metadata: spec: group: infra.kuid.dev names: + categories: + - kuid kind: Site listKind: SiteList plural: sites @@ -265,4 +267,6 @@ spec: type: object type: object served: true - storage: false + storage: true + subresources: + status: {} diff --git a/crds/ipam.be.kuid.dev_ipclaims.yaml b/crds/ipam.be.kuid.dev_ipclaims.yaml index 53415e3..4c70792 100644 --- a/crds/ipam.be.kuid.dev_ipclaims.yaml +++ b/crds/ipam.be.kuid.dev_ipclaims.yaml @@ -8,6 +8,8 @@ metadata: spec: group: ipam.be.kuid.dev names: + categories: + - kuid kind: IPClaim listKind: IPClaimList plural: ipclaims @@ -230,7 +232,9 @@ spec: type: object type: object served: true - storage: false + storage: true + subresources: + status: {} - name: v1alpha1 schema: openAPIV3Schema: @@ -448,3 +452,5 @@ spec: type: object served: true storage: false + subresources: + status: {} diff --git a/crds/ipam.be.kuid.dev_ipentries.yaml b/crds/ipam.be.kuid.dev_ipentries.yaml index 4bd9315..e93ffd0 100644 --- a/crds/ipam.be.kuid.dev_ipentries.yaml +++ b/crds/ipam.be.kuid.dev_ipentries.yaml @@ -8,6 +8,8 @@ metadata: spec: group: ipam.be.kuid.dev names: + categories: + - kuid kind: IPEntry listKind: IPEntryList plural: ipentries @@ -159,7 +161,9 @@ spec: type: object type: object served: true - storage: false + storage: true + subresources: + status: {} - name: v1alpha1 schema: openAPIV3Schema: @@ -306,3 +310,5 @@ spec: type: object served: true storage: false + subresources: + status: {} diff --git a/crds/ipam.be.kuid.dev_ipindices.yaml b/crds/ipam.be.kuid.dev_ipindices.yaml index cb3cc7c..65fb6a7 100644 --- a/crds/ipam.be.kuid.dev_ipindices.yaml +++ b/crds/ipam.be.kuid.dev_ipindices.yaml @@ -8,6 +8,8 @@ metadata: spec: group: ipam.be.kuid.dev names: + categories: + - kuid kind: IPIndex listKind: IPIndexList plural: ipindices @@ -172,7 +174,9 @@ spec: type: object type: object served: true - storage: false + storage: true + subresources: + status: {} - name: v1alpha1 schema: openAPIV3Schema: @@ -332,3 +336,5 @@ spec: type: object served: true storage: false + subresources: + status: {} diff --git a/crds/vlan.be.kuid.dev_vlanclaims.yaml b/crds/vlan.be.kuid.dev_vlanclaims.yaml index 8062df0..41d3180 100644 --- a/crds/vlan.be.kuid.dev_vlanclaims.yaml +++ b/crds/vlan.be.kuid.dev_vlanclaims.yaml @@ -8,6 +8,8 @@ metadata: spec: group: vlan.be.kuid.dev names: + categories: + - kuid kind: VLANClaim listKind: VLANClaimList plural: vlanclaims @@ -186,6 +188,8 @@ spec: type: object served: true storage: false + subresources: + status: {} - name: vlan schema: openAPIV3Schema: @@ -357,4 +361,6 @@ spec: type: object type: object served: true - storage: false + storage: true + subresources: + status: {} diff --git a/crds/vlan.be.kuid.dev_vlanentries.yaml b/crds/vlan.be.kuid.dev_vlanentries.yaml index 819cbca..d64e0d5 100644 --- a/crds/vlan.be.kuid.dev_vlanentries.yaml +++ b/crds/vlan.be.kuid.dev_vlanentries.yaml @@ -8,6 +8,8 @@ metadata: spec: group: vlan.be.kuid.dev names: + categories: + - kuid kind: VLANEntry listKind: VLANEntryList plural: vlanentries @@ -172,6 +174,8 @@ spec: type: object served: true storage: false + subresources: + status: {} - name: vlan schema: openAPIV3Schema: @@ -329,4 +333,6 @@ spec: type: object type: object served: true - storage: false + storage: true + subresources: + status: {} diff --git a/crds/vlan.be.kuid.dev_vlanindices.yaml b/crds/vlan.be.kuid.dev_vlanindices.yaml index 29083af..9d99672 100644 --- a/crds/vlan.be.kuid.dev_vlanindices.yaml +++ b/crds/vlan.be.kuid.dev_vlanindices.yaml @@ -8,6 +8,8 @@ metadata: spec: group: vlan.be.kuid.dev names: + categories: + - kuid kind: VLANIndex listKind: VLANIndexList plural: vlanindices @@ -131,6 +133,8 @@ spec: type: object served: true storage: false + subresources: + status: {} - name: vlan schema: openAPIV3Schema: @@ -247,4 +251,6 @@ spec: type: object type: object served: true - storage: false + storage: true + subresources: + status: {} From 8b447c1e4f78dbee76002e19a7bff9e392648379 Mon Sep 17 00:00:00 2001 From: Wim Henderickx Date: Tue, 29 Oct 2024 20:44:33 +0100 Subject: [PATCH 19/23] aligned with choreo --- apis/backend/as/invoker_claim.go | 33 ++- apis/backend/as/invoker_index.go | 33 ++- apis/backend/extcomm/invoker_claim.go | 34 ++- apis/backend/extcomm/invoker_index.go | 33 ++- apis/backend/genid/invoker_claim.go | 33 ++- apis/backend/genid/invoker_index.go | 33 ++- apis/backend/ipam/invoker_claim.go | 33 ++- apis/backend/ipam/invoker_index.go | 33 ++- apis/backend/ipam/ipindex_object.go | 2 +- apis/backend/vlan/invoker_claim.go | 33 ++- apis/backend/vlan/invoker_index.go | 33 ++- go.mod | 2 +- go.sum | 2 + pkg/backend/invoker.go | 42 ++-- pkg/backend/ipam/applicator_static_prefix.go | 2 +- pkg/backend/ipam/backend.go | 22 +- pkg/backend/ipam/backend_store.go | 207 ++----------------- pkg/registry/generic/strategy_resource.go | 14 +- pkg/registry/generic/strategy_status.go | 4 +- pkg/registry/options/options.go | 6 +- 20 files changed, 221 insertions(+), 413 deletions(-) diff --git a/apis/backend/as/invoker_claim.go b/apis/backend/as/invoker_claim.go index 5468e05..1483944 100644 --- a/apis/backend/as/invoker_claim.go +++ b/apis/backend/as/invoker_claim.go @@ -62,50 +62,47 @@ func claimConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error) return &unstructured.Unstructured{Object: uobj}, nil } -func (r *claiminvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error { +func (r *claiminvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { claim, err := claimConvertToInternal(obj) if err != nil { - return err + return obj, err } if err := r.be.Claim(ctx, claim, recursion); err != nil { - return err + return obj, err } newClaim, err := claimConvertFromInternal(claim) if err != nil { - return err + return obj, err } - obj = newClaim - return nil + return newClaim, nil } -func (r *claiminvoker) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error { +func (r *claiminvoker) InvokeUpdate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { claim, err := claimConvertToInternal(obj) if err != nil { - return err + return obj, err } if err := r.be.Claim(ctx, claim, recursion); err != nil { - return err + return obj, err } newClaim, err := claimConvertFromInternal(claim) if err != nil { - return err + return obj, err } - obj = newClaim - return nil + return newClaim, nil } -func (r *claiminvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error { +func (r *claiminvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { claim, err := claimConvertToInternal(obj) if err != nil { - return err + return obj, err } if err := r.be.Release(ctx, claim, recursion); err != nil { - return err + return obj,err } newClaim, err := claimConvertFromInternal(claim) if err != nil { - return err + return obj, err } - obj = newClaim - return nil + return newClaim, nil } diff --git a/apis/backend/as/invoker_index.go b/apis/backend/as/invoker_index.go index 9b7e3a0..5839516 100644 --- a/apis/backend/as/invoker_index.go +++ b/apis/backend/as/invoker_index.go @@ -63,50 +63,47 @@ func indexConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error) return &unstructured.Unstructured{Object: uobj}, nil } -func (r *idxinvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error { +func (r *idxinvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { index, err := indexConvertToInternal(obj) if err != nil { - return err + return obj, err } if err := r.be.CreateIndex(ctx, index); err != nil { - return err + return obj, err } newIndex, err := indexConvertFromInternal(index) if err != nil { - return err + return obj, err } - obj = newIndex - return nil + return newIndex, nil } -func (r *idxinvoker) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error { +func (r *idxinvoker) InvokeUpdate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { index, err := indexConvertToInternal(obj) if err != nil { - return err + return obj, err } if err := r.be.CreateIndex(ctx, index); err != nil { - return err + return obj, err } newIndex, err := indexConvertFromInternal(index) if err != nil { - return err + return obj, err } - obj = newIndex - return nil + return newIndex, nil } -func (r *idxinvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error { +func (r *idxinvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { index, err := indexConvertToInternal(obj) if err != nil { - return err + return obj, err } if err := r.be.DeleteIndex(ctx, index); err != nil { - return err + return obj, err } newIndex, err := indexConvertFromInternal(index) if err != nil { - return err + return obj, err } - obj = newIndex - return nil + return newIndex, nil } diff --git a/apis/backend/extcomm/invoker_claim.go b/apis/backend/extcomm/invoker_claim.go index 2e76a75..c96bae7 100644 --- a/apis/backend/extcomm/invoker_claim.go +++ b/apis/backend/extcomm/invoker_claim.go @@ -62,50 +62,48 @@ func claimConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error) return &unstructured.Unstructured{Object: uobj}, nil } -func (r *claiminvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error { +func (r *claiminvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { claim, err := claimConvertToInternal(obj) if err != nil { - return err + return obj, err } if err := r.be.Claim(ctx, claim, recursion); err != nil { - return err + return obj, err } newClaim, err := claimConvertFromInternal(claim) if err != nil { - return err + return obj, err } - obj = newClaim - return nil + return newClaim, nil } -func (r *claiminvoker) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error { +func (r *claiminvoker) InvokeUpdate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { claim, err := claimConvertToInternal(obj) if err != nil { - return err + return obj, err } if err := r.be.Claim(ctx, claim, recursion); err != nil { - return err + return obj, err } newClaim, err := claimConvertFromInternal(claim) if err != nil { - return err + return obj, err } - obj = newClaim - return nil + return newClaim, nil } -func (r *claiminvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error { +func (r *claiminvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { claim, err := claimConvertToInternal(obj) if err != nil { - return err + return obj, err } if err := r.be.Release(ctx, claim, recursion); err != nil { - return err + return obj,err } newClaim, err := claimConvertFromInternal(claim) if err != nil { - return err + return obj, err } - obj = newClaim - return nil + return newClaim, nil } + diff --git a/apis/backend/extcomm/invoker_index.go b/apis/backend/extcomm/invoker_index.go index f097aa5..a3816eb 100644 --- a/apis/backend/extcomm/invoker_index.go +++ b/apis/backend/extcomm/invoker_index.go @@ -63,50 +63,47 @@ func indexConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error) return &unstructured.Unstructured{Object: uobj}, nil } -func (r *idxinvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error { +func (r *idxinvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { index, err := indexConvertToInternal(obj) if err != nil { - return err + return obj, err } if err := r.be.CreateIndex(ctx, index); err != nil { - return err + return obj, err } newIndex, err := indexConvertFromInternal(index) if err != nil { - return err + return obj, err } - obj = newIndex - return nil + return newIndex, nil } -func (r *idxinvoker) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error { +func (r *idxinvoker) InvokeUpdate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { index, err := indexConvertToInternal(obj) if err != nil { - return err + return obj, err } if err := r.be.CreateIndex(ctx, index); err != nil { - return err + return obj, err } newIndex, err := indexConvertFromInternal(index) if err != nil { - return err + return obj, err } - obj = newIndex - return nil + return newIndex, nil } -func (r *idxinvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error { +func (r *idxinvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { index, err := indexConvertToInternal(obj) if err != nil { - return err + return obj, err } if err := r.be.DeleteIndex(ctx, index); err != nil { - return err + return obj, err } newIndex, err := indexConvertFromInternal(index) if err != nil { - return err + return obj, err } - obj = newIndex - return nil + return newIndex, nil } diff --git a/apis/backend/genid/invoker_claim.go b/apis/backend/genid/invoker_claim.go index acfb9aa..c225399 100644 --- a/apis/backend/genid/invoker_claim.go +++ b/apis/backend/genid/invoker_claim.go @@ -62,50 +62,47 @@ func claimConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error) return &unstructured.Unstructured{Object: uobj}, nil } -func (r *claiminvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error { +func (r *claiminvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { claim, err := claimConvertToInternal(obj) if err != nil { - return err + return obj, err } if err := r.be.Claim(ctx, claim, recursion); err != nil { - return err + return obj, err } newClaim, err := claimConvertFromInternal(claim) if err != nil { - return err + return obj, err } - obj = newClaim - return nil + return newClaim, nil } -func (r *claiminvoker) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error { +func (r *claiminvoker) InvokeUpdate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { claim, err := claimConvertToInternal(obj) if err != nil { - return err + return obj, err } if err := r.be.Claim(ctx, claim, recursion); err != nil { - return err + return obj, err } newClaim, err := claimConvertFromInternal(claim) if err != nil { - return err + return obj, err } - obj = newClaim - return nil + return newClaim, nil } -func (r *claiminvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error { +func (r *claiminvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { claim, err := claimConvertToInternal(obj) if err != nil { - return err + return obj, err } if err := r.be.Release(ctx, claim, recursion); err != nil { - return err + return obj,err } newClaim, err := claimConvertFromInternal(claim) if err != nil { - return err + return obj, err } - obj = newClaim - return nil + return newClaim, nil } diff --git a/apis/backend/genid/invoker_index.go b/apis/backend/genid/invoker_index.go index 5b1548b..23f00e7 100644 --- a/apis/backend/genid/invoker_index.go +++ b/apis/backend/genid/invoker_index.go @@ -63,50 +63,47 @@ func indexConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error) return &unstructured.Unstructured{Object: uobj}, nil } -func (r *idxinvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error { +func (r *idxinvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { index, err := indexConvertToInternal(obj) if err != nil { - return err + return obj, err } if err := r.be.CreateIndex(ctx, index); err != nil { - return err + return obj, err } newIndex, err := indexConvertFromInternal(index) if err != nil { - return err + return obj, err } - obj = newIndex - return nil + return newIndex, nil } -func (r *idxinvoker) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error { +func (r *idxinvoker) InvokeUpdate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { index, err := indexConvertToInternal(obj) if err != nil { - return err + return obj, err } if err := r.be.CreateIndex(ctx, index); err != nil { - return err + return obj, err } newIndex, err := indexConvertFromInternal(index) if err != nil { - return err + return obj, err } - obj = newIndex - return nil + return newIndex, nil } -func (r *idxinvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error { +func (r *idxinvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { index, err := indexConvertToInternal(obj) if err != nil { - return err + return obj, err } if err := r.be.DeleteIndex(ctx, index); err != nil { - return err + return obj, err } newIndex, err := indexConvertFromInternal(index) if err != nil { - return err + return obj, err } - obj = newIndex - return nil + return newIndex, nil } diff --git a/apis/backend/ipam/invoker_claim.go b/apis/backend/ipam/invoker_claim.go index c8773c0..0c636b1 100644 --- a/apis/backend/ipam/invoker_claim.go +++ b/apis/backend/ipam/invoker_claim.go @@ -62,50 +62,47 @@ func claimConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error) return &unstructured.Unstructured{Object: uobj}, nil } -func (r *claiminvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error { +func (r *claiminvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { claim, err := claimConvertToInternal(obj) if err != nil { - return err + return obj, err } if err := r.be.Claim(ctx, claim, recursion); err != nil { - return err + return obj, err } newClaim, err := claimConvertFromInternal(claim) if err != nil { - return err + return obj, err } - obj = newClaim - return nil + return newClaim, nil } -func (r *claiminvoker) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error { +func (r *claiminvoker) InvokeUpdate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { claim, err := claimConvertToInternal(obj) if err != nil { - return err + return obj, err } if err := r.be.Claim(ctx, claim, recursion); err != nil { - return err + return obj, err } newClaim, err := claimConvertFromInternal(claim) if err != nil { - return err + return obj, err } - obj = newClaim - return nil + return newClaim, nil } -func (r *claiminvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error { +func (r *claiminvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { claim, err := claimConvertToInternal(obj) if err != nil { - return err + return obj, err } if err := r.be.Release(ctx, claim, recursion); err != nil { - return err + return obj,err } newClaim, err := claimConvertFromInternal(claim) if err != nil { - return err + return obj, err } - obj = newClaim - return nil + return newClaim, nil } diff --git a/apis/backend/ipam/invoker_index.go b/apis/backend/ipam/invoker_index.go index 8a1d966..c0ccd57 100644 --- a/apis/backend/ipam/invoker_index.go +++ b/apis/backend/ipam/invoker_index.go @@ -63,50 +63,47 @@ func indexConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error) return &unstructured.Unstructured{Object: uobj}, nil } -func (r *idxinvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error { +func (r *idxinvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { index, err := indexConvertToInternal(obj) if err != nil { - return err + return obj, err } if err := r.be.CreateIndex(ctx, index); err != nil { - return err + return obj, err } newIndex, err := indexConvertFromInternal(index) if err != nil { - return err + return obj, err } - obj = newIndex - return nil + return newIndex, nil } -func (r *idxinvoker) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error { +func (r *idxinvoker) InvokeUpdate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { index, err := indexConvertToInternal(obj) if err != nil { - return err + return obj, err } if err := r.be.CreateIndex(ctx, index); err != nil { - return err + return obj, err } newIndex, err := indexConvertFromInternal(index) if err != nil { - return err + return obj, err } - obj = newIndex - return nil + return newIndex, nil } -func (r *idxinvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error { +func (r *idxinvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { index, err := indexConvertToInternal(obj) if err != nil { - return err + return obj, err } if err := r.be.DeleteIndex(ctx, index); err != nil { - return err + return obj, err } newIndex, err := indexConvertFromInternal(index) if err != nil { - return err + return obj, err } - obj = newIndex - return nil + return newIndex, nil } diff --git a/apis/backend/ipam/ipindex_object.go b/apis/backend/ipam/ipindex_object.go index 0685c97..a64c6b4 100644 --- a/apis/backend/ipam/ipindex_object.go +++ b/apis/backend/ipam/ipindex_object.go @@ -95,7 +95,7 @@ func (r *IPIndex) GetClaim(prefix Prefix) (*IPClaim, error) { Name: fmt.Sprintf("%s.%s", r.Name, pi.GetSubnetName()), OwnerReferences: []metav1.OwnerReference{ { - APIVersion: schema.GroupVersion{Group: SchemeGroupVersion.Group, Version: "v1alpah1"}.Identifier(), + APIVersion: schema.GroupVersion{Group: SchemeGroupVersion.Group, Version: "v1alpha1"}.Identifier(), Kind: IPIndexKind, Name: r.Name, UID: r.UID, diff --git a/apis/backend/vlan/invoker_claim.go b/apis/backend/vlan/invoker_claim.go index 3320520..8bfd865 100644 --- a/apis/backend/vlan/invoker_claim.go +++ b/apis/backend/vlan/invoker_claim.go @@ -62,50 +62,47 @@ func claimConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error) return &unstructured.Unstructured{Object: uobj}, nil } -func (r *claiminvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error { +func (r *claiminvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { claim, err := claimConvertToInternal(obj) if err != nil { - return err + return obj, err } if err := r.be.Claim(ctx, claim, recursion); err != nil { - return err + return obj, err } newClaim, err := claimConvertFromInternal(claim) if err != nil { - return err + return obj, err } - obj = newClaim - return nil + return newClaim, nil } -func (r *claiminvoker) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error { +func (r *claiminvoker) InvokeUpdate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { claim, err := claimConvertToInternal(obj) if err != nil { - return err + return obj, err } if err := r.be.Claim(ctx, claim, recursion); err != nil { - return err + return obj, err } newClaim, err := claimConvertFromInternal(claim) if err != nil { - return err + return obj, err } - obj = newClaim - return nil + return newClaim, nil } -func (r *claiminvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error { +func (r *claiminvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { claim, err := claimConvertToInternal(obj) if err != nil { - return err + return obj, err } if err := r.be.Release(ctx, claim, recursion); err != nil { - return err + return obj,err } newClaim, err := claimConvertFromInternal(claim) if err != nil { - return err + return obj, err } - obj = newClaim - return nil + return newClaim, nil } diff --git a/apis/backend/vlan/invoker_index.go b/apis/backend/vlan/invoker_index.go index e734398..2b616ff 100644 --- a/apis/backend/vlan/invoker_index.go +++ b/apis/backend/vlan/invoker_index.go @@ -63,50 +63,47 @@ func indexConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error) return &unstructured.Unstructured{Object: uobj}, nil } -func (r *idxinvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error { +func (r *idxinvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { index, err := indexConvertToInternal(obj) if err != nil { - return err + return obj, err } if err := r.be.CreateIndex(ctx, index); err != nil { - return err + return obj, err } newIndex, err := indexConvertFromInternal(index) if err != nil { - return err + return obj, err } - obj = newIndex - return nil + return newIndex, nil } -func (r *idxinvoker) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error { +func (r *idxinvoker) InvokeUpdate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { index, err := indexConvertToInternal(obj) if err != nil { - return err + return obj, err } if err := r.be.CreateIndex(ctx, index); err != nil { - return err + return obj, err } newIndex, err := indexConvertFromInternal(index) if err != nil { - return err + return obj, err } - obj = newIndex - return nil + return newIndex, nil } -func (r *idxinvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error { +func (r *idxinvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { index, err := indexConvertToInternal(obj) if err != nil { - return err + return obj, err } if err := r.be.DeleteIndex(ctx, index); err != nil { - return err + return obj, err } newIndex, err := indexConvertFromInternal(index) if err != nil { - return err + return obj, err } - obj = newIndex - return nil + return newIndex, nil } diff --git a/go.mod b/go.mod index ba96335..cd5693b 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/google/uuid v1.6.0 github.com/hansthienpondt/nipam v0.0.5 github.com/henderiw/apiserver-builder v0.0.4-0.20241027084658-10d7f9d97252 - github.com/henderiw/apiserver-store v0.0.3-0.20241027163114-c382e2d133b7 + github.com/henderiw/apiserver-store v0.0.3-0.20241029192510-f861391edccf github.com/henderiw/idxtable v0.0.0-20241021085446-f8d804551342 github.com/henderiw/iputil v0.0.0-20231218081610-37f78ad9c81c github.com/henderiw/logger v0.0.0-20230911123436-8655829b1abe diff --git a/go.sum b/go.sum index 1da2ff5..f510dac 100644 --- a/go.sum +++ b/go.sum @@ -149,6 +149,8 @@ github.com/henderiw/apiserver-builder v0.0.4-0.20241027084658-10d7f9d97252 h1:+I github.com/henderiw/apiserver-builder v0.0.4-0.20241027084658-10d7f9d97252/go.mod h1:LfJu1JURnxHwnFa8CVb2XPw50TwdU1xQvuUNxpaSOlE= github.com/henderiw/apiserver-store v0.0.3-0.20241027163114-c382e2d133b7 h1:gqpv6oJ0XN9H8/pXq2B7sXFdXH+YmjE05ivs/ffNAq0= github.com/henderiw/apiserver-store v0.0.3-0.20241027163114-c382e2d133b7/go.mod h1:VVkUptd3MTyREmpo+C/t6l+mJAwo3A1UWvHi0QSH0yE= +github.com/henderiw/apiserver-store v0.0.3-0.20241029192510-f861391edccf h1:3YeQVhqoeBdfj/WaHpxrgjM70V/4lEnqYAg3x+AmOEs= +github.com/henderiw/apiserver-store v0.0.3-0.20241029192510-f861391edccf/go.mod h1:VVkUptd3MTyREmpo+C/t6l+mJAwo3A1UWvHi0QSH0yE= github.com/henderiw/idxtable v0.0.0-20241021085446-f8d804551342 h1:gkdOvjxM6rNTkcyoykZLjAfPjn06/MEY4o8cy+3uj2g= github.com/henderiw/idxtable v0.0.0-20241021085446-f8d804551342/go.mod h1:EPdUFZyKA2IORzohdu67+xBbfDmkHEDUaMN0BBsk8eY= github.com/henderiw/iputil v0.0.0-20231218081610-37f78ad9c81c h1:nFnCNyRV1Ej/zqV/gn8UnFESkoPUXhwpUCZyhSYGSYA= diff --git a/pkg/backend/invoker.go b/pkg/backend/invoker.go index cb76c46..dbc304e 100644 --- a/pkg/backend/invoker.go +++ b/pkg/backend/invoker.go @@ -33,16 +33,25 @@ type claimInvoker struct { be Backend } -func (r *claimInvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error { - return r.be.Claim(ctx, obj, recursion) +func (r *claimInvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { + if err := r.be.Claim(ctx, obj, recursion); err != nil { + return obj, err + } + return obj, nil } -func (r *claimInvoker) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error { - return r.be.Claim(ctx, obj, recursion) +func (r *claimInvoker) InvokeUpdate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { + if err := r.be.Claim(ctx, obj, recursion); err != nil { + return obj, err + } + return obj, nil } -func (r *claimInvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error { - return r.be.Release(ctx, obj, recursion) +func (r *claimInvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { + if err := r.be.Release(ctx, obj, recursion); err != nil { + return obj, err + } + return obj, nil } func NewIndexInvoker(be Backend) options.BackendInvoker { @@ -55,14 +64,23 @@ type indexPreparator struct { be Backend } -func (r *indexPreparator) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error { - return r.be.CreateIndex(ctx, obj) +func (r *indexPreparator) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { + if err := r.be.CreateIndex(ctx, obj); err != nil { + return obj, err + } + return obj, nil } -func (r *indexPreparator) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error { - return r.be.CreateIndex(ctx, obj) +func (r *indexPreparator) InvokeUpdate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { + if err := r.be.CreateIndex(ctx, obj); err != nil { + return obj, err + } + return obj, nil } -func (r *indexPreparator) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error { - return r.be.DeleteIndex(ctx, obj) +func (r *indexPreparator) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { + if err := r.be.DeleteIndex(ctx, obj); err != nil { + return obj, err + } + return obj, nil } diff --git a/pkg/backend/ipam/applicator_static_prefix.go b/pkg/backend/ipam/applicator_static_prefix.go index 9d6785a..b07692f 100644 --- a/pkg/backend/ipam/applicator_static_prefix.go +++ b/pkg/backend/ipam/applicator_static_prefix.go @@ -188,6 +188,6 @@ func (r *staticPrefixApplicator) Apply(ctx context.Context, claim *ipam.IPClaim) func (r *staticPrefixApplicator) Delete(ctx context.Context, claim *ipam.IPClaim) error { log := log.FromContext(ctx) - log.Info("delete") + log.Debug("delete") return r.delete(ctx, claim) } diff --git a/pkg/backend/ipam/backend.go b/pkg/backend/ipam/backend.go index f66c463..59d4a94 100644 --- a/pkg/backend/ipam/backend.go +++ b/pkg/backend/ipam/backend.go @@ -61,18 +61,6 @@ func (r *be) AddStorageInterfaces(bes any) error { return fmt.Errorf("AddStorageInterfaces did not supply a ipam BackendStorage interface, got: %s", reflect.TypeOf(bes).Name()) } r.bestorage = bestorage - /* - entrystore, ok := entryStorage.(*registry.Store) - if !ok { - return errors.New("entry store is not a *registry.Store") - } - r.entryStorage = entrystore - claimstore, ok := claimStorage.(*registry.Store) - if !ok { - return errors.New("claim store is not a *registry.Store") - } - r.claimStorage = claimstore - */ return nil } @@ -89,7 +77,7 @@ func (r *be) CreateIndex(ctx context.Context, obj runtime.Object) error { log := log.FromContext(ctx) key := index.GetKey() - log.Debug("start", "isInitialized", r.cache.IsInitialized(ctx, key)) + log.Info("create index", "isInitialized", r.cache.IsInitialized(ctx, key)) // if the Cache is not initialized -> restore the cache // this happens upon initialization or backend restart if _, err := r.cache.Get(ctx, key); err != nil { @@ -111,7 +99,7 @@ func (r *be) CreateIndex(ctx context.Context, obj runtime.Object) error { return err } } - log.Debug("update IPIndex clains") + log.Info("update IPIndex claims", "object", obj) return r.updateIPIndexClaims(ctx, index) } @@ -126,7 +114,7 @@ func (r *be) DeleteIndex(ctx context.Context, obj runtime.Object) error { ctx = bebackend.InitIndexContext(ctx, "delete", index) log := log.FromContext(ctx) - log.Debug("start") + log.Info("start") key := index.GetKey() log.Debug("start", "isInitialized", r.cache.IsInitialized(ctx, key)) @@ -135,10 +123,10 @@ func (r *be) DeleteIndex(ctx context.Context, obj runtime.Object) error { log.Error("cannot delete Index", "error", err.Error()) return err } - log.Debug("destroyed") + log.Info("destroyed") r.cache.Delete(ctx, key) - log.Debug("finished") + log.Info("finished") return nil } diff --git a/pkg/backend/ipam/backend_store.go b/pkg/backend/ipam/backend_store.go index 44c992e..18cab55 100644 --- a/pkg/backend/ipam/backend_store.go +++ b/pkg/backend/ipam/backend_store.go @@ -115,17 +115,17 @@ func (r *be) saveAll(ctx context.Context, k store.Key) error { sort.Strings(curs) for _, newEntry := range newEntries { - log.Debug("SaveAll", "newIPEntry", newEntry.GetNamespacedName()) - newEntry := newEntry + log.Debug("SaveAll", "newIPEntry", newEntry.GetNamespacedName(), "apiVersion", newEntry.APIVersion) found := false var oldEntry *ipam.IPEntry for idx, curEntry := range curEntries { - log.Debug("SaveAll", "curEntry", *curEntry) + log.Debug("SaveAll", "curEntry", curEntry.GetNamespacedName(), "apiVersion", newEntry.APIVersion) idx := idx curEntry := curEntry - if curEntry.GetNamespace() == newEntry.GetNamespace() && - curEntry.GetName() == newEntry.GetName() { + if curEntry.GetNamespacedName() == newEntry.GetNamespacedName() { + log.Debug("SaveAll delete entry from curEntries", "curEntry", curEntry.GetNamespacedName()) curEntries = append(curEntries[:idx], curEntries[idx+1:]...) + log.Debug("SaveAll delete entry from curEntries", "curEntry", curEntry.GetNamespacedName(), "length", len(curEntries)) found = true oldEntry = curEntry break @@ -138,43 +138,20 @@ func (r *be) saveAll(ctx context.Context, k store.Key) error { log.Error("saveAll create failed", "name", newEntry.GetName(), "error", err.Error()) return err } - - /* - if _, err := r.entryStorage.Create(ctx, newEntry, nil, &metav1.CreateOptions{ - FieldManager: "backend", - }); err != nil { - - } - */ continue } if err := r.bestorage.UpdateEntry(ctx, newEntry, oldEntry); err != nil { log.Error("saveAll update failed", "name", newEntry.GetName(), "error", err.Error()) return err } - - /* - defaultObjInfo := rest.DefaultUpdatedObjectInfo(oldEntry, EntryTransformer) - if _, _, err := r.entryStorage.Update(ctx, oldEntry.GetName(), defaultObjInfo, nil, nil, false, &metav1.UpdateOptions{ - FieldManager: "backend", - }); err != nil { - fmt.Println("update err", err) - return err - } - */ - } - for _, curEntry := range curEntries { - if err := r.bestorage.DeleteEntry(ctx, curEntry); err != nil { - log.Error("saveAll update failed", "name", curEntry.GetName(), "error", err.Error()) - return err - } - /* - ctx = genericapirequest.WithNamespace(ctx, curEntry.GetNamespace()) - if _, _, err := r.entryStorage.Delete(ctx, curEntry.GetName(), nil, &metav1.DeleteOptions{}); err != nil { - return err - } - */ } + //for _, curEntry := range curEntries { + // log.Info("saveAll delete entry", "entry", curEntry.GetNamespacedName()) + // if err := r.bestorage.DeleteEntry(ctx, curEntry); err != nil { + // log.Error("saveAll update failed", "name", curEntry.GetName(), "error", err.Error()) + // return err + // } + //} return nil } @@ -226,14 +203,6 @@ func (r *be) deleteEntries(ctx context.Context, k store.Key) error { log.Error("delete entry failed", "name", curEntry.GetName(), "error", err.Error()) return err } - /* - ctx = genericapirequest.WithNamespace(ctx, entry.GetNamespace()) - if _, _, err := r.entryStorage.Delete(ctx, entry.GetName(), nil, &metav1.DeleteOptions{}); err != nil { - log.Error("cannot delete entry", "error", err) - errm = errors.Join(errm, err) - continue - } - */ } return errm } @@ -257,96 +226,16 @@ func (r *be) deleteClaims(ctx context.Context, k store.Key) error { errm = errors.Join(errm, err) continue } - - /* - ctx = genericapirequest.WithNamespace(ctx, claim.GetNamespace()) - if _, _, err := r.claimStorage.Delete(ctx, claim.GetName(), nil, &metav1.DeleteOptions{ - DryRun: []string{"recursion"}, - }); err != nil { - log.Error("cannot delete claim", "error", err) - errm = errors.Join(errm, err) - continue - } - */ } return errm } func (r *be) listEntries(ctx context.Context, k store.Key) ([]*ipam.IPEntry, error) { - //log := log.FromContext(ctx).With("key", k.String()) return r.bestorage.ListEntries(ctx, k) - - // selector, err := selector.ExprSelectorAsSelector( - // &selectorv1alpha1.ExpressionSelector{ - // Match: map[string]string{ - // "spec.index": k.Name, - // }, - // }, - // ) - // if err != nil { - // return nil, err - // } - /* - log.Debug("list entries from storage") - list, err := r.entryStorage.List(ctx, &internalversion.ListOptions{}) - if err != nil { - return nil, err - } - items, err := meta.ExtractList(list) - if err != nil { - return nil, err - } - entryList := make([]*ipam.IPEntry, 0) - var errm error - for _, obj := range items { - entryObj, ok := obj.(*ipam.IPEntry) - if !ok { - log.Error("obj is not an IPEntry", "obj", reflect.TypeOf(obj).Name()) - errm = errors.Join(errm, err) - continue - } - if entryObj.GetIndex() == k.Name { - entryList = append(entryList, entryObj) - } - } - return entryList, nil - */ } func (r *be) listClaims(ctx context.Context, k store.Key) (map[string]*ipam.IPClaim, error) { - //log := log.FromContext(ctx).With("key", k.String()) return r.bestorage.ListClaims(ctx, k) - // selector, err := selector.ExprSelectorAsSelector( - // &selectorv1alpha1.ExpressionSelector{ - // Match: match, - // }, - // ) - // if err != nil { - // return nil, err - // } - /* - log.Debug("list claims from storage") - list, err := r.claimStorage.List(ctx, &internalversion.ListOptions{}) - if err != nil { - return nil, err - } - items, err := meta.ExtractList(list) - if err != nil { - return nil, err - } - claimMap := map[string]*ipam.IPClaim{} - var errm error - for _, obj := range items { - claimObj, ok := obj.(*ipam.IPClaim) - if !ok { - log.Error("obj is not an IPClaim", "obj", reflect.TypeOf(obj).Name()) - errm = errors.Join(errm, err) - continue - } - claimMap[claimObj.GetNamespacedName().String()] = claimObj - } - return claimMap, errm - */ } func (r *be) restoreClaims(ctx context.Context, cacheInstanceCtx *CacheInstanceContext, entries []*ipam.IPEntry, kind string, claimType ipam.IPClaimType, ipclaimmap map[string]*ipam.IPClaim) error { @@ -426,59 +315,28 @@ func (r *be) updateIPIndexClaims(ctx context.Context, index *ipam.IPIndex) error errm = errors.Join(errm, err) continue } - /* - if _, err := r.claimStorage.Create(ctx, newClaim, nil, &metav1.CreateOptions{ - FieldManager: "backend", - DryRun: []string{"recursion"}, - }); err != nil { - log.Error("updateIPIndexClaims create failed", "name", newClaim.GetName(), "error", err.Error()) - errm = errors.Join(errm, err) - continue - } - */ continue - } if err := r.bestorage.UpdateClaim(ctx, newClaim, oldClaim); err != nil { log.Error("updateIPIndexClaims create failed", "name", newClaim.GetName(), "error", err.Error()) errm = errors.Join(errm, err) continue } - - /* - defaultObjInfo := rest.DefaultUpdatedObjectInfo(oldClaim, ClaimTransformer) - if _, _, err := r.claimStorage.Update(ctx, oldClaim.GetName(), defaultObjInfo, nil, nil, false, &metav1.UpdateOptions{ - FieldManager: "backend", - DryRun: []string{"recursion"}, - }); err != nil { - log.Error("updateIPIndexClaims update failed", "name", newClaim.GetName(), "error", err.Error()) - errm = errors.Join(errm, err) - continue - } - */ delete(existingClaims, newClaim.GetNamespacedName().String()) } - for _, claim := range existingClaims { - if err := r.bestorage.DeleteClaim(ctx, claim); err != nil { - log.Error("updateIPIndexClaims delete failed", "name", claim.GetName(), "error", err.Error()) - errm = errors.Join(errm, err) - continue - } - - /* - ctx = genericapirequest.WithNamespace(ctx, claim.GetNamespace()) - if _, _, err := r.entryStorage.Delete(ctx, claim.GetName(), nil, &metav1.DeleteOptions{}); err != nil { + /* + for _, claim := range existingClaims { + log.Info("updateIPIndexClaims: delete existing claims", "claim", claim.GetName()) + if err := r.bestorage.DeleteClaim(ctx, claim); err != nil { log.Error("updateIPIndexClaims delete failed", "name", claim.GetName(), "error", err.Error()) errm = errors.Join(errm, err) continue } - */ - } - + } + */ if errm != nil { return errm } - return r.saveAll(ctx, key) } @@ -520,33 +378,4 @@ func (r *be) listIndexClaims(ctx context.Context, k store.Key) (map[string]*ipam return r.bestorage.ListClaims(ctx, k, &ListOptions{ OwnerKind: ipam.IPIndexKind, }) - /* - log := log.FromContext(ctx).With("key", k.String()) - list, err := r.claimStorage.List(ctx, &internalversion.ListOptions{}) - if err != nil { - return nil, err - } - items, err := meta.ExtractList(list) - if err != nil { - return nil, err - } - claimMap := map[string]*ipam.IPClaim{} - var errm error - for _, obj := range items { - claim, ok := obj.(*ipam.IPClaim) - if !ok { - log.Error("obj is not an IPClaim", "obj", reflect.TypeOf(obj).Name()) - errm = errors.Join(errm, err) - continue - } - if claim.GetIndex() == k.Name { - for _, ownerRef := range claim.OwnerReferences { - if ownerRef.Kind == ipam.IPIndexKind { - claimMap[claim.GetNamespacedName().String()] = claim - } - } - } - } - return claimMap, errm - */ } diff --git a/pkg/registry/generic/strategy_resource.go b/pkg/registry/generic/strategy_resource.go index b169cbc..e8a0eea 100644 --- a/pkg/registry/generic/strategy_resource.go +++ b/pkg/registry/generic/strategy_resource.go @@ -99,9 +99,9 @@ func (r *strategy) Validate(ctx context.Context, obj runtime.Object) field.Error return r.obj.ValidateCreate(ctx, obj) } -func (r *strategy) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error { +func (r *strategy) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { if r.opts.BackendInvoker == nil { - return nil + return obj, nil } return r.opts.BackendInvoker.InvokeCreate(ctx, obj, recursion) } @@ -141,11 +141,11 @@ func (r *strategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) return r.obj.ValidateUpdate(ctx, obj, old) } -func (r *strategy) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error { +func (r *strategy) InvokeUpdate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { if r.opts.BackendInvoker == nil { - return nil + return obj, nil } - return r.opts.BackendInvoker.InvokeUpdate(ctx, obj, old, recursion) + return r.opts.BackendInvoker.InvokeUpdate(ctx, obj, recursion) } func (r *strategy) Update(ctx context.Context, key types.NamespacedName, obj, old runtime.Object, dryrun bool) (runtime.Object, error) { @@ -184,9 +184,9 @@ func (r *strategy) BeginDelete(ctx context.Context) error { return nil } -func (r *strategy) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error { +func (r *strategy) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { if r.opts.BackendInvoker == nil { - return nil + return obj, nil } return r.opts.BackendInvoker.InvokeDelete(ctx, obj, recursion) } diff --git a/pkg/registry/generic/strategy_status.go b/pkg/registry/generic/strategy_status.go index 4c633fa..8f8fcd7 100644 --- a/pkg/registry/generic/strategy_status.go +++ b/pkg/registry/generic/strategy_status.go @@ -86,8 +86,8 @@ func (r *statusStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.Ob return r.obj.ValidateStatusUpdate(ctx, obj, old) } -func (r *statusStrategy) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error { - return nil +func (r *statusStrategy) InvokeUpdate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) { + return obj, nil } func (r *statusStrategy) Update(ctx context.Context, key types.NamespacedName, obj, old runtime.Object, dryrun bool) (runtime.Object, error) { diff --git a/pkg/registry/options/options.go b/pkg/registry/options/options.go index 5bf4cb1..b20ddc4 100644 --- a/pkg/registry/options/options.go +++ b/pkg/registry/options/options.go @@ -52,7 +52,7 @@ type DryRunner interface { } type BackendInvoker interface { - InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error - InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error - InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error + InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) + InvokeUpdate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) + InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) } From 80cf3f8c51eca80c9381f5609dec29173a5a2e60 Mon Sep 17 00:00:00 2001 From: Wim Henderickx Date: Wed, 30 Oct 2024 07:39:29 +0100 Subject: [PATCH 20/23] updated logging --- pkg/backend/ipam/backend.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/backend/ipam/backend.go b/pkg/backend/ipam/backend.go index 59d4a94..e8cf9e8 100644 --- a/pkg/backend/ipam/backend.go +++ b/pkg/backend/ipam/backend.go @@ -99,7 +99,7 @@ func (r *be) CreateIndex(ctx context.Context, obj runtime.Object) error { return err } } - log.Info("update IPIndex claims", "object", obj) + log.Debug("update IPIndex claims", "object", obj) return r.updateIPIndexClaims(ctx, index) } From f61b6bf6f17e6624d34613b52f9bc26b33c30164 Mon Sep 17 00:00:00 2001 From: Wim Henderickx Date: Wed, 30 Oct 2024 07:41:02 +0100 Subject: [PATCH 21/23] updated logging --- pkg/backend/ipam/backend.go | 8 ++++---- pkg/backend/ipam/backend_store.go | 32 +++++++++++++++---------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/pkg/backend/ipam/backend.go b/pkg/backend/ipam/backend.go index e8cf9e8..857fde1 100644 --- a/pkg/backend/ipam/backend.go +++ b/pkg/backend/ipam/backend.go @@ -77,7 +77,7 @@ func (r *be) CreateIndex(ctx context.Context, obj runtime.Object) error { log := log.FromContext(ctx) key := index.GetKey() - log.Info("create index", "isInitialized", r.cache.IsInitialized(ctx, key)) + log.Debug("create index", "isInitialized", r.cache.IsInitialized(ctx, key)) // if the Cache is not initialized -> restore the cache // this happens upon initialization or backend restart if _, err := r.cache.Get(ctx, key); err != nil { @@ -114,7 +114,7 @@ func (r *be) DeleteIndex(ctx context.Context, obj runtime.Object) error { ctx = bebackend.InitIndexContext(ctx, "delete", index) log := log.FromContext(ctx) - log.Info("start") + log.Debug("start") key := index.GetKey() log.Debug("start", "isInitialized", r.cache.IsInitialized(ctx, key)) @@ -123,10 +123,10 @@ func (r *be) DeleteIndex(ctx context.Context, obj runtime.Object) error { log.Error("cannot delete Index", "error", err.Error()) return err } - log.Info("destroyed") + log.Debug("destroyed") r.cache.Delete(ctx, key) - log.Info("finished") + log.Debug("finished") return nil } diff --git a/pkg/backend/ipam/backend_store.go b/pkg/backend/ipam/backend_store.go index 18cab55..e16bcb4 100644 --- a/pkg/backend/ipam/backend_store.go +++ b/pkg/backend/ipam/backend_store.go @@ -145,13 +145,13 @@ func (r *be) saveAll(ctx context.Context, k store.Key) error { return err } } - //for _, curEntry := range curEntries { - // log.Info("saveAll delete entry", "entry", curEntry.GetNamespacedName()) - // if err := r.bestorage.DeleteEntry(ctx, curEntry); err != nil { - // log.Error("saveAll update failed", "name", curEntry.GetName(), "error", err.Error()) - // return err - // } - //} + for _, curEntry := range curEntries { + log.Debug("saveAll delete entry", "entry", curEntry.GetNamespacedName()) + if err := r.bestorage.DeleteEntry(ctx, curEntry); err != nil { + log.Error("saveAll update failed", "name", curEntry.GetName(), "error", err.Error()) + return err + } + } return nil } @@ -324,16 +324,16 @@ func (r *be) updateIPIndexClaims(ctx context.Context, index *ipam.IPIndex) error } delete(existingClaims, newClaim.GetNamespacedName().String()) } - /* - for _, claim := range existingClaims { - log.Info("updateIPIndexClaims: delete existing claims", "claim", claim.GetName()) - if err := r.bestorage.DeleteClaim(ctx, claim); err != nil { - log.Error("updateIPIndexClaims delete failed", "name", claim.GetName(), "error", err.Error()) - errm = errors.Join(errm, err) - continue - } + + for _, claim := range existingClaims { + log.Debug("updateIPIndexClaims: delete existing claims", "claim", claim.GetName()) + if err := r.bestorage.DeleteClaim(ctx, claim); err != nil { + log.Error("updateIPIndexClaims delete failed", "name", claim.GetName(), "error", err.Error()) + errm = errors.Join(errm, err) + continue } - */ + } + if errm != nil { return errm } From 980dd1d8a166d7c9a23bf6a418bb9aabb29e3cb5 Mon Sep 17 00:00:00 2001 From: Wim Henderickx Date: Wed, 30 Oct 2024 07:44:08 +0100 Subject: [PATCH 22/23] updated context --- pkg/backend/ipam/backend_store.go | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/pkg/backend/ipam/backend_store.go b/pkg/backend/ipam/backend_store.go index e16bcb4..4c799c5 100644 --- a/pkg/backend/ipam/backend_store.go +++ b/pkg/backend/ipam/backend_store.go @@ -52,39 +52,31 @@ func (r *be) restore(ctx context.Context, index *ipam.IPIndex) error { if err != nil { return nil } - - /* - prefixes := make(map[string]ipamv1alpha1.Prefix) - for _, prefix := range index.Spec.Prefixes { - prefixes[prefix.Prefix] = prefix - } - */ - - /* - if err := r.restoreIndexPrefixes(ctx, cacheInstanceCtx, curEntries, index, prefixes); err != nil { - return err - } - */ + // first restore the claims related to the ipindex if err := r.restoreClaims(ctx, cacheInstanceCtx, curEntries, ipam.IPIndexKind, ipam.IPClaimType_StaticPrefix, claimmap); err != nil { return err } + // 2nd restore the static prefix claims if err := r.restoreClaims(ctx, cacheInstanceCtx, curEntries, ipam.IPClaimKind, ipam.IPClaimType_StaticPrefix, claimmap); err != nil { return err } + // 3rd restore the static range claims if err := r.restoreClaims(ctx, cacheInstanceCtx, curEntries, ipam.IPClaimKind, ipam.IPClaimType_StaticRange, claimmap); err != nil { return err } + // 3rd restore the dynamic prefix claims if err := r.restoreClaims(ctx, cacheInstanceCtx, curEntries, ipam.IPClaimKind, ipam.IPClaimType_DynamicPrefix, claimmap); err != nil { return err } + // 4th restore the static address claims if err := r.restoreClaims(ctx, cacheInstanceCtx, curEntries, ipam.IPClaimKind, ipam.IPClaimType_StaticAddress, claimmap); err != nil { return err } + // 4th restore the dynamic address claims if err := r.restoreClaims(ctx, cacheInstanceCtx, curEntries, ipam.IPClaimKind, ipam.IPClaimType_DynamicAddress, claimmap); err != nil { return err } log.Debug("restore prefixes entries left", "items", len(curEntries)) - return nil } From 49b47eb1fc604c0c91401bffc738ed8672548f9d Mon Sep 17 00:00:00 2001 From: Wim Henderickx Date: Wed, 30 Oct 2024 07:45:28 +0100 Subject: [PATCH 23/23] updated gh action --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 837ab68..e61e085 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -38,7 +38,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v5 + uses: goreleaser/goreleaser-action@v6 with: # either 'goreleaser' (default) or 'goreleaser-pro' distribution: goreleaser