dynatrace-operator icon indicating copy to clipboard operation
dynatrace-operator copied to clipboard

Adds EEC diagnostic logs to support_archive package

Open aorcholski opened this issue 6 months ago • 1 comments

K8S-10826

Description

  1. Moves required permissions for supportability into its own role and binding.
  2. Adds option to opt-out of supportability feature (values.yaml)
rbac:
  supportability: true
  1. Adds EEC diagnostic files to the support_archive package if Prometheus feature is enabled and files exist.

The /var/lib/dynatrace/remotepluginmodule/log/extensions/* directory is recursively scanned for diagnostic *.log files.

support_archive.zip package contains:

.
├── logs
│   ├── dynakube-extensions-controller-0
│   │   ├── extensions-controller.log
│   │   ├── ls.txt
│   │   └── var
│   │       └── lib
│   │           └── dynatrace
│   │               └── remotepluginmodule
│   │                   └── log
│   │                       └── extensions
│   │                           ├── diagnostics
│   │                           │   └── diag_executor.log
│   │                           ├── oneagent-logmon-detailed.log
│   │                           ├── oneagent-logmon-general.log
│   │                           └── ruxitagent_extensionsmodule_14.0.log

extensions-controller.log - standard output of the EEC application diag_executor.log oneagent-logmon-detailed.log oneagent-logmon-general.log ruxitagent_extensionsmodule_14.0.log - EEC diagnostic log files ls.txt - output of ls -R1 /var/lib/dynatrace/remotepluginmodule/log/extensions command which is parsed to find *.log files

How can this be tested?

Install operator in your cluster with supportability feature enabled config/helm/chart/default/values.yaml :

rbac:
  supportability: true
make deploy/kubernetes

Deploy dynakube with Prometheus feature enabled :

spec:
  apiUrl: https://<tenant>.dev.dynatracelabs.com/api                                                                                                                                                                                                                                                                                                                                          
  activeGate:                                                                                                                                                                                                                                                                                                                                                                                 
    tlsSecretName: ag-tls 
  customPullSecret: <secret> 
  extensions:                                                                                                                                                                                                                                                                                                                                                                                 
    enabled: true                                                                                                                                                                                                                                                                                                                                                                             
  templates:                                                                                                                                                                                                                                                                                                                                                                                  
    extensionExecutionController:                                                                                                                                                                                                                                                                                                                                                             
      imageRef:                                                                                                                                                                                                                                                                                                                                                                               
        repository: extk8sregistry.azurecr.io/eec/dynatrace-eec                                                                                                                                                                                                                                                                                                                               
        tag: 1.301.0.20240826-070516 

Run support-archive command :

kubectl exec -n dynatrace deployment/dynatrace-operator -- dynatrace-operator support-archive --stdout > operator-support-archive.zip

Expected output :

...
[support-archive]	Successfully collected logs logs/dynakube-extensions-controller-0/extensions-controller.log
[support-archive]	Successfully collected EEC diagnostic logs logs/dynakube-extensions-controller-0/var/lib/dynatrace/remotepluginmodule/log/extensions/oneagent-logmon-detailed.log
[support-archive]	Successfully collected EEC diagnostic logs logs/dynakube-extensions-controller-0/var/lib/dynatrace/remotepluginmodule/log/extensions/oneagent-logmon-general.log
[support-archive]	Successfully collected EEC diagnostic logs logs/dynakube-extensions-controller-0/var/lib/dynatrace/remotepluginmodule/log/extensions/ruxitagent_extensionsmodule_14.0.log
[support-archive]	Successfully collected EEC diagnostic logs logs/dynakube-extensions-controller-0/var/lib/dynatrace/remotepluginmodule/log/extensions/diagnostics/diag_executor.log
[support-archive]	Starting K8S resource collection
...

Remove dynakube. Uninstall operator :

make undeploy/kubernetes

Disable supportability feature config/helm/chart/default/values.yaml :

rbac:
  supportability: false

Install operator :

make deploy/kubernetes

Deploy dynakube with Prometheus feature enabled. Run support-archive command. Expected output :

[support-archive]	Storing operator version into operator-version.txt
[support-archive]	Log Collection has been disabled during Operator install. The necessary resources for Log Collection to work are not present on the cluster. Redeploy the Operator via Helm with all the necessary resources enabled.
[support-archive]	EEC Diagnostic Log Collection has been disabled during Operator install. The necessary resources for EEC Diagnostic Log Collection to work are not present on the cluster. Redeploy the Operator via Helm with all the necessary resources enabled.
[support-archive]	Starting K8S resource collection

aorcholski avatar Aug 09 '24 17:08 aorcholski