2.2 KiB
2.2 KiB
Kubernetes dashboard as a code
This repository holds the code to generate the Kubernetes overwiew Dashboard as Code.
Dashboard is generated for specific cluster provided as parameter for the script.
Dashboard naming convention is: "[PROVIDED CLUSTER NAME] - Kubernetes cluster overview"
Prerequisites
Python packages
Before executing scripts, python requirements have to be satisfied. To do so, execute following command: pip install -r requirements.txt
.env file
To provide authentication for API calls, create ".env" file in the script directory with following definition:
<ENV NAME>=<ENV TOKEN>
<ENV NAME> is name of environment variable. This name should be passed to "environment.yaml" file as "env-token-name" parameter
Example:
environment.yaml file: "- env-token-name: "GLOBAL_CONFIG_TOKEN"
.env file: "GLOBAL_CONFIG_TOKEN=XXXXXXXXXXX"
DASHBOARD_OWNER=<owner e-mail>
Dashboard owner e-mail address.
Usage
usage: createDash.py [-h] -C CLUSTER [--remove] [-E ENVIRONMENT] [-O OWNER]
Generate and deploy the Kubernetes Overview Dashboard as Code.
options:
-h, --help show this help message and exit
-C CLUSTER, --cluster CLUSTER
Name of the Kubernetes cluster (default: None)
--remove Remove dashboard for given cluster. If not specified dashboard will be created or updated (default: False)
-E ENVIRONMENT, --environment ENVIRONMENT
Name of the environment (the same as in environment.yaml file. Used to upload dashboard to specific Dynatrace environment. If not specified all environments in file will be used
(default: None)
-O OWNER, --owner OWNER
Email address of dashboard owner (default: None)
Files
createDash.py
This scripts generates Dashboard and uploads it to Dynatrace.
environment.yaml
File containing environments to connect to Dynatrace tenant
Environment name:
name: string #name ov environment
env-url: str #url of environment
env-token-name: str #name of environment variable containing API token
requirements.txt
File containing required python packages
kubernetes_tiles_template.json
File containing template for dashboard