Skip to content

Commit

Permalink
GT-465 Fix debug mode in non TLS mode (#1391)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwierzbo authored Aug 25, 2023
1 parent 8c465a8 commit 344924b
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- (Feature) PVCResize action concurrency limit
- (Feature) Optional Assertions
- (Feature) Deprecate Actions
- (Bugfix) Debug mode

## [1.2.32](https://github.com/arangodb/kube-arangodb/tree/1.2.32) (2023-08-07)
- (Feature) Backup lifetime - remove Backup once its lifetime has been reached
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ rules:
verbs: ["list"]
- apiGroups: [""]
resources: ["pods/log"]
verbs: ["get", "ist"]
verbs: ["get", "list"]
{{- end }}
{{- if .Values.rbac.extensions.monitoring }}
- apiGroups: ["monitoring.coreos.com"]
Expand Down
12 changes: 7 additions & 5 deletions cmd/admin.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -205,10 +205,12 @@ func getDeploymentAndCredentials(ctx context.Context,
}

var secrets = kubeCli.CoreV1().Secrets(d.GetNamespace())
certCA, err = getCACertificate(ctx, secrets, d.GetAcceptedSpec().TLS.GetCASecretName())
if err != nil {
err = errors.WithMessage(err, "failed to get CA certificate")
return
if d.GetAcceptedSpec().TLS.IsSecure() {
certCA, err = getCACertificate(ctx, secrets, d.GetAcceptedSpec().TLS.GetCASecretName())
if err != nil {
err = errors.WithMessage(err, "failed to get CA certificate")
return
}
}

if d.GetAcceptedSpec().IsAuthenticated() {
Expand Down
6 changes: 3 additions & 3 deletions cmd/debug.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -42,7 +42,7 @@ func init() {

var debugPackage = &cobra.Command{
Use: "debugPackage",
Short: "[WiP] Generate debug package for debugging",
Short: "Generate debug package for debugging",
RunE: debugPackageFunc,
}

Expand All @@ -63,7 +63,7 @@ func debugPackageStdOut(cmd *cobra.Command) (returnError error) {
}

func debugPackageFile(cmd *cobra.Command) (returnError error) {
out, err := os.OpenFile("./out.tar.gz", os.O_TRUNC|os.O_WRONLY|os.O_CREATE, 0644)
out, err := os.OpenFile(debugPackageInput.Output, os.O_TRUNC|os.O_WRONLY|os.O_CREATE, 0644)
if err != nil {
return err
}
Expand Down
4 changes: 4 additions & 0 deletions docs/design/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@
- [Force rebuild out-synced Shards with broken Merkle Tree](./features/rebuild_out_synced_shards.md)
- [Failover Leader service](./features/failover_leader_service.md)
- [Restore defaults from last accepted state of deployment](./features/deployment_spec_defaults.md)

## Debugging
- [Collecting debug info](./debugging.md)
-
31 changes: 31 additions & 0 deletions docs/design/debugging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Collecting debug data

## Agency dump

To collect only agency dump, run:

```shell
kubectl exec -ti {POD_kube-arangodb-operator} -- /usr/bin/arangodb_operator admin agency dump > agency_dump.json
```

## Deployment debug package

To collect debug package, which contains things like:
- deployment pod logs
- operator pod logs
- kubernetes events
- deployment yaml files
- agency dump

Ensure you have debug mode enabled in the operator deployment:
```shell
```bash
helm upgrade --install kube-arangodb \
https://github.com/arangodb/kube-arangodb/releases/download/$VER/kube-arangodb-$VER.tgz \
--set "rbac.extensions.debug=true"
```

Then run:
```shell
kubectl exec -ti {POD_kube-arangodb-operator} -- /usr/bin/arangodb_operator debugPackage --namespace {namespace} -o - > db.tar.gz
```

0 comments on commit 344924b

Please sign in to comment.