This folder contains scripts to setup a Dynatrace Cloud Automation Workshop
It's assumed you have the following:
- A Dynatrace Environment (SaaS or Managed with exposed API)
- A Cloud Automation SaaS Environment (aka Keptn SaaS Control Plane)
- An EC2 Amazon Linux instance (min: m5.8xlarge)
What you need is:
- DT_TENANT: hostname of your SaaS or managed environment, e.g: abc12345.live.dynatrace.com
- DT_API_TOKEN: It needs configuration read/write access. Best is to give it all privileges that don't touch sensitive data
- DT_PAAS_TOKEN: A PAAS Token as the script also installs a OneAgent & ActiveGate on your Bastion Host
- KEPTN_CONTROL_PLANE_DOMAIN: hostname of your Cloud Automation enviornment, e.g: abc12345.cloudautomation.live.dynatrace.com
- KEPTN_CONTROL_PLANE_API_TOKEN: API Token for your Cloud Automation environment
- OWNER_EMAIL: The username (=email) of your Dynatrace user. It will be used to create dashboards in your tenant
Logon to your EC2 Amazon Linux instance and execute the following:
export DT_TENANT=abc12345.live.dynatrace.com
export DT_API_TOKEN=dt0c01.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
export DT_PAAS_TOKEN=dt0c01.YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
export KEPTN_CONTROL_PLANE_DOMAIN=abc12345.cloudautomation.live.dynatrace.com
export KEPTN_CONTROL_PLANE_API_TOKEN=ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
export OWNER_EMAIL=youremail@domain.com
export ISTIO=false
Now its time to clone this git repo
git clone https://github.com/keptn-sandbox/keptn-on-k3s
cd keptn-on-k3s
git checkout release-0.9.0
This installation option is good if you don't have too many tenants in your workshop and if your k3s host has sufficient CPU and Memory
Now its time to run the installation script!
export KEPTN_EXECUTION_PLANE_STAGE_FILTER=
export KEPTN_EXECUTION_PLANE_SERVICE_FILTER=
export KEPTN_EXECUTION_PLANE_PROJECT_FILTER=
./install-keptn-on-k3s.sh --executionplane --provider aws --with-genericexec --with-monaco --with-gitea --use-nip
This requires two smaller hosts as each host is only handling either production or staging traffic
We first install the Execution Plane targeted for Production (here we also install Gitea)
export KEPTN_EXECUTION_PLANE_STAGE_FILTER=production
export KEPTN_EXECUTION_PLANE_SERVICE_FILTER=
export KEPTN_EXECUTION_PLANE_PROJECT_FILTER=
./install-keptn-on-k3s.sh --executionplane --provider aws --with-genericexec --with-monaco --with-gitea --use-nip
And now the Execution Plane targeted for Staging (no need for gitea)
export KEPTN_EXECUTION_PLANE_STAGE_FILTER=staging
export KEPTN_EXECUTION_PLANE_SERVICE_FILTER=
export KEPTN_EXECUTION_PLANE_PROJECT_FILTER=
./install-keptn-on-k3s.sh --executionplane --provider aws --with-genericexec --with-monaco --use-nip
The demo project is called demo-delivery
. It is a two stage delivery pipeline of services with the name pattern tnt-TENANTID-svc.
The idea is that every attendee of the workshop gets its own service. The story is that we are all working for a SaaS provider and we are all responsible for our individual tenants.
In order to create tenants for each student we need to create a file called tenants.sh
in the cloudautomation/scripts
folder that sets the TENANTID into an array as described here. The tenant IDs must only contain alphanumeric characters and have to be lowercase. Here is an example for 3 tenants:
./cloudautomation/scripts/tenants.sh:
INSTANCE_ARRAY=(angr here saif)
TIP for Workshops: To come up with the list of tenants a suggestion is to use the first two characters of your attendees first and last names for the tenant IDs, e.g: Andreas Grabner would be angr, Henrik Rexed would be here, ...
Another option would be to use e.g: stock symbols. With this you can assign everyone a stock symbol that is easy to remember, e.g: aapl, tsla, ... There is a sample file called tenants.stocksample.sh
. It contains 30 symbol names (some made up) :-)
IMPORTANT: Dynatrace automatically detects "version information" in pod names by removing hexadecimal patterns. So - make sure that these tenantIDs do not include numbers or just letters from A to F
Now we are ready and can create the demo project for that workshop
cd cloudautomation
export OWNER_EMAIL=youremail@domain.com
export KEPTN_CONTROL_PLANE_DOMAIN=abc12345.cloudautomation.live.dynatrace.com
export KEPTN_EXECUTION_PLANE_INGRESS_DOMAIN=your.productionk3s.i.p.nip.io (this is the production execution plane IP)
export KEPTN_PRODUCTION_INGRESS=your.productionk3s.i.p.nip.io
export KEPTN_STAGING_INGRESS=your.stagingk3s.i.p.nip.io
./install-cloudautomation-workshop.sh
keptn trigger delivery --project=delivery-demo --service=tnt-angr-svc --image=grabnerandi/simplenodeservice:1.0.1
keptn trigger delivery --project=delivery-demo --service=tnt-angr-svc --stage=production --image=grabnerandi/simplenodeservice:1.0.1
./trigger-for-all-tenants.sh tenants.sh delivery-demo production grabnerandi/simplenodeservice:1.0.1
In this directory you find the default_qualitygate_dashboard.json.
I suggest you import this one to your Dynatrace environment as you can use it as a template for the SLO-based Quality Gate tutorial.
The name can be: KQG;project=dynatrace;stage=quality-gate;service=<YOURSERVICENAME>
In this directory you also find the default_slo_dashboard.json.
I suggest you import this one to your Dynatrace environment as you can use it as a template for the SLO-based Quality Gate tutorial.
The name can be: SLO Dashboard for tenant xxxx