Skip to content

Commit 344924b

Browse files
authored
GT-465 Fix debug mode in non TLS mode (#1391)
1 parent 8c465a8 commit 344924b

File tree

6 files changed

+47
-9
lines changed

6 files changed

+47
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- (Feature) PVCResize action concurrency limit
66
- (Feature) Optional Assertions
77
- (Feature) Deprecate Actions
8+
- (Bugfix) Debug mode
89

910
## [1.2.32](https://github.com/arangodb/kube-arangodb/tree/1.2.32) (2023-08-07)
1011
- (Feature) Backup lifetime - remove Backup once its lifetime has been reached

chart/kube-arangodb/templates/deployment-operator/role.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ rules:
4444
verbs: ["list"]
4545
- apiGroups: [""]
4646
resources: ["pods/log"]
47-
verbs: ["get", "ist"]
47+
verbs: ["get", "list"]
4848
{{- end }}
4949
{{- if .Values.rbac.extensions.monitoring }}
5050
- apiGroups: ["monitoring.coreos.com"]

cmd/admin.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
4+
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
55
//
66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.
@@ -205,10 +205,12 @@ func getDeploymentAndCredentials(ctx context.Context,
205205
}
206206

207207
var secrets = kubeCli.CoreV1().Secrets(d.GetNamespace())
208-
certCA, err = getCACertificate(ctx, secrets, d.GetAcceptedSpec().TLS.GetCASecretName())
209-
if err != nil {
210-
err = errors.WithMessage(err, "failed to get CA certificate")
211-
return
208+
if d.GetAcceptedSpec().TLS.IsSecure() {
209+
certCA, err = getCACertificate(ctx, secrets, d.GetAcceptedSpec().TLS.GetCASecretName())
210+
if err != nil {
211+
err = errors.WithMessage(err, "failed to get CA certificate")
212+
return
213+
}
212214
}
213215

214216
if d.GetAcceptedSpec().IsAuthenticated() {

cmd/debug.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
4+
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
55
//
66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.
@@ -42,7 +42,7 @@ func init() {
4242

4343
var debugPackage = &cobra.Command{
4444
Use: "debugPackage",
45-
Short: "[WiP] Generate debug package for debugging",
45+
Short: "Generate debug package for debugging",
4646
RunE: debugPackageFunc,
4747
}
4848

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

6565
func debugPackageFile(cmd *cobra.Command) (returnError error) {
66-
out, err := os.OpenFile("./out.tar.gz", os.O_TRUNC|os.O_WRONLY|os.O_CREATE, 0644)
66+
out, err := os.OpenFile(debugPackageInput.Output, os.O_TRUNC|os.O_WRONLY|os.O_CREATE, 0644)
6767
if err != nil {
6868
return err
6969
}

docs/design/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,7 @@
2424
- [Force rebuild out-synced Shards with broken Merkle Tree](./features/rebuild_out_synced_shards.md)
2525
- [Failover Leader service](./features/failover_leader_service.md)
2626
- [Restore defaults from last accepted state of deployment](./features/deployment_spec_defaults.md)
27+
28+
## Debugging
29+
- [Collecting debug info](./debugging.md)
30+
-

docs/design/debugging.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Collecting debug data
2+
3+
## Agency dump
4+
5+
To collect only agency dump, run:
6+
7+
```shell
8+
kubectl exec -ti {POD_kube-arangodb-operator} -- /usr/bin/arangodb_operator admin agency dump > agency_dump.json
9+
```
10+
11+
## Deployment debug package
12+
13+
To collect debug package, which contains things like:
14+
- deployment pod logs
15+
- operator pod logs
16+
- kubernetes events
17+
- deployment yaml files
18+
- agency dump
19+
20+
Ensure you have debug mode enabled in the operator deployment:
21+
```shell
22+
```bash
23+
helm upgrade --install kube-arangodb \
24+
https://github.com/arangodb/kube-arangodb/releases/download/$VER/kube-arangodb-$VER.tgz \
25+
--set "rbac.extensions.debug=true"
26+
```
27+
28+
Then run:
29+
```shell
30+
kubectl exec -ti {POD_kube-arangodb-operator} -- /usr/bin/arangodb_operator debugPackage --namespace {namespace} -o - > db.tar.gz
31+
```

0 commit comments

Comments
 (0)