Skip to content

Commit

Permalink
merge with main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
abikouo committed Mar 29, 2021
2 parents 263c41a + c9157ce commit 54aad1d
Show file tree
Hide file tree
Showing 26 changed files with 891 additions and 1,309 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,10 @@ jobs:
with:
python-version: ${{ matrix.python_version }}

# The 3.3.0 release of molecule introduced a breaking change. See
# https://github.com/ansible-community/molecule/issues/3083
- name: Install molecule and openshift dependencies
run: pip install ansible molecule yamllint openshift flake8
run: pip install ansible "molecule<3.3.0" yamllint openshift flake8

# The latest release doesn't work with Molecule currently.
# See: https://github.com/ansible-community/molecule/issues/2757
Expand Down Expand Up @@ -177,7 +179,7 @@ jobs:
python-version: ${{ matrix.python_version }}

- name: Install molecule and openshift dependencies
run: pip install "ansible>=2.9.0,<2.10.0" molecule yamllint openshift flake8
run: pip install "ansible>=2.9.0,<2.10.0" "molecule<3.3.0" yamllint openshift flake8

- name: Create default collection path symlink
run: |
Expand Down
2 changes: 2 additions & 0 deletions changelogs/fragments/379-remove-kubernetesrawmodule.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- remove the deprecated ``KubernetesRawModule`` class (https://github.com/ansible-collections/community.kubernetes/issues/232).
2 changes: 2 additions & 0 deletions changelogs/fragments/387-fix-helm-ignoring-context.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- helm - fix helm ignoring the kubeconfig context when passed through the ``context`` param or the ``K8S_AUTH_CONTEXT`` environment variable (https://github.com/ansible-collections/community.kubernetes/issues/385).
2 changes: 2 additions & 0 deletions changelogs/fragments/k8s_inventory.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- k8s - fix get_api_client API in k8s inventory plugin (https://github.com/ansible-collections/community.kubernetes/pull/395).
3 changes: 3 additions & 0 deletions meta/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ plugin_routing:
redirect: community.kubernetes.k8s_info
k8s_service:
redirect: community.kubernetes.k8s_info
inventory:
openshift:
redirect: community.okd.openshift
modules:
k8s_auth:
redirect: community.okd.k8s_auth
Expand Down
18 changes: 18 additions & 0 deletions molecule/default/roles/helm/tasks/tests_chart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,24 @@
that:
result.stat.exists

- name: Release using non-existent context
helm:
binary_path: "{{ helm_binary }}"
name: test
chart_ref: "{{ chart_source }}"
chart_version: "{{ chart_source_version | default(omit) }}"
namespace: "{{ helm_namespace }}"
create_namespace: true
context: does-not-exist
ignore_errors: yes
register: result

- name: Assert that release fails with non-existent context
assert:
that:
- result is failed
- "'context \"does-not-exist\" does not exist' in result.stderr"

always:
- name: Clean up temp dir
file:
Expand Down
8 changes: 4 additions & 4 deletions plugins/inventory/k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
plugin:
description: token that ensures this is a source file for the 'k8s' plugin.
required: True
choices: ['k8s']
choices: ['community.kubernetes.k8s', 'k8s']
connections:
description:
- Optional list of cluster connection settings. If no connections are provided, the default
Expand Down Expand Up @@ -117,7 +117,7 @@
import json

from ansible.errors import AnsibleError
from ansible_collections.community.kubernetes.plugins.module_utils.common import K8sAnsibleMixin, HAS_K8S_MODULE_HELPER, k8s_import_exception
from ansible_collections.community.kubernetes.plugins.module_utils.common import K8sAnsibleMixin, HAS_K8S_MODULE_HELPER, k8s_import_exception, get_api_client
from ansible.plugins.inventory import BaseInventoryPlugin, Constructable, Cacheable

try:
Expand Down Expand Up @@ -180,7 +180,7 @@ def fetch_objects(self, connections):
for connection in connections:
if not isinstance(connection, dict):
raise K8sInventoryException("Expecting connection to be a dictionary.")
client = self.get_api_client(**connection)
client = get_api_client(**connection)
name = connection.get('name', self.get_default_host_name(client.configuration.host))
if connection.get('namespaces'):
namespaces = connection['namespaces']
Expand All @@ -190,7 +190,7 @@ def fetch_objects(self, connections):
self.get_pods_for_namespace(client, name, namespace)
self.get_services_for_namespace(client, name, namespace)
else:
client = self.get_api_client()
client = get_api_client()
name = self.get_default_host_name(client.configuration.host)
namespaces = self.get_available_namespaces(client)
for namespace in namespaces:
Expand Down
202 changes: 0 additions & 202 deletions plugins/inventory/openshift.py

This file was deleted.

4 changes: 2 additions & 2 deletions plugins/lookup/k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
from ansible.module_utils.common._collections_compat import KeysView
from ansible.plugins.lookup import LookupBase

from ansible_collections.community.kubernetes.plugins.module_utils.common import K8sAnsibleMixin
from ansible_collections.community.kubernetes.plugins.module_utils.common import K8sAnsibleMixin, get_api_client


try:
Expand Down Expand Up @@ -235,7 +235,7 @@ def fail(self, msg=None):

def run(self, terms, variables=None, **kwargs):
self.params = kwargs
self.client = self.get_api_client()
self.client = get_api_client()

cluster_info = kwargs.get('cluster_info')
if cluster_info == 'version':
Expand Down
6 changes: 6 additions & 0 deletions plugins/module_utils/ansiblemodule.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from __future__ import (absolute_import, division, print_function)

__metaclass__ = type


from ansible.module_utils.basic import AnsibleModule # noqa: F401
Loading

0 comments on commit 54aad1d

Please sign in to comment.