Skip to content

Commit

Permalink
Deprecate inventory plugin (#582)
Browse files Browse the repository at this point in the history
Deprecate inventory plugin

SUMMARY

Deprecate inventory plugin

ISSUE TYPE


Bugfix Pull Request
Docs Pull Request
Feature Pull Request
New Module Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION

Reviewed-by: Mike Graves <[email protected]>
Reviewed-by: Bikouo Aubin
  • Loading branch information
alinabuzachis authored Feb 16, 2023
1 parent 031cc7c commit 31c1ccf
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/20230206-deprecate-k8s-inventory.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
deprecated_features:
- k8s - the ``k8s`` inventory plugin has been deprecated and will be removed in release 4.0.0 (https://github.com/ansible-collections/kubernetes.core/issues/31).
6 changes: 6 additions & 0 deletions meta/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ plugin_routing:
inventory:
openshift:
redirect: community.okd.openshift
k8s:
deprecation:
removal_version: 4.0.0
warning_text: >-
The k8s inventory plugin has been deprecated and
will be removed in release 4.0.0.
modules:
k8s_auth:
redirect: community.okd.k8s_auth
Expand Down
13 changes: 13 additions & 0 deletions plugins/inventory/k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
- Uses the kubectl connection plugin to access the Kubernetes cluster.
- Uses k8s.(yml|yaml) YAML configuration file to set parameter values.
deprecated:
removed_in: 4.0.0
why: |
As discussed in U(https://github.com/ansible-collections/kubernetes.core/issues/31), we decided to
remove the k8s inventory plugin in release 4.0.0.
alternative: "Use M(kubernetes.core.k8s_info) and M(ansible.builtin.add_host) instead."
options:
plugin:
description: token that ensures this is a source file for the 'k8s' plugin.
Expand Down Expand Up @@ -155,6 +162,12 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):

def parse(self, inventory, loader, path, cache=True):
super(InventoryModule, self).parse(inventory, loader, path)

self.display.deprecated(
"The 'k8s' inventory plugin has been deprecated and will be removed in release 4.0.0",
version="4.0.0",
collection_name="kubernetes.core",
)
cache_key = self._get_cache_prefix(path)
config_data = self._read_config_data(path)
self.setup(config_data, cache, cache_key)
Expand Down

0 comments on commit 31c1ccf

Please sign in to comment.