TBD
Project description
CSP Billing Adapter Kubernetes Plugin
This is a plugin for csp-billing-adapter that provides storage hook implementations. It also implements the get_usage_data hook for the adapter. The namespace is configured based on the ADAPTER_NAMESPACE environment variable which is expected to be set in the container.
The following function hooks are implemented:
Setup
Setup adapter
The setup_adapter function authenticates the current session. It
tries both the in cluster config and Kube config. If both fail an
exception is raised.
Cache
save_cache
Stores the adapter cache in an opaque secret named csp-adapter-cache in
the namespace determined by the above environment varaible. If the cache
already exists no save is performed. In this case it's expected to use the
update_cache function instead.
update_cache
Updates or replaces the adapter cache in the csp-adapter-cache secret using the configured namespace.
get_cache
Retrieves the cache from the secret named csp-adapter-cache. If the cache
is not found None is returned.
CSP Config
save_csp_config
Stores the adapter csp config in configMap named csp-config in the
configured namespace. If csp-config already exists nothing is saved.
It is expected to use update_csp_config to make updates to an existing
csp-config.
update_csp_config
Updates or replace the configMap named csp-config in the configured namespace.
get_csp_config
Retrieves the csp config from the configMap named csp-config. If the
csp config is not found None is returned.
Usage
get_usage_data
Retrieves usage data from the configured custom resource definition (CRD). The location, name and namespace of the CR are configured using environment variables:
ADAPTER_NAMESPACE:The namespace where the adapter is deployed.
USAGE_CRD_PLURAL: The plural name of the K8s CRD.
USAGE_RESOURCE: The name of the CRD object that contains the usage data.
USAGE_API_VERSION: The API version of the usage CRD to use. Example "v1.
USAGE_API_GROUP: The API group where the CRD exists.
The CRD is expected to have a number of fields. reporting_time is required and is expected to be a RFC 3339 compliant in UTC with the following format: YYYY-MM-DDTHH:MM:SS.FFFFFF+00:00. base_product is optional and if it's provided it is a string containing information about the product name and version. At least one usage field but there can be more than one.
Archive
save_metering_archive
Stores the adapter metering archive in a configMap named metering-archive in the configured namespace. If metering-archive already exists it is updated with the latest data.
get_metering_archive
Retrieves the metering archive from the configMap named metering-archive. If the metering archive is not found an empty list is returned.
get_archive_location
Returns the location of the metering archive. This is the config map name metering-archive.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file csp_billing_adapter_k8s-1.2.0.tar.gz.
File metadata
- Download URL: csp_billing_adapter_k8s-1.2.0.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fad8893dfcf49f02dc41f400f0228549db303f7a33f89c36a59ba1853d0948bf
|
|
| MD5 |
d6eac827836dbe19319fd5952063cc79
|
|
| BLAKE2b-256 |
b5bef49e2c9d5d6fd839bbafad665cd910e9f2acbfbb90f840f72a4a78e1ffcf
|
Provenance
The following attestation bundles were made for csp_billing_adapter_k8s-1.2.0.tar.gz:
Publisher:
pypi-publish.yml on SUSE-Enceladus/csp-billing-adapter-k8s
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
csp_billing_adapter_k8s-1.2.0.tar.gz -
Subject digest:
fad8893dfcf49f02dc41f400f0228549db303f7a33f89c36a59ba1853d0948bf - Sigstore transparency entry: 2116049831
- Sigstore integration time:
-
Permalink:
SUSE-Enceladus/csp-billing-adapter-k8s@f3a1ab1a9ab48d973e241535a1034129c750a6a7 -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/SUSE-Enceladus
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@f3a1ab1a9ab48d973e241535a1034129c750a6a7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file csp_billing_adapter_k8s-1.2.0-py3-none-any.whl.
File metadata
- Download URL: csp_billing_adapter_k8s-1.2.0-py3-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8137fdc0d0759ea8f678e016fe40d53bbb7ab5c600864091f5c4ee9027d4535
|
|
| MD5 |
6b379639e930f3de22612b24c9f0eb9f
|
|
| BLAKE2b-256 |
1b24455cd8e0e11b44d1e6540312ea7b7e7d2fbd044cf761145f0778cc354d46
|
Provenance
The following attestation bundles were made for csp_billing_adapter_k8s-1.2.0-py3-none-any.whl:
Publisher:
pypi-publish.yml on SUSE-Enceladus/csp-billing-adapter-k8s
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
csp_billing_adapter_k8s-1.2.0-py3-none-any.whl -
Subject digest:
b8137fdc0d0759ea8f678e016fe40d53bbb7ab5c600864091f5c4ee9027d4535 - Sigstore transparency entry: 2116049853
- Sigstore integration time:
-
Permalink:
SUSE-Enceladus/csp-billing-adapter-k8s@f3a1ab1a9ab48d973e241535a1034129c750a6a7 -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/SUSE-Enceladus
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@f3a1ab1a9ab48d973e241535a1034129c750a6a7 -
Trigger Event:
push
-
Statement type: