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

Added disable_monitoring option to module ntnx_karbon_clusters #501

Open
wants to merge 3 commits into
base: release/1.9.3
Choose a base branch
from
Open
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions plugins/modules/ntnx_karbon_clusters.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@
choices: ["Calico", "Flannel"]
default: "Flannel"
description: Configuration of the network provider
disable_monitoring:
type: bool
description: Set to true to disable deployment of monitoring stack(prometheus).
default: false
custom_node_configs:
type: dict
description: write
Expand Down Expand Up @@ -423,6 +427,7 @@ def get_module_spec():
type="dict", options=entity_by_spec, mutually_exclusive=mutually_exclusive
),
cni=dict(type="dict", options=cni_spec),
disable_monitoring=dict(type="bool", default=False),
custom_node_configs=dict(
type="dict", apply_defaults=True, options=custom_node_spec
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
msg: Start testing ntnx_karbon_clusters and ntnx_karbon_clusters_info

- set_fact:
karbon_name: "test-module21"
karbon_name: "test-module21"

#############################
- name: Verify check mode for PROD karbon cluster
- name: Verify check mode for PROD karbon cluster
ntnx_karbon_clusters:
cluster:
uuid: "{{cluster.uuid}}"
Expand All @@ -17,7 +17,7 @@
name: "{{network.dhcp.name}}"
cluster_type: PROD
cni:
node_cidr_mask_size: "{{cni.node_cidr_mask_size}}"
node_cidr_mask_size: "{{cni.node_cidr_mask_size}}"
service_ipv4_cidr: "{{cni.service_ipv4_cidr}}"
pod_ipv4_cidr: "{{cni.pod_ipv4_cidr}}"
network_provider: Flannel
Expand Down Expand Up @@ -65,7 +65,7 @@
fail_msg: "Check mode for PROD cluster failed"
#############################

- name: Verify check mode for ntnx_karbon_clusters
- name: Verify check mode for ntnx_karbon_clusters
ntnx_karbon_clusters:
cluster:
uuid: "{{cluster.uuid}}"
Expand All @@ -76,10 +76,11 @@
name: "{{network.dhcp.name}}"
cluster_type: DEV
cni:
node_cidr_mask_size: "{{cni.node_cidr_mask_size}}"
node_cidr_mask_size: "{{cni.node_cidr_mask_size}}"
service_ipv4_cidr: "{{cni.service_ipv4_cidr}}"
pod_ipv4_cidr: "{{cni.pod_ipv4_cidr}}"
network_provider: Flannel
disable_monitoring: true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a check in asserts to verify if this works or not. Also check in asserts of other tasks if disable_monitoring is by default set to false or not

storage_class:
nutanix_cluster_password: "{{nutanix_cluster_password}}"
nutanix_cluster_username: "{{nutanix_cluster_username}}"
Expand Down Expand Up @@ -117,10 +118,11 @@
name: "{{network.dhcp.name}}"
cluster_type: DEV
cni:
node_cidr_mask_size: "{{cni.node_cidr_mask_size}}"
node_cidr_mask_size: "{{cni.node_cidr_mask_size}}"
service_ipv4_cidr: "{{cni.service_ipv4_cidr}}"
pod_ipv4_cidr: "{{cni.pod_ipv4_cidr}}"
network_provider: Flannel
disable_monitoring: true
storage_class:
nutanix_cluster_password: "{{nutanix_cluster_password}}"
nutanix_cluster_username: "{{nutanix_cluster_username}}"
Expand Down Expand Up @@ -174,7 +176,7 @@
node_subnet:
uuid: "{{network.dhcp.uuid}}"
cni:
node_cidr_mask_size: "{{cni.node_cidr_mask_size}}"
node_cidr_mask_size: "{{cni.node_cidr_mask_size}}"
service_ipv4_cidr: "{{cni.service_ipv4_cidr}}"
pod_ipv4_cidr: "{{cni.pod_ipv4_cidr}}"
network_provider: Calico
Expand Down Expand Up @@ -281,9 +283,9 @@
suffix_name: "ansible"

- set_fact:
node1_name: "{{random_name}}{{suffix_name}}1"
node2_name: "{{random_name}}{{suffix_name}}2"
node3_name: "{{random_name}}{{suffix_name}}3"
node1_name: "{{random_name}}{{suffix_name}}1"
node2_name: "{{random_name}}{{suffix_name}}2"
node3_name: "{{random_name}}{{suffix_name}}3"

- debug:
msg: Start testing ntnx_karbon_clusters_node_pools
Expand All @@ -292,8 +294,8 @@
ntnx_karbon_clusters_node_pools:
node_subnet:
uuid: "{{network.dhcp.uuid}}"
node_pool_name: "{{node1_name}}"
cluster_name: "{{karbon_name}}"
node_pool_name: "{{node1_name}}"
cluster_name: "{{karbon_name}}"
pool_config:
num_instances: 2
cpu: 4
Expand All @@ -316,8 +318,8 @@
#################################
- name: try to update node pool config with same values
ntnx_karbon_clusters_node_pools:
node_pool_name: "{{node1_name}}"
cluster_name: "{{karbon_name}}"
node_pool_name: "{{node1_name}}"
cluster_name: "{{karbon_name}}"
pool_config:
num_instances: 2
cpu: 4
Expand All @@ -337,8 +339,8 @@
#################################
- name: try to update node pool config with wrong labels
ntnx_karbon_clusters_node_pools:
node_pool_name: "{{node1_name}}"
cluster_name: "{{karbon_name}}"
node_pool_name: "{{node1_name}}"
cluster_name: "{{karbon_name}}"
pool_config:
num_instances: 2
cpu: 4
Expand All @@ -362,13 +364,13 @@
- name: update pool by increasing cpu,memory_gb,num_instances and try to add wrong labels
ntnx_karbon_clusters_node_pools:
wait: True
node_pool_name: "{{node1_name}}"
cluster_name: "{{karbon_name}}"
node_pool_name: "{{node1_name}}"
cluster_name: "{{karbon_name}}"
pool_config:
cpu: 6
memory_gb: 10 # for etcd min 8
disk_gb: 150
num_instances: 4
cpu: 6
memory_gb: 10 # for etcd min 8
disk_gb: 150
num_instances: 4
add_labels:
property1: "test-property1"
property2: "test-property2"
Expand All @@ -393,8 +395,8 @@
- name: update pool by add labels
ntnx_karbon_clusters_node_pools:
wait: True
node_pool_name: "{{node1_name}}"
cluster_name: "{{karbon_name}}"
node_pool_name: "{{node1_name}}"
cluster_name: "{{karbon_name}}"
add_labels:
property1: "test-property1"
property2: "test-property2"
Expand All @@ -417,13 +419,13 @@
- name: update pool by decreasing cpu,memory_gb,num_instances and add remove labels
ntnx_karbon_clusters_node_pools:
wait: True
node_pool_name: "{{node1_name}}"
cluster_name: "{{karbon_name}}"
node_pool_name: "{{node1_name}}"
cluster_name: "{{karbon_name}}"
pool_config:
cpu: 5
memory_gb: 9 # for etcd min 8
disk_gb: 140
num_instances: 3
cpu: 5
memory_gb: 9 # for etcd min 8
disk_gb: 140
num_instances: 3
remove_labels:
- property2
- property3
Expand All @@ -445,8 +447,8 @@
- name: delete pool
ntnx_karbon_clusters_node_pools:
state: absent
node_pool_name: "{{node1_name}}"
cluster_name: "{{karbon_name}}"
node_pool_name: "{{node1_name}}"
cluster_name: "{{karbon_name}}"
register: result
ignore_errors: true

Expand All @@ -465,8 +467,8 @@
ntnx_karbon_clusters_node_pools:
node_subnet:
name: "{{network.dhcp.name}}"
node_pool_name: "{{node2_name}}"
cluster_name: "{{karbon_name}}"
node_pool_name: "{{node2_name}}"
cluster_name: "{{karbon_name}}"
register: result
ignore_errors: true

Expand All @@ -485,8 +487,8 @@
- name: delete pool
ntnx_karbon_clusters_node_pools:
state: absent
node_pool_name: "{{node2_name}}"
cluster_name: "{{karbon_name}}"
node_pool_name: "{{node2_name}}"
cluster_name: "{{karbon_name}}"
register: result
ignore_errors: true

Expand Down
Loading