Merge "Create lifecycle plugin for Metrics Server"
This commit is contained in:
commit
1dd4395066
55
.zuul.yaml
55
.zuul.yaml
@ -3,13 +3,68 @@
|
||||
check:
|
||||
jobs:
|
||||
- openstack-tox-linters
|
||||
- k8sapp-metrics-server-tox-py39
|
||||
- k8sapp-metrics-server-tox-flake8
|
||||
- k8sapp-metrics-server-tox-pylint
|
||||
gate:
|
||||
jobs:
|
||||
- openstack-tox-linters
|
||||
- k8sapp-metrics-server-tox-py39
|
||||
- k8sapp-metrics-server-tox-flake8
|
||||
- k8sapp-metrics-server-tox-pylint
|
||||
|
||||
post:
|
||||
jobs:
|
||||
- stx-metrics-server-armada-app-upload-git-mirror
|
||||
|
||||
- job:
|
||||
name: k8sapp-metrics-server-tox-py39
|
||||
parent: tox-py39
|
||||
description: |
|
||||
Run py39 test for metrics_server
|
||||
nodeset: debian-bullseye
|
||||
required-projects:
|
||||
- starlingx/config
|
||||
- starlingx/fault
|
||||
- starlingx/update
|
||||
- starlingx/utilities
|
||||
files:
|
||||
- python3-k8sapp-metrics-server/*
|
||||
vars:
|
||||
tox_envlist: py39
|
||||
python_version: 3.9
|
||||
tox_extra_args: -c python3-k8sapp-metrics-server/k8sapp_metrics_server/tox.ini
|
||||
|
||||
- job:
|
||||
name: k8sapp-metrics-server-tox-pylint
|
||||
parent: tox
|
||||
description: |
|
||||
Run pylint test for k8sapp_metrics_server
|
||||
nodeset: debian-bullseye
|
||||
required-projects:
|
||||
- starlingx/config
|
||||
- starlingx/fault
|
||||
- starlingx/update
|
||||
- starlingx/utilities
|
||||
files:
|
||||
- python3-k8sapp-metrics-server/*
|
||||
vars:
|
||||
tox_envlist: pylint
|
||||
tox_extra_args: -c python3-k8sapp-metrics-server/k8sapp_metrics_server/tox.ini
|
||||
|
||||
- job:
|
||||
name: k8sapp-metrics-server-tox-flake8
|
||||
parent: tox
|
||||
description: |
|
||||
Run flake8 for metrics-server
|
||||
nodeset: debian-bullseye
|
||||
files:
|
||||
- python3-k8sapp-metrics-server/*
|
||||
vars:
|
||||
tox_envlist: flake8
|
||||
tox_extra_args: -c python3-k8sapp-metrics-server/k8sapp_metrics_server/tox.ini
|
||||
|
||||
|
||||
- job:
|
||||
name: stx-metrics-server-armada-app-upload-git-mirror
|
||||
parent: upload-git-mirror
|
||||
|
10
bindep.txt
Normal file
10
bindep.txt
Normal file
@ -0,0 +1,10 @@
|
||||
# This is a cross-platform list tracking distribution packages needed for install and tests;
|
||||
# see https://docs.openstack.org/infra/bindep/ for additional information.
|
||||
|
||||
libffi-dev [platform:dpkg]
|
||||
libldap2-dev [platform:dpkg]
|
||||
libxml2-dev [platform:dpkg]
|
||||
libxslt1-dev [platform:dpkg]
|
||||
libsasl2-dev [platform:dpkg]
|
||||
libffi-devel [platform:rpm]
|
||||
python3-all-dev [platform:dpkg]
|
@ -1,2 +1,3 @@
|
||||
python3-k8sapp-metrics-server
|
||||
metrics-server-helm
|
||||
stx-metrics-server-helm
|
||||
|
@ -3,7 +3,6 @@ Section: libs
|
||||
Priority: optional
|
||||
Maintainer: StarlingX Developers <starlingx-discuss@lists.starlingx.io>
|
||||
Build-Depends: debhelper-compat (= 13),
|
||||
chartmuseum,
|
||||
helm,
|
||||
procps
|
||||
Standards-Version: 4.5.1
|
||||
|
@ -1,6 +1,6 @@
|
||||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: metrics-server-helm
|
||||
Source: https://opendev.org/starlingx/cert-manager-armada-app/
|
||||
Source: https://opendev.org/starlingx/metrics-server-armada-app
|
||||
|
||||
Files: *
|
||||
Copyright: (c) 2013-2023 Wind River Systems, Inc
|
||||
|
@ -0,0 +1,5 @@
|
||||
python3-k8sapp-metrics-server (1.0-1) unstable; urgency=medium
|
||||
|
||||
* Initial release.
|
||||
|
||||
-- David Bastos <david.barbosabastos@windriver.com> Fri, 27 Oct 2023 08:00:42 +0000
|
26
python3-k8sapp-metrics-server/debian/deb_folder/control
Normal file
26
python3-k8sapp-metrics-server/debian/deb_folder/control
Normal file
@ -0,0 +1,26 @@
|
||||
Source: python3-k8sapp-metrics-server
|
||||
Section: libs
|
||||
Priority: optional
|
||||
Maintainer: StarlingX Developers <starlingx-discuss@lists.starlingx.io>
|
||||
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-metrics-server
|
||||
Section: libs
|
||||
Architecture: any
|
||||
Depends: ${misc:Depends}, ${python3:Depends}
|
||||
Description: StarlingX Sysinv metrics-server Extensions
|
||||
This package contains sysinv plugins for the metrics-server K8S app.
|
||||
|
||||
Package: python3-k8sapp-metrics-server-wheels
|
||||
Section: libs
|
||||
Architecture: any
|
||||
Depends: ${misc:Depends}, ${python3:Depends}, python3-wheel
|
||||
Description: StarlingX Sysinv metrics-server Extension Wheels
|
||||
This package contains python wheels for the metrics-server K8S app plugins.
|
41
python3-k8sapp-metrics-server/debian/deb_folder/copyright
Normal file
41
python3-k8sapp-metrics-server/debian/deb_folder/copyright
Normal file
@ -0,0 +1,41 @@
|
||||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: python3-k8sapp-metrics-server
|
||||
Source: https://opendev.org/starlingx/metrics-server-armada-app/
|
||||
|
||||
Files: *
|
||||
Copyright: (c) 2013-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'.
|
@ -0,0 +1 @@
|
||||
plugins/*.whl
|
@ -0,0 +1 @@
|
||||
usr/lib/python3/dist-packages/k8sapp_*
|
33
python3-k8sapp-metrics-server/debian/deb_folder/rules
Normal file
33
python3-k8sapp-metrics-server/debian/deb_folder/rules
Normal file
@ -0,0 +1,33 @@
|
||||
#!/usr/bin/make -f
|
||||
# export DH_VERBOSE = 1
|
||||
|
||||
export APP_NAME = metrics-server
|
||||
export PYBUILD_NAME = k8sapp_metrics_server
|
||||
|
||||
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:
|
||||
env | sort
|
||||
|
||||
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
|
@ -0,0 +1 @@
|
||||
3.0 (quilt)
|
9
python3-k8sapp-metrics-server/debian/meta_data.yaml
Normal file
9
python3-k8sapp-metrics-server/debian/meta_data.yaml
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
debname: python3-k8sapp-metrics-server
|
||||
debver: 1.0-1
|
||||
src_path: k8sapp_metrics_server
|
||||
revision:
|
||||
dist: $STX_DIST
|
||||
GITREVCOUNT:
|
||||
SRC_DIR: ${MY_REPO}/stx/metrics-server-armada-app
|
||||
BASE_SRCREV: 9fa1ccbdbae09c9726642bfbb5b20e27cd729f2c
|
36
python3-k8sapp-metrics-server/k8sapp_metrics_server/.gitignore
vendored
Normal file
36
python3-k8sapp-metrics-server/k8sapp_metrics_server/.gitignore
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
# Compiled files
|
||||
*.py[co]
|
||||
*.a
|
||||
*.o
|
||||
*.so
|
||||
|
||||
# Sphinx
|
||||
_build
|
||||
doc/source/api/
|
||||
|
||||
# Packages/installer info
|
||||
*.egg
|
||||
*.egg-info
|
||||
.eggs
|
||||
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
|
@ -0,0 +1,3 @@
|
||||
[DEFAULT]
|
||||
test_path=./k8sapp_metrics_server/tests
|
||||
top_dir=./k8sapp_metrics_server
|
@ -0,0 +1,10 @@
|
||||
#
|
||||
# Copyright (c) 2023 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
HELM_NS_METRICS_SERVER = "metrics-server"
|
||||
HELM_APP_METRICS_SERVER = "metrics-server"
|
||||
HELM_CHART_METRICS_SERVER = "metrics-server"
|
||||
FLUXCD_HELMRELEASE_METRICS_SERVER = "metrics-server"
|
@ -0,0 +1,40 @@
|
||||
#
|
||||
# Copyright (c) 2023 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
from sysinv.common import exception
|
||||
from sysinv.helm import base
|
||||
|
||||
from k8sapp_metrics_server.common import constants as app_constants
|
||||
|
||||
|
||||
class MetricsServerHelm(base.FluxCDBaseHelm):
|
||||
"""Class to encapsulate helm operations for the app chart"""
|
||||
|
||||
SUPPORTED_NAMESPACES = base.BaseHelm.SUPPORTED_NAMESPACES + \
|
||||
[app_constants.HELM_NS_METRICS_SERVER]
|
||||
SUPPORTED_APP_NAMESPACES = {
|
||||
app_constants.HELM_APP_METRICS_SERVER: SUPPORTED_NAMESPACES
|
||||
}
|
||||
|
||||
CHART = app_constants.HELM_CHART_METRICS_SERVER
|
||||
HELM_RELEASE = app_constants.FLUXCD_HELMRELEASE_METRICS_SERVER
|
||||
|
||||
def get_namespaces(self):
|
||||
return self.SUPPORTED_NAMESPACES
|
||||
|
||||
def get_overrides(self, namespace=None):
|
||||
|
||||
overrides = {
|
||||
app_constants.HELM_NS_METRICS_SERVER: {}
|
||||
}
|
||||
|
||||
if namespace in self.SUPPORTED_NAMESPACES:
|
||||
return overrides[namespace]
|
||||
elif namespace:
|
||||
raise exception.InvalidHelmNamespace(chart=self.CHART,
|
||||
namespace=namespace)
|
||||
else:
|
||||
return overrides
|
@ -0,0 +1,27 @@
|
||||
#
|
||||
# Copyright (c) 2023 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
""" System inventory App lifecycle operator."""
|
||||
|
||||
from sysinv.helm import lifecycle_base as base
|
||||
|
||||
|
||||
class MetricsServerAppLifecycleOperator(base.AppLifecycleOperator):
|
||||
"""Class to encapsulate lifecycle operations for the Metrics Server"""
|
||||
|
||||
def app_lifecycle_actions(self,
|
||||
context,
|
||||
conductor_obj,
|
||||
app_op, app,
|
||||
hook_info):
|
||||
"""Perform lifecycle actions for an operation
|
||||
|
||||
:param context: request context
|
||||
:param conductor_obj: conductor object
|
||||
:param app_op: AppOperator object
|
||||
:param app: AppOperator.Application object
|
||||
:param hook_info: LifecycleHookInfo object
|
||||
"""
|
@ -0,0 +1,43 @@
|
||||
#
|
||||
# Copyright (c) 2023 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
from k8sapp_metrics_server.common import constants as app_constants
|
||||
from sysinv.tests.db import base as dbbase
|
||||
|
||||
|
||||
class K8SAppMetricsServerAppMixin(object):
|
||||
app_name = app_constants.HELM_APP_METRICS_SERVER
|
||||
path_name = app_name + '.tgz'
|
||||
|
||||
def setUp(self): # pylint: disable=useless-parent-delegation
|
||||
super(K8SAppMetricsServerAppMixin, self).setUp()
|
||||
|
||||
def test_stub(self):
|
||||
# Replace this with a real unit test.
|
||||
pass
|
||||
|
||||
|
||||
# Test Configuration:
|
||||
# - Controller
|
||||
# - IPv6
|
||||
# - Ceph Storage
|
||||
# - metrics-server app
|
||||
class K8sAppMetricsServerControllerTestCase(K8SAppMetricsServerAppMixin,
|
||||
dbbase.BaseIPv6Mixin,
|
||||
dbbase.BaseCephStorageBackendMixin,
|
||||
dbbase.ControllerHostTestCase):
|
||||
pass
|
||||
|
||||
|
||||
# Test Configuration:
|
||||
# - AIO
|
||||
# - IPv4
|
||||
# - Ceph Storage
|
||||
# - metrics-server app
|
||||
class K8SAppMetricsServerAIOTestCase(K8SAppMetricsServerAppMixin,
|
||||
dbbase.BaseCephStorageBackendMixin,
|
||||
dbbase.AIOSimplexHostTestCase):
|
||||
pass
|
231
python3-k8sapp-metrics-server/k8sapp_metrics_server/pylint.rc
Normal file
231
python3-k8sapp-metrics-server/k8sapp_metrics_server/pylint.rc
Normal file
@ -0,0 +1,231 @@
|
||||
[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=
|
||||
|
||||
# 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]
|
||||
# Enable 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.
|
||||
|
||||
# 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
|
||||
# We are disabling (C)onvention
|
||||
# We are disabling (R)efactor
|
||||
# W0212: protected-access
|
||||
# W1618: no-absolute-import
|
||||
disable=C, R, W0212, W1618
|
||||
|
||||
[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=yes
|
||||
|
||||
# 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.Exception
|
@ -0,0 +1,2 @@
|
||||
pbr>=2.0.0
|
||||
PyYAML>=3.10
|
@ -0,0 +1,35 @@
|
||||
[metadata]
|
||||
name = k8sapp-metrics-server
|
||||
summary = StarlingX sysinv extensions for metrics-server
|
||||
author = StarlingX
|
||||
author-email = starlingx-discuss@lists.starlingx.io
|
||||
home-page = https://www.starlingx.io/
|
||||
classifier =
|
||||
License :: OSI Approved :: Apache Software License
|
||||
Operating System :: POSIX :: Linux
|
||||
Programming Language :: Python
|
||||
Programming Language :: Python :: 2
|
||||
Programming Language :: Python :: 2.7
|
||||
Programming Language :: Python :: 3
|
||||
Programming Language :: Python :: 3.6
|
||||
|
||||
[files]
|
||||
packages =
|
||||
k8sapp_metrics_server
|
||||
|
||||
[global]
|
||||
setup-hooks =
|
||||
pbr.hooks.setup_hook
|
||||
|
||||
[entry_points]
|
||||
systemconfig.helm_applications =
|
||||
metrics-server = systemconfig.helm_plugins.metrics_server
|
||||
|
||||
systemconfig.helm_plugins.metrics_server =
|
||||
001_metrics-server = k8sapp_metrics_server.helm.metrics_server:MetricsServerHelm
|
||||
|
||||
systemconfig.app_lifecycle =
|
||||
metrics-server = k8sapp_metrics_server.lifecycle.lifecycle_metrics_server:MetricsServerAppLifecycleOperator
|
||||
|
||||
[bdist_wheel]
|
||||
universal = 1
|
@ -0,0 +1,9 @@
|
||||
#
|
||||
# copyright (c) 2023 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
import setuptools
|
||||
setuptools.setup(
|
||||
setup_requires=['pbr>=2.0.0'],
|
||||
pbr=True)
|
@ -0,0 +1,22 @@
|
||||
# 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
|
||||
coverage>=3.6
|
||||
discover
|
||||
mock>=2.0.0 # BSD
|
||||
passlib>=1.7.0
|
||||
psycopg2-binary
|
||||
python-subunit>=0.0.18
|
||||
requests-mock>=0.6.0 # Apache-2.0
|
||||
oslotest>=3.2.0 # Apache-2.0
|
||||
stestr>=1.0.0 # Apache-2.0
|
||||
testtools!=1.2.0,>=0.9.36
|
||||
ipaddr
|
||||
pytest
|
||||
pyudev
|
||||
migrate
|
||||
markupsafe
|
||||
bandit
|
||||
flake8-bugbear
|
||||
pylint
|
106
python3-k8sapp-metrics-server/k8sapp_metrics_server/tox.ini
Normal file
106
python3-k8sapp-metrics-server/k8sapp_metrics_server/tox.ini
Normal file
@ -0,0 +1,106 @@
|
||||
[tox]
|
||||
envlist = flake8,py39,pylint,bandit,cover
|
||||
minversion = 2.3
|
||||
|
||||
# tox does not work if the path to the workdir is too long, so move it to /tmp
|
||||
toxworkdir = /tmp/{env:USER}_k8smstox
|
||||
stxdir = {toxinidir}/../../..
|
||||
distshare={toxworkdir}/.tox/distshare
|
||||
|
||||
[testenv]
|
||||
allowlist_externals = bash
|
||||
find
|
||||
basepython = python3
|
||||
sitepackages = False
|
||||
|
||||
install_command = pip install -v -v -v \
|
||||
-c{toxinidir}/upper-constraints.txt \
|
||||
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt} \
|
||||
{opts} {packages}
|
||||
|
||||
# Note the hash seed is set to 0 until can be tested with a
|
||||
# random hash seed successfully.
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
PYTHONHASHSEED=0
|
||||
PYTHONDONTWRITEBYTECODE=1
|
||||
OS_TEST_PATH=./k8sapp_metrics_server/tests
|
||||
LANG=en_US.UTF-8
|
||||
LANGUAGE=en_US:en
|
||||
LC_ALL=C
|
||||
EVENTS_YAML=./k8sapp_metrics_server/tests/events_for_testing.yaml
|
||||
SYSINV_TEST_ENV=True
|
||||
TOX_WORK_DIR={toxworkdir}
|
||||
PYLINTHOME={toxworkdir}
|
||||
|
||||
# the path to cgcs-patch needs to be updated to sw-patch
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
-e{[tox]stxdir}/config/sysinv/sysinv/sysinv
|
||||
-e{[tox]stxdir}/config/tsconfig/tsconfig
|
||||
-e{[tox]stxdir}/fault/fm-api/source
|
||||
-e{[tox]stxdir}/fault/python-fmclient/fmclient
|
||||
-e{[tox]stxdir}/utilities/ceph/python-cephclient/python-cephclient
|
||||
-e{[tox]stxdir}/update/sw-patch/cgcs-patch
|
||||
|
||||
|
||||
commands =
|
||||
find . -type f -name "*.pyc" -delete
|
||||
|
||||
[flake8]
|
||||
exclude = build,dist,tools,.eggs
|
||||
max-line-length=120
|
||||
|
||||
[testenv:flake8]
|
||||
basepython = python3
|
||||
deps = -r{toxinidir}/test-requirements.txt
|
||||
commands =
|
||||
flake8 {posargs} .
|
||||
|
||||
[testenv:py39]
|
||||
basepython = python3.9
|
||||
commands =
|
||||
{[testenv]commands}
|
||||
stestr run {posargs}
|
||||
stestr slowest
|
||||
|
||||
[testenv:pep8]
|
||||
deps = {[testenv:flake8]deps}
|
||||
commands = {[testenv:flake8]commands}
|
||||
|
||||
[testenv:venv]
|
||||
commands = {posargs}
|
||||
|
||||
[bandit]
|
||||
# Add bandit configuration here
|
||||
|
||||
[testenv:bandit]
|
||||
deps = -r{toxinidir}/test-requirements.txt
|
||||
commands = bandit --ini tox.ini -n 5 -r k8sapp_metrics_server
|
||||
|
||||
[testenv:pylint]
|
||||
deps = {[testenv]deps}
|
||||
commands =
|
||||
pylint {posargs} k8sapp_metrics_server --rcfile=./pylint.rc
|
||||
|
||||
[testenv:cover]
|
||||
deps = {[testenv]deps}
|
||||
setenv = {[testenv]setenv}
|
||||
PYTHON=coverage run --parallel-mode
|
||||
|
||||
commands =
|
||||
{[testenv]commands}
|
||||
coverage erase
|
||||
stestr run {posargs}
|
||||
coverage combine
|
||||
coverage html -d cover
|
||||
coverage xml -o cover/coverage.xml
|
||||
coverage report
|
||||
|
||||
[testenv:pip-missing-reqs]
|
||||
# do not install test-requirements as that will pollute the virtualenv for
|
||||
# determining missing packages
|
||||
# this also means that pip-missing-reqs must be installed separately, outside
|
||||
# of the requirements.txt files
|
||||
deps = pip_missing_reqs
|
||||
-rrequirements.txt
|
||||
commands=pip-missing-reqs -d --ignore-file=/k8sapp_metrics_server/tests k8sapp_metrics_server
|
@ -0,0 +1 @@
|
||||
# Override upstream constraints based on StarlingX load
|
@ -3,10 +3,10 @@ Section: libs
|
||||
Priority: optional
|
||||
Maintainer: StarlingX Developers <starlingx-discuss@lists.starlingx.io>
|
||||
Build-Depends: debhelper-compat (= 13),
|
||||
chartmuseum,
|
||||
helm,
|
||||
procps,
|
||||
metrics-server-helm
|
||||
metrics-server-helm,
|
||||
python3-k8sapp-metrics-server,
|
||||
python3-k8sapp-metrics-server-wheels
|
||||
Standards-Version: 4.5.1
|
||||
Homepage: https://www.starlingx.io
|
||||
|
||||
|
@ -41,6 +41,10 @@ override_dh_auto_build:
|
||||
sed -i 's/@APP_VERSION@/$(APP_VERSION)/g' $(STAGING_FLUXCD)/metadata.yaml
|
||||
sed -i 's/@HELM_REPO@/$(HELM_REPO)/g' $(STAGING_FLUXCD)/metadata.yaml
|
||||
|
||||
# Copy the plugins: installed in the buildroot
|
||||
mkdir -p $(STAGING_FLUXCD)/plugins
|
||||
cp /plugins/*.whl $(STAGING_FLUXCD)/plugins
|
||||
|
||||
# Package fluxcd
|
||||
cp -R fluxcd-manifests $(STAGING_FLUXCD)/
|
||||
|
||||
@ -59,4 +63,3 @@ override_dh_auto_install:
|
||||
override_dh_auto_test:
|
||||
|
||||
override_dh_usrlocal:
|
||||
|
||||
|
15
tox.ini
15
tox.ini
@ -1,11 +1,14 @@
|
||||
[tox]
|
||||
envlist = linters
|
||||
minversion = 2.3
|
||||
minversion = 2.9
|
||||
skipsdist = True
|
||||
sitepackages=False
|
||||
|
||||
[testenv]
|
||||
install_command = pip install -U {opts} {packages}
|
||||
basepython = python3
|
||||
install_command = pip install -U \
|
||||
{opts} {packages} \
|
||||
-c{env:TOX_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt}
|
||||
setenv =
|
||||
VIRTUAL_ENV={envdir}
|
||||
OS_STDOUT_CAPTURE=1
|
||||
@ -33,3 +36,11 @@ commands =
|
||||
[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
|
||||
|
Loading…
x
Reference in New Issue
Block a user