Skip to main content

PyPI Latest Release Container Repository on Quay Actions StatusCoverage Status Documentation Status python License

Cloud Governance

What is it?

Cloud Governance tool provides a lightweight and flexible framework for deploying cloud management policies focusing on cost optimize and security. We have implemented several pruning policies.
When monitoring the resources, we found that most of the cost leakage is from available volumes, unused NAT gateways, and unattached Public IPv4 addresses (Starting from February 2024, public IPv4 addresses are chargeable whether they are used or not).

Providers Disks NatGateway PublicIp Snapshots InstanceIdle TagResources EC2Stop ocp_cleanup ClusterRun EmptyBucket EmptyRoles
AWS ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓
Azure ✓ ✓ ✓ ✓ ✓ ✗ ✗ ✗ ✓ ✗ ✗

List of Policies:

AWS Polices!
  • instance_idle
  • instance_run
  • unattached_volume
  • zombie_cluster_resource
  • ip_unattached
  • zombie_snapshots
  • unused_nat_gateway
  • s3_inactive
  • unused_access_key
  • empty_roles
  • tag_resources
  • tag_iam_user
  • cost_over_usage
  • cluster_run
Azure Polices!
  • instance_idle
  • unattached_volume
  • ip_unattached
  • unused_nat_gateway
IBM Polices!
  • tag_baremetal
  • tag_vm
  • tag_resources

Check out policy summary here!

Reference:

Table of Contents

Installation

Download cloud-governance image from quay.io

podman pull quay.io/rh_perfscale/cloud-governance

Environment variables configurations:

Key Value Description
AWS_ACCESS_KEY_ID required AWS access key
AWS_SECRET_ACCESS_KEY required AWS Secret key
AWS_DEFAULT_REGION required AWS Region, default set to us-east-2
BUCKET_NAME optional Cloud bucket Name, to store data
policy required check here for policies list
dry_run optional default set to "yes", supported only two: yes/ no
log_level optional default set to INFO
LDAP_HOST_NAME optional ldap hostname
LDAP_FALLBACK_HOSTS optional comma-separated backup ldap hostnames, tried in order if LDAP_HOST_NAME fails
LDAP_BIND_DN optional ldap service-account bind DN, for an authenticated bind
LDAP_BIND_PASSWORD optional ldap service-account bind password
LDAP_BASE_DN optional ldap search base DN
LDAP_CA_CERT_FILE optional path to a CA bundle for verifying the ldap server's TLS certificate
es_host optional Elasticsearch Host
es_port optional Elasticsearch Port
es_index optional Elasticsearch Index, to push the data. default to cloud-governance-es-index
GOOGLE_APPLICATION_CREDENTIALS optional GCP creds, to access google resources. i.e Sheets, Docs
AZURE_CLIENT_SECRET required Azure Client Secret
AZURE_TENANT_ID Azure Tenant Id
AZURE_ACCOUNT_ID Azure Account Id
AZURE_CLIENT_ID Azure Client Id
GCP_DATABASE_NAME GCP BigQuery database name, used to generate cost reports
GCP_DATABASE_TABLE_NAME GCP BigQuery TableName, used to generate cost reports
IBM_API_USERNAME IBM Account Username
IBM_API_KEY IBM Account Classic Infrastructure key
IBM_CLOUD_API_KEY IBM Cloud API Key
IBM_CUSTOM_TAGS_LIST pass string with separated with comma. i.e: "env: test, team: dev"

AWS Configuration

Create IAM User with Read/Delete Permissions and create S3 bucket.

IBM Configuration

  • Create classic infrastructure API key
  • Create IBM CLOUD API key to use tag_resources policy

Run Policies

AWS

  • Passing environment variables
  podman run --rm --name cloud-governance \
  -e policy="zombie_cluster_resource" \
  -e AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID" \
  -e AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY" \
  -e AWS_DEFAULT_REGION="us-east-2" \
  -e dry_run="yes"  \
   "quay.io/rh_perfscale/cloud-governance"
  • Using involvement file config
  • Create env.yaml file, and mount it to /tmp/env.yaml else mount to anypath and pass env DEFAULT_CONFIG_PATH where you mounted
AWS_ACCESS_KEY_ID: ""
AWS_SECRET_ACCESS_KEY: ""
AWS_DEFAULT_REGION: "us-east-2"
policy: "zombie_cluster_resource"
dry_run: "yes"
es_host: ""
es_port: ""
es_index: ""
  podman run --rm --name cloud-governance \
  -v "env.yaml":"/tmp/env.yaml" \
  --net="host" \
   "quay.io/rh_perfscale/cloud-governance"

Run Policy Using Pod

Run as a pod job via OpenShift

Job Pod: cloud-governance.yaml

Configmaps: cloud_governance_configmap.yaml

Quay.io Secret: quayio_secret.sh

AWS Secret: cloud_governance_secret.yaml

* Need to convert secret key to base64 [run_base64.py](pod_yaml/run_base64.py)

Pytest

Cloud-governance integration tests using pytest
python3 -m venv governance
source governance/bin/activate
(governance) $ python -m pip install --upgrade pip
(governance) $ pip install coverage
(governance) $ pip install pytest
(governance) $ git clone https://github.com/redhat-performance/cloud-governance
(governance) $ cd cloud-governance
(governance) $ coverage run -m pytest
(governance) $ deactivate
rm -rf *governance*

Post Installation

Delete cloud-governance image

sudo podman rmi quay.io/rh_perfscale/cloud-governance

Metadata

Release files for cloud-governance 1.1.491

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cloud-governance 1.1.491
File Size Uploaded Provenance Actions
cloud_governance-1.1.491.tar.gz 246.3 kB Without provenance Details for cloud_governance-1.1.491.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cloud-governance 1.1.491
File Interpreter ABI Platform Actions
cloud_governance-1.1.491-py3-none-any.whl Python 3 none any Details for cloud_governance-1.1.491-py3-none-any.whl

Total release size: 594.5 kB

Release files / cloud_governance-1.1.491.tar.gz

Download URL cloud_governance-1.1.491.tar.gz
Size 246.3 kB
Tags Source
SHA-256 checksum
How to use checksums
48313db8a94120ef86c4ba14e787e14b3bdee372f2e33e0313363bbb794034bf
BLAKE2b-256 checksum
How to use checksums
bf6a68b766804acd7a60fafaaa074e0b2f93a283f9cbfb8fd3c0ce6615f50289
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.10

Release files / cloud_governance-1.1.491-py3-none-any.whl

Download URL cloud_governance-1.1.491-py3-none-any.whl
Size 348.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1dc6db2503a328c6838f39d2fff18879f4e13f0eeba6ad54ed043e38d6e876ff
BLAKE2b-256 checksum
How to use checksums
90979c34b0be17cbb0774a0a02f02c88fc0a7bb8226827521c20a4e149b69809
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.10

Security for cloud-governance 1.1.491

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.491 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page