From b718b0e23045bdb2e76e04ee9b2b7b147aae0d56 Mon Sep 17 00:00:00 2001 From: Mayank Patel Date: Wed, 20 Sep 2023 04:08:52 -0400 Subject: [PATCH] App Node Interface Metrics Exporter:directory structure creation This commit creates the directory structure of app-node-interface-metrics-exporter repo. Test Plan: PASS:Build process with creation of debian package. PASS:Extract the content of stx-node-interface-metrics-exporter-helm_ 1.0-1.stx.1_amd64.deb and check. Story: 2010918 Task: 48792 Change-Id: I05411252457f91ceeaf3553c82f00ad0458c1fa1 Signed-off-by: Mayank Patel --- .gitignore | 35 +++ .zuul.yaml | 8 + debian_build_layer.cfg | 1 + debian_iso_image.inc | 1 + debian_pkg_dirs | 2 + .../debian/deb_folder/changelog | 5 + .../debian/deb_folder/control | 28 +++ .../debian/deb_folder/copyright | 41 +++ ...-interface-metrics-exporter-wheels.install | 1 + ...pp-node-interface-metrics-exporter.install | 1 + .../debian/deb_folder/rules | 26 ++ .../debian/deb_folder/source/format | 1 + .../debian/meta_data.yaml | 9 + .../.stestr.conf | 4 + .../LICENSE | 202 +++++++++++++++ .../README.rst | 7 + .../__init__.py | 0 .../common/__init__.py | 0 .../common/constants.py | 17 ++ .../helm/__init__.py | 0 .../helm/node_interface_metrics_exporter.py | 96 +++++++ .../lifecycle/__init__.py | 0 ...fecycle_node_interface_metrics_exporter.py | 21 ++ .../tests/__init__.py | 0 .../test_node_interface_metrics_exporter.py | 33 +++ .../tests/test_plugins.py | 47 ++++ .../pylint.rc | 234 ++++++++++++++++++ .../requirements.txt | 2 + .../setup.cfg | 39 +++ .../setup.py | 13 + .../test-requirements.txt | 20 ++ .../upper-constraints.txt | 1 + requirements.txt | 1 + .../debian/deb_folder/changelog | 5 + .../debian/deb_folder/control | 18 ++ .../debian/deb_folder/copyright | 41 +++ .../debian/deb_folder/rules | 57 +++++ .../debian/deb_folder/source/format | 1 + ...de-interface-metrics-exporter-helm.install | 1 + .../debian/meta_data.yaml | 10 + .../README | 12 + .../files/metadata.yaml | 10 + .../fluxcd-manifests/base/helmrepository.yaml | 13 + .../fluxcd-manifests/base/kustomization.yaml | 9 + .../fluxcd-manifests/base/namespace.yaml | 10 + .../fluxcd-manifests/kustomization.yaml | 12 + .../helmrelease.yaml | 36 +++ .../kustomization.yaml | 18 ++ .../nime-static-overrides.yaml | 5 + .../nime-system-overrides.yaml | 5 + .../helm-charts/Makefile | 41 +++ .../Chart.yaml | 10 + test-requirements.txt | 3 + tox.ini | 51 ++++ 54 files changed, 1264 insertions(+) create mode 100644 .gitignore create mode 100644 .zuul.yaml create mode 100644 debian_build_layer.cfg create mode 100644 debian_iso_image.inc create mode 100644 debian_pkg_dirs create mode 100644 python3-k8sapp-node-interface-metrics-exporter/debian/deb_folder/changelog create mode 100644 python3-k8sapp-node-interface-metrics-exporter/debian/deb_folder/control create mode 100644 python3-k8sapp-node-interface-metrics-exporter/debian/deb_folder/copyright create mode 100644 python3-k8sapp-node-interface-metrics-exporter/debian/deb_folder/python3-k8sapp-node-interface-metrics-exporter-wheels.install create mode 100644 python3-k8sapp-node-interface-metrics-exporter/debian/deb_folder/python3-k8sapp-node-interface-metrics-exporter.install create mode 100755 python3-k8sapp-node-interface-metrics-exporter/debian/deb_folder/rules create mode 100644 python3-k8sapp-node-interface-metrics-exporter/debian/deb_folder/source/format create mode 100644 python3-k8sapp-node-interface-metrics-exporter/debian/meta_data.yaml create mode 100644 python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/.stestr.conf create mode 100644 python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/LICENSE create mode 100644 python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/README.rst create mode 100644 python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/__init__.py create mode 100644 python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/common/__init__.py create mode 100644 python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/common/constants.py create mode 100644 python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/helm/__init__.py create mode 100644 python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/helm/node_interface_metrics_exporter.py create mode 100644 python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/lifecycle/__init__.py create mode 100644 python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/lifecycle/lifecycle_node_interface_metrics_exporter.py create mode 100644 python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/tests/__init__.py create mode 100644 python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/tests/test_node_interface_metrics_exporter.py create mode 100644 python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/tests/test_plugins.py create mode 100644 python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/pylint.rc create mode 100644 python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/requirements.txt create mode 100644 python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/setup.cfg create mode 100644 python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/setup.py create mode 100644 python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/test-requirements.txt create mode 100644 python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/upper-constraints.txt create mode 100644 requirements.txt create mode 100644 stx-node-interface-metrics-exporter-helm/debian/deb_folder/changelog create mode 100644 stx-node-interface-metrics-exporter-helm/debian/deb_folder/control create mode 100644 stx-node-interface-metrics-exporter-helm/debian/deb_folder/copyright create mode 100755 stx-node-interface-metrics-exporter-helm/debian/deb_folder/rules create mode 100644 stx-node-interface-metrics-exporter-helm/debian/deb_folder/source/format create mode 100644 stx-node-interface-metrics-exporter-helm/debian/deb_folder/stx-node-interface-metrics-exporter-helm.install create mode 100644 stx-node-interface-metrics-exporter-helm/debian/meta_data.yaml create mode 100644 stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/README create mode 100644 stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/files/metadata.yaml create mode 100644 stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/fluxcd-manifests/base/helmrepository.yaml create mode 100644 stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/fluxcd-manifests/base/kustomization.yaml create mode 100644 stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/fluxcd-manifests/base/namespace.yaml create mode 100644 stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/fluxcd-manifests/kustomization.yaml create mode 100644 stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/fluxcd-manifests/node-interface-metrics-exporter/helmrelease.yaml create mode 100644 stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/fluxcd-manifests/node-interface-metrics-exporter/kustomization.yaml create mode 100644 stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/fluxcd-manifests/node-interface-metrics-exporter/nime-static-overrides.yaml create mode 100644 stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/fluxcd-manifests/node-interface-metrics-exporter/nime-system-overrides.yaml create mode 100644 stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/helm-charts/Makefile create mode 100644 stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/helm-charts/node-interface-metrics-exporter/Chart.yaml create mode 100644 test-requirements.txt create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..78c457c --- /dev/null +++ b/.gitignore @@ -0,0 +1,35 @@ +# Compiled files +*.py[co] +*.a +*.o +*.so + +# Sphinx +_build +doc/source/api/ + +# Packages/installer info +*.egg +*.egg-info +dist +build +eggs +parts +var +sdist +develop-eggs +.installed.cfg + +# Other +*.DS_Store +.stestr +.testrepository +.tox +.venv +.*.swp +.coverage +bandit.xml +cover +AUTHORS +ChangeLog +*.sqlite diff --git a/.zuul.yaml b/.zuul.yaml new file mode 100644 index 0000000..7ccbd0a --- /dev/null +++ b/.zuul.yaml @@ -0,0 +1,8 @@ +--- +- project: + check: + jobs: + - openstack-tox-linters + gate: + jobs: + - openstack-tox-linters diff --git a/debian_build_layer.cfg b/debian_build_layer.cfg new file mode 100644 index 0000000..c581999 --- /dev/null +++ b/debian_build_layer.cfg @@ -0,0 +1 @@ +flock diff --git a/debian_iso_image.inc b/debian_iso_image.inc new file mode 100644 index 0000000..269d387 --- /dev/null +++ b/debian_iso_image.inc @@ -0,0 +1 @@ +stx-node-interface-metrics-exporter-helm diff --git a/debian_pkg_dirs b/debian_pkg_dirs new file mode 100644 index 0000000..513a7fa --- /dev/null +++ b/debian_pkg_dirs @@ -0,0 +1,2 @@ +python3-k8sapp-node-interface-metrics-exporter +stx-node-interface-metrics-exporter-helm diff --git a/python3-k8sapp-node-interface-metrics-exporter/debian/deb_folder/changelog b/python3-k8sapp-node-interface-metrics-exporter/debian/deb_folder/changelog new file mode 100644 index 0000000..794e30e --- /dev/null +++ b/python3-k8sapp-node-interface-metrics-exporter/debian/deb_folder/changelog @@ -0,0 +1,5 @@ +python3-k8sapp-node-interface-metrics-exporter (1.0-1) unstable; urgency=medium + + * Initial release. + + -- Mayank Patel Mon 18 September 2023 07:32:24 AM EST diff --git a/python3-k8sapp-node-interface-metrics-exporter/debian/deb_folder/control b/python3-k8sapp-node-interface-metrics-exporter/debian/deb_folder/control new file mode 100644 index 0000000..747c594 --- /dev/null +++ b/python3-k8sapp-node-interface-metrics-exporter/debian/deb_folder/control @@ -0,0 +1,28 @@ +Source: python3-k8sapp-node-interface-metrics-exporter +Section: libs +Priority: optional +Maintainer: StarlingX Developers +Build-Depends: debhelper-compat (= 13), + dh-python, + python3-all, + python3-pbr, + python3-setuptools, + python3-wheel +Standards-Version: 4.5.1 +Homepage: https://www.starlingx.io + +Package: python3-k8sapp-node-interface-metrics-exporter +Section: libs +Architecture: any +Depends: ${misc:Depends}, ${python3:Depends} +Description: StarlingX Sysinv Interface Metrics Exporter Extensions + This package contains sysinv plugins for the interface metrics + exporter K8S app. + +Package: python3-k8sapp-node-interface-metrics-exporter-wheels +Section: libs +Architecture: any +Depends: ${misc:Depends}, ${python3:Depends}, python3-wheel +Description: StarlingX Sysinv Interface Metrics Exporter Extension Wheels + This package contains python wheels for the interface metrics exporter + K8S app plugins. diff --git a/python3-k8sapp-node-interface-metrics-exporter/debian/deb_folder/copyright b/python3-k8sapp-node-interface-metrics-exporter/debian/deb_folder/copyright new file mode 100644 index 0000000..1e4cd83 --- /dev/null +++ b/python3-k8sapp-node-interface-metrics-exporter/debian/deb_folder/copyright @@ -0,0 +1,41 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: python3-k8sapp-node-interface-metrics-exporter +Source: https://opendev.org/starlingx/app-node-interface-metrics-exporter/ + +Files: * +Copyright: (c) 2023 Wind River Systems, Inc +License: Apache-2 + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + . + https://www.apache.org/licenses/LICENSE-2.0 + . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + . + On Debian-based systems the full text of the Apache version 2.0 license + can be found in `/usr/share/common-licenses/Apache-2.0'. + +# If you want to use GPL v2 or later for the /debian/* files use +# the following clauses, or change it to suit. Delete these two lines +Files: debian/* +Copyright: 2023 Wind River Systems, Inc +License: Apache-2 + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + . + https://www.apache.org/licenses/LICENSE-2.0 + . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + . + On Debian-based systems the full text of the Apache version 2.0 license + can be found in `/usr/share/common-licenses/Apache-2.0'. diff --git a/python3-k8sapp-node-interface-metrics-exporter/debian/deb_folder/python3-k8sapp-node-interface-metrics-exporter-wheels.install b/python3-k8sapp-node-interface-metrics-exporter/debian/deb_folder/python3-k8sapp-node-interface-metrics-exporter-wheels.install new file mode 100644 index 0000000..19a9e4c --- /dev/null +++ b/python3-k8sapp-node-interface-metrics-exporter/debian/deb_folder/python3-k8sapp-node-interface-metrics-exporter-wheels.install @@ -0,0 +1 @@ +plugins/*.whl diff --git a/python3-k8sapp-node-interface-metrics-exporter/debian/deb_folder/python3-k8sapp-node-interface-metrics-exporter.install b/python3-k8sapp-node-interface-metrics-exporter/debian/deb_folder/python3-k8sapp-node-interface-metrics-exporter.install new file mode 100644 index 0000000..91d1d9d --- /dev/null +++ b/python3-k8sapp-node-interface-metrics-exporter/debian/deb_folder/python3-k8sapp-node-interface-metrics-exporter.install @@ -0,0 +1 @@ +usr/lib/python3/dist-packages/k8sapp_* diff --git a/python3-k8sapp-node-interface-metrics-exporter/debian/deb_folder/rules b/python3-k8sapp-node-interface-metrics-exporter/debian/deb_folder/rules new file mode 100755 index 0000000..416be47 --- /dev/null +++ b/python3-k8sapp-node-interface-metrics-exporter/debian/deb_folder/rules @@ -0,0 +1,26 @@ +#!/usr/bin/make -f +# export DH_VERBOSE = 1 + +export APP_NAME = node-interface-metrics-exporter +export PYBUILD_NAME = k8sapp-node-interface-metrics-exporter + +export DEB_VERSION = $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ') +export MAJOR = $(shell echo $(DEB_VERSION) | cut -f 1 -d '-') +export MINOR_PATCH = $(shell echo $(DEB_VERSION) | cut -f 4 -d '.') +export PBR_VERSION = $(MAJOR).$(MINOR_PATCH) + +export ROOT = $(CURDIR)/debian/tmp +export SKIP_PIP_INSTALL = 1 + +%: + dh $@ --with=python3 --buildsystem=pybuild + +override_dh_auto_install: + python3 setup.py install --install-layout=deb --root $(ROOT) + python3 setup.py bdist_wheel --universal -d $(ROOT)/plugins + +override_dh_python3: + dh_python3 --shebang=/usr/bin/python3 + +override_dh_auto_test: + PYTHONDIR=$(CURDIR) stestr run diff --git a/python3-k8sapp-node-interface-metrics-exporter/debian/deb_folder/source/format b/python3-k8sapp-node-interface-metrics-exporter/debian/deb_folder/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/python3-k8sapp-node-interface-metrics-exporter/debian/deb_folder/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/python3-k8sapp-node-interface-metrics-exporter/debian/meta_data.yaml b/python3-k8sapp-node-interface-metrics-exporter/debian/meta_data.yaml new file mode 100644 index 0000000..e95ce2a --- /dev/null +++ b/python3-k8sapp-node-interface-metrics-exporter/debian/meta_data.yaml @@ -0,0 +1,9 @@ +--- +debname: python3-k8sapp-node-interface-metrics-exporter +debver: 1.0-1 +src_path: k8sapp_node_interface_metrics_exporter +revision: + dist: $STX_DIST + GITREVCOUNT: + SRC_DIR: ${MY_REPO}/stx/app-node-interface-metrics-exporter + BASE_SRCREV: ffbb60b0669956a4a0bec37ae8f01b42f4f387bb \ No newline at end of file diff --git a/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/.stestr.conf b/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/.stestr.conf new file mode 100644 index 0000000..c05a891 --- /dev/null +++ b/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/.stestr.conf @@ -0,0 +1,4 @@ +[DEFAULT] +test_path=./k8sapp_node_interface_metrics_exporter/tests +top_dir=./k8sapp_node_interface_metrics_exporter + diff --git a/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/LICENSE b/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/LICENSE new file mode 100644 index 0000000..d6e2801 --- /dev/null +++ b/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2019 Wind River Systems, Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/README.rst b/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/README.rst new file mode 100644 index 0000000..8cac562 --- /dev/null +++ b/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/README.rst @@ -0,0 +1,7 @@ +k8sapp-node-interface-merics-exporter +===================================== + +This project contains StarlingX Kubernetes application specific python plugins +for Node Interface Metrics Exporter. These plugins are required to integrate +the Power Metrics application into the StarlingX application framework and to +support the various StarlingX deployments. diff --git a/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/__init__.py b/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/common/__init__.py b/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/common/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/common/constants.py b/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/common/constants.py new file mode 100644 index 0000000..0fa8aac --- /dev/null +++ b/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/common/constants.py @@ -0,0 +1,17 @@ +# +# Copyright (c) 2023 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# + +# Namespace to deploy the application +HELM_NS_PM = 'node-interface-metrics-exporter' + +# Application Name +HELM_APP_PM = 'node-interface-metrics-exporter' + +# Application component label +HELM_LABEL_PARAMETER = 'podLabels' +HELM_COMPONENT_LABEL = 'app.starlingx.io/component' +HELM_COMPONENT_LABEL_VALUE_PLATFORM = 'platform' +HELM_COMPONENT_LABEL_VALUE_APPLICATION = 'application' diff --git a/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/helm/__init__.py b/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/helm/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/helm/node_interface_metrics_exporter.py b/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/helm/node_interface_metrics_exporter.py new file mode 100644 index 0000000..bec4399 --- /dev/null +++ b/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/helm/node_interface_metrics_exporter.py @@ -0,0 +1,96 @@ +# +# Copyright (c) 2023 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# + +from k8sapp_node_interface_metrics_exporter.common import constants as app_constants + +from oslo_log import log as logging +from sysinv.common import constants +from sysinv.common import exception +from sysinv.common import kubernetes +from sysinv.db import api as sys_dbapi +from sysinv.helm import base + + +LOG = logging.getLogger(__name__) + +class NodeInterfaceMetricsExporterHelm(base.FluxCDBaseHelm): + """Class to encapsulate helm operations for the metrics exporter chart.""" + + SUPPORTED_NAMESPACES = base.FluxCDBaseHelm.SUPPORTED_NAMESPACES + \ + [app_constants.HELM_NS_PM] + + SUPPORTED_APP_NAMESPACES = { + app_constants.HELM_APP_PM: SUPPORTED_NAMESPACES + } + + SERVICE_NAME = app_constants.HELM_APP_PM + + SUPPORTED_COMPONENT_OVERRIDES = [ + app_constants.HELM_COMPONENT_LABEL_VALUE_PLATFORM, + app_constants.HELM_COMPONENT_LABEL_VALUE_APPLICATION + ] + + DEFAULT_AFFINITY = app_constants.HELM_COMPONENT_LABEL_VALUE_PLATFORM + + def get_namespaces(self): + return self.SUPPORTED_NAMESPACES + + def get_overrides(self, namespace=None): + dbapi_instance = dbapi.get_instance() + db_app = dbapi_instance.kube_app_get(app_constants.HELM_APP_PM) + + # User chart overrides + chart_overrides = self._get_user_helm_overrides( + dbapi_instance, + db_app, + app_constants.HELM_NS_PM, + 'user_overrides') + + user_affinity = chart_overrides.get(app_constants.HELM_COMPONENT_LABEL, + self.DEFAULT_AFFINITY) + + if user_affinity in self.SUPPORTED_COMPONENT_OVERRIDES: + affinity = user_affinity + else: + LOG.warn(f"User override value {user_affinity} " + f"for {app_constants.HELM_COMPONENT_LABEL} is invalid, " + f"using default value {self.DEFAULT_AFFINITY}") + affinity = self.DEFAULT_AFFINITY + + overrides = { + app_constants.HELM_NS_PM: { + app_constants.HELM_LABEL_PARAMETER: { + app_constants.HELM_COMPONENT_LABEL: affinity + } + } + } + + if namespace in self.SUPPORTED_NAMESPACES: + return overrides[namespace] + + if namespace: + raise exception.InvalidHelmNamespace(chart=self.CHART, + namespace=namespace) + return overrides + + @staticmethod + def _get_user_helm_overrides(dbapi_instance, app, chart, namespace, + type_of_overrides): + """Helper function for querying helm overrides from db.""" + helm_overrides = {} + try: + overrides = dbapi_instance.helm_override_get( + app_id=app.id, + name=chart, + namespace=namespace, + )[type_of_overrides] + + if isinstance(overrides, str): + helm_overrides = yaml.safe_load(overrides) + except exception.HelmOverrideNotFound: + LOG.debug("Overrides for this chart not found, nothing to be done.") + return helm_overrides + diff --git a/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/lifecycle/__init__.py b/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/lifecycle/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/lifecycle/lifecycle_node_interface_metrics_exporter.py b/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/lifecycle/lifecycle_node_interface_metrics_exporter.py new file mode 100644 index 0000000..f3bc94b --- /dev/null +++ b/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/lifecycle/lifecycle_node_interface_metrics_exporter.py @@ -0,0 +1,21 @@ +# +# Copyright (c) 2023 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# +# All Rights Reserved. +# + +""" System inventory App lifecycle operator.""" + +from oslo_log import log as logging + +from sysinv.common import constants as sysinv_constants +from sysinv.helm import lifecycle_base as base +from sysinv.helm import lifecycle_utils + +from k8sapp_node_interface_metrics_exporter.common import constants as app_constants + +LOG = logging.getLogger(__name__) + + diff --git a/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/tests/__init__.py b/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/tests/test_node_interface_metrics_exporter.py b/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/tests/test_node_interface_metrics_exporter.py new file mode 100644 index 0000000..a50e052 --- /dev/null +++ b/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/tests/test_node_interface_metrics_exporter.py @@ -0,0 +1,33 @@ +# +# Copyright (c) 2023 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# + +from sysinv.db import api as dbapi +from sysinv.tests.db import base as dbbase +from sysinv.tests.db import utils as dbutils +from sysinv.tests.helm import base + +from k8sapp_node_interface_metrics_exporter.tests import test_plugins + + +class NodeInterfaceMetricsExporterTestCase( + test_plugins.K8SAppNodeInterfaceMetricsExporterAppMixin, + base.HelmTestCaseMixin): + """Test Class for Node interface metris exporter app.""" + + def setUp(self): + super().setUp() + self.app = dbutils.create_test_app( + name='node-interface-metrics-exporter') + self.dbapi = dbapi.get_instance() + + +class NodeInterfaceMetricsExporterTestCaseDummy( + NodeInterfaceMetricsExporterTestCase, + dbbase.ProvisionedControllerHostTestCase): + """Dummy Class to pass the zuul.""" + + def test_dummy(self): + pass \ No newline at end of file diff --git a/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/tests/test_plugins.py b/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/tests/test_plugins.py new file mode 100644 index 0000000..4408d26 --- /dev/null +++ b/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/k8sapp_node_interface_metrics_exporter/tests/test_plugins.py @@ -0,0 +1,47 @@ +# +# Copyright (c) 2023 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# + +from sysinv.tests.db import base as dbbase + +from k8sapp_node_interface_metrics_exporter.common import constants as app_constants + + +class K8SAppNodeInterfaceMetricsExporterAppMixin(object): + app_name = app_constants.HELM_APP_PM + path_name = app_name + '.tgz' + + # pylint: disable=invalid-name,useless-parent-delegation + def setUp(self): + super().setUp() + + def test_stub(self): + # Replace this with a real unit test. + pass + + +# Test Configuration: +# - Controller +# - IPv6 +# - Ceph Storage +# - node-interface-metrics-exporter app +class K8SAppNodeInterfaceMetricsExporterControllerTestCase( + K8SAppNodeInterfaceMetricsExporterAppMixin, + dbbase.BaseIPv6Mixin, + dbbase.BaseCephStorageBackendMixin, + dbbase.ControllerHostTestCase): + pass + + +# Test Configuration: +# - AIO +# - IPv4 +# - Ceph Storage +# - node-interface-metrics-exporter app +class K8SAppNodeInterfaceMetricsExporterAIOTestCase( + K8SAppNodeInterfaceMetricsExporterAppMixin, + dbbase.BaseCephStorageBackendMixin, + dbbase.AIOSimplexHostTestCase): + pass diff --git a/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/pylint.rc b/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/pylint.rc new file mode 100644 index 0000000..13b0acd --- /dev/null +++ b/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/pylint.rc @@ -0,0 +1,234 @@ +[MASTER] +# Specify a configuration file. +rcfile=pylint.rc + +# Python code to execute, usually for sys.path manipulation such as +# pygtk.require(). +#init-hook= + +# Add files or directories to the blacklist. Should be base names, not paths. +ignore= + +# Pickle collected data for later comparisons. +persistent=yes + +# List of plugins (as comma separated values of python modules names) to load, +# usually to register additional checkers. +load-plugins=pylint.extensions.bad_builtin + +# Use multiple processes to speed up Pylint. +jobs=4 + +# Allow loading of arbitrary C extensions. Extensions are imported into the +# active Python interpreter and may run arbitrary code. +unsafe-load-any-extension=no + +# A comma-separated list of package or module names from where C extensions may +# be loaded. Extensions are loading into the active Python interpreter and may +# run arbitrary code +extension-pkg-whitelist=lxml.etree,greenlet + + + +[MESSAGES CONTROL] +# Disable the message, report, category or checker with the given id(s). You +# can either give multiple identifier separated by comma (,) or put this option +# multiple time (only on the command line, not in the configuration file where +# it should appear only once). +# See "Messages Control" section of +# https://pylint.readthedocs.io/en/latest/user_guide +disable= + # C codes refer to Convention + C0114, # missing-module-docstring + C0115, # missing-class-docstring + C0116, # missing-function-docstring + # R codes refer to refactoring + R0205, # useless-object-inheritance + R0901, # too-many-ancestors + R0903, # too-few-public-methods + R0913, # too-many-arguments + # W codes are warnings + W0212, # protected-access + +[REPORTS] +# Set the output format. Available formats are text, parseable, colorized, msvs +# (visual studio) and html +output-format=text + +# Tells whether to display a full report or only the messages +reports=no + +# Python expression which should return a note less than 10 (10 is the highest +# note). You have access to the variables errors warning, statement which +# respectively contain the number of errors / warnings messages and the total +# number of statements analyzed. This is used by the global evaluation report +# (RP0004). +evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) + + +[SIMILARITIES] +# Minimum lines number of a similarity. +min-similarity-lines=4 + +# Ignore comments when computing similarities. +ignore-comments=yes + +# Ignore docstrings when computing similarities. +ignore-docstrings=yes + + +[FORMAT] +# Maximum number of characters on a single line. +max-line-length=85 + +# Maximum number of lines in a module +max-module-lines=1000 + +# String used as indentation unit. This is usually 4 spaces or "\t" (1 tab). +indent-string=' ' + + +[TYPECHECK] +# Tells whether missing members accessed in mixin class should be ignored. A +# mixin class is detected if its name ends with "mixin" (case insensitive). +ignore-mixin-members=yes + +# List of module names for which member attributes should not be checked +# (useful for modules/projects where namespaces are manipulated during runtime +# and thus existing member attributes cannot be deduced by static analysis +ignored-modules=distutils,eventlet.green.subprocess,six,six.moves + +# List of classes names for which member attributes should not be checked +# (useful for classes with attributes dynamically set). +# pylint is confused by sqlalchemy Table, as well as sqlalchemy Enum types +# ie: (unprovisioned, identity) +# LookupDict in requests library confuses pylint +ignored-classes=SQLObject, optparse.Values, thread._local, _thread._local, + Table, unprovisioned, identity, LookupDict + +# List of members which are set dynamically and missed by pylint inference +# system, and so shouldn't trigger E0201 when accessed. Python regular +# expressions are accepted. +generated-members=REQUEST,acl_users,aq_parent + + +[BASIC] +# Regular expression which should only match correct module names +module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ + +# Regular expression which should only match correct module level names +const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$ + +# Regular expression which should only match correct class names +class-rgx=[A-Z_][a-zA-Z0-9]+$ + +# Regular expression which should only match correct function names +function-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression which should only match correct method names +method-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression which should only match correct instance attribute names +attr-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression which should only match correct argument names +argument-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression which should only match correct variable names +variable-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression which should only match correct list comprehension / +# generator expression variable names +inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ + +# Good variable names which should always be accepted, separated by a comma +good-names=i,j,k,ex,Run,_ + +# Bad variable names which should always be refused, separated by a comma +bad-names=foo,bar,baz,toto,tutu,tata + +# Regular expression which should only match functions or classes name which do +# not require a docstring +no-docstring-rgx=__.*__ + + +[MISCELLANEOUS] +# List of note tags to take in consideration, separated by a comma. +notes=FIXME,XXX,TODO + + +[VARIABLES] +# Tells whether we should check for unused import in __init__ files. +init-import=no + +# A regular expression matching the beginning of the name of dummy variables +# (i.e. not used). +dummy-variables-rgx=_|dummy + +# List of additional names supposed to be defined in builtins. Remember that +# you should avoid to define new builtins when possible. +additional-builtins= + + +[IMPORTS] +# Deprecated modules which should not be used, separated by a comma +deprecated-modules=regsub,string,TERMIOS,Bastion,rexec + +# Create a graph of every (i.e. internal and external) dependencies in the +# given file (report RP0402 must not be disabled) +import-graph= + +# Create a graph of external dependencies in the given file (report RP0402 must +# not be disabled) +ext-import-graph= + +# Create a graph of internal dependencies in the given file (report RP0402 must +# not be disabled) +int-import-graph= + + +[DESIGN] +# Maximum number of arguments for function / method +max-args=5 + +# Argument names that match this expression will be ignored. Default to name +# with leading underscore +ignored-argument-names=_.* + +# Maximum number of locals for function / method body +max-locals=15 + +# Maximum number of return / yield for function / method body +max-returns=6 + +# Maximum number of branch for function / method body +max-branches=12 + +# Maximum number of statements in function / method body +max-statements=50 + +# Maximum number of parents for a class (see R0901). +max-parents=7 + +# Maximum number of attributes for a class (see R0902). +max-attributes=7 + +# Minimum number of public methods for a class (see R0903). +min-public-methods=2 + +# Maximum number of public methods for a class (see R0904). +max-public-methods=20 + + +[CLASSES] +# List of method names used to declare (i.e. assign) instance attributes. +defining-attr-methods=__init__,__new__,setUp + +# List of valid names for the first argument in a class method. +valid-classmethod-first-arg=cls + + +[EXCEPTIONS] +# Exceptions that will emit a warning when being caught. Defaults to +# "Exception" +overgeneral-exceptions=builtins.BaseException,builtins.Exception diff --git a/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/requirements.txt b/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/requirements.txt new file mode 100644 index 0000000..8f225d8 --- /dev/null +++ b/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/requirements.txt @@ -0,0 +1,2 @@ +pbr>=2.0.0 +PyYAML>=3.10.0 diff --git a/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/setup.cfg b/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/setup.cfg new file mode 100644 index 0000000..d390bef --- /dev/null +++ b/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/setup.cfg @@ -0,0 +1,39 @@ +[metadata] +name = k8sapp-node-interface-metrics-exporter +summary = StarlingX sysinv extensions for node-interface-metrics-exporter +long_description = file: README.rst +long_description_content_type = text/x-rst +license = Apache 2.0 +author = StarlingX +author-email = starlingx-discuss@lists.starlingx.io +home-page = https://www.starlingx.io/ +classifier = + Environment :: OpenStack + Intended Audience :: Information Technology + Intended Audience :: System Administrators + License :: OSI Approved :: Apache Software License + Operating System :: POSIX :: Linux + Programming Language :: Python + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.9 + +[files] +packages = + k8sapp_node_interface_metrics_exporter + +[global] +setup-hooks = + pbr.hooks.setup_hook + +[entry_points] +systemconfig.helm_applications = + node-interface-metrics-exporter = systemconfig.helm_plugins.node_interface_metrics_exporter + +systemconfig.helm_plugins.node_interface_metrics_exporter = + 001_metrics-exporter = k8sapp_node_interface_metrics_exporter.helm.node_interface_metrics_exporter:NodeInterfaceMetricsExporterHelm + +systemconfig.app_lifecycle = + node-interface-metrics-exporter = k8sapp_node_interface_metrics_exporter.lifecycle.lifecycle_node_interface_metrics_exporter:NodeInterfaceMetricsExporterAppLifecycleOperator + +[bdist_wheel] +universal = 1 diff --git a/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/setup.py b/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/setup.py new file mode 100644 index 0000000..edd484d --- /dev/null +++ b/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/setup.py @@ -0,0 +1,13 @@ +# +# Copyright (c) 2023 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# + +import setuptools + + +setuptools.setup( + setup_requires=['pbr>=2.0.0', + 'PyYAML>=3.10.0'], + pbr=True) diff --git a/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/test-requirements.txt b/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/test-requirements.txt new file mode 100644 index 0000000..1191b51 --- /dev/null +++ b/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/test-requirements.txt @@ -0,0 +1,20 @@ +# The order of packages is significant, because pip processes them in the order +# of appearance. Changing the order has an impact on the overall integration +# process, which may cause wedges in the gate later. +hacking>=1.1.0,<=2.0.0 # Apache-2.0 +astroid +bandit<1.7.2;python_version>="3.0" +coverage>=3.6 +fixtures>=3.0.0 # Apache-2.0/BSD +mock>=2.0.0 # BSD +python-subunit>=0.0.18 +requests-mock>=0.6.0 # Apache-2.0 +sphinx +oslosphinx +oslotest>=3.2.0 # Apache-2.0 +stestr>=1.0.0 # Apache-2.0 +testrepository>=0.0.18 +testtools!=1.2.0,>=0.9.36 +isort<5;python_version>="3.0" +pylint +pycryptodomex \ No newline at end of file diff --git a/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/upper-constraints.txt b/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/upper-constraints.txt new file mode 100644 index 0000000..9c30188 --- /dev/null +++ b/python3-k8sapp-node-interface-metrics-exporter/k8sapp_node_interface_metrics_exporter/upper-constraints.txt @@ -0,0 +1 @@ +# Override upstream constraints based on StarlingX load diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..c01ade2 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +# Nothing diff --git a/stx-node-interface-metrics-exporter-helm/debian/deb_folder/changelog b/stx-node-interface-metrics-exporter-helm/debian/deb_folder/changelog new file mode 100644 index 0000000..cd52388 --- /dev/null +++ b/stx-node-interface-metrics-exporter-helm/debian/deb_folder/changelog @@ -0,0 +1,5 @@ +stx-node-interface-metrics-exporter-helm (1.0-1) unstable; urgency=medium + + * Initial release. + + -- Mayank Patel Mon 18 September 2023 07:32:24 AM EST diff --git a/stx-node-interface-metrics-exporter-helm/debian/deb_folder/control b/stx-node-interface-metrics-exporter-helm/debian/deb_folder/control new file mode 100644 index 0000000..c4c810d --- /dev/null +++ b/stx-node-interface-metrics-exporter-helm/debian/deb_folder/control @@ -0,0 +1,18 @@ +Source: stx-node-interface-metrics-exporter-helm +Section: libs +Priority: optional +Maintainer: StarlingX Developers +Build-Depends: debhelper-compat (= 13), + helm, + python3-k8sapp-node-interface-metrics-exporter, + python3-k8sapp-node-interface-metrics-exporter-wheels +Standards-Version: 4.5.1 +Homepage: https://www.starlingx.io + +Package: stx-node-interface-metrics-exporter-helm +Section: libs +Architecture: any +Depends: ${misc:Depends} +Description: StarlingX Node Interface Metrics Exporter Application FluxCD + Helm Charts This package contains Fluxcd helm charts for the Node Interface + Metrics Exporter application. diff --git a/stx-node-interface-metrics-exporter-helm/debian/deb_folder/copyright b/stx-node-interface-metrics-exporter-helm/debian/deb_folder/copyright new file mode 100644 index 0000000..daced4c --- /dev/null +++ b/stx-node-interface-metrics-exporter-helm/debian/deb_folder/copyright @@ -0,0 +1,41 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: stx-node-interface-metrics-exporter-helm +Source: https://opendev.org/starlingx/app-node-interface-metrics-exporter/ + +Files: * +Copyright: (c) 2023 Wind River Systems, Inc +License: Apache-2 + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + . + https://www.apache.org/licenses/LICENSE-2.0 + . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + . + On Debian-based systems the full text of the Apache version 2.0 license + can be found in `/usr/share/common-licenses/Apache-2.0'. + +# If you want to use GPL v2 or later for the /debian/* files use +# the following clauses, or change it to suit. Delete these two lines +Files: debian/* +Copyright: 2023 Wind River Systems, Inc +License: Apache-2 + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + . + https://www.apache.org/licenses/LICENSE-2.0 + . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + . + On Debian-based systems the full text of the Apache version 2.0 license + can be found in `/usr/share/common-licenses/Apache-2.0'. diff --git a/stx-node-interface-metrics-exporter-helm/debian/deb_folder/rules b/stx-node-interface-metrics-exporter-helm/debian/deb_folder/rules new file mode 100755 index 0000000..a37d697 --- /dev/null +++ b/stx-node-interface-metrics-exporter-helm/debian/deb_folder/rules @@ -0,0 +1,57 @@ +#!/usr/bin/make -f +# export DH_VERBOSE = 1 + +export ROOT = debian/tmp +export APP_FOLDER = $(ROOT)/usr/local/share/applications/helm + +export DEB_VERSION = $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ') +export RELEASE = $(shell echo $(DEB_VERSION) | cut -f 1 -d '-') +export REVISION = $(shell echo $(DEB_VERSION) | cut -f 4 -d '.') + +export APP_NAME = node-interface-metrics-exporter +export APP_VERSION = $(RELEASE)-$(REVISION) +export APP_TARBALL_FLUXCD = $(APP_NAME)-$(APP_VERSION).tgz +export HELM_FOLDER = /usr/lib/helm +export HELM_REPO = stx-platform +export STAGING = staging + +%: + dh $@ + +override_dh_auto_build: + # Create the helm-chart TGZ file. + #cd helm-charts && make + + # Setup the staging directory. + mkdir -p $(STAGING) + cp files/metadata.yaml $(STAGING) + cp -Rv fluxcd-manifests/ $(STAGING) + mkdir -p $(STAGING)/charts + #cp helm-charts/*.tgz $(STAGING)/charts + + # Populate metadata. + sed -i 's/@APP_NAME@/$(APP_NAME)/g' $(STAGING)/metadata.yaml + sed -i 's/@APP_VERSION@/$(APP_VERSION)/g' $(STAGING)/metadata.yaml + sed -i 's/@HELM_REPO@/$(HELM_REPO)/g' $(STAGING)/metadata.yaml + + # Copy the plugins: installed in the buildroot + mkdir -p $(STAGING)/plugins + #cp /plugins/*.whl $(STAGING)/plugins + + # Prepare staging for fluxcd package + cp -R fluxcd-manifests $(STAGING)/ + + # Create the app package. + cd $(STAGING) && find . -type f ! -name '*.md5' -print0 | xargs -0 md5sum > checksum.md5 + tar cfz $(APP_TARBALL_FLUXCD) -C $(STAGING)/ . + # Cleanup staging + rm -rf $(STAGING) + +override_dh_auto_install: + # Install the app tar file. + install -d -m 755 $(APP_FOLDER) + install -p -D -m 755 $(APP_TARBALL_FLUXCD) $(APP_FOLDER) + +override_dh_auto_test: + +override_dh_usrlocal: diff --git a/stx-node-interface-metrics-exporter-helm/debian/deb_folder/source/format b/stx-node-interface-metrics-exporter-helm/debian/deb_folder/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/stx-node-interface-metrics-exporter-helm/debian/deb_folder/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/stx-node-interface-metrics-exporter-helm/debian/deb_folder/stx-node-interface-metrics-exporter-helm.install b/stx-node-interface-metrics-exporter-helm/debian/deb_folder/stx-node-interface-metrics-exporter-helm.install new file mode 100644 index 0000000..1b47c6e --- /dev/null +++ b/stx-node-interface-metrics-exporter-helm/debian/deb_folder/stx-node-interface-metrics-exporter-helm.install @@ -0,0 +1 @@ +usr/local/share/applications/helm/* diff --git a/stx-node-interface-metrics-exporter-helm/debian/meta_data.yaml b/stx-node-interface-metrics-exporter-helm/debian/meta_data.yaml new file mode 100644 index 0000000..b216e38 --- /dev/null +++ b/stx-node-interface-metrics-exporter-helm/debian/meta_data.yaml @@ -0,0 +1,10 @@ +--- +debname: stx-node-interface-metrics-exporter-helm +debver: 1.0-1 +src_path: stx-node-interface-metrics-exporter-helm +revision: + dist: $STX_DIST + GITREVCOUNT: + SRC_DIR: ${MY_REPO}/stx/app-node-interface-metrics-exporter + BASE_SRCREV: ffbb60b0669956a4a0bec37ae8f01b42f4f387bb + diff --git a/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/README b/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/README new file mode 100644 index 0000000..84a8ebb --- /dev/null +++ b/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/README @@ -0,0 +1,12 @@ +## Intel Device Plugins Operator Helm +This directory contains helm chart that need to be built for this +application. This helm chart deploys the Interface Matrics Exporter +on Kubernetes clusters. + +## Source +TODO:MAYANK => Custom helm chart related info +Charts are based on Custom helm chart + +## Installation +Installation of helm-chart is done automatically from the intel-device-plugins-operator-helm package. + diff --git a/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/files/metadata.yaml b/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/files/metadata.yaml new file mode 100644 index 0000000..2498be2 --- /dev/null +++ b/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/files/metadata.yaml @@ -0,0 +1,10 @@ +app_name: @APP_NAME@ +app_version: @APP_VERSION@ +helm_repo: @HELM_REPO@ + +upgrades: + auto_update: true + +behavior: + platform_managed_app: yes + desired_state: applied diff --git a/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/fluxcd-manifests/base/helmrepository.yaml b/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/fluxcd-manifests/base/helmrepository.yaml new file mode 100644 index 0000000..d18a068 --- /dev/null +++ b/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/fluxcd-manifests/base/helmrepository.yaml @@ -0,0 +1,13 @@ +# +# Copyright (c) 2023 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# + +apiVersion: source.toolkit.fluxcd.io/v1beta1 +kind: HelmRepository +metadata: + name: stx-platform +spec: + url: http://192.168.206.1:8080/helm_charts/stx-platform + interval: 1m \ No newline at end of file diff --git a/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/fluxcd-manifests/base/kustomization.yaml b/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/fluxcd-manifests/base/kustomization.yaml new file mode 100644 index 0000000..1bdef7e --- /dev/null +++ b/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/fluxcd-manifests/base/kustomization.yaml @@ -0,0 +1,9 @@ +# +# Copyright (c) 2023 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# + +resources: + - helmrepository.yaml + - namespace.yaml \ No newline at end of file diff --git a/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/fluxcd-manifests/base/namespace.yaml b/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/fluxcd-manifests/base/namespace.yaml new file mode 100644 index 0000000..21008fb --- /dev/null +++ b/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/fluxcd-manifests/base/namespace.yaml @@ -0,0 +1,10 @@ +# +# Copyright (c) 2023 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# + +apiVersion: v1 +kind: Namespace +metadata: + name: node-interface-metrics-exporter \ No newline at end of file diff --git a/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/fluxcd-manifests/kustomization.yaml b/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/fluxcd-manifests/kustomization.yaml new file mode 100644 index 0000000..0b3ff71 --- /dev/null +++ b/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/fluxcd-manifests/kustomization.yaml @@ -0,0 +1,12 @@ +# +# Copyright (c) 2023 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# + +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +namespace: node-interface-metrics-exporter +resources: + - base + - node-interface-metrics-exporter \ No newline at end of file diff --git a/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/fluxcd-manifests/node-interface-metrics-exporter/helmrelease.yaml b/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/fluxcd-manifests/node-interface-metrics-exporter/helmrelease.yaml new file mode 100644 index 0000000..08c62f2 --- /dev/null +++ b/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/fluxcd-manifests/node-interface-metrics-exporter/helmrelease.yaml @@ -0,0 +1,36 @@ +# +# Copyright (c) 2023 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# + +apiVersion: "helm.toolkit.fluxcd.io/v2beta1" +kind: HelmRelease +metadata: + name: node-interface-metrics-exporter + labels: + chart_group: node-interface-metrics-exporter-charts +spec: + releaseName: node-interface-metrics-exporter + chart: + spec: + chart: node-interface-metrics-exporter + version: 0.1.0 + sourceRef: + kind: HelmRepository + name: stx-platform + interval: 1m + timeout: 30m + test: + enable: false + install: + disableHooks: false + upgrade: + disableHooks: false + valuesFrom: + - kind: Secret + name: nime-static-overrides + valuesKey: nime-static-overrides.yaml + - kind: Secret + name: nime-system-overrides + valuesKey: nime-system-overrides.yaml \ No newline at end of file diff --git a/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/fluxcd-manifests/node-interface-metrics-exporter/kustomization.yaml b/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/fluxcd-manifests/node-interface-metrics-exporter/kustomization.yaml new file mode 100644 index 0000000..07af2c0 --- /dev/null +++ b/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/fluxcd-manifests/node-interface-metrics-exporter/kustomization.yaml @@ -0,0 +1,18 @@ +# +# Copyright (c) 2023 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# + +namespace: node-interface-metrics-exporter +resources: + - helmrelease.yaml +secretGenerator: + - name: nime-static-overrides + files: + - nime-static-overrides.yaml + - name: nime-system-overrides + files: + - nime-system-overrides.yaml +generatorOptions: + disableNameSuffixHash: true \ No newline at end of file diff --git a/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/fluxcd-manifests/node-interface-metrics-exporter/nime-static-overrides.yaml b/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/fluxcd-manifests/node-interface-metrics-exporter/nime-static-overrides.yaml new file mode 100644 index 0000000..6ca1ee6 --- /dev/null +++ b/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/fluxcd-manifests/node-interface-metrics-exporter/nime-static-overrides.yaml @@ -0,0 +1,5 @@ +# +# Copyright (c) 2023 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# diff --git a/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/fluxcd-manifests/node-interface-metrics-exporter/nime-system-overrides.yaml b/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/fluxcd-manifests/node-interface-metrics-exporter/nime-system-overrides.yaml new file mode 100644 index 0000000..6ca1ee6 --- /dev/null +++ b/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/fluxcd-manifests/node-interface-metrics-exporter/nime-system-overrides.yaml @@ -0,0 +1,5 @@ +# +# Copyright (c) 2023 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# diff --git a/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/helm-charts/Makefile b/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/helm-charts/Makefile new file mode 100644 index 0000000..fe1ba06 --- /dev/null +++ b/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/helm-charts/Makefile @@ -0,0 +1,41 @@ +# +# Copyright (c) 2023 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# +# It's necessary to set this because some environments don't link sh -> bash. +SHELL := /bin/bash +TASK := build + +EXCLUDES := helm-toolkit doc tests tools logs tmp +CHARTS := helm-toolkit $(filter-out $(EXCLUDES), $(patsubst %/.,%,$(wildcard */.))) + +.PHONY: $(EXCLUDES) $(CHARTS) + +all: $(CHARTS) + +$(CHARTS): + @if [ -d $@ ]; then \ + echo; \ + echo "===== Processing [$@] chart ====="; \ + make $(TASK)-$@; \ + fi + +init-%: + if [ -f $*/Makefile ]; then make -C $*; fi + if [ -f $*/requirements.yaml ]; then helm dep up $*; fi + +lint-%: init-% + if [ -d $* ]; then helm lint $*; fi + +build-%: lint-% + if [ -d $* ]; then helm package $*; fi + +clean: + @echo "Clean all build artifacts" + rm -f */templates/_partials.tpl */templates/_globals.tpl + rm -f *tgz */charts/*tgz */requirements.lock + rm -rf */charts */tmpcharts + +%: + @: diff --git a/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/helm-charts/node-interface-metrics-exporter/Chart.yaml b/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/helm-charts/node-interface-metrics-exporter/Chart.yaml new file mode 100644 index 0000000..bd72c90 --- /dev/null +++ b/stx-node-interface-metrics-exporter-helm/stx-node-interface-metrics-exporter-helm/helm-charts/node-interface-metrics-exporter/Chart.yaml @@ -0,0 +1,10 @@ +# Copyright (c) 2023 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# +apiVersion: v2 +appVersion: 1.0.0 +description: A Helm chart for Node Interface Metrics Exporter +name: node-interface-metrics-exporter +type: application +version: 0.1.0 diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..8ae3e22 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,3 @@ +# hacking pulls in flake8 +hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0 +bashate >= 0.2 diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..f86f050 --- /dev/null +++ b/tox.ini @@ -0,0 +1,51 @@ +[tox] +envlist = linters +minversion = 4.0 +skipsdist = True +sitepackages=False + +[testenv] +install_command = pip install -U {opts} {packages} +setenv = + VIRTUAL_ENV={envdir} + OS_STDOUT_CAPTURE=1 + OS_STDERR_CAPTURE=1 + OS_DEBUG=1 + OS_LOG_CAPTURE=1 +deps = + -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt +allowlist_externals = + bash + +passenv = + XDG_CACHE_HOME + + +[testenv:bashate] +# Treat all E* codes as Errors rather than warnings using: -e 'E*' +commands = + bash -c "find {toxinidir} \ + -not \( -type d -name .?\* -prune \) \ + -type f \ + -not -name \*~ \ + -not -name \*.md \ + -name \*.sh \ + -print0 | xargs -r -n 1 -0 bashate -v \ + -e 'E*'" + +[testenv:linters] +commands = + {[testenv:bashate]commands} + +[testenv:flake8] +basepython = python3 +description = Dummy environment to allow flake8 to be run in subdir tox + +[testenv:pylint] +basepython = python3 +description = Dummy environment to allow pylint to be run in subdir tox + +[testenv:bandit] +basepython = python3 +description = Dummy environment to allow bandit to be run in subdir tox