Currently it's just an idea and a place to chat it out.
Have a small program which utilizes yaml and/or json to talk to the dynatrace api to configure the settings (environment, configuration and maybe even cluster) from a repository through CI/CD. Why would just the developers have fun and not us infra-guys too?
Golang or Python
Possible with go and python. No shortcomings in any way.
- Pod could run constantly but also short-lived
- it would fetch multiple/single file(s) from defined sources (git, https) and apply the configs to target (the gitops way)
- go would fit better as theres a smaller image
...
- create a dynatrace trial account if you don't have one
- create a dynatrace API-Token with Write Configuration in the dynatrace web console "Settings -> Integration -> Dynatrace API"
- use the experiments/config/anomaly-detection-service.json or create a new file according to the https://www.dynatrace.com/support/help/extend-dynatrace/dynatrace-api/configuration-api/ . the configuration file must contain the API uri and the http method like in . The json body for the dynatrace API is in the payload key, like in
- then execute (adapt to your use case)
export DYNATRACE_API_URL="https://yourenvironment.live.dynatrace.com/api/config"
export DYNATRACE_API_TOKEN="xxxxxx"
there are different command parameters available:
get current state of the configuration object:
go run experiments/dynatrace-config.go get experiments/config/anomaly-detection-service.json
show diff between current state and desired state of the configuration object:
go run experiments/dynatrace-config.go diff experiments/config/anomaly-detection-service.json
validate desired state:
go run experiments/dynatrace-config.go validate experiments/config/anomaly-detection-service.json
apply desired state:
go run experiments/dynatrace-config.go apply experiments/config/anomaly-detection-service.json
- from my opinion it doesn't make sense to build a new API or configuration layer. In the configuration json files there needs to be the same payload as the dynatrace API server expects. Otherwise we always need to adapt our tool when the dynatrace API changes or will be expanded
- setting the dynatrace configuration is not always a PUT, sometimes also a POST. so we probably need to specify the http method in the configuration json file like in
- http returncode is depending on the api, so we also need to specify the expected success return code in the configuration json file, like in
- every (?) API has a 'validator' API which can validate the desired configuration. Not sure if that is really true for every API.