Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support stateful active/active Tier-0 deployment #516

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 51 additions & 1 deletion plugins/modules/nsxt_policy_tier0.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,30 @@
- 'ACTIVE_ACTIVE'
default: 'ACTIVE_ACTIVE'
type: str
stateful_services:
description: For ACTIVE-ACTIVE, this is used to enable/disable
stateful services.
type: dict
suboptions:
enabled:
description: Flag to enable ACTIVE-ACTIVE stateful services
type: bool
default: False
redirection_policy:
description:
- Redirection policy configuration
- Redirection policy to load balance traffic among nodes
IP_HASH: Hash Source IP or destination ip to redirect
packet for load sharing and stateful services.
NONE: Disable redirection. It requires user to define
static traffic group per edge node and expects external
router to forward return packet back to the same edge node.
SRC_DST_IP_HASH: Hash both source and desitnation ip to
redirect packet for load sharing. This mode doesn't support
NAT and presumes source and destination IP remains same in
either direction.
type: str
default: "IP_HASH"
disable_firewall:
description: Disable or enable gateway fiewall.
default: False
Expand Down Expand Up @@ -1162,7 +1186,10 @@
validate_certs: False
display_name: test-tier0-1
state: present
ha_mode: "ACTIVE_STANDBY"
ha_mode: "ACTIVE_ACTIVE"
stateful_services:
enabled: True
redirection_policy: "IP_HASH"
failover_mode: "PREEMPTIVE"
disable_firewall: True
force_whitelisting: True
Expand Down Expand Up @@ -1267,6 +1294,20 @@ def get_resource_spec():
default="ACTIVE_ACTIVE",
choices=['ACTIVE_STANDBY', 'ACTIVE_ACTIVE']
),
stateful_services=dict(
required=False,
type='dict',
options=dict(
enabled=dict(
required=False,
type='bool'
),
redirection_policy=dict(
default="IP_HASH",
type='str'
),
)
),
disable_firewall=dict(
required=False,
type='bool',
Expand Down Expand Up @@ -1451,6 +1492,15 @@ def update_resource_params(self, nsx_resource_params):
nsx_resource_params["dhcp_config_paths"] = [
DHCP_RELAY_CONFIG_URL + "/" + dhcp_config_id]

if "stateful_services" in nsx_resource_params:
stateful_services = nsx_resource_params['stateful_services']
if stateful_services.get('enabled'):
ha_mode = nsx_resource_params['ha_mode']
if ha_mode != "ACTIVE_ACTIVE":
self.exit_with_failure(msg="stateful_services can only be "
"enabled when ha_mode is set to "
"ACTIVE_ACTIVE")

if 'vrf_config' in nsx_resource_params:
# vrf config is attached
vrf_config = nsx_resource_params['vrf_config']
Expand Down