From e9a0339ba9b07392a8f1c5cb3874bcf7cf8201d0 Mon Sep 17 00:00:00 2001 From: abikouo Date: Tue, 25 May 2021 16:25:19 +0200 Subject: [PATCH 01/12] scale deployment using label selectors --- ...label-selectors-and-continue-on-error.yaml | 4 + molecule/default/files/deployment.yaml | 50 +++++++ molecule/default/tasks/scale.yml | 63 ++++++++ plugins/doc_fragments/k8s_scale_options.py | 6 + plugins/modules/k8s_scale.py | 141 ++++++++++++++---- 5 files changed, 233 insertions(+), 31 deletions(-) create mode 100644 changelogs/fragments/112-k8s_scale-add-label-selectors-and-continue-on-error.yaml create mode 100644 molecule/default/files/deployment.yaml diff --git a/changelogs/fragments/112-k8s_scale-add-label-selectors-and-continue-on-error.yaml b/changelogs/fragments/112-k8s_scale-add-label-selectors-and-continue-on-error.yaml new file mode 100644 index 0000000000..72a9dc308b --- /dev/null +++ b/changelogs/fragments/112-k8s_scale-add-label-selectors-and-continue-on-error.yaml @@ -0,0 +1,4 @@ +--- +minor_changes: + - k8s_scale - ability to scale multiple resource using ``label_selectors`` (https://github.com/ansible-collections/community.kubernetes/pull/112). + - k8s_scale - new parameter to determine wether to continue or not on error when scaling multiple resources (https://github.com/ansible-collections/community.kubernetes/pull/112). diff --git a/molecule/default/files/deployment.yaml b/molecule/default/files/deployment.yaml new file mode 100644 index 0000000000..bff04d4785 --- /dev/null +++ b/molecule/default/files/deployment.yaml @@ -0,0 +1,50 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: test0 + labels: + app: nginx +spec: + replicas: 3 + selector: + matchLabels: + app: nginx + template: + metadata: + labels: + app: nginx + spec: + containers: + - name: nginx + image: nginx:1.14.2 + ports: + - containerPort: 80 + - name: hello + image: busybox + command: ['sh', '-c', 'echo "Hello, from test0" && sleep 3600'] +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: test1 + labels: + app: nginx +spec: + replicas: 3 + selector: + matchLabels: + app: nginx + template: + metadata: + labels: + app: nginx + spec: + containers: + - name: nginx + image: nginx:1.14.2 + ports: + - containerPort: 80 + - name: hello + image: busybox + command: ['sh', '-c', 'echo "Hello, from test1" && sleep 3600'] diff --git a/molecule/default/tasks/scale.yml b/molecule/default/tasks/scale.yml index 9e0c31a096..4eaba67894 100644 --- a/molecule/default/tasks/scale.yml +++ b/molecule/default/tasks/scale.yml @@ -201,6 +201,69 @@ - scale_down_no_wait is changed - scale_down_no_wait.diff - scale_down_no_wait_pods.resources | length == 1 + + # scale multiple resource using label selectors + - name: create deployment + kubernetes.core.k8s: + namespace: "{{ scale_namespace }}" + src: files/deployment.yaml + + - name: list deployment + kubernetes.core.k8s_info: + kind: Deployment + namespace: "{{ scale_namespace }}" + label_selectors: + - app=nginx + register: resource + + - assert: + that: + - resource.resources | list | length == 2 + + - name: scale deployment using resource version + kubernetes.core.k8s_scale: + replicas: 2 + kind: Deployment + namespace: "{{ scale_namespace }}" + resource_version: 0 + label_selectors: + - app=nginx + register: scale_out + + - assert: + that: + - not scale_out.changed + - scale_out.results | selectattr('warning', 'defined') | list | length == 2 + + - name: scale deployment using current replicas (wrong value) + kubernetes.core.k8s_scale: + replicas: 2 + current_replicas: 4 + kind: Deployment + namespace: "{{ scale_namespace }}" + label_selectors: + - app=nginx + register: scale_out + + - assert: + that: + - not scale_out.changed + - scale_out.results | selectattr('warning', 'defined') | list | length == 2 + + - name: scale deployment using current replicas (right value) + kubernetes.core.k8s_scale: + replicas: 2 + current_replicas: 3 + kind: Deployment + namespace: "{{ scale_namespace }}" + label_selectors: + - app=nginx + register: scale_out + + - assert: + that: + - scale_out.changed + - scale_out.results | map(attribute='result.status.replicas') | list | unique == [2] always: - name: Remove namespace diff --git a/plugins/doc_fragments/k8s_scale_options.py b/plugins/doc_fragments/k8s_scale_options.py index 0c01439a8e..8b10dcefb6 100644 --- a/plugins/doc_fragments/k8s_scale_options.py +++ b/plugins/doc_fragments/k8s_scale_options.py @@ -40,4 +40,10 @@ class ModuleDocFragment(object): is ignored. type: int default: 20 + wait_sleep: + description: + - Number of seconds to sleep between checks. + default: 5 + type: int + version_added: 2.0.0 ''' diff --git a/plugins/modules/k8s_scale.py b/plugins/modules/k8s_scale.py index e4643aad92..82bb8ce463 100644 --- a/plugins/modules/k8s_scale.py +++ b/plugins/modules/k8s_scale.py @@ -23,6 +23,7 @@ description: - Similar to the kubectl scale command. Use to set the number of replicas for a Deployment, ReplicaSet, or Replication Controller, or the parallelism attribute of a Job. Supports check mode. + - C(wait) parameter is not supported for Jobs. extends_documentation_fragment: - kubernetes.core.k8s_name_options @@ -30,6 +31,19 @@ - kubernetes.core.k8s_resource_options - kubernetes.core.k8s_scale_options +options: + label_selectors: + description: List of label selectors to use to filter results + type: list + elements: str + version_added: 2.0.0 + continue_on_error: + description: + - Whether to continue on errors when multiple resources are defined. + type: bool + default: False + version_added: 2.0.0 + requirements: - "python >= 3.6" - "kubernetes >= 12.0.0" @@ -82,6 +96,15 @@ resource_definition: "{{ lookup('file', '/myproject/elastic_deployment.yml') | from_yaml }}" replicas: 3 wait: no + +- name: Scale deployment using label selectors (continue operation in case error occured on one resource) + kubernetes.core.k8s_scale: + replicas: 3 + kind: Deployment + namespace: test + label_selectors: + - app = test + continue_on_error: true ''' RETURN = r''' @@ -131,6 +154,7 @@ 'resource_version': {}, 'wait': {'type': 'bool', 'default': True}, 'wait_timeout': {'type': 'int', 'default': 20}, + 'wait_sleep': {'type': 'int', 'default': 5}, } @@ -147,11 +171,17 @@ def execute_module(module, k8s_ansible_mixin,): replicas = module.params.get('replicas') resource_version = module.params.get('resource_version') + label_selectors = module.params.get('label_selectors') + if not label_selectors: + label_selectors = [] + continue_on_error = module.params.get('continue_on_error') + wait = module.params.get('wait') wait_time = module.params.get('wait_timeout') + wait_sleep = module.params.get('wait_sleep') existing = None existing_count = None - return_attributes = dict(changed=False, result=dict(), diff=dict()) + return_attributes = dict(result=dict(), diff=dict()) if wait: return_attributes['duration'] = 0 @@ -159,37 +189,82 @@ def execute_module(module, k8s_ansible_mixin,): from ansible_collections.kubernetes.core.plugins.module_utils.common import NotFoundError + multiple_scale = False try: - existing = resource.get(name=name, namespace=namespace) - return_attributes['result'] = existing.to_dict() + existing = resource.get(name=name, namespace=namespace, label_selector=','.join(label_selectors)) + if existing.kind.endswith('List'): + existing_items = existing.items + multiple_scale = len(existing_items) > 1 + else: + existing_items = [existing] except NotFoundError as exc: module.fail_json(msg='Failed to retrieve requested object: {0}'.format(exc), error=exc.value.get('status')) - if module.params['kind'] == 'job': - existing_count = existing.spec.parallelism - elif hasattr(existing.spec, 'replicas'): - existing_count = existing.spec.replicas - - if existing_count is None: - module.fail_json(msg='Failed to retrieve the available count for the requested object.') - - if resource_version and resource_version != existing.metadata.resourceVersion: - module.exit_json(**return_attributes) - - if current_replicas is not None and existing_count != current_replicas: - module.exit_json(**return_attributes) - - if existing_count != replicas: - return_attributes['changed'] = True - if not module.check_mode: - if module.params['kind'] == 'job': - existing.spec.parallelism = replicas - return_attributes['result'] = resource.patch(existing.to_dict()).to_dict() - else: - return_attributes = scale(module, k8s_ansible_mixin, resource, existing, replicas, wait, wait_time) - - module.exit_json(**return_attributes) + if multiple_scale: + # when scaling multiple resource, the 'result' is changed to 'results' and is a list + return_attributes = {'results': []} + changed = False + + def _continue_or_fail(error): + if multiple_scale and continue_on_error: + if "errors" not in return_attributes: + return_attributes['errors'] = [] + return_attributes['errors'].append({'error': error, 'failed': True}) + else: + module.fail_json(msg=error, **return_attributes) + + def _continue_or_exit(warn): + if multiple_scale: + return_attributes['results'].append({'warning': warn, 'changed': False}) + else: + module.exit_json(warning=warn, **return_attributes) + + for existing in existing_items: + if module.params['kind'] == 'job': + existing_count = existing.spec.parallelism + elif hasattr(existing.spec, 'replicas'): + existing_count = existing.spec.replicas + + if existing_count is None: + error = 'Failed to retrieve the available count for object kind={0} name={1} namespace={2}.'.format( + existing.kind, existing.metadata.name, existing.metadata.namespace) + _continue_or_fail(error) + continue + + if resource_version and resource_version != existing.metadata.resourceVersion: + warn = 'expected resource version {0} does not match with actual {1} for object kind={2} name={3} namespace={4}.'.format( + resource_version, existing.metadata.resourceVersion, existing.kind, existing.metadata.name, existing.metadata.namespace) + _continue_or_exit(warn) + continue + + if current_replicas is not None and existing_count != current_replicas: + warn = 'current replicas {0} does not match with actual {1} for object kind={2} name={3} namespace={4}.'.format( + current_replicas, existing_count, existing.kind, existing.metadata.name, existing.metadata.namespace) + _continue_or_exit(warn) + continue + + if existing_count != replicas: + if not module.check_mode: + if module.params['kind'] == 'job': + existing.spec.parallelism = replicas + result = resource.patch(existing.to_dict()).to_dict() + else: + result = scale(module, k8s_ansible_mixin, resource, existing, replicas, wait, wait_time, wait_sleep) + changed = changed or result['changed'] + else: + name = existing.metadata.name + namespace = existing.metadata.namespace + existing = resource.get(name=name, namespace=namespace) + result = {'changed': False, 'result': existing.to_dict()} + # append result to the return attribute + if multiple_scale: + return_attributes['results'].append(result) + else: + del result['changed'] + return_attributes = result + + module.exit_json(changed=changed, **return_attributes) def argspec(): @@ -197,10 +272,12 @@ def argspec(): args.update(RESOURCE_ARG_SPEC) args.update(NAME_ARG_SPEC) args.update(AUTH_ARG_SPEC) + args.update({'label_selectors': {'type': 'list', 'elements': 'str', 'default': []}}) + args.update(({'continue_on_error': {'type': 'bool', 'default': False}})) return args -def scale(module, k8s_ansible_mixin, resource, existing_object, replicas, wait, wait_time): +def scale(module, k8s_ansible_mixin, resource, existing_object, replicas, wait, wait_time, wait_sleep): name = existing_object.metadata.name namespace = existing_object.metadata.namespace kind = existing_object.kind @@ -227,17 +304,19 @@ def scale(module, k8s_ansible_mixin, resource, existing_object, replicas, wait, result['diff'] = diffs if wait: - success, result['result'], result['duration'] = k8s_ansible_mixin.wait(resource, scale_obj, 5, wait_time) + success, result['result'], result['duration'] = k8s_ansible_mixin.wait(resource, scale_obj, wait_sleep, wait_time) if not success: module.fail_json(msg="Resource scaling timed out", **result) return result def main(): - module = AnsibleModule(argument_spec=argspec(), supports_check_mode=True) + mutually_exclusive = [ + ('resource_definition', 'src'), + ] + module = AnsibleModule(argument_spec=argspec(), mutually_exclusive=mutually_exclusive, supports_check_mode=True) from ansible_collections.kubernetes.core.plugins.module_utils.common import ( K8sAnsibleMixin, get_api_client) - k8s_ansible_mixin = K8sAnsibleMixin(module) k8s_ansible_mixin.client = get_api_client(module=module) execute_module(module, k8s_ansible_mixin) From 273e821c492395feb0c526b2620fffea9cb13db2 Mon Sep 17 00:00:00 2001 From: abikouo <79859644+abikouo@users.noreply.github.com> Date: Tue, 25 May 2021 16:40:41 +0200 Subject: [PATCH 02/12] Update and rename 112-k8s_scale-add-label-selectors-and-continue-on-error.yaml to 114-k8s_scale-add-label-selectors-and-continue-on-error.yaml --- ...-k8s_scale-add-label-selectors-and-continue-on-error.yaml} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename changelogs/fragments/{112-k8s_scale-add-label-selectors-and-continue-on-error.yaml => 114-k8s_scale-add-label-selectors-and-continue-on-error.yaml} (78%) diff --git a/changelogs/fragments/112-k8s_scale-add-label-selectors-and-continue-on-error.yaml b/changelogs/fragments/114-k8s_scale-add-label-selectors-and-continue-on-error.yaml similarity index 78% rename from changelogs/fragments/112-k8s_scale-add-label-selectors-and-continue-on-error.yaml rename to changelogs/fragments/114-k8s_scale-add-label-selectors-and-continue-on-error.yaml index 72a9dc308b..78cd9ace27 100644 --- a/changelogs/fragments/112-k8s_scale-add-label-selectors-and-continue-on-error.yaml +++ b/changelogs/fragments/114-k8s_scale-add-label-selectors-and-continue-on-error.yaml @@ -1,4 +1,4 @@ --- minor_changes: - - k8s_scale - ability to scale multiple resource using ``label_selectors`` (https://github.com/ansible-collections/community.kubernetes/pull/112). - - k8s_scale - new parameter to determine wether to continue or not on error when scaling multiple resources (https://github.com/ansible-collections/community.kubernetes/pull/112). + - k8s_scale - ability to scale multiple resource using ``label_selectors`` (https://github.com/ansible-collections/community.kubernetes/pull/114). + - k8s_scale - new parameter to determine wether to continue or not on error when scaling multiple resources (https://github.com/ansible-collections/community.kubernetes/pull/114). From ba0a39d93aa55457f35ba91602988f63acf6ba9f Mon Sep 17 00:00:00 2001 From: abikouo Date: Tue, 25 May 2021 16:58:43 +0200 Subject: [PATCH 03/12] sanity --- tests/sanity/ignore-2.10.txt | 1 + tests/sanity/ignore-2.11.txt | 1 + tests/sanity/ignore-2.12.txt | 1 + tests/sanity/ignore-2.9.txt | 1 + 4 files changed, 4 insertions(+) diff --git a/tests/sanity/ignore-2.10.txt b/tests/sanity/ignore-2.10.txt index 986bb10a60..36c8f4e73c 100644 --- a/tests/sanity/ignore-2.10.txt +++ b/tests/sanity/ignore-2.10.txt @@ -15,3 +15,4 @@ plugins/module_utils/client/discovery.py future-import-boilerplate!skip plugins/module_utils/client/discovery.py metaclass-boilerplate!skip tests/unit/module_utils/test_discoverer.py future-import-boilerplate!skip tests/unit/module_utils/test_discoverer.py metaclass-boilerplate!skip +molecule/default/files/deployment.yaml yamllint!skip \ No newline at end of file diff --git a/tests/sanity/ignore-2.11.txt b/tests/sanity/ignore-2.11.txt index 986bb10a60..36c8f4e73c 100644 --- a/tests/sanity/ignore-2.11.txt +++ b/tests/sanity/ignore-2.11.txt @@ -15,3 +15,4 @@ plugins/module_utils/client/discovery.py future-import-boilerplate!skip plugins/module_utils/client/discovery.py metaclass-boilerplate!skip tests/unit/module_utils/test_discoverer.py future-import-boilerplate!skip tests/unit/module_utils/test_discoverer.py metaclass-boilerplate!skip +molecule/default/files/deployment.yaml yamllint!skip \ No newline at end of file diff --git a/tests/sanity/ignore-2.12.txt b/tests/sanity/ignore-2.12.txt index 2be297c293..742b5cad79 100644 --- a/tests/sanity/ignore-2.12.txt +++ b/tests/sanity/ignore-2.12.txt @@ -13,3 +13,4 @@ plugins/module_utils/client/discovery.py import-3.7!skip plugins/module_utils/client/resource.py import-3.7!skip plugins/module_utils/client/discovery.py future-import-boilerplate!skip plugins/module_utils/client/discovery.py metaclass-boilerplate!skip +molecule/default/files/deployment.yaml yamllint!skip \ No newline at end of file diff --git a/tests/sanity/ignore-2.9.txt b/tests/sanity/ignore-2.9.txt index 3a99de7b39..14c8a24cde 100644 --- a/tests/sanity/ignore-2.9.txt +++ b/tests/sanity/ignore-2.9.txt @@ -12,3 +12,4 @@ plugins/module_utils/client/discovery.py future-import-boilerplate!skip plugins/module_utils/client/discovery.py metaclass-boilerplate!skip tests/unit/module_utils/test_discoverer.py future-import-boilerplate!skip tests/unit/module_utils/test_discoverer.py metaclass-boilerplate!skip +molecule/default/files/deployment.yaml yamllint!skip \ No newline at end of file From 7a06ef53e4a0480428bfdfeacf4362646364ab2c Mon Sep 17 00:00:00 2001 From: abikouo Date: Tue, 25 May 2021 17:07:08 +0200 Subject: [PATCH 04/12] lint --- molecule/default/tasks/scale.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/molecule/default/tasks/scale.yml b/molecule/default/tasks/scale.yml index 4eaba67894..ce1b106a7b 100644 --- a/molecule/default/tasks/scale.yml +++ b/molecule/default/tasks/scale.yml @@ -201,7 +201,7 @@ - scale_down_no_wait is changed - scale_down_no_wait.diff - scale_down_no_wait_pods.resources | length == 1 - + # scale multiple resource using label selectors - name: create deployment kubernetes.core.k8s: @@ -249,7 +249,7 @@ that: - not scale_out.changed - scale_out.results | selectattr('warning', 'defined') | list | length == 2 - + - name: scale deployment using current replicas (right value) kubernetes.core.k8s_scale: replicas: 2 From 7213b15710ef5d118fdf083f3a5c4fc0bcc6d11a Mon Sep 17 00:00:00 2001 From: abikouo Date: Wed, 26 May 2021 10:13:55 +0200 Subject: [PATCH 05/12] add duration --- plugins/modules/k8s_scale.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/modules/k8s_scale.py b/plugins/modules/k8s_scale.py index 82bb8ce463..923597458b 100644 --- a/plugins/modules/k8s_scale.py +++ b/plugins/modules/k8s_scale.py @@ -257,6 +257,8 @@ def _continue_or_exit(warn): namespace = existing.metadata.namespace existing = resource.get(name=name, namespace=namespace) result = {'changed': False, 'result': existing.to_dict()} + if wait: + result['duration'] = 0 # append result to the return attribute if multiple_scale: return_attributes['results'].append(result) From d279c75e4426a5901f1fcef2147a56c3fb07637d Mon Sep 17 00:00:00 2001 From: abikouo Date: Wed, 26 May 2021 10:20:38 +0200 Subject: [PATCH 06/12] add diff field --- plugins/modules/k8s_scale.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/modules/k8s_scale.py b/plugins/modules/k8s_scale.py index 923597458b..c5188fdf91 100644 --- a/plugins/modules/k8s_scale.py +++ b/plugins/modules/k8s_scale.py @@ -256,15 +256,14 @@ def _continue_or_exit(warn): name = existing.metadata.name namespace = existing.metadata.namespace existing = resource.get(name=name, namespace=namespace) - result = {'changed': False, 'result': existing.to_dict()} + result = {'changed': False, 'result': existing.to_dict(), 'diff': {}} if wait: result['duration'] = 0 # append result to the return attribute if multiple_scale: return_attributes['results'].append(result) else: - del result['changed'] - return_attributes = result + module.exit_json(**result) module.exit_json(changed=changed, **return_attributes) From d6952698c2e0fbfbe3db3291d3308c84b3fa968a Mon Sep 17 00:00:00 2001 From: abikouo <79859644+abikouo@users.noreply.github.com> Date: Tue, 1 Jun 2021 10:29:28 +0200 Subject: [PATCH 07/12] Update plugins/modules/k8s_scale.py Co-authored-by: Abhijeet Kasurde --- plugins/modules/k8s_scale.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/modules/k8s_scale.py b/plugins/modules/k8s_scale.py index c5188fdf91..7968379974 100644 --- a/plugins/modules/k8s_scale.py +++ b/plugins/modules/k8s_scale.py @@ -103,7 +103,7 @@ kind: Deployment namespace: test label_selectors: - - app = test + - app=test continue_on_error: true ''' From bab52f5726b503ffea8b7b547924ab8f03a3d8b8 Mon Sep 17 00:00:00 2001 From: abikouo <79859644+abikouo@users.noreply.github.com> Date: Tue, 1 Jun 2021 10:29:44 +0200 Subject: [PATCH 08/12] Update plugins/modules/k8s_scale.py Co-authored-by: Abhijeet Kasurde --- plugins/modules/k8s_scale.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/modules/k8s_scale.py b/plugins/modules/k8s_scale.py index 7968379974..85c6a276ee 100644 --- a/plugins/modules/k8s_scale.py +++ b/plugins/modules/k8s_scale.py @@ -33,7 +33,7 @@ options: label_selectors: - description: List of label selectors to use to filter results + description: List of label selectors to use to filter results. type: list elements: str version_added: 2.0.0 From 71b44396f314032384cee94347a24a95953bd0e8 Mon Sep 17 00:00:00 2001 From: abikouo <79859644+abikouo@users.noreply.github.com> Date: Tue, 1 Jun 2021 10:30:13 +0200 Subject: [PATCH 09/12] Update molecule/default/tasks/scale.yml Co-authored-by: Abhijeet Kasurde --- molecule/default/tasks/scale.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/molecule/default/tasks/scale.yml b/molecule/default/tasks/scale.yml index ce1b106a7b..93d2c45e77 100644 --- a/molecule/default/tasks/scale.yml +++ b/molecule/default/tasks/scale.yml @@ -219,6 +219,7 @@ - assert: that: - resource.resources | list | length == 2 + - resource is changed - name: scale deployment using resource version kubernetes.core.k8s_scale: From 192a008ecb842ba8b55362fa775fba081218885b Mon Sep 17 00:00:00 2001 From: abikouo <79859644+abikouo@users.noreply.github.com> Date: Tue, 1 Jun 2021 10:30:24 +0200 Subject: [PATCH 10/12] Update changelogs/fragments/114-k8s_scale-add-label-selectors-and-continue-on-error.yaml Co-authored-by: Abhijeet Kasurde --- ...114-k8s_scale-add-label-selectors-and-continue-on-error.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelogs/fragments/114-k8s_scale-add-label-selectors-and-continue-on-error.yaml b/changelogs/fragments/114-k8s_scale-add-label-selectors-and-continue-on-error.yaml index 78cd9ace27..c0fee8e7be 100644 --- a/changelogs/fragments/114-k8s_scale-add-label-selectors-and-continue-on-error.yaml +++ b/changelogs/fragments/114-k8s_scale-add-label-selectors-and-continue-on-error.yaml @@ -1,4 +1,4 @@ --- minor_changes: - k8s_scale - ability to scale multiple resource using ``label_selectors`` (https://github.com/ansible-collections/community.kubernetes/pull/114). - - k8s_scale - new parameter to determine wether to continue or not on error when scaling multiple resources (https://github.com/ansible-collections/community.kubernetes/pull/114). + - k8s_scale - new parameter to determine whether to continue or not on error when scaling multiple resources (https://github.com/ansible-collections/community.kubernetes/pull/114). From 5794130e0dafca4c00b07ea18f0903be2a886570 Mon Sep 17 00:00:00 2001 From: abikouo Date: Wed, 2 Jun 2021 10:41:00 +0200 Subject: [PATCH 11/12] should not change --- molecule/default/tasks/scale.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/molecule/default/tasks/scale.yml b/molecule/default/tasks/scale.yml index 93d2c45e77..ce1b106a7b 100644 --- a/molecule/default/tasks/scale.yml +++ b/molecule/default/tasks/scale.yml @@ -219,7 +219,6 @@ - assert: that: - resource.resources | list | length == 2 - - resource is changed - name: scale deployment using resource version kubernetes.core.k8s_scale: From 9eeaf9b72bd173acdab05195c187bfbf5c66801a Mon Sep 17 00:00:00 2001 From: abikouo <79859644+abikouo@users.noreply.github.com> Date: Wed, 2 Jun 2021 13:27:48 +0200 Subject: [PATCH 12/12] Update scale.yml --- molecule/default/tasks/scale.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/molecule/default/tasks/scale.yml b/molecule/default/tasks/scale.yml index ce1b106a7b..866a5debd4 100644 --- a/molecule/default/tasks/scale.yml +++ b/molecule/default/tasks/scale.yml @@ -215,7 +215,6 @@ label_selectors: - app=nginx register: resource - - assert: that: - resource.resources | list | length == 2