Skip to content

Use k8s_info module instead of deprecated k8s_facts in molecule scaffold (#2168) #2203

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

Merged
merged 3 commits into from
Nov 26, 2019
Merged
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
- Upgrade Helm version from `v2.15.0` to `v2.16.1`. ([#2145](https://github.com/operator-framework/operator-sdk/pull/2145))
- Upgrade [`controller-runtime`](https://github.com/kubernetes-sigs/controller-runtime) version from `v0.3.0` to [`v0.4.0`](https://github.com/kubernetes-sigs/controller-runtime/releases/tag/v0.4.0). ([#2145](https://github.com/operator-framework/operator-sdk/pull/2145))
- Updated `pkg/test/e2eutil.WaitForDeployment()` and `pkg/test/e2eutil.WaitForOperatorDeployment()` to successfully complete waiting when the available replica count is _at least_ (rather than exactly) the minimum replica count required. ([#2248](https://github.com/operator-framework/operator-sdk/pull/2248))
- Replace in the Ansible based operators module tests `k8s_info` for `k8s_facts` which is deprecated. ([#2168](https://github.com/operator-framework/operator-sdk/issues/2168))
- Upgrade the Ansible version from `2.8` to `2.9` on the Ansible based operators image. ([#2168](https://github.com/operator-framework/operator-sdk/issues/2168))

### Deprecated

Expand Down
2 changes: 1 addition & 1 deletion ci/dockerfiles/ansible-e2e-hybrid.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ RUN yum clean all && rm -rf /var/cache/yum/* \
ansible-runner==1.3.4 \
ansible-runner-http==1.0.0 \
openshift==0.8.9 \
ansible~=2.8 \
ansible~=2.9 \
jmespath \
&& yum remove -y gcc python36-devel \
&& yum clean all \
Expand Down
2 changes: 1 addition & 1 deletion ci/dockerfiles/ansible.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ RUN yum clean all && rm -rf /var/cache/yum/* \
ansible-runner==1.3.4 \
ansible-runner-http==1.0.0 \
openshift==0.8.9 \
ansible~=2.8 \
ansible~=2.9 \
jmespath \
&& yum remove -y gcc python36-devel \
&& yum clean all \
Expand Down
2 changes: 1 addition & 1 deletion doc/ansible/dev/retroactively-owned-resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ This file can be used as-is without user adjustments.
- name: Import user variables
include_vars: vars.yml
- name: Retrieve owning resource
k8s_facts:
k8s_info:
api_version: "{{ owning_resource.apiVersion }}"
kind: "{{ owning_resource.kind }}"
name: "{{ owning_resource.name }}"
Expand Down
2 changes: 1 addition & 1 deletion internal/scaffold/ansible/dockerfilehybrid.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ RUN yum clean all && rm -rf /var/cache/yum/* \
ansible-runner==1.3.4 \
ansible-runner-http==1.0.0 \
openshift==0.8.9 \
ansible~=2.8 \
ansible~=2.9 \
jmespath \
&& yum remove -y gcc python36-devel \
&& yum clean all \
Expand Down
2 changes: 1 addition & 1 deletion internal/scaffold/ansible/molecule_default_asserts.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const moleculeDefaultAssertsAnsibleTmpl = `---
ansible_python_interpreter: '{{ ansible_playbook_python }}'
tasks:
- name: Get all pods in {{ namespace }}
k8s_facts:
k8s_info:
api_version: v1
kind: Pod
namespace: '{{ namespace }}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const moleculeTestClusterPlaybookAnsibleTmpl = `---
msg: "{{ lookup('k8s', group='[[.Resource.FullGroup]]', api_version='[[.Resource.Version]]', kind='[[.Resource.Kind]]', namespace=namespace, resource_name=custom_resource.metadata.name) }}"

- name: Wait 2m for reconciliation to run
k8s_facts:
k8s_info:
api_version: '[[.Resource.Version]]'
kind: '[[.Resource.Kind]]'
namespace: '{{ namespace }}'
Expand Down
4 changes: 2 additions & 2 deletions internal/scaffold/ansible/molecule_test_local_playbook.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const moleculeTestLocalPlaybookAnsibleTmpl = `---
when: hostvars[groups.k8s.0].build_cmd.changed

- name: Wait 30s for Operator Deployment to terminate
k8s_facts:
k8s_info:
api_version: '{{ definition.apiVersion }}'
kind: '{{ definition.kind }}'
namespace: '{{ namespace }}'
Expand All @@ -102,7 +102,7 @@ const moleculeTestLocalPlaybookAnsibleTmpl = `---
definition: '{{ custom_resource }}'

- name: Wait 2m for reconciliation to run
k8s_facts:
k8s_info:
api_version: '{{ custom_resource.apiVersion }}'
kind: '{{ custom_resource.kind }}'
namespace: '{{ namespace }}'
Expand Down
4 changes: 2 additions & 2 deletions test/ansible-inventory/molecule/test-local/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
when: hostvars[groups.k8s.0].build_cmd.changed

- name: Wait 30s for Operator Deployment to terminate
k8s_facts:
k8s_info:
api_version: '{{ definition.apiVersion }}'
kind: '{{ definition.kind }}'
namespace: '{{ namespace }}'
Expand All @@ -60,7 +60,7 @@
definition: "{{ custom_resource }}"

- name: Wait 2m for reconciliation to run
k8s_facts:
k8s_info:
api_version: '{{ custom_resource.apiVersion }}'
kind: '{{ custom_resource.kind }}'
namespace: '{{ namespace }}'
Expand Down
2 changes: 1 addition & 1 deletion test/ansible-memcached/asserts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
definition: '{{ custom_resource }}'

- name: Wait for the custom resource to be deleted
k8s_facts:
k8s_info:
api_version: '{{ custom_resource.apiVersion }}'
kind: '{{ custom_resource.kind }}'
namespace: '{{ namespace }}'
Expand Down