|
1 | 1 | # GitOps Operator Must-Gather |
2 | | -================= |
3 | 2 |
|
4 | 3 | `GitOps must-gather` is a tool to gather information about the gitop-operator. It is built on top of [OpenShift must-gather](https://github.com/openshift/must-gather). |
5 | 4 |
|
6 | | -### Usage |
| 5 | +## Usage |
| 6 | + |
7 | 7 | ```sh |
8 | 8 | oc adm must-gather --image=quay.io/redhat-developer/gitops-must-gather:latest |
9 | 9 | ``` |
10 | 10 |
|
11 | 11 | The command above will create a local directory with a dump of the OpenShift GitOps state. Note that this command will only get data related to the GitOps Operator in your OpenShift cluster. |
12 | 12 |
|
13 | 13 | You will get a dump of: |
| 14 | + |
14 | 15 | - Information for the subscription of the gitops-operator |
15 | 16 | - The GitOps Operator namespace (and its children objects) |
16 | 17 | - All namespaces where ArgoCD objects exist in, plus all objects in those namespaces, such as ArgoCD, Applications, ApplicationSets, and AppProjects, and configmaps |
17 | 18 | - No secrets will be collected |
18 | | -- A list of list of the namespaces that are managed by gitops-operator identified namespaces and resources from those namespaces. |
| 19 | +- A list of the namespaces that are managed by gitops-operator identified namespaces and resources from those namespaces. |
19 | 20 | - All GitOps CRD's objects and definitions |
20 | 21 | - Operator logs |
21 | 22 | - Logs of Argo CD |
22 | 23 | - Warning and error-level Events |
23 | 24 |
|
| 25 | +In addition to that, we will get a summary of: |
| 26 | + |
| 27 | +- All executed commands: `must-gather-script-commands.txt` |
| 28 | +- Errors: `must-gather-script-errors.txt` |
| 29 | +- Commands that produced no output: `must-gather-script-no-output.txt` |
| 30 | + |
| 31 | +All the output of the commands is stored into 3 different formats: |
| 32 | + |
| 33 | +- `*.txt` that represents the normal view without any structure. |
| 34 | +- `*.yaml` that is the YAML output of the command. |
| 35 | +- `*.json` that is the JSON output of the command. |
| 36 | + |
24 | 37 | In order to get data about other parts of the cluster (not specific to gitops-operator) you should run just `oc adm must-gather` (without passing a custom image). Run `oc adm must-gather -h` to see more options. |
25 | 38 |
|
26 | 39 | An example of the GitOps must-gather output would be something like the following, where there are two argocd instances in namespaces `openshift-gitops` and `foo` and an additional namespace called `foo-managed` which is managed by namespace `foo`: |
27 | | -``` |
| 40 | + |
| 41 | +```shell |
28 | 42 | cluster-gitops |
29 | | - └── gitops |
30 | | - ├── appprojects.yaml |
31 | | - ├── crds.yaml |
32 | | - ├── namespace_openshift-gitops_resources |
33 | | - │ ├── application_controller_logs.txt |
34 | | - │ ├── applications |
35 | | - │ ├── applicationsets |
36 | | - │ ├── argocd.yaml |
37 | | - │ ├── deployments |
38 | | - │ │ ├── cluster.yaml |
39 | | - │ │ └── kam.yaml |
40 | | - │ ├── dex-server_logs.txt |
41 | | - │ ├── error-events.txt |
42 | | - │ ├── pods |
43 | | - │ │ ├── cluster-5db4b95547-rdz2m.yaml |
44 | | - │ │ └── kam-fff7f474f-d27c8.yaml |
45 | | - │ ├── redis_logs.txt |
46 | | - │ ├── replicasets |
47 | | - │ │ ├── cluster-5db4b95547.yaml |
48 | | - │ │ └── kam-fff7f474f.yaml |
49 | | - │ ├── repo-server_logs.txt |
50 | | - │ ├── routes |
51 | | - │ │ └── kam.yaml |
52 | | - │ ├── server_logs.txt |
53 | | - │ ├── services |
54 | | - │ │ ├── cluster.yaml |
55 | | - │ │ └── kam.yaml |
56 | | - │ ├── statefulsets |
57 | | - │ └── warning-events.txt |
58 | | - ├── namespace_foo_resources |
59 | | - │ ├── application_controller_logs.txt |
60 | | - │ ├── applications |
61 | | - │ │ └── guestbook.yaml |
62 | | - │ ├── applicationsets |
63 | | - │ │ └── guestbook.yaml |
64 | | - │ ├── argocd.yaml |
65 | | - │ ├── deployments |
66 | | - │ ├── dex-server_logs.txt |
67 | | - │ ├── error-events.txt |
68 | | - │ ├── managedNamespace_foo-managed |
69 | | - │ │ ├── deployments |
70 | | - │ │ ├── pods |
71 | | - │ │ ├── replicasets |
72 | | - │ │ ├── routes |
73 | | - │ │ ├── services |
74 | | - │ │ └── statefulsets |
75 | | - │ ├── pods |
76 | | - │ ├── redis_logs.txt |
77 | | - │ ├── replicasets |
78 | | - │ ├── repo-server_logs.txt |
79 | | - │ ├── routes |
80 | | - │ ├── server_logs.txt |
81 | | - │ ├── services |
82 | | - │ ├── statefulsets |
83 | | - │ └── warning-events.txt |
84 | | - ├── oc-version.txt |
85 | | - └── subscription.yaml |
86 | | -``` |
| 43 | + └── gitops |
| 44 | + ├── clusterversion.txt |
| 45 | + ├── crds |
| 46 | + │ ├── crds.json/.txt./.yaml |
| 47 | + ├── managedNamespace_foo-managed |
| 48 | + │ └── resources |
| 49 | + │ ├── deployments |
| 50 | + │ ├── pods |
| 51 | + │ ├── replicasets |
| 52 | + │ ├── routes |
| 53 | + │ ├── services |
| 54 | + │ └── statefulsets |
| 55 | + ├── namespace_foo_resources |
| 56 | + │ ├── argocd |
| 57 | + │ │ ├── applications |
| 58 | + │ │ │ ├── applications.json/.txt./.yaml |
| 59 | + │ │ │ └── guestbook.yaml |
| 60 | + │ │ ├── applicationsets |
| 61 | + │ │ │ ├── applicationsets.txt |
| 62 | + │ │ │ ├── guestbook.json |
| 63 | + │ │ │ ├── guestbook.txt |
| 64 | + │ │ │ └── guestbook.yaml |
| 65 | + │ │ ├── argocd.json |
| 66 | + │ │ ├── argocd.txt |
| 67 | + │ │ ├── argocd.yaml |
| 68 | + │ │ ├── logs |
| 69 | + │ │ │ └── server-logs.txt |
| 70 | + │ │ ├── managed-namespaces.txt |
| 71 | + │ │ └── sourceNamespaces.txt |
| 72 | + │ ├── deployments |
| 73 | + │ │ ├── argocd-dex-server.json/.txt./.yaml |
| 74 | + │ │ ├── argocd-redis.json/.txt./.yaml |
| 75 | + │ │ ├── argocd-repo-server.json/.txt./.yaml |
| 76 | + │ │ ├── argocd-server.json/.txt./.yaml |
| 77 | + │ │ └── deployments.txt |
| 78 | + │ ├── events |
| 79 | + │ │ ├── all-events.txt |
| 80 | + │ │ └── warning-events.txt |
| 81 | + │ ├── pods |
| 82 | + │ │ ├── argocd-application-controller-0.json/.txt./.yaml |
| 83 | + │ │ ├── argocd-dex-server-69f99bdd45-g84b9.json/.txt./.yaml |
| 84 | + │ │ ├── argocd-dex-server-6d4f7d9d48-rkk9d.json/.txt./.yaml |
| 85 | + │ │ ├── argocd-redis-78d4849f68-pxxbp.json/.txt./.yaml |
| 86 | + │ │ ├── argocd-repo-server-6cfc8bbd5f-w4bsg.json/.txt./.yaml |
| 87 | + │ │ ├── argocd-server-5dc69475bf-98m6s.json/.txt./.yaml |
| 88 | + │ │ └── pods.txt |
| 89 | + │ ├── replicaSets |
| 90 | + │ │ ├── argocd-dex-server-69f99bdd45.json/.txt./.yaml |
| 91 | + │ │ ├── argocd-dex-server-6d4f7d9d48.json/.txt./.yaml |
| 92 | + │ │ ├── argocd-redis-78d4849f68.json/.txt./.yaml |
| 93 | + │ │ ├── argocd-repo-server-6cfc8bbd5f.json/.txt./.yaml |
| 94 | + │ │ ├── argocd-server-5dc69475bf.json/.txt./.yaml |
| 95 | + │ │ └── replicaSets.txt |
| 96 | + │ ├── routes |
| 97 | + │ │ ├── argocd-server.json/.txt./.yaml |
| 98 | + │ │ └── routes.txt |
| 99 | + │ ├── services |
| 100 | + │ │ ├── argocd-dex-server.json/.txt./.yaml |
| 101 | + │ │ ├── argocd-metrics.json/.txt./.yaml |
| 102 | + │ │ ├── argocd-redis.json/.txt./.yaml |
| 103 | + │ │ ├── argocd-repo-server.json/.txt./.yaml |
| 104 | + │ │ ├── argocd-server.json/.txt./.yaml |
| 105 | + │ │ ├── argocd-server-metrics.json/.txt./.yaml |
| 106 | + │ │ └── services.txt |
| 107 | + │ └── statefulsets |
| 108 | + │ ├── argocd-application-controller.json/.txt./.yaml |
| 109 | + │ └── statefulsets.txt |
| 110 | + ├── namespace_openshift-gitops_resources |
| 111 | + │ ├── argocd |
| 112 | + │ │ ├── applications |
| 113 | + │ │ ├── applicationsets |
| 114 | + │ │ ├── appprojects |
| 115 | + │ │ ├── appprojects.json/.txt./.yaml |
| 116 | + │ │ ├── argocd.txt |
| 117 | + │ │ ├── logs |
| 118 | + │ │ │ ├── application-controller-logs.txt |
| 119 | + │ │ │ ├── dex-server-logs.txt |
| 120 | + │ │ │ ├── redis-logs.txt |
| 121 | + │ │ │ ├── repo-server-logs.txt |
| 122 | + │ │ │ └── server-logs.txt |
| 123 | + │ │ ├── openshift-gitops.json |
| 124 | + │ │ ├── openshift-gitops.txt |
| 125 | + │ │ ├── openshift-gitops.yaml |
| 126 | + │ │ └── sourceNamespaces.txt |
| 127 | + │ ├── deployments |
| 128 | + │ │ ├── cluster.json/.txt./.yaml |
| 129 | + │ │ ├── deployments.txt |
| 130 | + │ │ ├── kam.json |
| 131 | + │ │ ├── kam.txt |
| 132 | + │ │ ├── kam.yaml |
| 133 | + │ │ ├── openshift-gitops-applicationset-controller.json/.txt./.yaml |
| 134 | + │ │ ├── openshift-gitops-dex-server.json/.txt./.yaml |
| 135 | + │ │ ├── openshift-gitops-redis.json/.txt./.yaml |
| 136 | + │ │ ├── openshift-gitops-repo-server.json/.txt./.yaml |
| 137 | + │ │ ├── openshift-gitops-server.json/.txt./.yaml |
| 138 | + │ ├── events |
| 139 | + │ ├── pods |
| 140 | + │ │ ├── cluster-5db4b95547-mks98.json/.txt./.yaml |
| 141 | + │ │ ├── kam-fff7f474f-t875v.json/.txt./.yaml |
| 142 | + │ │ ├── openshift-gitops-application-controller-0.json/.txt./.yaml |
| 143 | + │ │ ├── openshift-gitops-applicationset-controller-5dbdfcc689-6x4vf.json/.txt./.yaml |
| 144 | + │ │ ├── openshift-gitops-dex-server-5bf6f4f684-ghtqf.json/.txt./.yaml |
| 145 | + │ │ ├── openshift-gitops-redis-664cdd4757-f9jcc.json/.txt./.yaml |
| 146 | + │ │ ├── openshift-gitops-repo-server-6795d6d8cd-x7hzc.json/.txt./.yaml |
| 147 | + │ │ ├── openshift-gitops-server-6cc58f9cc8-fx8g7.json/.txt./.yaml |
| 148 | + │ │ └── pods.txt |
| 149 | + │ ├── replicaSets |
| 150 | + │ │ ├── cluster-5db4b95547.json/.txt./.yaml |
| 151 | + │ │ ├── kam-fff7f474f.json/.txt./.yaml |
| 152 | + │ │ ├── openshift-gitops-applicationset-controller-5dbdfcc689.json/.txt./.yaml |
| 153 | + │ │ ├── openshift-gitops-dex-server-5bf6f4f684.json/.txt./.yaml |
| 154 | + │ │ ├── openshift-gitops-dex-server-684c85d5d7.json/.txt./.yaml |
| 155 | + │ │ ├── openshift-gitops-redis-664cdd4757.json/.txt./.yaml |
| 156 | + │ │ ├── openshift-gitops-repo-server-6795d6d8cd.json/.txt./.yaml |
| 157 | + │ │ ├── openshift-gitops-server-6cc58f9cc8.json/.txt./.yaml |
| 158 | + │ │ └── replicaSets.txt |
| 159 | + │ ├── routes |
| 160 | + │ │ ├── kam.json/.txt./.yaml |
| 161 | + │ │ ├── openshift-gitops-server.json/.txt./.yaml |
| 162 | + │ │ └── routes.txt |
| 163 | + │ ├── services |
| 164 | + │ │ ├── cluster.json/.txt./.yaml |
| 165 | + │ │ ├── kam.json/.txt./.yaml |
| 166 | + │ │ ├── openshift-gitops-applicationset-controller.json/.txt./.yaml |
| 167 | + │ │ ├── openshift-gitops-dex-server.json/.txt./.yaml |
| 168 | + │ │ ├── openshift-gitops-metrics.json/.txt./.yaml |
| 169 | + │ │ ├── openshift-gitops-redis.json/.txt./.yaml |
| 170 | + │ │ ├── openshift-gitops-repo-server.json/.txt./.yaml |
| 171 | + │ │ ├── openshift-gitops-server.json/.txt./.yaml |
| 172 | + │ │ ├── openshift-gitops-server-metrics.json/.txt./.yaml |
| 173 | + │ │ └── services.txt |
| 174 | + │ └── statefulsets |
| 175 | + │ ├── openshift-gitops-application-controller.json/.txt./.yaml |
| 176 | + │ └── statefulsets.txt |
| 177 | + ├── oc-version.txt |
| 178 | + ├── subscription.json/.txt./.yaml |
| 179 | + ├── must-gather-script-commands.txt |
| 180 | + ├── must-gather-script-no-output.txt |
| 181 | + └── must-gather-script-errors.txt |
| 182 | +``` |
| 183 | +Note: most of the resource outputs are given in 3 file types: `.json`, `.yaml`, and `.txt`, however those files are combined in this tree for clarity and conciseness. |
| 184 | + |
| 185 | +## Testing |
| 186 | + |
| 187 | +You can run the script locally from your workstation. |
| 188 | +To do that you need an OpenShift cluster and you will have to install the Red Hat GitOps Operator. |
| 189 | +Then you can run the script like this: |
| 190 | + |
| 191 | +```shell |
| 192 | +chmod +x ./gather_gitops.sh |
| 193 | +./gather_gitops.sh --base-collection-path . |
| 194 | +``` |
| 195 | + |
| 196 | +Last but not least, please make sure you run `make lint` before pushing new changes. |
| 197 | +This requires `shellcheck` to be installed in your machine. |
| 198 | + |
| 199 | +For more information about `building` and `pushing` the image, see `make help`. |
0 commit comments