mirror of
https://github.com/openshift/community.okd.git
synced 2026-11-22 07:00:26 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
56e39540a0 | ||
|
|
2d71c469bd | ||
|
|
87cd174b96 | ||
|
|
32a6a1fda3 | ||
|
|
775312c037 | ||
|
|
c1c08606e2 |
@@ -49,7 +49,7 @@ jobs:
|
||||
|
||||
# run ansible-test sanity inside of Docker.
|
||||
# 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
|
||||
run: make upstream-test-sanity TEST_ARGS='--python ${{ matrix.python }}'
|
||||
working-directory: ./ansible_collections/community/okd
|
||||
@@ -93,7 +93,7 @@ jobs:
|
||||
# # OPTIONAL If your integration test requires Python libraries or modules from other collections
|
||||
# # Install them like this
|
||||
# - name: Install collection dependencies
|
||||
# run: ansible-galaxy collection install community.kubernetes -p .
|
||||
# run: ansible-galaxy collection install kubernetes.core -p .
|
||||
|
||||
# # Run the integration tests
|
||||
# - name: Run integration test
|
||||
@@ -111,7 +111,7 @@ jobs:
|
||||
# fail_ci_if_error: false
|
||||
#
|
||||
downstream-sanity-29:
|
||||
name: Sanity (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }})
|
||||
name: Downstream Sanity (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }})
|
||||
strategy:
|
||||
matrix:
|
||||
ansible:
|
||||
@@ -135,7 +135,7 @@ jobs:
|
||||
|
||||
# run ansible-test sanity inside of Docker.
|
||||
# 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
|
||||
run: make downstream-test-sanity
|
||||
working-directory: ./ansible_collections/community/okd
|
||||
|
||||
@@ -5,6 +5,22 @@ OKD Collection Release Notes
|
||||
.. contents:: Topics
|
||||
|
||||
|
||||
v1.0.1
|
||||
======
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- Generate downstream redhat.openshift documentation (https://github.com/ansible-collections/community.okd/pull/59).
|
||||
|
||||
v1.0.0
|
||||
======
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- Released version 1 to Automation Hub as redhat.openshift (https://github.com/ansible-collections/community.okd/issues/51).
|
||||
|
||||
v0.3.0
|
||||
======
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Also needs to be updated in galaxy.yml
|
||||
VERSION = 0.3.0
|
||||
VERSION = 1.0.1
|
||||
|
||||
# To run sanity tests in a venv, set SANITY_TEST_ARGS to '--venv'
|
||||
SANITY_TEST_ARGS ?= --docker --color
|
||||
@@ -12,11 +12,8 @@ build: clean
|
||||
ansible-galaxy collection build
|
||||
|
||||
install-kubernetes-src:
|
||||
mkdir -p ansible_collections/community/kubernetes
|
||||
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
|
||||
ansible-galaxy collection install -p ansible_collections kubernetes.core
|
||||
|
||||
# TODO: Once we no longer rely on features in main we should drop the install-kubernetes-src dependency
|
||||
install: build install-kubernetes-src
|
||||
ansible-galaxy collection install -p ansible_collections community-okd-$(VERSION).tar.gz
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
# OKD/OpenShift Collection for Ansible
|
||||
# OKD Collection for Ansible
|
||||
|
||||
<!--- STARTREMOVE --->
|
||||
[](https://github.com/ansible-collections/community.okd/actions) [](https://codecov.io/gh/ansible-collections/community.okd)
|
||||
|
||||
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
|
||||
|
||||
@@ -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.
|
||||
|
||||
<!--- ENDREMOVE --->
|
||||
|
||||
## Installation and Usage
|
||||
|
||||
### 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:
|
||||
- name: community.okd
|
||||
version: 0.3.0
|
||||
version: 1.0.1
|
||||
```
|
||||
|
||||
### 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.
|
||||
|
||||
<!--- STARTREMOVE --->
|
||||
## 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.
|
||||
@@ -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.
|
||||
|
||||
After the version is published, verify it exists on the [OKD Collection Galaxy page](https://galaxy.ansible.com/community/okd).
|
||||
<!--- ENDREMOVE --->
|
||||
|
||||
## More Information
|
||||
|
||||
|
||||
@@ -61,3 +61,17 @@ releases:
|
||||
name: openshift_route
|
||||
namespace: ''
|
||||
release_date: '2020-10-12'
|
||||
1.0.0:
|
||||
changes:
|
||||
minor_changes:
|
||||
- Released version 1 to Automation Hub as redhat.openshift (https://github.com/ansible-collections/community.okd/issues/51).
|
||||
fragments:
|
||||
- 51-redhat-openshift-ah-release.yml
|
||||
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 @@
|
||||
---
|
||||
minor_changes:
|
||||
- Released version 1 to Automation Hub as redhat.openshift (https://github.com/ansible-collections/community.okd/issues/51).
|
||||
@@ -0,0 +1,3 @@
|
||||
---
|
||||
bugfixes:
|
||||
- Generate downstream redhat.openshift documentation (https://github.com/ansible-collections/community.okd/pull/59).
|
||||
+95
-49
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash -eu
|
||||
#!/bin/bash -e
|
||||
|
||||
# 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
|
||||
# from when in use throughout the script
|
||||
|
||||
DOWNSTREAM_VERSION="0.3.0"
|
||||
DOWNSTREAM_VERSION="1.0.1"
|
||||
KEEP_DOWNSTREAM_TMPDIR="${KEEP_DOWNSTREAM_TMPDIR:-''}"
|
||||
_build_dir=""
|
||||
|
||||
@@ -31,15 +31,22 @@ f_show_help()
|
||||
f_text_sub()
|
||||
{
|
||||
# Switch FQCN and dependent components
|
||||
sed -i "s/community-okd/redhat-openshift/" "${_build_dir}/Makefile"
|
||||
sed -i "s/community\/okd/redhat\/openshift/" "${_build_dir}/Makefile"
|
||||
sed -i "s/^VERSION\:/VERSION: ${DOWNSTREAM_VERSION}/" "${_build_dir}/Makefile"
|
||||
sed -i "s/name\:.*$/name: openshift/" "${_build_dir}/galaxy.yml"
|
||||
sed -i "s/namespace\:.*$/namespace: redhat/" "${_build_dir}/galaxy.yml"
|
||||
sed -i "s/Kubernetes/OpenShift/g" "${_build_dir}/galaxy.yml"
|
||||
sed -i "s/^version\:.*$/version: ${DOWNSTREAM_VERSION}/" "${_build_dir}/galaxy.yml"
|
||||
find ${_build_dir} -type f -exec sed -i "s/community\.kubernetes/kubernetes\.core/g" {} \;
|
||||
find ${_build_dir} -type f -exec sed -i "s/community\.okd/redhat\.openshift/g" {} \;
|
||||
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"
|
||||
for okd_file in ${OKD_sed_files[@]}; do sed -i.bak "s/OKD/OpenShift/g" "${okd_file}"; done
|
||||
|
||||
sed -i.bak "s/============================/==================================/" "${_build_dir}/CHANGELOG.rst"
|
||||
sed -i.bak "s/Ansible Galaxy/Automation Hub/" "${_build_dir}/README.md"
|
||||
sed -i.bak "s/community-okd/redhat-openshift/" "${_build_dir}/Makefile"
|
||||
sed -i.bak "s/community\/okd/redhat\/openshift/" "${_build_dir}/Makefile"
|
||||
sed -i.bak "s/^VERSION\:/VERSION: ${DOWNSTREAM_VERSION}/" "${_build_dir}/Makefile"
|
||||
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()
|
||||
@@ -70,9 +77,18 @@ f_prep()
|
||||
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)
|
||||
_start_dir="${PWD}"
|
||||
_build_dir="${_tmp_dir}/ansible_collections/redhat/openshift"
|
||||
mkdir -p "${_build_dir}"
|
||||
}
|
||||
@@ -111,33 +127,62 @@ f_create_collection_dir_structure()
|
||||
do
|
||||
cp -r "./${d_name}" "${_build_dir}/${d_name}"
|
||||
done
|
||||
for exclude_file in "${_file_exclude[@]}";
|
||||
do
|
||||
if [[ -f "${_build_dir}/${exclude_file}" ]]; then
|
||||
rm -f "${_build_dir}/${exclude_file}"
|
||||
fi
|
||||
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_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"
|
||||
mkdir -p "${community_k8s_tmpdir}"
|
||||
|
||||
pushd "${_tmp_dir}"
|
||||
# curl -L \
|
||||
# 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
|
||||
ansible-galaxy collection install -p "${install_collections_dir}" kubernetes.core
|
||||
popd
|
||||
}
|
||||
|
||||
@@ -155,6 +200,7 @@ f_common_steps()
|
||||
f_prep
|
||||
f_create_collection_dir_structure
|
||||
f_text_sub
|
||||
f_handle_doc_fragments_workaround
|
||||
}
|
||||
|
||||
# Run the test sanity scanerio
|
||||
@@ -162,11 +208,11 @@ f_test_sanity_option()
|
||||
{
|
||||
f_log_info "${FUNCNAME[0]}"
|
||||
f_common_steps
|
||||
f_install_kubernetes_core_from_src
|
||||
f_install_kubernetes_core
|
||||
pushd "${_build_dir}" || return
|
||||
ansible-galaxy collection build
|
||||
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
|
||||
#SANITY_TEST_ARGS="--docker --color --python 3.6" make test-sanity
|
||||
# Run tests in docker if available, venv otherwise
|
||||
@@ -185,7 +231,7 @@ f_test_integration_option()
|
||||
{
|
||||
f_log_info "${FUNCNAME[0]}"
|
||||
f_common_steps
|
||||
f_install_kubernetes_core_from_src
|
||||
f_install_kubernetes_core
|
||||
pushd "${_build_dir}" || return
|
||||
f_log_info "INTEGRATION TEST WD: ${PWD}"
|
||||
OVERRIDE_COLLECTION_PATH="${_tmp_dir}" molecule test
|
||||
@@ -198,16 +244,16 @@ f_build_option()
|
||||
{
|
||||
f_log_info "${FUNCNAME[0]}"
|
||||
f_common_steps
|
||||
pushd "${_build_dir}" || return
|
||||
pushd "${_build_dir}" || return
|
||||
f_log_info "BUILD WD: ${PWD}"
|
||||
# FIXME
|
||||
# This doesn't work because we end up either recursively curl'ing
|
||||
# community.kubernetes and redoing the text replacement over and over
|
||||
#
|
||||
# make build
|
||||
# FIXME
|
||||
# This doesn't work because we end up either recursively curl'ing
|
||||
# kubernetes.core and redoing the text replacement over and over
|
||||
#
|
||||
# make build
|
||||
ansible-galaxy collection build
|
||||
|
||||
popd || return
|
||||
popd || return
|
||||
f_copy_collection_to_working_dir
|
||||
f_cleanup
|
||||
}
|
||||
@@ -222,19 +268,19 @@ fi
|
||||
while getopts ":sirb" option
|
||||
do
|
||||
case $option in
|
||||
s)
|
||||
s)
|
||||
f_test_sanity_option
|
||||
;;
|
||||
i)
|
||||
i)
|
||||
f_test_integration_option
|
||||
;;
|
||||
r)
|
||||
r)
|
||||
f_release_option
|
||||
;;
|
||||
b)
|
||||
b)
|
||||
f_build_option
|
||||
;;
|
||||
*)
|
||||
*)
|
||||
printf "ERROR: Unimplemented option chosen.\n"
|
||||
f_show_help
|
||||
f_exit 1
|
||||
|
||||
Executable
+26
@@ -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
@@ -5,7 +5,7 @@ authors:
|
||||
- willthames (https://github.com/willthames)
|
||||
- Akasurde (https://github.com/akasurde)
|
||||
dependencies:
|
||||
community.kubernetes: '>=1.0.0'
|
||||
kubernetes.core: '>=1.1.1'
|
||||
description: OKD Collection for Ansible.
|
||||
documentation: ''
|
||||
homepage: ''
|
||||
@@ -24,4 +24,4 @@ tags:
|
||||
- okd
|
||||
- cluster
|
||||
# Also needs to be updated in the Makefile
|
||||
version: 0.3.0
|
||||
version: 1.0.1
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
register: openshift_auth_results
|
||||
|
||||
- name: Get the test User
|
||||
community.kubernetes.k8s_info:
|
||||
kubernetes.core.k8s_info:
|
||||
api_key: "{{ openshift_auth_results.openshift_auth.api_key }}"
|
||||
host: '{{ openshift_host }}'
|
||||
verify_ssl: false
|
||||
@@ -35,7 +35,7 @@
|
||||
verify_ssl: false
|
||||
|
||||
- name: Get the test user
|
||||
community.kubernetes.k8s_info:
|
||||
kubernetes.core.k8s_info:
|
||||
api_key: "{{ openshift_auth_results.openshift_auth.api_key }}"
|
||||
host: '{{ openshift_host }}'
|
||||
verify_ssl: false
|
||||
|
||||
@@ -133,7 +133,7 @@
|
||||
that: result is not changed
|
||||
|
||||
- name: Get the created configmap
|
||||
community.kubernetes.k8s_info:
|
||||
kubernetes.core.k8s_info:
|
||||
api_version: v1
|
||||
kind: ConfigMap
|
||||
name: example
|
||||
|
||||
@@ -147,7 +147,7 @@ DOCUMENTATION = '''
|
||||
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'
|
||||
|
||||
@@ -113,7 +113,7 @@ connections:
|
||||
context: 'awx/192-168-64-4:8443/developer'
|
||||
'''
|
||||
|
||||
from ansible_collections.community.kubernetes.plugins.inventory.k8s import K8sInventoryException, InventoryModule as K8sInventoryModule, format_dynamic_api_exc
|
||||
from ansible_collections.kubernetes.core.plugins.inventory.k8s import K8sInventoryException, InventoryModule as K8sInventoryModule, format_dynamic_api_exc
|
||||
|
||||
try:
|
||||
from openshift.dynamic.exceptions import DynamicApiError
|
||||
|
||||
+13
-16
@@ -6,15 +6,9 @@
|
||||
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
||||
# STARTREMOVE (downstream)
|
||||
DOCUMENTATION = '''
|
||||
|
||||
module: k8s
|
||||
@@ -36,10 +30,10 @@ description:
|
||||
- Optimized for OKD/OpenShift Kubernetes flavors
|
||||
|
||||
extends_documentation_fragment:
|
||||
- community.kubernetes.k8s_state_options
|
||||
- community.kubernetes.k8s_name_options
|
||||
- community.kubernetes.k8s_resource_options
|
||||
- community.kubernetes.k8s_auth_options
|
||||
- kubernetes.core.k8s_state_options
|
||||
- kubernetes.core.k8s_name_options
|
||||
- kubernetes.core.k8s_resource_options
|
||||
- kubernetes.core.k8s_auth_options
|
||||
|
||||
notes:
|
||||
- If your OpenShift Python library is not 0.9.0 or newer and you are trying to
|
||||
@@ -112,8 +106,8 @@ options:
|
||||
description:
|
||||
- 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.
|
||||
- The possible reasons in a condition are specific to each resource type in Kubernetes. See the API documentation of the status field
|
||||
for a given resource to see possible choices.
|
||||
- The possible reasons in a condition are specific to each resource type in Kubernetes.
|
||||
See the API documentation of the status field for a given resource to see possible choices.
|
||||
type: dict
|
||||
validate:
|
||||
description:
|
||||
@@ -264,6 +258,7 @@ result:
|
||||
type: int
|
||||
sample: 48
|
||||
'''
|
||||
# ENDREMOVE (downstream)
|
||||
|
||||
import re
|
||||
import operator
|
||||
@@ -273,7 +268,7 @@ from functools import reduce
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
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
|
||||
except ImportError as e:
|
||||
HAS_KUBERNETES_COLLECTION = False
|
||||
@@ -297,7 +292,7 @@ class OKDRawModule(KubernetesRawModule):
|
||||
def __init__(self):
|
||||
if not HAS_KUBERNETES_COLLECTION:
|
||||
self.fail_json(
|
||||
msg="The community.kubernetes collection must be installed",
|
||||
msg="The kubernetes.core collection must be installed",
|
||||
exception=K8S_COLLECTION_ERROR,
|
||||
error=to_native(k8s_collection_import_exception)
|
||||
)
|
||||
@@ -396,7 +391,9 @@ class OKDRawModule(KubernetesRawModule):
|
||||
image = existing['spec']['template']['spec']['containers'][old_container_index]['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:
|
||||
existing_image = existing_triggers[existing_index].get('imageChangeParams', {}).get('lastTriggeredImage')
|
||||
if existing_image:
|
||||
|
||||
@@ -5,10 +5,8 @@
|
||||
# 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
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
DOCUMENTATION = r'''
|
||||
|
||||
module: openshift_auth
|
||||
@@ -99,7 +97,7 @@ EXAMPLES = r'''
|
||||
# Previous task provides the token/api_key, while all other parameters
|
||||
# are taken from module_defaults
|
||||
- name: Get a list of all pods from any namespace
|
||||
community.kubernetes.k8s_info:
|
||||
kubernetes.core.k8s_info:
|
||||
api_key: "{{ openshift_auth_results.openshift_auth.api_key }}"
|
||||
kind: Pod
|
||||
register: pod_list
|
||||
|
||||
@@ -5,10 +5,9 @@
|
||||
# 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
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
# STARTREMOVE (downstream)
|
||||
DOCUMENTATION = r'''
|
||||
module: openshift_process
|
||||
|
||||
@@ -25,9 +24,9 @@ description:
|
||||
- For CRUD operations on Template resources themselves, see the community.okd.k8s module.
|
||||
|
||||
extends_documentation_fragment:
|
||||
- community.kubernetes.k8s_auth_options
|
||||
- community.kubernetes.k8s_wait_options
|
||||
- community.kubernetes.k8s_resource_options
|
||||
- kubernetes.core.k8s_auth_options
|
||||
- kubernetes.core.k8s_wait_options
|
||||
- kubernetes.core.k8s_resource_options
|
||||
|
||||
requirements:
|
||||
- "python >= 2.7"
|
||||
@@ -40,7 +39,7 @@ options:
|
||||
- The name of the Template to process.
|
||||
- The Template must be present in the cluster.
|
||||
- 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
|
||||
namespace:
|
||||
description:
|
||||
@@ -202,6 +201,7 @@ resources:
|
||||
type: complex
|
||||
description: Array of status conditions for the object. Not guaranteed to be present
|
||||
'''
|
||||
# ENDREMOVE (downstream)
|
||||
|
||||
import re
|
||||
import os
|
||||
@@ -212,7 +212,7 @@ from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
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
|
||||
)
|
||||
HAS_KUBERNETES_COLLECTION = True
|
||||
@@ -243,7 +243,7 @@ class OpenShiftProcess(K8sAnsibleMixin):
|
||||
|
||||
if not HAS_KUBERNETES_COLLECTION:
|
||||
self.module.fail_json(
|
||||
msg="The community.kubernetes collection must be installed",
|
||||
msg="The kubernetes.core collection must be installed",
|
||||
exception=K8S_COLLECTION_ERROR,
|
||||
error=to_native(k8s_collection_import_exception)
|
||||
)
|
||||
|
||||
@@ -8,7 +8,7 @@ from __future__ import absolute_import, division, print_function
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
# STARTREMOVE (downstream)
|
||||
DOCUMENTATION = r'''
|
||||
module: openshift_route
|
||||
|
||||
@@ -21,12 +21,12 @@ author: "Fabian von Feilitzsch (@fabianvf)"
|
||||
description:
|
||||
- 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.
|
||||
- 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:
|
||||
- community.kubernetes.k8s_auth_options
|
||||
- community.kubernetes.k8s_wait_options
|
||||
- community.kubernetes.k8s_state_options
|
||||
- kubernetes.core.k8s_auth_options
|
||||
- kubernetes.core.k8s_wait_options
|
||||
- kubernetes.core.k8s_state_options
|
||||
|
||||
requirements:
|
||||
- "python >= 2.7"
|
||||
@@ -296,6 +296,7 @@ duration:
|
||||
type: int
|
||||
sample: 48
|
||||
'''
|
||||
# ENDREMOVE (downstream)
|
||||
|
||||
import copy
|
||||
import traceback
|
||||
@@ -304,7 +305,7 @@ from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
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
|
||||
)
|
||||
HAS_KUBERNETES_COLLECTION = True
|
||||
@@ -332,7 +333,7 @@ class OpenShiftRoute(K8sAnsibleMixin):
|
||||
|
||||
if not HAS_KUBERNETES_COLLECTION:
|
||||
self.module.fail_json(
|
||||
msg="The community.kubernetes collection must be installed",
|
||||
msg="The kubernetes.core collection must be installed",
|
||||
exception=K8S_COLLECTION_ERROR,
|
||||
error=to_native(k8s_collection_import_exception)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user