[bp/1.2] Rename from community.kubernetes to kubernetes.core (#111)

This commit is contained in:
Mike Graves
2021-06-01 09:21:24 -04:00
committed by GitHub
parent 4846b38819
commit bf5d70e920
34 changed files with 190 additions and 521 deletions

View File

@@ -19,7 +19,7 @@ jobs:
- name: Check out code
uses: actions/checkout@v2
with:
path: ansible_collections/community/kubernetes
path: ansible_collections/kubernetes/core
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v1
@@ -31,7 +31,7 @@ jobs:
- name: Run sanity tests on Python ${{ matrix.python_version }}
run: make test-sanity PYTHON_VERSION=${{ matrix.python_version }}
working-directory: ./ansible_collections/community/kubernetes
working-directory: ./ansible_collections/kubernetes/core
integration:
runs-on: ubuntu-latest
@@ -43,7 +43,7 @@ jobs:
- name: Check out code
uses: actions/checkout@v2
with:
path: ansible_collections/community/kubernetes
path: ansible_collections/kubernetes/core
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v1
@@ -55,11 +55,11 @@ jobs:
- name: Run integration tests on Python ${{ matrix.python_version }}
run: make test-integration PYTHON_VERSION=${{ matrix.python_version }}
working-directory: ./ansible_collections/community/kubernetes
working-directory: ./ansible_collections/kubernetes/core
- name: Generate coverage report.
run: ansible-test coverage xml -v --requirements --group-by command --group-by version
working-directory: ./ansible_collections/community/kubernetes
working-directory: ./ansible_collections/kubernetes/core
- uses: codecov/codecov-action@v1
with:
@@ -74,7 +74,7 @@ jobs:
- name: Check out code
uses: actions/checkout@v2
with:
path: ansible_collections/community/kubernetes
path: ansible_collections/kubernetes/core
- name: Set up KinD cluster
uses: engineerd/setup-kind@v0.5.0
@@ -110,82 +110,4 @@ jobs:
- name: Run molecule default test scenario
run: make test-molecule
working-directory: ./ansible_collections/community/kubernetes
downstream-sanity-29:
runs-on: ubuntu-latest
strategy:
matrix:
python_version: ['3.7']
steps:
- name: Check out code
uses: actions/checkout@v2
with:
path: ansible_collections/community/kubernetes
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python_version }}
- name: Install ansible base (devel branch)
run: pip install "ansible>=2.9.0,<2.10.0"
- name: Run sanity tests on Python ${{ matrix.python_version }}
run: make downstream-test-sanity
working-directory: ./ansible_collections/community/kubernetes
downstream-integration-29:
runs-on: ubuntu-latest
strategy:
matrix:
# Our old integration tests fail under newer Python versions.
python_version: ['3.6']
steps:
- name: Check out code
uses: actions/checkout@v2
with:
path: ansible_collections/community/kubernetes
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python_version }}
- name: Install ansible base (devel branch)
run: pip install "ansible>=2.9.0,<2.10.0" pip==20.3.1
- name: Run integration tests on Python ${{ matrix.python_version }}
run: make downstream-test-integration
working-directory: ./ansible_collections/community/kubernetes
downstream-molecule-29:
runs-on: ubuntu-latest
strategy:
matrix:
python_version: ['3.7']
steps:
- name: Check out code
uses: actions/checkout@v2
with:
path: ansible_collections/community/kubernetes
- name: Set up KinD cluster
uses: engineerd/setup-kind@v0.5.0
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python_version }}
- name: Install molecule and openshift dependencies
run: pip install "ansible>=2.9.0,<2.10.0" "molecule<3.3.0" yamllint openshift flake8
- name: Create default collection path symlink
run: |
mkdir -p /home/runner/.ansible
ln -s /home/runner/work/kubernetes/kubernetes /home/runner/.ansible/collections
- name: Run molecule default test scenario
run: make downstream-test-molecule
working-directory: ./ansible_collections/community/kubernetes
working-directory: ./ansible_collections/kubernetes/core

View File

