匯入叢集時,您可以移轉依預設不會移轉的自訂資源。
NCP 不會建立自訂資源。nsxt_mp_to_policy_converter.py 檔案中有方法 (在方法定義中搜尋單詞「custom」) 可加以覆寫,從而在管理程式至原則匯入期間實作預期的行為。依預設,NCP 不會對這些資源採取任何動作,因此不會實作任何自訂行為。如果您指定任何自訂資源識別碼,將會建立一個簡單的匯入要求 (在此情況下,會從 display_name 推斷原則識別碼,而不會在第 2 和 3 階段中執行任何更新)。您可以使用 custom_resources 識別碼,在使用者規格檔案中指定這些資源的識別碼 (請參閱以下範例)。語法如下:
k8s-clusters: <k8s cluster name>: <NSX Resource Shell Class Name>: <NSX Resource - 1 Class Name>: custom_resources: <NSX Resource - 1A ID>: metadata: - "key": <metadata key recognized by Migration API> "value": <metadata value associated with the key recognized by Migration API> linked_ids: - "key": <linked_ids key recognized by Migration API> "value": <linked_ids value associated with the key recognized by Migration API> <NSX Resource - 2 Class Name>: # these resources are imported after NSX Resource - 1A is custom_resources: <NSX Resource - 2A ID>: metadata: - "key": <metadata key recognized by Migration API> "value": <metadata value associated with the key recognized by Migration API> linked_ids: - "key": <linked_ids key recognized by Migration API> "value": <linked_ids value associated with the key recognized by Migration API> <NSX Resource - 1 Class Name>: <NSX Resource - 1B ID>: metadata: - "key": <metadata key recognized by Migration API> "value": <metadata value associated with the key recognized by Migration API> linked_ids: - "key": <linked_ids key recognized by Migration API> "value": <linked_ids value associated with the key recognized by Migration API>
在 user-spec.yaml 中指定自訂資源的範例
k8s-clusters: k8scluster: # top-tier-router-id is required for each cluster top-tier-router-id: t1-router-id top-tier-router-type: TIER1 # Provide custom resources as follow: NamespaceResources: Tier1Router: custom_resources: # Custom resources are specified only with MP ID 6d93a932-87ea-42de-a30c-b39f397322b0: metadata: # It should be a list - key: 'metadata-key' value: 'metadata-value' linked_ids: # It should be a list - key: 'linked_id-key' value: 'linked_id-value' NATRules: custom_resources: # Custom resources are specified only with MP ID 536870924: metadata: # It should be a list - key: 'metadata-key' value: 'metadata-value' linked_ids: # It should be a list - key: 'linked_id-key' value: 'linked_id-value'
請參閱下面的〈資源規格命令〉一節,瞭解應如何在 user-spec.yaml 中指定自訂資源。
資源規格命令
SharedResources - IpBlock - IpPool - IpPoolAllocation (specified as ip-allocations; see the sample user-spec.yaml for an example) - Tier0Router - Tier0RouterPorts (cannot be specified in user-spec.yaml) - Tier0RouterConfig (cannot be specified in user-spec.yaml) - Tier1Router - SpoofGuardSwitchingProfile - SwitchSecuritySwitchingProfile - QosSwitchingProfile - IpDiscoverySwitchingProfile - MacManagementSwitchingProfile - NodeLogicalSwitch - LogicalPort - Tier1RouterPortsAndStaticRoutes - NatRule - IpSet - MacSet - NsGroup - Certificate - LBClientSSlProfile - LBServerSSlProfile - LBCookiePersistenceProfile - LBSourceIPPersistenceProfile - LBGenericPersistenceProfile - LbHttpMonitor - LbHttpsMonitor - LbIcmpMonitor - LbTcpMonitor - LbUdpMonitor - LbPassiveMonitor - LbHttpProfile - LbFastTcpProfile - LbFastUdpProfile - LbPool - LbVirtualServer - LbService - NSService - NSProfile - FirewallSectionsAndRules - GatewayFirewallSectionsAndRules ClusterResources - Tier1Router - LogicalPort - Tier1RouterPortsAndStaticRoutes - GatewayFirewallSectionsAndRules NamespaceResources - ExternalIpPoolsAllocations - IpBlockSubnet - IpPoolAllocation - Tier1Router - Tier1RouterPorts - SpoofguradProfile - NodeLogicalSwitch - NATRules - NsGroup - GatewayFirewallSectionsAndRules PodResources - ExternalIpPoolsAllocations - LogicalPort - NATRules NetworkPolicyResources - IpSet - FirewallSectionsAndRules SecretResources - Certificate LBClusterWideResources - ExternalIpPoolsAllocations - IpPool - IpPoolAllocation - NodeLogicalSwitch - Tier1Router - Tier1RouterPortsAndStaticRoutes - Certificate - ServerPool - CookiePersistenceProfile - SourceIPPersistenceProfile - ApplicationProfile - VirtualServer - GatewayFirewallSectionsAndRules L4ServiceResources - ExternalIpPoolsAllocations - SourceIPPersistenceProfile - VirtualServer - LBService - DefaultLBService