Compare commits

..
5 Commits
Author SHA1 Message Date
Jeff GeerlingandGitHub 56e39540a0 Issue #60: Release version 1.0.1. (#61)
* Issue #60: Release version 1.0.1.

* Fix rstcheck issue by substituting some equals signs with ugly regex.
2020-11-17 17:44:37 -06:00
2d71c469bd doc fragments workaround for downstream (#59)
* doc fragments workaround for downstream

Signed-off-by: Adam Miller <admiller@redhat.com>

* make shellcheck happy

Signed-off-by: Adam Miller <admiller@redhat.com>

* fix collection location for downstream doc fragment resolution

Signed-off-by: Adam Miller <admiller@redhat.com>

* do things in the correct order

Signed-off-by: Adam Miller <admiller@redhat.com>

* add ANSIBLE_COLLECTIONS_PATH to ansible-doc for downstream

Signed-off-by: Adam Miller <admiller@redhat.com>

* remove elements of the json dump that aren't valid for DOCUMENTATION

Signed-off-by: Adam Miller <admiller@redhat.com>

* Add fix for Ansible 2.9

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>

* Update ci/downstream.sh

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
Co-authored-by: Jeff Geerling <geerlingguy@mac.com>
2020-11-17 18:03:00 +01:00
Jeff GeerlingandGitHub 87cd174b96 Issue #57: Switch dependency from community.kubernetes to kubernetes.core. (#58)
* Issue #57: Switch dependency from community.kubernetes to kubernetes.core.

* Issue #57: Rely on kubernetes.core install directly.

* Issue #57: Don't install kubernetes.core from source anymore.
2020-11-16 13:35:18 -06:00
Adam MillerandGitHub 32a6a1fda3 Fix ci/downstream.sh docs "branding" (#55)
* Fix ci/downstream.sh docs "branding"

Signed-off-by: Adam Miller <admiller@redhat.com>

* fix CHANGELOG.rst title overline length

Signed-off-by: Adam Miller <admiller@redhat.com>
2020-11-12 14:04:23 -06:00
Jeff GeerlingandGitHub 775312c037 Issue #51: Update downstream build script so it works on macOS / BSD-sed. (#54) 2020-11-12 10:44:32 -06:00
17 changed files with 190 additions and 102 deletions
+4 -4
View File
@@ -49,7 +49,7 @@ jobs:
# run ansible-test sanity inside of Docker. # run ansible-test sanity inside of Docker.
# The docker container has all the pinned dependencies that are required. # The docker container has all the pinned dependencies that are required.
# Explicity specify the version of Python we want to test # Explicitly specify the version of Python we want to test
- name: Run sanity tests - name: Run sanity tests
run: make upstream-test-sanity TEST_ARGS='--python ${{ matrix.python }}' run: make upstream-test-sanity TEST_ARGS='--python ${{ matrix.python }}'
working-directory: ./ansible_collections/community/okd working-directory: ./ansible_collections/community/okd
@@ -93,7 +93,7 @@ jobs:
# # OPTIONAL If your integration test requires Python libraries or modules from other collections # # OPTIONAL If your integration test requires Python libraries or modules from other collections
# # Install them like this # # Install them like this
# - name: Install collection dependencies # - name: Install collection dependencies
# run: ansible-galaxy collection install community.kubernetes -p . # run: ansible-galaxy collection install kubernetes.core -p .
# # Run the integration tests # # Run the integration tests
# - name: Run integration test # - name: Run integration test
@@ -111,7 +111,7 @@ jobs:
# fail_ci_if_error: false # fail_ci_if_error: false
# #
downstream-sanity-29: downstream-sanity-29:
name: Sanity (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }}) name: Downstream Sanity (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }})
strategy: strategy:
matrix: matrix:
ansible: ansible:
@@ -135,7 +135,7 @@ jobs:
# run ansible-test sanity inside of Docker. # run ansible-test sanity inside of Docker.
# The docker container has all the pinned dependencies that are required. # The docker container has all the pinned dependencies that are required.
# Explicity specify the version of Python we want to test # Explicitly specify the version of Python we want to test
- name: Run sanity tests - name: Run sanity tests
run: make downstream-test-sanity run: make downstream-test-sanity
working-directory: ./ansible_collections/community/okd working-directory: ./ansible_collections/community/okd
+8
View File
@@ -5,6 +5,14 @@ OKD Collection Release Notes
.. contents:: Topics .. contents:: Topics
v1.0.1
======
Bugfixes
--------
- Generate downstream redhat.openshift documentation (https://github.com/ansible-collections/community.okd/pull/59).
v1.0.0 v1.0.0
====== ======
+2 -5
View File
@@ -1,5 +1,5 @@
# Also needs to be updated in galaxy.yml # Also needs to be updated in galaxy.yml
VERSION = 1.0.0 VERSION = 1.0.1
# To run sanity tests in a venv, set SANITY_TEST_ARGS to '--venv' # To run sanity tests in a venv, set SANITY_TEST_ARGS to '--venv'
SANITY_TEST_ARGS ?= --docker --color SANITY_TEST_ARGS ?= --docker --color
@@ -12,11 +12,8 @@ build: clean
ansible-galaxy collection build ansible-galaxy collection build
install-kubernetes-src: install-kubernetes-src:
mkdir -p ansible_collections/community/kubernetes ansible-galaxy collection install -p ansible_collections kubernetes.core
rm -rf ansible_collections/community/kubernetes/*
curl -L https://github.com/ansible-collections/community.kubernetes/archive/main.tar.gz | tar -xz -C ansible_collections/community/kubernetes --strip-components 1
# TODO: Once we no longer rely on features in main we should drop the install-kubernetes-src dependency
install: build install-kubernetes-src install: build install-kubernetes-src
ansible-galaxy collection install -p ansible_collections community-okd-$(VERSION).tar.gz ansible-galaxy collection install -p ansible_collections community-okd-$(VERSION).tar.gz
+8 -3
View File
@@ -1,10 +1,11 @@
# OKD/OpenShift Collection for Ansible # OKD Collection for Ansible
<!--- STARTREMOVE --->
[![CI](https://github.com/ansible-collections/community.okd/workflows/CI/badge.svg?event=push)](https://github.com/ansible-collections/community.okd/actions) [![Codecov](https://img.shields.io/codecov/c/github/ansible-collections/community.okd)](https://codecov.io/gh/ansible-collections/community.okd) [![CI](https://github.com/ansible-collections/community.okd/workflows/CI/badge.svg?event=push)](https://github.com/ansible-collections/community.okd/actions) [![Codecov](https://img.shields.io/codecov/c/github/ansible-collections/community.okd)](https://codecov.io/gh/ansible-collections/community.okd)
This repo hosts the `community.okd` Ansible Collection. This repo hosts the `community.okd` Ansible Collection.
The collection includes a variety of Ansible content to help automate the management of applications in OKD/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 OKD clusters, as well as the provisioning and maintenance of clusters themselves.
## Included content ## Included content
@@ -22,6 +23,8 @@ Click on the name of a plugin or module to view that content's documentation:
> **Note**: Some of these documentation links currently link to older module versions. For the latest module documentation, please use `ansible-doc` in the CLI. > **Note**: Some of these documentation links currently link to older module versions. For the latest module documentation, please use `ansible-doc` in the CLI.
<!--- ENDREMOVE --->
## Installation and Usage ## Installation and Usage
### Installing the Collection from Ansible Galaxy ### Installing the Collection from Ansible Galaxy
@@ -36,7 +39,7 @@ You can also include it in a `requirements.yml` file and install it via `ansible
--- ---
collections: collections:
- name: community.okd - name: community.okd
version: 1.0.0 version: 1.0.1
``` ```
### Installing the OpenShift Python Library ### Installing the OpenShift Python Library
@@ -59,6 +62,7 @@ connections:
For documentation on how to use individual plugins included in this collection, please see the links in the 'Included content' section earlier in this README. For documentation on how to use individual plugins included in this collection, please see the links in the 'Included content' section earlier in this README.
<!--- STARTREMOVE --->
## Testing and Development ## Testing and Development
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.
@@ -115,6 +119,7 @@ Releases are automatically built and pushed to Ansible Galaxy for any new tag. B
1. Tag the version in Git and push to GitHub. 1. Tag the version in Git and push to GitHub.
After the version is published, verify it exists on the [OKD Collection Galaxy page](https://galaxy.ansible.com/community/okd). After the version is published, verify it exists on the [OKD Collection Galaxy page](https://galaxy.ansible.com/community/okd).
<!--- ENDREMOVE --->
## More Information ## More Information
+7
View File
@@ -68,3 +68,10 @@ releases:
fragments: fragments:
- 51-redhat-openshift-ah-release.yml - 51-redhat-openshift-ah-release.yml
release_date: '2020-11-12' release_date: '2020-11-12'
1.0.1:
changes:
bugfixes:
- Generate downstream redhat.openshift documentation (https://github.com/ansible-collections/community.okd/pull/59).
fragments:
- 59-downstream-docs.yml
release_date: '2020-11-17'
@@ -0,0 +1,3 @@
---
bugfixes:
- Generate downstream redhat.openshift documentation (https://github.com/ansible-collections/community.okd/pull/59).
+83 -37
View File
@@ -1,4 +1,4 @@
#!/bin/bash -eu #!/bin/bash -e
# Script to dual-home the upstream and downstream Collection in a single repo # Script to dual-home the upstream and downstream Collection in a single repo
# #
@@ -9,7 +9,7 @@
# - All functions are prefixed with f_ so it's obvious where they come # - All functions are prefixed with f_ so it's obvious where they come
# from when in use throughout the script # from when in use throughout the script
DOWNSTREAM_VERSION="1.0.0" DOWNSTREAM_VERSION="1.0.1"
KEEP_DOWNSTREAM_TMPDIR="${KEEP_DOWNSTREAM_TMPDIR:-''}" KEEP_DOWNSTREAM_TMPDIR="${KEEP_DOWNSTREAM_TMPDIR:-''}"
_build_dir="" _build_dir=""
@@ -31,15 +31,22 @@ f_show_help()
f_text_sub() f_text_sub()
{ {
# Switch FQCN and dependent components # Switch FQCN and dependent components
sed -i "s/community-okd/redhat-openshift/" "${_build_dir}/Makefile" OKD_sed_files="${_build_dir}/README.md ${_build_dir}/CHANGELOG.rst ${_build_dir}/changelogs/config.yaml ${_build_dir}/ci/downstream.sh ${_build_dir}/galaxy.yml"
sed -i "s/community\/okd/redhat\/openshift/" "${_build_dir}/Makefile" for okd_file in ${OKD_sed_files[@]}; do sed -i.bak "s/OKD/OpenShift/g" "${okd_file}"; done
sed -i "s/^VERSION\:/VERSION: ${DOWNSTREAM_VERSION}/" "${_build_dir}/Makefile"
sed -i "s/name\:.*$/name: openshift/" "${_build_dir}/galaxy.yml" sed -i.bak "s/============================/==================================/" "${_build_dir}/CHANGELOG.rst"
sed -i "s/namespace\:.*$/namespace: redhat/" "${_build_dir}/galaxy.yml" sed -i.bak "s/Ansible Galaxy/Automation Hub/" "${_build_dir}/README.md"
sed -i "s/Kubernetes/OpenShift/g" "${_build_dir}/galaxy.yml" sed -i.bak "s/community-okd/redhat-openshift/" "${_build_dir}/Makefile"
sed -i "s/^version\:.*$/version: ${DOWNSTREAM_VERSION}/" "${_build_dir}/galaxy.yml" sed -i.bak "s/community\/okd/redhat\/openshift/" "${_build_dir}/Makefile"
find ${_build_dir} -type f -exec sed -i "s/community\.kubernetes/kubernetes\.core/g" {} \; sed -i.bak "s/^VERSION\:/VERSION: ${DOWNSTREAM_VERSION}/" "${_build_dir}/Makefile"
find ${_build_dir} -type f -exec sed -i "s/community\.okd/redhat\.openshift/g" {} \; sed -i.bak "s/name\:.*$/name: openshift/" "${_build_dir}/galaxy.yml"
sed -i.bak "s/namespace\:.*$/namespace: redhat/" "${_build_dir}/galaxy.yml"
sed -i.bak "s/Kubernetes/OpenShift/g" "${_build_dir}/galaxy.yml"
sed -i.bak "s/^version\:.*$/version: ${DOWNSTREAM_VERSION}/" "${_build_dir}/galaxy.yml"
sed -i.bak "/STARTREMOVE/,/ENDREMOVE/d" "${_build_dir}/README.md"
find "${_build_dir}" -type f -exec sed -i.bak "s/community\.okd/redhat\.openshift/g" {} \;
find "${_build_dir}" -type f -name "*.bak" -delete
} }
f_prep() f_prep()
@@ -70,9 +77,18 @@ f_prep()
tests tests
) )
# Modules with inherited doc fragments from kubernetes.core that need
# rendering to deal with Galaxy/AH lack of functionality.
_doc_fragment_modules=(
k8s
openshift_process
openshift_route
)
# Temp build dir # Temp build dir
_tmp_dir=$(mktemp -d) _tmp_dir=$(mktemp -d)
_start_dir="${PWD}"
_build_dir="${_tmp_dir}/ansible_collections/redhat/openshift" _build_dir="${_tmp_dir}/ansible_collections/redhat/openshift"
mkdir -p "${_build_dir}" mkdir -p "${_build_dir}"
} }
@@ -111,33 +127,62 @@ f_create_collection_dir_structure()
do do
cp -r "./${d_name}" "${_build_dir}/${d_name}" cp -r "./${d_name}" "${_build_dir}/${d_name}"
done done
for exclude_file in "${_file_exclude[@]}"; if [ -n "${_file_exclude:-}" ]; then
do for exclude_file in "${_file_exclude[@]}";
if [[ -f "${_build_dir}/${exclude_file}" ]]; then do
rm -f "${_build_dir}/${exclude_file}" if [[ -f "${_build_dir}/${exclude_file}" ]]; then
fi rm -f "${_build_dir}/${exclude_file}"
done fi
done
fi
} }
f_install_kubernetes_core_from_src() f_handle_doc_fragments_workaround()
{ {
local community_k8s_tmpdir="${_tmp_dir}/community.kubernetes" f_log_info "${FUNCNAME[0]}"
local install_collections_dir="${_build_dir}/collections/"
local temp_fragments_json="${_tmp_dir}/fragments.json"
local temp_start="${_tmp_dir}/startfile.txt"
local temp_end="${_tmp_dir}/endfile.txt"
local rendered_fragments="./rendereddocfragments.txt"
# Build the collection, export docs, render them, stitch it all back together
pushd "${_build_dir}" || return
ansible-galaxy collection build
ansible-galaxy collection install -p "${install_collections_dir}" ./*.tar.gz
rm ./*.tar.gz
for doc_fragment_mod in "${_doc_fragment_modules[@]}"
do
local module_py="plugins/modules/${doc_fragment_mod}.py"
f_log_info "Processing doc fragments for ${module_py}"
ANSIBLE_COLLECTIONS_PATH="${install_collections_dir}" \
ANSIBLE_COLLECTIONS_PATHS="${ANSIBLE_COLLECTIONS_PATH}:${install_collections_dir}" \
ansible-doc -j "redhat.openshift.${doc_fragment_mod}" > "${temp_fragments_json}"
# FIXME: Check Python interpreter from environment variable to work with prow
if [ -e /usr/bin/python3.6 ]; then
PYTHON="/usr/bin/python3.6"
else
PYTHON="python"
fi
"${PYTHON}" "${_start_dir}/ci/downstream_fragments.py" "redhat.openshift.${doc_fragment_mod}" "${temp_fragments_json}"
sed -n '/STARTREMOVE/q;p' "${module_py}" > "${temp_start}"
sed '0,/ENDREMOVE/d' "${module_py}" > "${temp_end}"
cat "${temp_start}" "${rendered_fragments}" "${temp_end}" > "${module_py}"
cat "${module_py}"
done
rm -f "${rendered_fragments}"
rm -fr "${install_collections_dir}"
popd
}
f_install_kubernetes_core()
{
f_log_info "${FUNCNAME[0]}"
local install_collections_dir="${_tmp_dir}/ansible_collections" local install_collections_dir="${_tmp_dir}/ansible_collections"
mkdir -p "${community_k8s_tmpdir}"
pushd "${_tmp_dir}" pushd "${_tmp_dir}"
# curl -L \ ansible-galaxy collection install -p "${install_collections_dir}" kubernetes.core
# https://github.com/ansible-collections/community.kubernetes/archive/main.tar.gz \
# | tar -xz -C "${community_k8s_tmpdir}" --strip-components 1
# pushd "${community_k8s_tmpdir}"
# make downstream-build
# ansible-galaxy collection install -p "${install_collections_dir}" "${community_k8s_tmpdir}"/kubernetes-core-*.tar.gz
# popd
#popd
git clone https://github.com/ansible-collections/community.kubernetes "${community_k8s_tmpdir}"
pushd "${community_k8s_tmpdir}"
make downstream-build
ansible-galaxy collection install -p "${install_collections_dir}" "${community_k8s_tmpdir}"/kubernetes-core-*.tar.gz
popd
popd popd
} }
@@ -155,6 +200,7 @@ f_common_steps()
f_prep f_prep
f_create_collection_dir_structure f_create_collection_dir_structure
f_text_sub f_text_sub
f_handle_doc_fragments_workaround
} }
# Run the test sanity scanerio # Run the test sanity scanerio
@@ -162,11 +208,11 @@ f_test_sanity_option()
{ {
f_log_info "${FUNCNAME[0]}" f_log_info "${FUNCNAME[0]}"
f_common_steps f_common_steps
f_install_kubernetes_core_from_src f_install_kubernetes_core
pushd "${_build_dir}" || return pushd "${_build_dir}" || return
ansible-galaxy collection build ansible-galaxy collection build
f_log_info "SANITY TEST PWD: ${PWD}" f_log_info "SANITY TEST PWD: ${PWD}"
## Can't do this because the upstream community.kubernetes dependency logic ## Can't do this because the upstream kubernetes.core dependency logic
## is bound as a Makefile dep to the test-sanity target ## is bound as a Makefile dep to the test-sanity target
#SANITY_TEST_ARGS="--docker --color --python 3.6" make test-sanity #SANITY_TEST_ARGS="--docker --color --python 3.6" make test-sanity
# Run tests in docker if available, venv otherwise # Run tests in docker if available, venv otherwise
@@ -185,7 +231,7 @@ f_test_integration_option()
{ {
f_log_info "${FUNCNAME[0]}" f_log_info "${FUNCNAME[0]}"
f_common_steps f_common_steps
f_install_kubernetes_core_from_src f_install_kubernetes_core
pushd "${_build_dir}" || return pushd "${_build_dir}" || return
f_log_info "INTEGRATION TEST WD: ${PWD}" f_log_info "INTEGRATION TEST WD: ${PWD}"
OVERRIDE_COLLECTION_PATH="${_tmp_dir}" molecule test OVERRIDE_COLLECTION_PATH="${_tmp_dir}" molecule test
@@ -202,7 +248,7 @@ f_build_option()
f_log_info "BUILD WD: ${PWD}" f_log_info "BUILD WD: ${PWD}"
# FIXME # FIXME
# This doesn't work because we end up either recursively curl'ing # This doesn't work because we end up either recursively curl'ing
# community.kubernetes and redoing the text replacement over and over # kubernetes.core and redoing the text replacement over and over
# #
# make build # make build
ansible-galaxy collection build ansible-galaxy collection build
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env python
import json
import yaml
import sys
with open("./rendereddocfragments.txt", 'w') as df_fd:
with open(sys.argv[2], 'r') as fd:
json_docs = json.load(fd)
json_docs[sys.argv[1]]['doc'].pop('collection', '')
json_docs[sys.argv[1]]['doc'].pop('filename', '')
df_fd.write("DOCUMENTATION = '''\n")
df_fd.write(yaml.dump(json_docs[sys.argv[1]]['doc'], default_flow_style=False))
df_fd.write("'''\n\n")
df_fd.write("EXAMPLES = '''\n")
df_fd.write(json_docs[sys.argv[1]]['examples'])
df_fd.write("'''\n\n")
df_fd.write("RETURN = '''\n")
df_fd.write(yaml.dump(json_docs[sys.argv[1]]['return'], default_flow_style=False))
df_fd.write("'''\n\n")
+2 -2
View File
@@ -5,7 +5,7 @@ authors:
- willthames (https://github.com/willthames) - willthames (https://github.com/willthames)
- Akasurde (https://github.com/akasurde) - Akasurde (https://github.com/akasurde)
dependencies: dependencies:
community.kubernetes: '>=1.0.0' kubernetes.core: '>=1.1.1'
description: OKD Collection for Ansible. description: OKD Collection for Ansible.
documentation: '' documentation: ''
homepage: '' homepage: ''
@@ -24,4 +24,4 @@ tags:
- okd - okd
- cluster - cluster
# Also needs to be updated in the Makefile # Also needs to be updated in the Makefile
version: 1.0.0 version: 1.0.1
+2 -2
View File
@@ -12,7 +12,7 @@
register: openshift_auth_results register: openshift_auth_results
- name: Get the test User - name: Get the test User
community.kubernetes.k8s_info: kubernetes.core.k8s_info:
api_key: "{{ openshift_auth_results.openshift_auth.api_key }}" api_key: "{{ openshift_auth_results.openshift_auth.api_key }}"
host: '{{ openshift_host }}' host: '{{ openshift_host }}'
verify_ssl: false verify_ssl: false
@@ -35,7 +35,7 @@
verify_ssl: false verify_ssl: false
- name: Get the test user - name: Get the test user
community.kubernetes.k8s_info: kubernetes.core.k8s_info:
api_key: "{{ openshift_auth_results.openshift_auth.api_key }}" api_key: "{{ openshift_auth_results.openshift_auth.api_key }}"
host: '{{ openshift_host }}' host: '{{ openshift_host }}'
verify_ssl: false verify_ssl: false
+1 -1
View File
@@ -133,7 +133,7 @@
that: result is not changed that: result is not changed
- name: Get the created configmap - name: Get the created configmap
community.kubernetes.k8s_info: kubernetes.core.k8s_info:
api_version: v1 api_version: v1
kind: ConfigMap kind: ConfigMap
name: example name: example
+1 -1
View File
@@ -147,7 +147,7 @@ DOCUMENTATION = '''
aliases: [ oc_verify_ssl ] aliases: [ oc_verify_ssl ]
''' '''
from ansible_collections.community.kubernetes.plugins.connection.kubectl import Connection as KubectlConnection from ansible_collections.kubernetes.core.plugins.connection.kubectl import Connection as KubectlConnection
CONNECTION_TRANSPORT = 'oc' CONNECTION_TRANSPORT = 'oc'
+1 -1
View File
@@ -113,7 +113,7 @@ connections:
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
+13 -16
View File
@@ -6,15 +6,9 @@
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
# STARTREMOVE (downstream)
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = ''' DOCUMENTATION = '''
module: k8s module: k8s
@@ -36,10 +30,10 @@ description:
- Optimized for OKD/OpenShift Kubernetes flavors - Optimized for OKD/OpenShift Kubernetes flavors
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
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
@@ -112,8 +106,8 @@ options:
description: description:
- The value of the reason field in your desired condition - The value of the reason field in your desired condition
- For example, if a C(Deployment) is paused, The C(Progressing) C(type) will have the C(DeploymentPaused) reason. - For example, if a C(Deployment) is paused, The C(Progressing) C(type) will have the C(DeploymentPaused) reason.
- The possible reasons in a condition are specific to each resource type in Kubernetes. See the API documentation of the status field - The possible reasons in a condition are specific to each resource type in Kubernetes.
for a given resource to see possible choices. See the API documentation of the status field for a given resource to see possible choices.
type: dict type: dict
validate: validate:
description: description:
@@ -264,6 +258,7 @@ result:
type: int type: int
sample: 48 sample: 48
''' '''
# ENDREMOVE (downstream)
import re import re
import operator import operator
@@ -273,7 +268,7 @@ from functools import reduce
from ansible.module_utils._text import to_native from ansible.module_utils._text import to_native
try: try:
from ansible_collections.community.kubernetes.plugins.module_utils.raw import KubernetesRawModule from ansible_collections.kubernetes.core.plugins.module_utils.raw import KubernetesRawModule
HAS_KUBERNETES_COLLECTION = True HAS_KUBERNETES_COLLECTION = True
except ImportError as e: except ImportError as e:
HAS_KUBERNETES_COLLECTION = False HAS_KUBERNETES_COLLECTION = False
@@ -297,7 +292,7 @@ class OKDRawModule(KubernetesRawModule):
def __init__(self): def __init__(self):
if not HAS_KUBERNETES_COLLECTION: if not HAS_KUBERNETES_COLLECTION:
self.fail_json( self.fail_json(
msg="The community.kubernetes collection must be installed", msg="The kubernetes.core collection must be installed",
exception=K8S_COLLECTION_ERROR, exception=K8S_COLLECTION_ERROR,
error=to_native(k8s_collection_import_exception) error=to_native(k8s_collection_import_exception)
) )
@@ -396,7 +391,9 @@ class OKDRawModule(KubernetesRawModule):
image = existing['spec']['template']['spec']['containers'][old_container_index]['image'] image = existing['spec']['template']['spec']['containers'][old_container_index]['image']
definition['spec']['template']['spec']['containers'][new_container_index]['image'] = image definition['spec']['template']['spec']['containers'][new_container_index]['image'] = image
existing_index = self.get_index(trigger['imageChangeParams'], [x.get('imageChangeParams') for x in existing_triggers], ['containerNames']) existing_index = self.get_index(trigger['imageChangeParams'],
[x.get('imageChangeParams') for x in existing_triggers],
['containerNames'])
if existing_index is not None: if existing_index is not None:
existing_image = existing_triggers[existing_index].get('imageChangeParams', {}).get('lastTriggeredImage') existing_image = existing_triggers[existing_index].get('imageChangeParams', {}).get('lastTriggeredImage')
if existing_image: if existing_image:
+1 -3
View File
@@ -5,10 +5,8 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = r''' DOCUMENTATION = r'''
module: openshift_auth module: openshift_auth
@@ -99,7 +97,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: "{{ openshift_auth_results.openshift_auth.api_key }}" api_key: "{{ openshift_auth_results.openshift_auth.api_key }}"
kind: Pod kind: Pod
register: pod_list register: pod_list
+8 -8
View File
@@ -5,10 +5,9 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
# STARTREMOVE (downstream)
DOCUMENTATION = r''' DOCUMENTATION = r'''
module: openshift_process module: openshift_process
@@ -25,9 +24,9 @@ description:
- For CRUD operations on Template resources themselves, see the community.okd.k8s module. - For CRUD operations on Template resources themselves, see the community.okd.k8s module.
extends_documentation_fragment: extends_documentation_fragment:
- community.kubernetes.k8s_auth_options - kubernetes.core.k8s_auth_options
- community.kubernetes.k8s_wait_options - kubernetes.core.k8s_wait_options
- community.kubernetes.k8s_resource_options - kubernetes.core.k8s_resource_options
requirements: requirements:
- "python >= 2.7" - "python >= 2.7"
@@ -40,7 +39,7 @@ options:
- The name of the Template to process. - The name of the Template to process.
- The Template must be present in the cluster. - The Template must be present in the cluster.
- When provided, I(namespace) is required. - When provided, I(namespace) is required.
- Mutually exlusive with I(resource_definition) or I(src) - Mutually exclusive with I(resource_definition) or I(src)
type: str type: str
namespace: namespace:
description: description:
@@ -202,6 +201,7 @@ resources:
type: complex type: complex
description: Array of status conditions for the object. Not guaranteed to be present description: Array of status conditions for the object. Not guaranteed to be present
''' '''
# ENDREMOVE (downstream)
import re import re
import os import os
@@ -212,7 +212,7 @@ from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils._text import to_native from ansible.module_utils._text import to_native
try: try:
from ansible_collections.community.kubernetes.plugins.module_utils.common import ( from ansible_collections.kubernetes.core.plugins.module_utils.common import (
K8sAnsibleMixin, AUTH_ARG_SPEC, RESOURCE_ARG_SPEC, WAIT_ARG_SPEC K8sAnsibleMixin, AUTH_ARG_SPEC, RESOURCE_ARG_SPEC, WAIT_ARG_SPEC
) )
HAS_KUBERNETES_COLLECTION = True HAS_KUBERNETES_COLLECTION = True
@@ -243,7 +243,7 @@ class OpenShiftProcess(K8sAnsibleMixin):
if not HAS_KUBERNETES_COLLECTION: if not HAS_KUBERNETES_COLLECTION:
self.module.fail_json( self.module.fail_json(
msg="The community.kubernetes collection must be installed", msg="The kubernetes.core collection must be installed",
exception=K8S_COLLECTION_ERROR, exception=K8S_COLLECTION_ERROR,
error=to_native(k8s_collection_import_exception) error=to_native(k8s_collection_import_exception)
) )
+8 -7
View File
@@ -8,7 +8,7 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
# STARTREMOVE (downstream)
DOCUMENTATION = r''' DOCUMENTATION = r'''
module: openshift_route module: openshift_route
@@ -21,12 +21,12 @@ author: "Fabian von Feilitzsch (@fabianvf)"
description: description:
- Looks up a Service and creates a new Route based on it. - Looks up a Service and creates a new Route based on it.
- Analogous to `oc expose` and `oc create route` for creating Routes, but does not support creating Services. - Analogous to `oc expose` and `oc create route` for creating Routes, but does not support creating Services.
- For creating Services from other resources, see community.kubernetes.k8s_expose - For creating Services from other resources, see kubernetes.core.k8s_expose
extends_documentation_fragment: extends_documentation_fragment:
- community.kubernetes.k8s_auth_options - kubernetes.core.k8s_auth_options
- community.kubernetes.k8s_wait_options - kubernetes.core.k8s_wait_options
- community.kubernetes.k8s_state_options - kubernetes.core.k8s_state_options
requirements: requirements:
- "python >= 2.7" - "python >= 2.7"
@@ -296,6 +296,7 @@ duration:
type: int type: int
sample: 48 sample: 48
''' '''
# ENDREMOVE (downstream)
import copy import copy
import traceback import traceback
@@ -304,7 +305,7 @@ from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils._text import to_native from ansible.module_utils._text import to_native
try: try:
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, COMMON_ARG_SPEC K8sAnsibleMixin, AUTH_ARG_SPEC, WAIT_ARG_SPEC, COMMON_ARG_SPEC
) )
HAS_KUBERNETES_COLLECTION = True HAS_KUBERNETES_COLLECTION = True
@@ -332,7 +333,7 @@ class OpenShiftRoute(K8sAnsibleMixin):
if not HAS_KUBERNETES_COLLECTION: if not HAS_KUBERNETES_COLLECTION:
self.module.fail_json( self.module.fail_json(
msg="The community.kubernetes collection must be installed", msg="The kubernetes.core collection must be installed",
exception=K8S_COLLECTION_ERROR, exception=K8S_COLLECTION_ERROR,
error=to_native(k8s_collection_import_exception) error=to_native(k8s_collection_import_exception)
) )