mirror of
https://github.com/openshift/community.okd.git
synced 2026-11-22 07:00:26 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b51c229ad | ||
|
|
d197d28cd1 | ||
|
|
5361c9322e | ||
|
|
6c1dc79c7f | ||
|
|
4cfbde3d14 | ||
|
|
56e39540a0 | ||
|
|
2d71c469bd | ||
|
|
87cd174b96 | ||
|
|
32a6a1fda3 | ||
|
|
775312c037 |
@@ -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.2
|
||||
======
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- restrict the version of kubernetes.core dependency (https://github.com/ansible-collections/community.okd/pull/66).
|
||||
|
||||
v1.0.1
|
||||
======
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- Generate downstream redhat.openshift documentation (https://github.com/ansible-collections/community.okd/pull/59).
|
||||
|
||||
v1.0.0
|
||||
======
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Also needs to be updated in galaxy.yml
|
||||
VERSION = 1.0.0
|
||||
VERSION = 1.0.2
|
||||
|
||||
# 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: 1.0.0
|
||||
version: 1.0.2
|
||||
```
|
||||
|
||||
### 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
|
||||
|
||||
|
||||
@@ -68,3 +68,17 @@ releases:
|
||||
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'
|
||||
1.0.2:
|
||||
changes:
|
||||
minor_changes:
|
||||
- restrict the version of kubernetes.core dependency (https://github.com/ansible-collections/community.okd/pull/66).
|
||||
fragments:
|
||||
- 66-restrict-kubernetes-core-version.yaml
|
||||
release_date: '2021-02-19'
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
---
|
||||
bugfixes:
|
||||
- Generate downstream redhat.openshift documentation (https://github.com/ansible-collections/community.okd/pull/59).
|
||||
@@ -0,0 +1,2 @@
|
||||
minor_changes:
|
||||
- restrict the version of kubernetes.core dependency (https://github.com/ansible-collections/community.okd/pull/66).
|
||||
+96
-48
@@ -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="1.0.0"
|
||||
DOWNSTREAM_VERSION="1.0.2"
|
||||
KEEP_DOWNSTREAM_TMPDIR="${KEEP_DOWNSTREAM_TMPDIR:-''}"
|
||||
_build_dir=""
|
||||
|
||||
@@ -31,15 +31,23 @@ 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"
|
||||
# shellcheck disable=SC2068
|
||||
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 +78,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 +128,63 @@ 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}"
|
||||
# We need following variable for ansible-doc only
|
||||
# shellcheck disable=SC2097,SC2098
|
||||
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 '1,/ENDREMOVE/d' "${module_py}" > "${temp_end}"
|
||||
cat "${temp_start}" "${rendered_fragments}" "${temp_end}" > "${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 +202,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 +210,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 +233,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 +246,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 +270,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
+28
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import json
|
||||
import sys
|
||||
import yaml
|
||||
|
||||
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', '')
|
||||
json_docs[sys.argv[1]]['doc'].pop('has_action', '')
|
||||
|
||||
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")
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/bin/bash -eu
|
||||
|
||||
set -x
|
||||
|
||||
@@ -11,17 +11,18 @@ NAMESPACE=${NAMESPACE:-default}
|
||||
# and set the IMAGE_FORMAT environment variable so that it properly
|
||||
# resolves to your image. For example, quay.io/mynamespace/$component
|
||||
# would resolve to quay.io/mynamespace/molecule-test-runner
|
||||
# shellcheck disable=SC2034
|
||||
component='molecule-test-runner'
|
||||
eval IMAGE=$IMAGE_FORMAT
|
||||
eval IMAGE="$IMAGE_FORMAT"
|
||||
|
||||
PULL_POLICY=${PULL_POLICY:-IfNotPresent}
|
||||
|
||||
if ! oc get namespace $NAMESPACE
|
||||
if ! oc get namespace "$NAMESPACE"
|
||||
then
|
||||
oc create namespace $NAMESPACE
|
||||
oc create namespace "$NAMESPACE"
|
||||
fi
|
||||
|
||||
oc project $NAMESPACE
|
||||
oc project "$NAMESPACE"
|
||||
oc adm policy add-cluster-role-to-user cluster-admin -z default
|
||||
oc adm policy who-can create projectrequests
|
||||
|
||||
@@ -52,7 +53,7 @@ spec:
|
||||
EOF
|
||||
|
||||
function check_success {
|
||||
oc wait --for=condition=complete job/molecule-integration-test --timeout 5s -n $NAMESPACE \
|
||||
oc wait --for=condition=complete job/molecule-integration-test --timeout 5s -n "$NAMESPACE" \
|
||||
&& oc logs job/molecule-integration-test \
|
||||
&& echo "Molecule integration tests ran successfully" \
|
||||
&& return 0
|
||||
@@ -60,7 +61,7 @@ function check_success {
|
||||
}
|
||||
|
||||
function check_failure {
|
||||
oc wait --for=condition=failed job/molecule-integration-test --timeout 5s -n $NAMESPACE \
|
||||
oc wait --for=condition=failed job/molecule-integration-test --timeout 5s -n "$NAMESPACE" \
|
||||
&& oc logs job/molecule-integration-test \
|
||||
&& echo "Molecule integration tests failed, see logs for more information..." \
|
||||
&& return 0
|
||||
|
||||
+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,<1.2.0'
|
||||
description: OKD Collection for Ansible.
|
||||
documentation: ''
|
||||
homepage: ''
|
||||
@@ -24,4 +24,4 @@ tags:
|
||||
- okd
|
||||
- cluster
|
||||
# Also needs to be updated in the Makefile
|
||||
version: 1.0.0
|
||||
version: 1.0.2
|
||||
|
||||
@@ -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
|
||||
|
||||
+15
-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:
|
||||
@@ -140,6 +134,7 @@ options:
|
||||
will only work if the same object is passed with state=absent (alternatively, just use state=absent with the name including
|
||||
the generated hash and append_hash=no)
|
||||
type: bool
|
||||
default: false
|
||||
apply:
|
||||
description:
|
||||
- C(apply) compares the desired resource definition with the previously supplied resource definition,
|
||||
@@ -147,6 +142,7 @@ options:
|
||||
- C(apply) works better with Services than 'force=yes'
|
||||
- mutually exclusive with C(merge_type)
|
||||
type: bool
|
||||
default: false
|
||||
|
||||
requirements:
|
||||
- "python >= 2.7"
|
||||
@@ -264,6 +260,7 @@ result:
|
||||
type: int
|
||||
sample: 48
|
||||
'''
|
||||
# ENDREMOVE (downstream)
|
||||
|
||||
import re
|
||||
import operator
|
||||
@@ -273,7 +270,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 +294,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 +393,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