@@ -9,16 +9,16 @@ https://docs.ansible.com/ansible/latest/community/index.html).
## Kubernetes Collections
### community.kubernetes
### kubernetes.core
This collection contains modules and plugins contributed and maintained by the Ansible Kubernetes
community.
New modules and plugins developed by the community should be proposed to `community.kubernetes`.
New modules and plugins developed by the community should be proposed to `kubernetes.core`.
## Submitting Issues
All software has bugs, and the `community.kubernetes` collection is no exception. When you find a bug,
you can help tremendously by [telling us about it](https://github.com/ansible-collections/community.kubernetes/issues/new/choose).
All software has bugs, and the `kubernetes.core` collection is no exception. When you find a bug,
you can help tremendously by [telling us about it](https://github.com/ansible-collections/kubernetes.core/issues/new/choose).
If you should discover that the bug you're trying to file already exists in an issue,
you can help by verifying the behavior of the reported bug with a comment in that
@@ -28,7 +28,7 @@ issue, or by reporting any additional information.
All modules MUST have integration tests for new features.
Bug fixes for modules that currently have integration tests SHOULD have tests added.
New modules should be submitted to the [community.kubernetes](https://github.com/ansible-collections/community.kubernetes) collection and MUST have integration tests.
New modules should be submitted to the [kubernetes.core](https://github.com/ansible-collections/kubernetes.core) collection and MUST have integration tests.
Expected test criteria:
* Resource creation under check mode
@@ -52,7 +52,7 @@ especially the section on configuration for cloud tests. For questions about wri
### Code of Conduct
The `community.kubernetes` collection follows the Ansible project's
The `kubernetes.core` collection follows the Ansible project's
[Code of Conduct](https://docs.ansible.com/ansible/devel/community/code_of_conduct.html).
Please read and familiarize yourself with this document.
@@ -60,6 +60,6 @@ Please read and familiarize yourself with this document.
Our IRC channels may require you to register your nickname. If you receive an error when you connect, see
[Freenode's Nickname Registration guide](https://freenode.net/kb/answer/registration) for instructions.
The `#ansible-kubernetes` channel on Freenode IRC is the main and official place to discuss use and development of the `community.kubernetes` collection.
The `#ansible-kubernetes` channel on Freenode IRC is the main and official place to discuss use and development of the `kubernetes.core` collection.
For more information about Ansible's Kubernetes integration, browse the resources in the [Kubernetes Working Group](https://github.com/ansible/community/wiki/Kubernetes) Community wiki page.

View File

@@ -5,7 +5,7 @@ TEST_ARGS ?= ""
PYTHON_VERSION ?= `python -c 'import platform; print("{0}.{1}".format(platform.python_version_tuple()[0], platform.python_version_tuple()[1]))'`
clean:
rm -f community-kubernetes-${VERSION}.tar.gz
rm -f kubernetes-core-${VERSION}.tar.gz
rm -rf ansible_collections
rm -rf tests/output
@@ -13,10 +13,10 @@ build: clean
ansible-galaxy collection build
release: build
ansible-galaxy collection publish community-kubernetes-${VERSION}.tar.gz
ansible-galaxy collection publish kubernetes-core-${VERSION}.tar.gz
install: build
ansible-galaxy collection install -p ansible_collections community-kubernetes-${VERSION}.tar.gz
ansible-galaxy collection install -p ansible_collections kubernetes-core-${VERSION}.tar.gz
test-sanity:
ansible-test sanity --docker -v --color --python $(PYTHON_VERSION) $(?TEST_ARGS)
@@ -26,18 +26,3 @@ test-integration:
test-molecule:
molecule test
downstream-test-sanity:
./utils/downstream.sh -s
downstream-test-integration:
./utils/downstream.sh -i
downstream-test-molecule:
./utils/downstream.sh -m
downstream-build:
./utils/downstream.sh -b
downstream-release:
./utils/downstream.sh -r

View File

@@ -1,8 +1,8 @@
# Kubernetes Collection for Ansible
[![CI](https://github.com/ansible-collections/community.kubernetes/workflows/CI/badge.svg?event=push)](https://github.com/ansible-collections/community.kubernetes/actions) [![Codecov](https://img.shields.io/codecov/c/github/ansible-collections/community.kubernetes)](https://codecov.io/gh/ansible-collections/community.kubernetes)
[![CI](https://github.com/ansible-collections/kubernetes.core/workflows/CI/badge.svg?event=push)](https://github.com/ansible-collections/kubernetes.core/actions) [![Codecov](https://img.shields.io/codecov/c/github/ansible-collections/kubernetes.core)](https://codecov.io/gh/ansible-collections/kubernetes.core)
This repo hosts the `community.kubernetes` (a.k.a. `kubernetes.core`) Ansible Collection.
This repo hosts the `kubernetes.core` (formerly known as `community.kubernetes`) Ansible Collection.
The collection includes a variety of Ansible content to help automate the management of applications in Kubernetes and OpenShift clusters, as well as the provisioning and maintenance of clusters themselves.
@@ -22,7 +22,7 @@ Click on the name of a plugin or module to view that content's documentation:
- **Modules**:
- [k8s](https://docs.ansible.com/ansible/2.10/collections/community/kubernetes/k8s_module.html)
- [k8s_auth](https://docs.ansible.com/ansible/2.10/collections/community/kubernetes/k8s_auth_module.html)
- [k8s_cluster_info](https://github.com/ansible-collections/community.kubernetes/blob/main/plugins/modules/k8s_cluster_info.py)
- [k8s_cluster_info](https://github.com/ansible-collections/kubernetes.core/blob/main/plugins/modules/k8s_cluster_info.py)
- [k8s_exec](https://docs.ansible.com/ansible/2.10/collections/community/kubernetes/k8s_exec_module.html)
- [k8s_info](https://docs.ansible.com/ansible/2.10/collections/community/kubernetes/k8s_info_module.html)
- [k8s_log](https://docs.ansible.com/ansible/2.10/collections/community/kubernetes/k8s_log_module.html)
@@ -30,8 +30,8 @@ Click on the name of a plugin or module to view that content's documentation:
- [k8s_service](https://docs.ansible.com/ansible/2.10/collections/community/kubernetes/k8s_service_module.html)
- [helm](https://docs.ansible.com/ansible/2.10/collections/community/kubernetes/helm_module.html)
- [helm_info](https://docs.ansible.com/ansible/2.10/collections/community/kubernetes/helm_info_module.html)
- [helm_plugin](https://github.com/ansible-collections/community.kubernetes/blob/main/plugins/modules/helm_plugin.py)
- [helm_plugin_info](https://github.com/ansible-collections/community.kubernetes/blob/main/plugins/modules/helm_plugin_info.py)
- [helm_plugin](https://github.com/ansible-collections/kubernetes.core/blob/main/plugins/modules/helm_plugin.py)
- [helm_plugin_info](https://github.com/ansible-collections/kubernetes.core/blob/main/plugins/modules/helm_plugin_info.py)
- [helm_repository](https://docs.ansible.com/ansible/2.10/collections/community/kubernetes/helm_repository_module.html)
## Installation and Usage
@@ -40,14 +40,14 @@ Click on the name of a plugin or module to view that content's documentation:
Before using the Kubernetes collection, you need to install it with the Ansible Galaxy CLI:
ansible-galaxy collection install community.kubernetes
ansible-galaxy collection install kubernetes.core
You can also include it in a `requirements.yml` file and install it via `ansible-galaxy collection install -r requirements.yml`, using the format:
```yaml
---
collections:
- name: community.kubernetes
- name: kubernetes.core
version: 1.2.1
```
@@ -59,7 +59,7 @@ Content in this collection requires the [OpenShift Python client](https://pypi.o
### Using modules from the Kubernetes Collection in your playbooks
It's preferable to use content in this collection using their Fully Qualified Collection Namespace (FQCN), for example `community.kubernetes.k8s_info`:
It's preferable to use content in this collection using their Fully Qualified Collection Namespace (FQCN), for example `kubernetes.core.k8s_info`:
```yaml
---
@@ -69,14 +69,14 @@ It's preferable to use content in this collection using their Fully Qualified Co
tasks:
- name: Ensure the myapp Namespace exists.
community.kubernetes.k8s:
kubernetes.core.k8s:
api_version: v1
kind: Namespace
name: myapp
state: present
- name: Ensure the myapp Service exists in the myapp Namespace.
community.kubernetes.k8s:
kubernetes.core.k8s:
state: present
definition:
apiVersion: v1
@@ -93,7 +93,7 @@ It's preferable to use content in this collection using their Fully Qualified Co
app: myapp
- name: Get a list of all Services in the myapp namespace.
community.kubernetes.k8s_info:
kubernetes.core.k8s_info:
kind: Service
namespace: myapp
register: myapp_services
@@ -112,7 +112,7 @@ If upgrading older playbooks which were built prior to Ansible 2.10 and this col
connection: local
collections:
- community.kubernetes
- kubernetes.core
tasks:
- name: Ensure the myapp Namespace exists.
@@ -129,7 +129,7 @@ For documentation on how to use individual modules and other content included in
If you want to develop new content for this collection or improve what's already here, the easiest way to work on the collection is to clone it into one of the configured [`COLLECTIONS_PATHS`](https://docs.ansible.com/ansible/latest/reference_appendices/config.html#collections-paths), and work on it there.
See [Contributing to community.kubernetes](CONTRIBUTING.md).
See [Contributing to kubernetes.core](CONTRIBUTING.md).
### Testing with `ansible-test`
@@ -154,25 +154,15 @@ Releases are automatically built and pushed to Ansible Galaxy for any new tag. B
1. Update the version in the following places:
1. The `version` in `galaxy.yml`
2. This README's `requirements.yml` example
3. The `DOWNSTREAM_VERSION` in `utils/downstream.sh`
4. The `VERSION` in `Makefile`
3. The `VERSION` in `Makefile`
2. Update the CHANGELOG:
1. Make sure you have [`antsibull-changelog`](https://pypi.org/project/antsibull-changelog/) installed.
2. Make sure there are fragments for all known changes in `changelogs/fragments`.
3. Run `antsibull-changelog release`.
3. Commit the changes and create a PR with the changes. Wait for tests to pass, then merge it once they have.
4. Tag the version in Git and push to GitHub.
5. Manually build and release the `kubernetes.core` collection (see following section).
After the version is published, verify it exists on the [Kubernetes Collection Galaxy page](https://galaxy.ansible.com/community/kubernetes).
### Publishing `kubernetes.core`
Until the contents of repository are moved into a new `kubernetes.core` repository on GitHub, this repository is the source of both the `kubernetes.core` and `community.kubernetes` repositories on Ansible Galaxy.
To publish the `kubernetes.core` collection on Ansible Galaxy, do the following:
1. Run `make downstream-release` (on macOS, add `LC_ALL=C` before the command).
After the version is published, verify it exists on the [Kubernetes Collection Galaxy page](https://galaxy.ansible.com/kubernetes/core).
The process for uploading a supported release to Automation Hub is documented separately.

View File

@@ -12,12 +12,12 @@ dependencies: {}
description: Kubernetes Collection for Ansible.
documentation: ''
homepage: ''
issues: https://github.com/ansible-collections/community.kubernetes/issues
issues: https://github.com/ansible-collections/kubernetes.core/issues
license_file: LICENSE
name: kubernetes
namespace: community
name: core
namespace: kubernetes
readme: README.md
repository: https://github.com/ansible-collections/community.kubernetes
repository: https://github.com/ansible-collections/kubernetes.core
tags:
- kubernetes
- k8s

View File

@@ -19,54 +19,54 @@ action_groups:
plugin_routing:
action:
helm:
redirect: community.kubernetes.k8s_info
redirect: kubernetes.core.k8s_info
helm_info:
redirect: community.kubernetes.k8s_info
redirect: kubernetes.core.k8s_info
helm_plugin:
redirect: community.kubernetes.k8s_info
redirect: kubernetes.core.k8s_info
helm_plugin_info:
redirect: community.kubernetes.k8s_info
redirect: kubernetes.core.k8s_info
helm_repository:
redirect: community.kubernetes.k8s_info
redirect: kubernetes.core.k8s_info
k8s:
redirect: community.kubernetes.k8s_info
redirect: kubernetes.core.k8s_info
k8s_auth:
redirect: community.kubernetes.k8s_info
redirect: kubernetes.core.k8s_info
k8s_cluster_info:
redirect: community.kubernetes.k8s_info
redirect: kubernetes.core.k8s_info
k8s_event_info:
redirect: community.kubernetes.k8s_info
redirect: kubernetes.core.k8s_info
k8s_exec:
redirect: community.kubernetes.k8s_info
redirect: kubernetes.core.k8s_info
k8s_log:
redirect: community.kubernetes.k8s_info
redirect: kubernetes.core.k8s_info
k8s_rollback:
redirect: community.kubernetes.k8s_info
redirect: kubernetes.core.k8s_info
k8s_scale:
redirect: community.kubernetes.k8s_info
redirect: kubernetes.core.k8s_info
k8s_service:
redirect: community.kubernetes.k8s_info
redirect: kubernetes.core.k8s_info
modules:
# k8s_facts was originally slated for removal in Ansible 2.13.
k8s_facts:
redirect: community.kubernetes.k8s_info
redirect: kubernetes.core.k8s_info
deprecation:
removal_version: 2.0.0
warning_text: Use community.kubernetes.k8s_info instead.
warning_text: Use kubernetes.core.k8s_info instead.
k8s_raw:
tombstone:
removal_version: 0.1.0
warning_text: The k8s_raw module was slated for deprecation in Ansible 2.10 and has been removed. Use community.kubernetes.k8s instead.
warning_text: The k8s_raw module was slated for deprecation in Ansible 2.10 and has been removed. Use kubernetes.core.k8s instead.
openshift_raw:
tombstone:
removal_version: 0.1.0
warning_text: The openshift_raw module was slated for deprecation in Ansible 2.10 and has been removed. Use community.kubernetes.k8s instead.
warning_text: The openshift_raw module was slated for deprecation in Ansible 2.10 and has been removed. Use kubernetes.core.k8s instead.
openshift_scale:
tombstone:
removal_version: 0.1.0
warning_text: The openshift_scale module was slated for deprecation in Ansible 2.10 and has been removed. Use community.kubernetes.k8s_scale instead.
warning_text: The openshift_scale module was slated for deprecation in Ansible 2.10 and has been removed. Use kubernetes.core.k8s_scale instead.
lookup:
openshift:
tombstone:
removal_version: 0.1.0
warning_text: The openshift lookup plugin was slated for deprecation in Ansible 2.10 and has been removed. Use community.kubernetes.k8s instead.
warning_text: The openshift lookup plugin was slated for deprecation in Ansible 2.10 and has been removed. Use kubernetes.core.k8s instead.

View File

@@ -4,7 +4,7 @@
connection: local
collections:
- community.kubernetes
- kubernetes.core
vars_files:
- vars/main.yml

View File

@@ -17,11 +17,11 @@ provisioner:
log: true
config_options:
inventory:
enable_plugins: community.kubernetes.k8s
enable_plugins: kubernetes.core.k8s
lint: {}
inventory:
hosts:
plugin: community.kubernetes.k8s
plugin: kubernetes.core.k8s
host_vars:
localhost:
ansible_python_interpreter: '{{ ansible_playbook_python }}'

View File

@@ -12,7 +12,7 @@
name: "{{ template_namespace }}"
- name: Check if k8s_service does not inherit parameter
community.kubernetes.k8s_service:
kubernetes.core.k8s_service:
template: "pod_template_one.j2"
state: present
ignore_errors: yes
@@ -25,7 +25,7 @@
- "'is only supported parameter for' in r.msg"
- name: Specify both definition and template
community.kubernetes.k8s:
kubernetes.core.k8s:
state: present
template: "pod_template_one.j2"
definition:
@@ -52,7 +52,7 @@
- "'parameters are mutually exclusive' in r.msg"
- name: Specify both src and template
community.kubernetes.k8s:
kubernetes.core.k8s:
state: present
src: "../templates/pod_template_one.j2"
template: "pod_template_one.j2"
@@ -69,7 +69,7 @@
- "'parameters are mutually exclusive' in r.msg"
- name: Create pod using template (direct specification)
community.kubernetes.k8s:
kubernetes.core.k8s:
template: "pod_template_one.j2"
wait: yes
vars:
@@ -83,7 +83,7 @@
- r is successful
- name: Create pod using template with wrong parameter
community.kubernetes.k8s:
kubernetes.core.k8s:
template:
- default
wait: yes
@@ -100,7 +100,7 @@
- "'Error while reading template file' in r.msg"
- name: Create pod using template (path parameter)
community.kubernetes.k8s:
kubernetes.core.k8s:
template:
path: "pod_template_one.j2"
wait: yes
@@ -115,7 +115,7 @@
- r is successful
- name: Create pod using template (different variable string)
community.kubernetes.k8s:
kubernetes.core.k8s:
template:
path: "pod_template_two.j2"
variable_start_string: '[['
@@ -133,7 +133,7 @@
- r is successful
- name: Create pods using multi-resource template
community.kubernetes.k8s:
kubernetes.core.k8s:
template:
path: "pod_template_three.j2"
wait: yes

View File

@@ -66,7 +66,7 @@ class ActionModule(ActionBase):
def load_template(self, template, new_module_args, task_vars):
# template is only supported by k8s module.
if self._task.action not in ('k8s', 'community.kubernetes.k8s', 'community.okd.k8s'):
if self._task.action not in ('k8s', 'kubernetes.core.k8s', 'community.okd.k8s'):
raise AnsibleActionFail("'template' is only supported parameter for 'k8s' module.")
if isinstance(template, string_types):
# treat this as raw_params

View File

@@ -95,20 +95,20 @@ EXAMPLES = '''
# File must be named k8s.yaml or k8s.yml
# Authenticate with token, and return all pods and services for all namespaces
plugin: community.kubernetes.k8s
plugin: kubernetes.core.k8s
connections:
- host: https://192.168.64.4:8443
api_key: xxxxxxxxxxxxxxxx
validate_certs: false
# Use default config (~/.kube/config) file and active context, and return objects for a specific namespace
plugin: community.kubernetes.k8s
plugin: kubernetes.core.k8s
connections:
- namespaces:
- testing
# Use a custom config file, and a specific context.
plugin: community.kubernetes.k8s
plugin: kubernetes.core.k8s
connections:
- kubeconfig: /path/to/config
context: 'awx/192-168-64-4:8443/developer'
@@ -118,10 +118,10 @@ import json
from ansible.errors import AnsibleError
from ansible.plugins.inventory import BaseInventoryPlugin, Constructable, Cacheable
from ansible_collections.community.kubernetes.plugins.module_utils.common import (
from ansible_collections.kubernetes.core.plugins.module_utils.common import (
K8sAnsibleMixin, HAS_K8S_MODULE_HELPER, k8s_import_exception
)
from ansible_collections.community.kubernetes.plugins.module_utils.exceptions import K8sInventoryException
from ansible_collections.kubernetes.core.plugins.module_utils.exceptions import K8sInventoryException
try:
from openshift.dynamic.exceptions import DynamicApiError
@@ -141,9 +141,9 @@ def format_dynamic_api_exc(exc):
class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable, K8sAnsibleMixin):
NAME = 'community.kubernetes.k8s'
NAME = 'kubernetes.core.k8s'
connection_plugin = 'community.kubernetes.kubectl'
connection_plugin = 'kubernetes.core.kubectl'
transport = 'kubectl'
def parse(self, inventory, loader, path, cache=True):

View File

@@ -94,26 +94,26 @@ EXAMPLES = '''
# File must be named openshift.yaml or openshift.yml
# Authenticate with token, and return all pods and services for all namespaces
plugin: community.kubernetes.openshift
plugin: kubernetes.core.openshift
connections:
- host: https://192.168.64.4:8443
api_key: xxxxxxxxxxxxxxxx
verify_ssl: false
# Use default config (~/.kube/config) file and active context, and return objects for a specific namespace
plugin: community.kubernetes.openshift
plugin: kubernetes.core.openshift
connections:
- namespaces:
- testing
# Use a custom config file, and a specific context.
plugin: community.kubernetes.openshift
plugin: kubernetes.core.openshift
connections:
- kubeconfig: /path/to/config
context: 'awx/192-168-64-4:8443/developer'
'''
from ansible_collections.community.kubernetes.plugins.inventory.k8s import K8sInventoryException, InventoryModule as K8sInventoryModule, format_dynamic_api_exc
from ansible_collections.kubernetes.core.plugins.inventory.k8s import K8sInventoryException, InventoryModule as K8sInventoryModule, format_dynamic_api_exc
try:
from openshift.dynamic.exceptions import DynamicApiError
@@ -122,7 +122,7 @@ except ImportError:
class InventoryModule(K8sInventoryModule):
NAME = 'community.kubernetes.openshift'
NAME = 'kubernetes.core.openshift'
transport = 'oc'

View File

@@ -133,23 +133,23 @@ DOCUMENTATION = '''
EXAMPLES = """
- name: Fetch a list of namespaces
set_fact:
projects: "{{ lookup('community.kubernetes.k8s', api_version='v1', kind='Namespace') }}"
projects: "{{ lookup('kubernetes.core.k8s', api_version='v1', kind='Namespace') }}"
- name: Fetch all deployments
set_fact:
deployments: "{{ lookup('community.kubernetes.k8s', kind='Deployment') }}"
deployments: "{{ lookup('kubernetes.core.k8s', kind='Deployment') }}"
- name: Fetch all deployments in a namespace
set_fact:
deployments: "{{ lookup('community.kubernetes.k8s', kind='Deployment', namespace='testing') }}"
deployments: "{{ lookup('kubernetes.core.k8s', kind='Deployment', namespace='testing') }}"
- name: Fetch a specific deployment by name
set_fact:
deployments: "{{ lookup('community.kubernetes.k8s', kind='Deployment', namespace='testing', resource_name='elastic') }}"
deployments: "{{ lookup('kubernetes.core.k8s', kind='Deployment', namespace='testing', resource_name='elastic') }}"
- name: Fetch with label selector
set_fact:
service: "{{ lookup('community.kubernetes.k8s', kind='Service', label_selector='app=galaxy') }}"
service: "{{ lookup('kubernetes.core.k8s', kind='Service', label_selector='app=galaxy') }}"
# Use parameters from a YAML config
@@ -159,11 +159,11 @@ EXAMPLES = """
- name: Using the config (loaded from a file in prior task), fetch the latest version of the object
set_fact:
service: "{{ lookup('community.kubernetes.k8s', resource_definition=config) }}"
service: "{{ lookup('kubernetes.core.k8s', resource_definition=config) }}"
- name: Use a config from the local filesystem
set_fact:
service: "{{ lookup('community.kubernetes.k8s', src='service.yml') }}"
service: "{{ lookup('kubernetes.core.k8s', src='service.yml') }}"
"""
RETURN = """
@@ -198,7 +198,7 @@ from ansible.errors import AnsibleError
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.kubernetes.core.plugins.module_utils.common import K8sAnsibleMixin
try:

View File

@@ -31,7 +31,7 @@ from ansible.module_utils.six import iteritems, string_types
from ansible.module_utils._text import to_native, to_bytes, to_text
from ansible.module_utils.common.dict_transformations import dict_merge
from ansible.module_utils.parsing.convert_bool import boolean
from ansible_collections.community.kubernetes.plugins.module_utils.exceptions import K8sInventoryException
from ansible_collections.kubernetes.core.plugins.module_utils.exceptions import K8sInventoryException
K8S_IMP_ERR = None

View File

@@ -22,7 +22,7 @@ __metaclass__ = type
import copy
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.kubernetes.plugins.module_utils.common import (
from ansible_collections.kubernetes.core.plugins.module_utils.common import (
K8sAnsibleMixin, AUTH_ARG_SPEC, COMMON_ARG_SPEC, RESOURCE_ARG_SPEC, NAME_ARG_SPEC)

View File

@@ -22,7 +22,7 @@ __metaclass__ = type
import copy
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.kubernetes.plugins.module_utils.common import (
from ansible_collections.kubernetes.core.plugins.module_utils.common import (
AUTH_ARG_SPEC, RESOURCE_ARG_SPEC, NAME_ARG_SPEC, K8sAnsibleMixin)
try:

View File

@@ -140,12 +140,12 @@ options:
default: False
version_added: "1.2.0"
extends_documentation_fragment:
- community.kubernetes.helm_common_options
- kubernetes.core.helm_common_options
'''
EXAMPLES = r'''
- name: Deploy latest version of Prometheus chart inside monitoring namespace (and create it)
community.kubernetes.helm:
kubernetes.core.helm:
name: test
chart_ref: stable/prometheus
release_namespace: monitoring
@@ -153,12 +153,12 @@ EXAMPLES = r'''
# From repository
- name: Add stable chart repo
community.kubernetes.helm_repository:
kubernetes.core.helm_repository:
name: stable
repo_url: "https://kubernetes.github.io/ingress-nginx"
- name: Deploy latest version of Grafana chart inside monitoring namespace with values
community.kubernetes.helm:
kubernetes.core.helm:
name: test
chart_ref: stable/grafana
release_namespace: monitoring
@@ -166,14 +166,14 @@ EXAMPLES = r'''
replicas: 2
- name: Deploy Grafana chart on 5.0.12 with values loaded from template
community.kubernetes.helm:
kubernetes.core.helm:
name: test
chart_ref: stable/grafana
chart_version: 5.0.12
values: "{{ lookup('template', 'somefile.yaml') | from_yaml }}"
- name: Deploy Grafana chart using values files on target
community.kubernetes.helm:
kubernetes.core.helm:
name: test
chart_ref: stable/grafana
release_namespace: monitoring
@@ -181,7 +181,7 @@ EXAMPLES = r'''
- /path/to/values.yaml
- name: Remove test release and waiting suppression ending
community.kubernetes.helm:
kubernetes.core.helm:
name: test
state: absent
wait: true
@@ -193,14 +193,14 @@ EXAMPLES = r'''
dest: /tmp/helm_repo
- name: Deploy Grafana chart from local path
community.kubernetes.helm:
kubernetes.core.helm:
name: test
chart_ref: /tmp/helm_repo/stable/grafana
release_namespace: monitoring
# From url
- name: Deploy Grafana chart on 5.6.0 from url
community.kubernetes.helm:
kubernetes.core.helm:
name: test
chart_ref: "https://github.com/grafana/helm-charts/releases/download/grafana-5.6.0/grafana-5.6.0.tgz"
release_namespace: monitoring
@@ -272,7 +272,7 @@ except ImportError:
IMP_YAML = False
from ansible.module_utils.basic import AnsibleModule, missing_required_lib, env_fallback
from ansible_collections.community.kubernetes.plugins.module_utils.helm import run_helm, get_values
from ansible_collections.kubernetes.core.plugins.module_utils.helm import run_helm, get_values
def get_release(state, release_name):

View File

@@ -39,12 +39,12 @@ options:
type: str
aliases: [ namespace ]
extends_documentation_fragment:
- community.kubernetes.helm_common_options
- kubernetes.core.helm_common_options
'''
EXAMPLES = r'''
- name: Deploy latest version of Grafana chart inside monitoring namespace
community.kubernetes.helm_info:
kubernetes.core.helm_info:
name: test
release_namespace: monitoring
'''
@@ -99,7 +99,7 @@ except ImportError:
IMP_YAML = False
from ansible.module_utils.basic import AnsibleModule, missing_required_lib, env_fallback
from ansible_collections.community.kubernetes.plugins.module_utils.helm import run_helm, get_values
from ansible_collections.kubernetes.core.plugins.module_utils.helm import run_helm, get_values
# Get Release from all deployed releases

View File

@@ -47,22 +47,22 @@ options:
- Required only if C(state=present).
type: str
extends_documentation_fragment:
- community.kubernetes.helm_common_options
- kubernetes.core.helm_common_options
'''
EXAMPLES = r'''
- name: Install Helm env plugin
community.kubernetes.helm_plugin:
kubernetes.core.helm_plugin:
plugin_path: https://github.com/adamreese/helm-env
state: present
- name: Install Helm plugin from local filesystem
community.kubernetes.helm_plugin:
kubernetes.core.helm_plugin:
plugin_path: https://domain/path/to/plugin.tar.gz
state: present
- name: Remove Helm env plugin
community.kubernetes.helm_plugin:
kubernetes.core.helm_plugin:
plugin_name: env
state: absent
'''
@@ -96,7 +96,7 @@ rc:
'''
from ansible.module_utils.basic import AnsibleModule, env_fallback
from ansible_collections.community.kubernetes.plugins.module_utils.helm import run_helm
from ansible_collections.kubernetes.core.plugins.module_utils.helm import run_helm
def main():

View File

@@ -32,15 +32,15 @@ options:
- Name of Helm plugin, to gather particular plugin info.
type: str
extends_documentation_fragment:
- community.kubernetes.helm_common_options
- kubernetes.core.helm_common_options
'''
EXAMPLES = r'''
- name: Gather Helm plugin info
community.kubernetes.helm_plugin_info:
kubernetes.core.helm_plugin_info:
- name: Gather Helm env plugin info
community.kubernetes.helm_plugin_info:
kubernetes.core.helm_plugin_info:
plugin_name: env
'''
@@ -77,7 +77,7 @@ rc:
'''
from ansible.module_utils.basic import AnsibleModule, env_fallback
from ansible_collections.community.kubernetes.plugins.module_utils.helm import run_helm
from ansible_collections.kubernetes.core.plugins.module_utils.helm import run_helm
def main():

View File

@@ -68,12 +68,12 @@ options:
EXAMPLES = r'''
- name: Add a repository
community.kubernetes.helm_repository:
kubernetes.core.helm_repository:
name: stable
repo_url: https://kubernetes.github.io/ingress-nginx
- name: Add Red Hat Helm charts repository
community.kubernetes.helm_repository:
kubernetes.core.helm_repository:
name: redhat-charts
repo_url: https://redhat-developer.github.com/redhat-helm-charts
'''
@@ -121,7 +121,7 @@ except ImportError:
IMP_YAML = False
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
from ansible_collections.community.kubernetes.plugins.module_utils.helm import run_helm
from ansible_collections.kubernetes.core.plugins.module_utils.helm import run_helm
# Get repository from all repositories added

View File

@@ -83,12 +83,12 @@ options:
EXAMPLES = r'''
- name: Render templates to specified directory
community.kubernetes.helm_template:
kubernetes.core.helm_template:
chart_ref: stable/prometheus
output_dir: mycharts
- name: Render templates
community.kubernetes.helm_template:
kubernetes.core.helm_template:
chart_ref: stable/prometheus
register: result
@@ -127,7 +127,7 @@ except ImportError:
IMP_YAML = False
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
from ansible_collections.community.kubernetes.plugins.module_utils.helm import run_helm
from ansible_collections.kubernetes.core.plugins.module_utils.helm import run_helm
def template(cmd, chart_ref, chart_repo_url=None, chart_version=None, output_dir=None,

View File

@@ -24,17 +24,17 @@ description:
- Pass the object definition from a source file or inline. See examples for reading
files and using Jinja templates or vault-encrypted files.
- Access to the full range of K8s APIs.
- Use the M(community.kubernetes.k8s_info) module to obtain a list of items about an object of type C(kind)
- Use the M(kubernetes.core.k8s_info) module to obtain a list of items about an object of type C(kind)
- Authenticate using either a config file, certificates, password or token.
- Supports check mode.
extends_documentation_fragment:
- community.kubernetes.k8s_state_options
- community.kubernetes.k8s_name_options
- community.kubernetes.k8s_resource_options
- community.kubernetes.k8s_auth_options
- community.kubernetes.k8s_wait_options
- community.kubernetes.k8s_delete_options
- kubernetes.core.k8s_state_options
- kubernetes.core.k8s_name_options
- kubernetes.core.k8s_resource_options
- kubernetes.core.k8s_auth_options
- kubernetes.core.k8s_wait_options
- kubernetes.core.k8s_delete_options
notes:
- If your OpenShift Python library is not 0.9.0 or newer and you are trying to
@@ -132,14 +132,14 @@ requirements:
EXAMPLES = r'''
- name: Create a k8s namespace
community.kubernetes.k8s:
kubernetes.core.k8s:
name: testing
api_version: v1
kind: Namespace
state: present
- name: Create a Service object from an inline definition
community.kubernetes.k8s:
kubernetes.core.k8s:
state: present
definition:
apiVersion: v1
@@ -161,7 +161,7 @@ EXAMPLES = r'''
port: 8000
- name: Remove an existing Service object
community.kubernetes.k8s:
kubernetes.core.k8s:
state: absent
api_version: v1
kind: Service
@@ -171,24 +171,24 @@ EXAMPLES = r'''
# Passing the object definition from a file
- name: Create a Deployment by reading the definition from a local file
community.kubernetes.k8s:
kubernetes.core.k8s:
state: present
src: /testing/deployment.yml
- name: >-
Read definition file from the Ansible controller file system.
If the definition file has been encrypted with Ansible Vault it will automatically be decrypted.
community.kubernetes.k8s:
kubernetes.core.k8s:
state: present
definition: "{{ lookup('file', '/testing/deployment.yml') | from_yaml }}"
- name: Read definition template file from the Ansible controller file system
community.kubernetes.k8s:
kubernetes.core.k8s:
state: present
template: '/testing/deployment.j2'
- name: Read definition template file from the Ansible controller file system that uses custom start/end strings
community.kubernetes.k8s:
kubernetes.core.k8s:
state: present
template:
path: '/testing/deployment.j2'
@@ -196,14 +196,14 @@ EXAMPLES = r'''
variable_end_string: ']]'
- name: fail on validation errors
community.kubernetes.k8s:
kubernetes.core.k8s:
state: present
definition: "{{ lookup('template', '/testing/deployment.yml') | from_yaml }}"
validate:
fail_on_error: yes
- name: warn on validation errors, check for unexpected properties
community.kubernetes.k8s:
kubernetes.core.k8s:
state: present
definition: "{{ lookup('template', '/testing/deployment.yml') | from_yaml }}"
validate:
@@ -218,7 +218,7 @@ EXAMPLES = r'''
mode: '0664'
- name: Apply metrics-server manifest to the cluster.
community.kubernetes.k8s:
kubernetes.core.k8s:
state: present
src: ~/metrics-server.yaml
'''
@@ -264,7 +264,7 @@ result:
import copy
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.kubernetes.plugins.module_utils.common import (
from ansible_collections.kubernetes.core.plugins.module_utils.common import (
K8sAnsibleMixin, COMMON_ARG_SPEC, NAME_ARG_SPEC, RESOURCE_ARG_SPEC, AUTH_ARG_SPEC,
WAIT_ARG_SPEC, DELETE_OPTS_ARG_SPEC)

View File

@@ -88,7 +88,7 @@ EXAMPLES = r'''
- include_vars: k8s_passwords.yml
- name: Log in (obtain access token)
community.kubernetes.k8s_auth:
kubernetes.core.k8s_auth:
username: admin
password: "{{ k8s_admin_password }}"
register: k8s_auth_results
@@ -96,7 +96,7 @@ EXAMPLES = r'''
# Previous task provides the token/api_key, while all other parameters
# are taken from module_defaults
- name: Get a list of all pods from any namespace
community.kubernetes.k8s_info:
kubernetes.core.k8s_info:
api_key: "{{ k8s_auth_results.k8s_auth.api_key }}"
kind: Pod
register: pod_list
@@ -104,7 +104,7 @@ EXAMPLES = r'''
always:
- name: If login succeeded, try to log out (revoke access token)
when: k8s_auth_results.k8s_auth.api_key is defined
community.kubernetes.k8s_auth:
kubernetes.core.k8s_auth:
state: absent
api_key: "{{ k8s_auth_results.k8s_auth.api_key }}"
'''

View File

@@ -30,7 +30,7 @@ options:
default: True
extends_documentation_fragment:
- community.kubernetes.k8s_auth_options
- kubernetes.core.k8s_auth_options
requirements:
- "python >= 2.7"
@@ -40,11 +40,11 @@ requirements:
EXAMPLES = r'''
- name: Get Cluster information
community.kubernetes.k8s_cluster_info:
kubernetes.core.k8s_cluster_info:
register: api_status
- name: Do not invalidate cache before getting information
community.kubernetes.k8s_cluster_info:
kubernetes.core.k8s_cluster_info:
invalidate_cache: False
register: api_status
'''
@@ -163,7 +163,7 @@ import traceback
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
from ansible.module_utils.parsing.convert_bool import boolean
from ansible_collections.community.kubernetes.plugins.module_utils.common import K8sAnsibleMixin, AUTH_ARG_SPEC
from ansible_collections.kubernetes.core.plugins.module_utils.common import K8sAnsibleMixin, AUTH_ARG_SPEC
try:
try:

View File

@@ -23,7 +23,7 @@ description:
- Use the Kubernetes Python client to execute command on K8s pods.
extends_documentation_fragment:
- community.kubernetes.k8s_auth_options
- kubernetes.core.k8s_auth_options
requirements:
- "python >= 2.7"
@@ -66,13 +66,13 @@ options:
EXAMPLES = r'''
- name: Execute a command
community.kubernetes.k8s_exec:
kubernetes.core.k8s_exec:
namespace: myproject
pod: zuul-scheduler
command: zuul-scheduler full-reconfigure
- name: Check RC status of command executed
community.kubernetes.k8s_exec:
kubernetes.core.k8s_exec:
namespace: myproject
pod: busybox-test
command: cmd_with_non_zero_exit_code
@@ -120,7 +120,7 @@ except ImportError:
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils._text import to_native
from ansible_collections.community.kubernetes.plugins.module_utils.common import (
from ansible_collections.kubernetes.core.plugins.module_utils.common import (
K8sAnsibleMixin, AUTH_ARG_SPEC
)

View File

@@ -44,9 +44,9 @@ options:
elements: str
extends_documentation_fragment:
- community.kubernetes.k8s_auth_options
- community.kubernetes.k8s_name_options
- community.kubernetes.k8s_wait_options
- kubernetes.core.k8s_auth_options
- kubernetes.core.k8s_name_options
- kubernetes.core.k8s_wait_options
requirements:
- "python >= 2.7"
@@ -56,7 +56,7 @@ requirements:
EXAMPLES = r'''
- name: Get an existing Service object
community.kubernetes.k8s_info:
kubernetes.core.k8s_info:
api_version: v1
kind: Service
name: web
@@ -64,26 +64,26 @@ EXAMPLES = r'''
register: web_service
- name: Get a list of all service objects
community.kubernetes.k8s_info:
kubernetes.core.k8s_info:
api_version: v1
kind: Service
namespace: testing
register: service_list
- name: Get a list of all pods from any namespace
community.kubernetes.k8s_info:
kubernetes.core.k8s_info:
kind: Pod
register: pod_list
- name: Search for all Pods labelled app=web
community.kubernetes.k8s_info:
kubernetes.core.k8s_info:
kind: Pod
label_selectors:
- app = web
- tier in (dev, test)
- name: Using vars while using label_selectors
community.kubernetes.k8s_info:
kubernetes.core.k8s_info:
kind: Pod
label_selectors:
- "app = {{ app_label_web }}"
@@ -91,18 +91,18 @@ EXAMPLES = r'''
app_label_web: web
- name: Search for all running pods
community.kubernetes.k8s_info:
kubernetes.core.k8s_info:
kind: Pod
field_selectors:
- status.phase=Running
- name: List custom objects created using CRD
community.kubernetes.k8s_info:
kubernetes.core.k8s_info:
kind: MyCustomObject
api_version: "stable.example.com/v1"
- name: Wait till the Object is created
community.kubernetes.k8s_info:
kubernetes.core.k8s_info:
kind: Pod
wait: yes
name: pod-not-yet-created
@@ -149,7 +149,7 @@ resources:
import copy
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.kubernetes.plugins.module_utils.common import (
from ansible_collections.kubernetes.core.plugins.module_utils.common import (
K8sAnsibleMixin, AUTH_ARG_SPEC, WAIT_ARG_SPEC)

View File

@@ -25,8 +25,8 @@ description:
- Supports check mode.
- Analogous to `kubectl logs` or `oc logs`
extends_documentation_fragment:
- community.kubernetes.k8s_auth_options
- community.kubernetes.k8s_name_options
- kubernetes.core.k8s_auth_options
- kubernetes.core.k8s_name_options
options:
kind:
description:
@@ -63,14 +63,14 @@ requirements:
EXAMPLES = r'''
- name: Get a log from a Pod
community.kubernetes.k8s_log:
kubernetes.core.k8s_log:
name: example-1
namespace: testing
register: log
# This will get the log from the first Pod found matching the selector
- name: Log a Pod matching a label selector
community.kubernetes.k8s_log:
kubernetes.core.k8s_log:
namespace: testing
label_selectors:
- app=example
@@ -78,7 +78,7 @@ EXAMPLES = r'''
# This will get the log from a single Pod managed by this Deployment
- name: Get a log from a Deployment
community.kubernetes.k8s_log:
kubernetes.core.k8s_log:
api_version: apps/v1
kind: Deployment
namespace: testing
@@ -87,7 +87,7 @@ EXAMPLES = r'''
# This will get the log from a single Pod managed by this DeploymentConfig
- name: Get a log from a DeploymentConfig
community.kubernetes.k8s_log:
kubernetes.core.k8s_log:
api_version: apps.openshift.io/v1
kind: DeploymentConfig
namespace: testing
@@ -114,7 +114,7 @@ import copy
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.six import PY2
from ansible_collections.community.kubernetes.plugins.module_utils.common import (
from ansible_collections.kubernetes.core.plugins.module_utils.common import (
K8sAnsibleMixin, AUTH_ARG_SPEC, NAME_ARG_SPEC)

View File

@@ -28,8 +28,8 @@ options:
type: list
elements: str
extends_documentation_fragment:
- community.kubernetes.k8s_auth_options
- community.kubernetes.k8s_name_options
- kubernetes.core.k8s_auth_options
- kubernetes.core.k8s_name_options
requirements:
- "python >= 2.7"
- "openshift >= 0.6"
@@ -38,7 +38,7 @@ requirements:
EXAMPLES = r'''
- name: Rollback a failed deployment
community.kubernetes.k8s_rollback:
kubernetes.core.k8s_rollback:
api_version: apps/v1
kind: Deployment
name: web
@@ -79,7 +79,7 @@ rollback_info:
import copy
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.kubernetes.plugins.module_utils.common import (
from ansible_collections.kubernetes.core.plugins.module_utils.common import (
K8sAnsibleMixin, AUTH_ARG_SPEC, NAME_ARG_SPEC)

View File

@@ -25,10 +25,10 @@ description:
or Replication Controller, or the parallelism attribute of a Job. Supports check mode.
extends_documentation_fragment:
- community.kubernetes.k8s_name_options
- community.kubernetes.k8s_auth_options
- community.kubernetes.k8s_resource_options
- community.kubernetes.k8s_scale_options
- kubernetes.core.k8s_name_options
- kubernetes.core.k8s_auth_options
- kubernetes.core.k8s_resource_options
- kubernetes.core.k8s_scale_options
requirements:
- "python >= 2.7"
@@ -38,7 +38,7 @@ requirements:
EXAMPLES = r'''
- name: Scale deployment up, and extend timeout
community.kubernetes.k8s_scale:
kubernetes.core.k8s_scale:
api_version: v1
kind: Deployment
name: elastic
@@ -47,7 +47,7 @@ EXAMPLES = r'''
wait_timeout: 60
- name: Scale deployment down when current replicas match
community.kubernetes.k8s_scale:
kubernetes.core.k8s_scale:
api_version: v1
kind: Deployment
name: elastic
@@ -56,7 +56,7 @@ EXAMPLES = r'''
replicas: 2
- name: Increase job parallelism
community.kubernetes.k8s_scale:
kubernetes.core.k8s_scale:
api_version: batch/v1
kind: job
name: pi-with-timeout
@@ -66,19 +66,19 @@ EXAMPLES = r'''
# Match object using local file or inline definition
- name: Scale deployment based on a file from the local filesystem
community.kubernetes.k8s_scale:
kubernetes.core.k8s_scale:
src: /myproject/elastic_deployment.yml
replicas: 3
wait: no
- name: Scale deployment based on a template output
community.kubernetes.k8s_scale:
kubernetes.core.k8s_scale:
resource_definition: "{{ lookup('template', '/myproject/elastic_deployment.yml') | from_yaml }}"
replicas: 3
wait: no
- name: Scale deployment based on a file from the Ansible controller filesystem
community.kubernetes.k8s_scale:
kubernetes.core.k8s_scale:
resource_definition: "{{ lookup('file', '/myproject/elastic_deployment.yml') | from_yaml }}"
replicas: 3
wait: no
@@ -118,7 +118,7 @@ result:
sample: 48
'''
from ansible_collections.community.kubernetes.plugins.module_utils.scale import KubernetesAnsibleScaleModule
from ansible_collections.kubernetes.core.plugins.module_utils.scale import KubernetesAnsibleScaleModule
def main():

View File

@@ -21,9 +21,9 @@ description:
- Use Openshift Python SDK to manage Services on Kubernetes
extends_documentation_fragment:
- community.kubernetes.k8s_auth_options
- community.kubernetes.k8s_resource_options
- community.kubernetes.k8s_state_options
- kubernetes.core.k8s_auth_options
- kubernetes.core.k8s_resource_options
- kubernetes.core.k8s_state_options
options:
merge_type:
@@ -91,7 +91,7 @@ requirements:
EXAMPLES = r'''
- name: Expose https port with ClusterIP
community.kubernetes.k8s_service:
kubernetes.core.k8s_service:
state: present
name: test-https
namespace: default
@@ -102,7 +102,7 @@ EXAMPLES = r'''
key: special
- name: Expose https port with ClusterIP using spec
community.kubernetes.k8s_service:
kubernetes.core.k8s_service:
state: present
name: test-https
namespace: default
@@ -150,7 +150,7 @@ import traceback
from collections import defaultdict
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.kubernetes.plugins.module_utils.common import (
from ansible_collections.kubernetes.core.plugins.module_utils.common import (
K8sAnsibleMixin, AUTH_ARG_SPEC, COMMON_ARG_SPEC, RESOURCE_ARG_SPEC)

View File

@@ -7,7 +7,7 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible_collections.community.kubernetes.plugins.module_utils.common import (
from ansible_collections.kubernetes.core.plugins.module_utils.common import (
_encode_stringdata,
)

View File

@@ -11,7 +11,7 @@ import os.path
import yaml
from ansible_collections.community.kubernetes.plugins.module_utils.helm import (
from ansible_collections.kubernetes.core.plugins.module_utils.helm import (
run_helm,
write_temp_kubeconfig,
)

View File

@@ -1,228 +0,0 @@
#!/bin/bash -eu
# Script to dual-home the upstream and downstream Collection in a single repo
#
# This script will build or test a downstream collection, removing any
# upstream components that will not ship in the downstream release
#
# NOTES:
# - All functions are prefixed with f_ so it's obvious where they come
# from when in use throughout the script
DOWNSTREAM_VERSION="1.2.1"
KEEP_DOWNSTREAM_TMPDIR="${KEEP_DOWNSTREAM_TMPDIR:-''}"
f_log_info()
{
printf "%s:LOG:INFO: %s\n" "${0}" "${1}\n"
}
f_prep()
{
f_log_info "${FUNCNAME[0]}"
# Array of excluded files from downstream build (relative path)
_file_exclude=(
)
# Files to copy downstream (relative repo root dir path)
_file_manifest=(
CHANGELOG.rst
galaxy.yml
LICENSE
README.md
Makefile
setup.cfg
.yamllint
requirements.txt
)
# Directories to recursively copy downstream (relative repo root dir path)
_dir_manifest=(
changelogs
meta
plugins
tests
molecule
)
# Temp build dir
_tmp_dir=$(mktemp -d)
_build_dir="${_tmp_dir}/ansible_collections/kubernetes/core"
mkdir -p "${_build_dir}"
}
f_show_help()
{
printf "Usage: downstream.sh [OPTION]\n"
printf "\t-s\t\tCreate a temporary downstream release and perform sanity tests.\n"
printf "\t-i\t\tCreate a temporary downstream release and perform integration tests.\n"
printf "\t-m\t\tCreate a temporary downstream release and perform molecule tests.\n"
printf "\t-b\t\tCreate a downstream release and stage for release.\n"
printf "\t-r\t\tCreate a downstream release and publish release.\n"
}
f_text_sub()
{
# Switch FQCN and dependent components
sed -i.bak "s/community-kubernetes/kubernetes-core/" "${_build_dir}/Makefile"
sed -i.bak "s/community\/kubernetes/kubernetes\/core/" "${_build_dir}/Makefile"
sed -i.bak "s/^VERSION\:/VERSION: ${DOWNSTREAM_VERSION}/" "${_build_dir}/Makefile"
sed -i.bak "s/community.kubernetes/kubernetes.core/" "${_build_dir}/galaxy.yml"
sed -i.bak "s/name\:.*$/name: core/" "${_build_dir}/galaxy.yml"
sed -i.bak "s/namespace\:.*$/namespace: kubernetes/" "${_build_dir}/galaxy.yml"
sed -i.bak "s/^version\:.*$/version: ${DOWNSTREAM_VERSION}/" "${_build_dir}/galaxy.yml"
find "${_build_dir}" -type f -exec sed -i.bak "s/community\.kubernetes/kubernetes\.core/g" {} \;
sed -i.bak "s/a\.k\.a\. \`kubernetes\.core\`/formerly known as \`community\.kubernetes\`/" "${_build_dir}/README.md";
find "${_build_dir}" -type f -name "*.bak" -delete
}
f_cleanup()
{
f_log_info "${FUNCNAME[0]}"
if [[ -n ${KEEP_DOWNSTREAM_TMPDIR} ]]; then
if [[ -d ${_build_dir} ]]; then
rm -fr "${_build_dir}"
fi
fi
}
# Exit and handle cleanup processes if needed
f_exit()
{
f_cleanup
exit "$0"
}
f_create_collection_dir_structure()
{
f_log_info "${FUNCNAME[0]}"
# Create the Collection
for f_name in "${_file_manifest[@]}";
do
cp "./${f_name}" "${_build_dir}/${f_name}"
done
for d_name in "${_dir_manifest[@]}";
do
cp -r "./${d_name}" "${_build_dir}/${d_name}"
done
if [ -n "${_file_exclude:-}" ]; then
for exclude_file in "${_file_exclude[@]}";
do
if [[ -f "${_build_dir}/${exclude_file}" ]]; then
rm -f "${_build_dir}/${exclude_file}"
fi
done
fi
}
f_copy_collection_to_working_dir()
{
f_log_info "${FUNCNAME[0]}"
# Copy the Collection build result into original working dir
cp "${_build_dir}"/*.tar.gz ./
}
f_common_steps()
{
f_log_info "${FUNCNAME[0]}"
f_prep
f_create_collection_dir_structure
f_text_sub
}
# Run the test sanity scanerio
f_test_sanity_option()
{
f_log_info "${FUNCNAME[0]}"
f_common_steps
pushd "${_build_dir}" || return
f_log_info "SANITY TEST PWD: ${PWD}"
make test-sanity
popd || return
f_cleanup
}
# Run the test integration
f_test_integration_option()
{
f_log_info "${FUNCNAME[0]}"
f_common_steps
pushd "${_build_dir}" || return
f_log_info "INTEGRATION TEST WD: ${PWD}"
make test-integration
popd || return
f_cleanup
}
# Run the molecule tests
f_test_molecule_option()
{
f_log_info "${FUNCNAME[0]}"
f_common_steps
pushd "${_build_dir}" || return
f_log_info "MOLECULE TEST WD: ${PWD}"
make test-molecule
popd || return
f_cleanup
}
# Run the release scanerio
f_release_option()
{
f_log_info "${FUNCNAME[0]}"
f_common_steps
pushd "${_build_dir}" || return
f_log_info "RELEASE WD: ${PWD}"
make release
popd || return
f_cleanup
}
# Run the build scanerio
f_build_option()
{
f_log_info "${FUNCNAME[0]}"
f_common_steps
pushd "${_build_dir}" || return
f_log_info "BUILD WD: ${PWD}"
make build
popd || return
f_copy_collection_to_working_dir
f_cleanup
}
# If no options are passed, display usage and exit
if [[ "${#}" -eq "0" ]]; then
f_show_help
f_exit 0
fi
# Handle options
while getopts ":simrb" option
do
case $option in
s)
f_test_sanity_option
;;
i)
f_test_integration_option
;;
m)
f_test_molecule_option
;;
r)
f_release_option
;;
b)
f_build_option
;;
*)
printf "ERROR: Unimplemented option chosen.\n"
f_show_help
f_exit 1
;; # Default.
esac
done
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4