[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 - name: Check out code
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
path: ansible_collections/community/kubernetes path: ansible_collections/kubernetes/core
- name: Set up Python ${{ matrix.python_version }} - name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v1 uses: actions/setup-python@v1
@@ -31,7 +31,7 @@ jobs:
- name: Run sanity tests on Python ${{ matrix.python_version }} - name: Run sanity tests on Python ${{ matrix.python_version }}
run: make test-sanity PYTHON_VERSION=${{ 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: integration:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -43,7 +43,7 @@ jobs:
- name: Check out code - name: Check out code
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
path: ansible_collections/community/kubernetes path: ansible_collections/kubernetes/core
- name: Set up Python ${{ matrix.python_version }} - name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v1 uses: actions/setup-python@v1
@@ -55,11 +55,11 @@ jobs:
- name: Run integration tests on Python ${{ matrix.python_version }} - name: Run integration tests on Python ${{ matrix.python_version }}
run: make test-integration PYTHON_VERSION=${{ 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. - name: Generate coverage report.
run: ansible-test coverage xml -v --requirements --group-by command --group-by version 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 - uses: codecov/codecov-action@v1
with: with:
@@ -74,7 +74,7 @@ jobs:
- name: Check out code - name: Check out code
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
path: ansible_collections/community/kubernetes path: ansible_collections/kubernetes/core
- name: Set up KinD cluster - name: Set up KinD cluster
uses: engineerd/setup-kind@v0.5.0 uses: engineerd/setup-kind@v0.5.0
@@ -110,82 +110,4 @@ jobs:
- name: Run molecule default test scenario - name: Run molecule default test scenario
run: make test-molecule run: make test-molecule
working-directory: ./ansible_collections/community/kubernetes working-directory: ./ansible_collections/kubernetes/core
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

View File

@@ -9,16 +9,16 @@ https://docs.ansible.com/ansible/latest/community/index.html).
## Kubernetes Collections ## Kubernetes Collections
### community.kubernetes ### kubernetes.core
This collection contains modules and plugins contributed and maintained by the Ansible Kubernetes This collection contains modules and plugins contributed and maintained by the Ansible Kubernetes
community. 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 ## Submitting Issues
All software has bugs, and the `community.kubernetes` collection is no exception. When you find a bug, 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/community.kubernetes/issues/new/choose). 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, 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 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. All modules MUST have integration tests for new features.
Bug fixes for modules that currently have integration tests SHOULD have tests added. 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: Expected test criteria:
* Resource creation under check mode * Resource creation under check mode
@@ -52,7 +52,7 @@ especially the section on configuration for cloud tests. For questions about wri
### Code of Conduct ### 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). [Code of Conduct](https://docs.ansible.com/ansible/devel/community/code_of_conduct.html).
Please read and familiarize yourself with this document. 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 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. [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. 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]))'` PYTHON_VERSION ?= `python -c 'import platform; print("{0}.{1}".format(platform.python_version_tuple()[0], platform.python_version_tuple()[1]))'`
clean: clean:
rm -f community-kubernetes-${VERSION}.tar.gz rm -f kubernetes-core-${VERSION}.tar.gz
rm -rf ansible_collections rm -rf ansible_collections
rm -rf tests/output rm -rf tests/output
@@ -13,10 +13,10 @@ build: clean
ansible-galaxy collection build ansible-galaxy collection build
release: build release: build
ansible-galaxy collection publish community-kubernetes-${VERSION}.tar.gz ansible-galaxy collection publish kubernetes-core-${VERSION}.tar.gz
install: build 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: test-sanity:
ansible-test sanity --docker -v --color --python $(PYTHON_VERSION) $(?TEST_ARGS) ansible-test sanity --docker -v --color --python $(PYTHON_VERSION) $(?TEST_ARGS)
@@ -26,18 +26,3 @@ test-integration:
test-molecule: test-molecule:
molecule test 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 # 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. 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**: - **Modules**:
- [k8s](https://docs.ansible.com/ansible/2.10/collections/community/kubernetes/k8s_module.html) - [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_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_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_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) - [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) - [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](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_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](https://github.com/ansible-collections/kubernetes.core/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_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) - [helm_repository](https://docs.ansible.com/ansible/2.10/collections/community/kubernetes/helm_repository_module.html)
## Installation and Usage ## 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: 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: 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 ```yaml
--- ---
collections: collections:
- name: community.kubernetes - name: kubernetes.core
version: 1.2.1 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 ### 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 ```yaml
--- ---
@@ -69,14 +69,14 @@ It's preferable to use content in this collection using their Fully Qualified Co
tasks: tasks:
- name: Ensure the myapp Namespace exists. - name: Ensure the myapp Namespace exists.
community.kubernetes.k8s: kubernetes.core.k8s:
api_version: v1 api_version: v1
kind: Namespace kind: Namespace
name: myapp name: myapp
state: present state: present
- name: Ensure the myapp Service exists in the myapp Namespace. - name: Ensure the myapp Service exists in the myapp Namespace.
community.kubernetes.k8s: kubernetes.core.k8s:
state: present state: present
definition: definition:
apiVersion: v1 apiVersion: v1
@@ -93,7 +93,7 @@ It's preferable to use content in this collection using their Fully Qualified Co
app: myapp app: myapp
- name: Get a list of all Services in the myapp namespace. - name: Get a list of all Services in the myapp namespace.
community.kubernetes.k8s_info: kubernetes.core.k8s_info:
kind: Service kind: Service
namespace: myapp namespace: myapp
register: myapp_services register: myapp_services
@@ -112,7 +112,7 @@ If upgrading older playbooks which were built prior to Ansible 2.10 and this col
connection: local connection: local
collections: collections:
- community.kubernetes - kubernetes.core
tasks: tasks:
- name: Ensure the myapp Namespace exists. - 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. 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` ### 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. Update the version in the following places:
1. The `version` in `galaxy.yml` 1. The `version` in `galaxy.yml`
2. This README's `requirements.yml` example 2. This README's `requirements.yml` example
3. The `DOWNSTREAM_VERSION` in `utils/downstream.sh` 3. The `VERSION` in `Makefile`
4. The `VERSION` in `Makefile`
2. Update the CHANGELOG: 2. Update the CHANGELOG:
1. Make sure you have [`antsibull-changelog`](https://pypi.org/project/antsibull-changelog/) installed. 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`. 2. Make sure there are fragments for all known changes in `changelogs/fragments`.
3. Run `antsibull-changelog release`. 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. 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. 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). After the version is published, verify it exists on the [Kubernetes Collection Galaxy page](https://galaxy.ansible.com/kubernetes/core).
### 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).
The process for uploading a supported release to Automation Hub is documented separately. 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. description: Kubernetes Collection for Ansible.
documentation: '' documentation: ''
homepage: '' homepage: ''
issues: https://github.com/ansible-collections/community.kubernetes/issues issues: https://github.com/ansible-collections/kubernetes.core/issues
license_file: LICENSE license_file: LICENSE
name: kubernetes name: core
namespace: community namespace: kubernetes
readme: README.md readme: README.md
repository: https://github.com/ansible-collections/community.kubernetes repository: https://github.com/ansible-collections/kubernetes.core
tags: tags:
- kubernetes - kubernetes
- k8s - k8s

View File

@@ -19,54 +19,54 @@ action_groups:
plugin_routing: plugin_routing:
action: action:
helm: helm:
redirect: community.kubernetes.k8s_info redirect: kubernetes.core.k8s_info
helm_info: helm_info:
redirect: community.kubernetes.k8s_info redirect: kubernetes.core.k8s_info
helm_plugin: helm_plugin:
redirect: community.kubernetes.k8s_info redirect: kubernetes.core.k8s_info
helm_plugin_info: helm_plugin_info:
redirect: community.kubernetes.k8s_info redirect: kubernetes.core.k8s_info
helm_repository: helm_repository:
redirect: community.kubernetes.k8s_info redirect: kubernetes.core.k8s_info
k8s: k8s:
redirect: community.kubernetes.k8s_info redirect: kubernetes.core.k8s_info
k8s_auth: k8s_auth:
redirect: community.kubernetes.k8s_info redirect: kubernetes.core.k8s_info
k8s_cluster_info: k8s_cluster_info:
redirect: community.kubernetes.k8s_info redirect: kubernetes.core.k8s_info
k8s_event_info: k8s_event_info:
redirect: community.kubernetes.k8s_info redirect: kubernetes.core.k8s_info
k8s_exec: k8s_exec:
redirect: community.kubernetes.k8s_info redirect: kubernetes.core.k8s_info
k8s_log: k8s_log:
redirect: community.kubernetes.k8s_info redirect: kubernetes.core.k8s_info
k8s_rollback: k8s_rollback:
redirect: community.kubernetes.k8s_info redirect: kubernetes.core.k8s_info
k8s_scale: k8s_scale:
redirect: community.kubernetes.k8s_info redirect: kubernetes.core.k8s_info
k8s_service: k8s_service:
redirect: community.kubernetes.k8s_info redirect: kubernetes.core.k8s_info
modules: modules:
# k8s_facts was originally slated for removal in Ansible 2.13. # k8s_facts was originally slated for removal in Ansible 2.13.
k8s_facts: k8s_facts:
redirect: community.kubernetes.k8s_info redirect: kubernetes.core.k8s_info
deprecation: deprecation:
removal_version: 2.0.0 removal_version: 2.0.0
warning_text: Use community.kubernetes.k8s_info instead. warning_text: Use kubernetes.core.k8s_info instead.
k8s_raw: k8s_raw:
tombstone: tombstone:
removal_version: 0.1.0 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: openshift_raw:
tombstone: tombstone:
removal_version: 0.1.0 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: openshift_scale:
tombstone: tombstone:
removal_version: 0.1.0 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: lookup:
openshift: openshift:
tombstone: tombstone:
removal_version: 0.1.0 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 connection: local
collections: collections:
- community.kubernetes - kubernetes.core
vars_files: vars_files:
- vars/main.yml - vars/main.yml

View File

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

View File

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

View File

@@ -66,7 +66,7 @@ class ActionModule(ActionBase):
def load_template(self, template, new_module_args, task_vars): def load_template(self, template, new_module_args, task_vars):
# template is only supported by k8s module. # 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.") raise AnsibleActionFail("'template' is only supported parameter for 'k8s' module.")
if isinstance(template, string_types): if isinstance(template, string_types):
# treat this as raw_params # treat this as raw_params

View File

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

View File

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

View File

@@ -133,23 +133,23 @@ DOCUMENTATION = '''
EXAMPLES = """ EXAMPLES = """
- name: Fetch a list of namespaces - name: Fetch a list of namespaces
set_fact: 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 - name: Fetch all deployments
set_fact: set_fact:
deployments: "{{ lookup('community.kubernetes.k8s', kind='Deployment') }}" deployments: "{{ lookup('kubernetes.core.k8s', kind='Deployment') }}"
- name: Fetch all deployments in a namespace - name: Fetch all deployments in a namespace
set_fact: 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 - name: Fetch a specific deployment by name
set_fact: 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 - name: Fetch with label selector
set_fact: 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 # 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 - name: Using the config (loaded from a file in prior task), fetch the latest version of the object
set_fact: 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 - name: Use a config from the local filesystem
set_fact: set_fact:
service: "{{ lookup('community.kubernetes.k8s', src='service.yml') }}" service: "{{ lookup('kubernetes.core.k8s', src='service.yml') }}"
""" """
RETURN = """ RETURN = """
@@ -198,7 +198,7 @@ from ansible.errors import AnsibleError
from ansible.module_utils.common._collections_compat import KeysView from ansible.module_utils.common._collections_compat import KeysView
from ansible.plugins.lookup import LookupBase 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: 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._text import to_native, to_bytes, to_text
from ansible.module_utils.common.dict_transformations import dict_merge from ansible.module_utils.common.dict_transformations import dict_merge
from ansible.module_utils.parsing.convert_bool import boolean 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 K8S_IMP_ERR = None

View File

@@ -22,7 +22,7 @@ __metaclass__ = type
import copy import copy
from ansible.module_utils.basic import AnsibleModule 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) K8sAnsibleMixin, AUTH_ARG_SPEC, COMMON_ARG_SPEC, RESOURCE_ARG_SPEC, NAME_ARG_SPEC)

View File

@@ -22,7 +22,7 @@ __metaclass__ = type
import copy import copy
from ansible.module_utils.basic import AnsibleModule 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) AUTH_ARG_SPEC, RESOURCE_ARG_SPEC, NAME_ARG_SPEC, K8sAnsibleMixin)
try: try:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -28,8 +28,8 @@ options:
type: list type: list
elements: str elements: str
extends_documentation_fragment: extends_documentation_fragment:
- community.kubernetes.k8s_auth_options - kubernetes.core.k8s_auth_options
- community.kubernetes.k8s_name_options - kubernetes.core.k8s_name_options
requirements: requirements:
- "python >= 2.7" - "python >= 2.7"
- "openshift >= 0.6" - "openshift >= 0.6"
@@ -38,7 +38,7 @@ requirements:
EXAMPLES = r''' EXAMPLES = r'''
- name: Rollback a failed deployment - name: Rollback a failed deployment
community.kubernetes.k8s_rollback: kubernetes.core.k8s_rollback:
api_version: apps/v1 api_version: apps/v1
kind: Deployment kind: Deployment
name: web name: web
@@ -79,7 +79,7 @@ rollback_info:
import copy import copy
from ansible.module_utils.basic import AnsibleModule 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) 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. or Replication Controller, or the parallelism attribute of a Job. Supports check mode.
extends_documentation_fragment: extends_documentation_fragment:
- community.kubernetes.k8s_name_options - kubernetes.core.k8s_name_options
- community.kubernetes.k8s_auth_options - kubernetes.core.k8s_auth_options
- community.kubernetes.k8s_resource_options - kubernetes.core.k8s_resource_options
- community.kubernetes.k8s_scale_options - kubernetes.core.k8s_scale_options
requirements: requirements:
- "python >= 2.7" - "python >= 2.7"
@@ -38,7 +38,7 @@ requirements:
EXAMPLES = r''' EXAMPLES = r'''
- name: Scale deployment up, and extend timeout - name: Scale deployment up, and extend timeout
community.kubernetes.k8s_scale: kubernetes.core.k8s_scale:
api_version: v1 api_version: v1
kind: Deployment kind: Deployment
name: elastic name: elastic
@@ -47,7 +47,7 @@ EXAMPLES = r'''
wait_timeout: 60 wait_timeout: 60
- name: Scale deployment down when current replicas match - name: Scale deployment down when current replicas match
community.kubernetes.k8s_scale: kubernetes.core.k8s_scale:
api_version: v1 api_version: v1
kind: Deployment kind: Deployment
name: elastic name: elastic
@@ -56,7 +56,7 @@ EXAMPLES = r'''
replicas: 2 replicas: 2
- name: Increase job parallelism - name: Increase job parallelism
community.kubernetes.k8s_scale: kubernetes.core.k8s_scale:
api_version: batch/v1 api_version: batch/v1
kind: job kind: job
name: pi-with-timeout name: pi-with-timeout
@@ -66,19 +66,19 @@ EXAMPLES = r'''
# Match object using local file or inline definition # Match object using local file or inline definition
- name: Scale deployment based on a file from the local filesystem - name: Scale deployment based on a file from the local filesystem
community.kubernetes.k8s_scale: kubernetes.core.k8s_scale:
src: /myproject/elastic_deployment.yml src: /myproject/elastic_deployment.yml
replicas: 3 replicas: 3
wait: no wait: no
- name: Scale deployment based on a template output - 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 }}" resource_definition: "{{ lookup('template', '/myproject/elastic_deployment.yml') | from_yaml }}"
replicas: 3 replicas: 3
wait: no wait: no
- name: Scale deployment based on a file from the Ansible controller filesystem - 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 }}" resource_definition: "{{ lookup('file', '/myproject/elastic_deployment.yml') | from_yaml }}"
replicas: 3 replicas: 3
wait: no wait: no
@@ -118,7 +118,7 @@ result:
sample: 48 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(): def main():

View File

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

View File

@@ -11,7 +11,7 @@ import os.path
import yaml import yaml
from ansible_collections.community.kubernetes.plugins.module_utils.helm import ( from ansible_collections.kubernetes.core.plugins.module_utils.helm import (
run_helm, run_helm,
write_temp_kubeconfig, 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