Compare commits

..
19 Commits
Author SHA1 Message Date
Mike GravesandGitHub ac86a8900c Release 1.1.1 (#79)
* Release 1.1.1

* Add CI fix to changelog
2021-04-06 12:09:53 -04:00
Mike GravesandGitHub fb1912728d Update CI for ansible 2.11 (#80)
* Update CI for ansible 2.11

This copies the ignore-2.11.txt to ignore-2.12.txt and makes sure the CI
build tests against ansible 2.11.

* Add changelog fragment
2021-04-06 16:40:46 +02:00
Mike GravesandGitHub 22f878023a Add missing requirements.txt file (#78)
* Add missing requirements.txt file

This is needed for execution environments.

* Add changelog fragment
2021-04-06 06:14:43 +02:00
Abhijeet KasurdeandGitHub 921c451f0d k8s_auth: Redirect using meta/runtime.yml (#73)
Fixes: #57

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2021-04-05 18:39:15 +02:00
Mike GravesandGitHub e7e114743c Fix sanity failure (#77)
* Fix sanity failure

This fixes a sanity test failure for newer versions of ansible-test. It
was falsely flagging the key parameter for TLS configuration as
sensitive. This parameter is just the path to a key file.

* Restrict molecule version

This is needed to address a breaking change in molecule 3.3.0.

* Add changelog fragment
2021-04-05 17:15:15 +02:00
Mike GravesandGitHub ef6712c8f6 Release version 1.1.0 (#72) 2021-02-24 10:33:21 -05:00
Mike GravesandGitHub 570a8ccd27 Increase kubernetes.core dependency version number (#71)
* Increase kubernetes.core dependency version number

* Add changelog fragment
2021-02-23 02:43:25 -05:00
Eric GustavssonandGitHub d76430d879 typo: conig -> config (#69) 2021-02-22 11:15:15 -05:00
Mike GravesandGitHub 2b51c229ad Prepare for 1.0.2 release (#70) 2021-02-19 12:03:23 -05:00
Mike GravesandGitHub d197d28cd1 Restrict kubernetes.core dependency version (#66)
* Restrict kubernetes.core dependency version

In order to better coordinate releases between this collection and the
kubernetes.core collection we need to use a more restrictive dependency
version range.

* Add changelog fragment
2021-02-19 10:38:31 -05:00
Mike GravesandGitHub 5361c9322e Remove has_action field from doc fragment (#68)
A recent change in Ansible
(https://github.com/ansible/ansible/commit/42da4807214cd609fd3c1800ab245c025ae044cd)
added a has_action field to the json output of ansible-doc. This started
causing the downstream sanity checks to fail.
2021-02-18 11:35:30 -05:00
Mike GravesandGitHub 6c1dc79c7f Fix doc string (#67)
* Fix doc string

The sanity tests fail due to missing default values on a few options in
the doc string. This change puts the doc string in alignment with the
argument spec.

* Fix case
2021-02-18 08:01:49 -05:00
Abhijeet KasurdeandGitHub 4cfbde3d14 Sanity check fixes for CI (#63)
Fixes: #62 #57

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2020-11-18 15:52:26 +01:00
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
Jeff GeerlingandGitHub c1c08606e2 Issue #51: Prepare for 1.0.0 release. (#52) 2020-11-12 09:57:41 -06:00
29 changed files with 299 additions and 112 deletions
+5 -4
View File
@@ -24,6 +24,7 @@ jobs:
ansible:
- stable-2.9
- stable-2.10
- stable-2.11
- devel
python:
- 2.7
@@ -49,7 +50,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 +94,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 +112,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 +136,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
+43
View File
@@ -5,6 +5,49 @@ OKD Collection Release Notes
.. contents:: Topics
v1.1.1
======
Bugfixes
--------
- add missing requirements.txt file needed for execution environments (https://github.com/ansible-collections/community.okd/pull/78).
- openshift_route - default to ``no_log=False`` for the ``key`` parameter in TLS configuration to fix sanity failures (https://github.com/ansible-collections/community.okd/pull/77).
- restrict molecule version to <3.3.0 to address breaking change (https://github.com/ansible-collections/community.okd/pull/77).
- update CI to work with ansible 2.11 (https://github.com/ansible-collections/community.okd/pull/80).
v1.1.0
======
Minor Changes
-------------
- increase the kubernetes.core dependency version number (https://github.com/ansible-collections/community.okd/pull/71).
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
======
Minor Changes
-------------
- Released version 1 to Automation Hub as redhat.openshift (https://github.com/ansible-collections/community.okd/issues/51).
v0.3.0
======
+2 -5
View File
@@ -1,5 +1,5 @@
# Also needs to be updated in galaxy.yml
VERSION = 0.3.0
VERSION = 1.1.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
+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)
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.1.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
+41
View File
@@ -61,3 +61,44 @@ 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'
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'
1.1.0:
changes:
minor_changes:
- increase the kubernetes.core dependency version number (https://github.com/ansible-collections/community.okd/pull/71).
fragments:
- 71-bump-kubernetes-core-version.yaml
release_date: '2021-02-23'
1.1.1:
changes:
bugfixes:
- add missing requirements.txt file needed for execution environments (https://github.com/ansible-collections/community.okd/pull/78).
- openshift_route - default to ``no_log=False`` for the ``key`` parameter in
TLS configuration to fix sanity failures (https://github.com/ansible-collections/community.okd/pull/77).
- restrict molecule version to <3.3.0 to address breaking change (https://github.com/ansible-collections/community.okd/pull/77).
- update CI to work with ansible 2.11 (https://github.com/ansible-collections/community.okd/pull/80).
fragments:
- 77-fix-ci-failure.yaml
- 78-add-requirements-file.yaml
- 80-update-ci.yaml
release_date: '2021-04-06'
@@ -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).
@@ -0,0 +1,2 @@
minor_changes:
- restrict the version of kubernetes.core dependency (https://github.com/ansible-collections/community.okd/pull/66).
@@ -0,0 +1,2 @@
minor_changes:
- increase the kubernetes.core dependency version number (https://github.com/ansible-collections/community.okd/pull/71).
@@ -0,0 +1,3 @@
bugfixes:
- restrict molecule version to <3.3.0 to address breaking change (https://github.com/ansible-collections/community.okd/pull/77).
- openshift_route - default to ``no_log=False`` for the ``key`` parameter in TLS configuration to fix sanity failures (https://github.com/ansible-collections/community.okd/pull/77).
@@ -0,0 +1,2 @@
bugfixes:
- add missing requirements.txt file needed for execution environments (https://github.com/ansible-collections/community.okd/pull/78).
+2
View File
@@ -0,0 +1,2 @@
bugfixes:
- update CI to work with ansible 2.11 (https://github.com/ansible-collections/community.okd/pull/80).
+1 -1
View File
@@ -18,7 +18,7 @@ RUN yum install -y \
&& pip3 install --no-cache-dir \
openshift \
ansible==2.9.* \
molecule \
"molecule<3.3.0" \
&& yum clean all \
&& rm -rf $HOME/.cache \
&& curl -L https://github.com/openshift/okd/releases/download/4.5.0-0.okd-2020-08-12-020541/openshift-client-linux-4.5.0-0.okd-2020-08-12-020541.tar.gz | tar -xz -C /usr/local/bin
+96 -48
View File
@@ -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.1.1"
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
+28
View File
@@ -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")
+8 -7
View File
@@ -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
View File
@@ -5,7 +5,7 @@ authors:
- willthames (https://github.com/willthames)
- Akasurde (https://github.com/akasurde)
dependencies:
community.kubernetes: '>=1.0.0'
kubernetes.core: '>=1.2.0,<1.3.0'
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.1.1
+4
View File
@@ -1,2 +1,6 @@
---
requires_ansible: '>=2.9'
plugin_routing:
modules:
k8s_auth:
redirect: community.okd.openshift_auth
+2 -2
View File
@@ -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
+1 -1
View File
@@ -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
+2 -2
View File
@@ -71,7 +71,7 @@ DOCUMENTATION = '''
- name: K8S_AUTH_EXTRA_ARGS
oc_kubeconfig:
description:
- Path to a oc config file. Defaults to I(~/.kube/conig)
- Path to a oc config file. Defaults to I(~/.kube/config)
default: ''
vars:
- name: ansible_oc_kubeconfig
@@ -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'
+1 -1
View File
@@ -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
View File
@@ -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:
-1
View File
@@ -1 +0,0 @@
openshift_auth.py
+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)
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
+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)
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)
)
+9 -8
View File
@@ -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)
)
@@ -366,7 +367,7 @@ class OpenShiftRoute(K8sAnsibleMixin):
ca_certificate=dict(type='str'),
certificate=dict(type='str'),
destination_ca_certificate=dict(type='str'),
key=dict(type='str'),
key=dict(type='str', no_log=False),
insecure_policy=dict(type='str', choices=['allow', 'redirect', 'disallow'], default='disallow'),
))
spec['termination'] = dict(choices=['edge', 'passthrough', 'reencrypt', 'insecure'], default='insecure')
+2
View File
@@ -0,0 +1,2 @@
openshift>=0.6.2
requests-oauthlib
+3
View File
@@ -0,0 +1,3 @@
plugins/modules/k8s.py validate-modules:parameter-type-not-in-doc
plugins/modules/k8s.py validate-modules:return-syntax-error
plugins/modules/openshift_process.py validate-modules:parameter-type-not-in-doc