Skip to content

Commit 5e3bc95

Browse files
authored
Initial must-gather base code (#1)
* initial must-gather base code
1 parent e3d724f commit 5e3bc95

File tree

8 files changed

+444
-2
lines changed

8 files changed

+444
-2
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**Additional context**
27+
Add any other context about the problem here.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

.github/ISSUE_TEMPLATE/task.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: Task 🔧
3+
about: Internal things, technical debt, and to-do tasks to be performed.
4+
title: ''
5+
labels: 'kind/task'
6+
assignees: ''
7+
8+
---
9+
### Is your task related to a problem? Please describe.
10+
<!-- A clear and concise description of what the problem is.-->
11+
12+
### Describe the solution you'd like
13+
<!-- A clear and concise description of what you want to happen. -->
14+
15+
### Describe alternatives you've considered
16+
<!--A clear and concise description of any alternative solutions or features you've considered. -->
17+
18+
### Additional context
19+
<!-- Add any other context or screenshots about the task here. -->

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
**What type of PR is this?**
2+
> Uncomment only one ` /kind` line, and delete the rest.
3+
> For example, `> /kind bug` would simply become: `/kind bug`
4+
5+
> /kind bug
6+
> /kind cleanup
7+
> /kind failing-test
8+
> /kind enhancement
9+
> /kind documentation
10+
> /kind code-refactoring
11+
12+
13+
**What does this PR do / why we need it**:
14+
15+
**Have you updated the necessary documentation?**
16+
17+
* [ ] Documentation update is required by this PR.
18+
* [ ] Documentation has been updated.
19+
20+
**Which issue(s) this PR fixes**:
21+
22+
Fixes #?
23+
24+
**Test acceptance criteria**:
25+
26+
* [ ] Unit Test
27+
* [ ] E2E Test
28+
29+
**How to test changes / Special notes to the reviewer**:

Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM quay.io/openshift/origin-must-gather:4.13
2+
3+
# Save original gather script
4+
RUN mv /usr/bin/gather /usr/bin/gather_original
5+
6+
# Use our gather script in place of the original one
7+
COPY gather_gitops.sh /usr/bin/gather
8+
9+
# Make it executable
10+
RUN chmod +x /usr/bin/gather
11+
12+
ENTRYPOINT /usr/bin/gather

Makefile

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
## Copyright 2023 Red Hat, Inc.
2+
##
3+
## Licensed under the Apache License, Version 2.0 (the "License");
4+
## you may not use this file except in compliance with the License.
5+
## You may obtain a copy of the License at
6+
##
7+
## http://www.apache.org/licenses/LICENSE-2.0
8+
##
9+
## Unless required by applicable law or agreed to in writing, software
10+
## distributed under the License is distributed on an "AS IS" BASIS,
11+
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
## See the License for the specific language governing permissions and
13+
## limitations under the License.
14+
15+
default: build
16+
17+
HUB ?= quay.io/redhat-developer
18+
TAG ?= latest
19+
20+
lint:
21+
@if command -v shellcheck >/dev/null; then \
22+
find . -name '*.sh' -print0 | xargs -0 -r shellcheck; \
23+
else \
24+
echo "shellcheck not found, installing it now..."; \
25+
if command -v apt-get >/dev/null; then \
26+
sudo apt-get install -y shellcheck; \
27+
elif command -v yum >/dev/null; then \
28+
sudo yum install -y shellcheck; \
29+
elif command -v dnf >/dev/null; then \
30+
sudo dnf install -y shellcheck; \
31+
elif command -v pacman >/dev/null; then \
32+
sudo pacman -S --noconfirm shellcheck; \
33+
else \
34+
echo "shellcheck not found and unable to install it automatically"; \
35+
echo "Please install shellcheck manually and run the lint target again"; \
36+
exit 1; \
37+
fi; \
38+
find . -name '*.sh' -print0 | xargs -0 -r shellcheck; \
39+
fi
40+
41+
image:
42+
@if command -v podman >/dev/null; then \
43+
podman build -t ${HUB}/gitops-must-gather:${TAG}; \
44+
else \
45+
docker build -t ${HUB}/gitops-must-gather:${TAG}; \
46+
fi
47+
48+
push: image
49+
@if command -v podman >/dev/null; then \
50+
podman push ${HUB}/gitops-must-gather:${TAG}; \
51+
else \
52+
docker push ${HUB}/gitops-must-gather:${TAG}; \
53+
fi

README.md

Lines changed: 86 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,86 @@
1-
# gitops-must-gather
2-
A client tool for gathering GitOps Operator information in a OpenShift cluster.
1+
# GitOps Operator Must-Gather
2+
=================
3+
4+
`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+
6+
### Usage
7+
```sh
8+
oc adm must-gather --image=quay.io/redhat-developer/gitops-must-gather:latest
9+
```
10+
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+
13+
You will get a dump of:
14+
- Information for the subscription of the gitops-operator
15+
- The GitOps Operator namespace (and its children objects)
16+
- All namespaces where ArgoCD objects exist in, plus all objects in those namespaces, such as ArgoCD, Applications, ApplicationSets, and AppProjects, and configmaps
17+
- 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+
- All GitOps CRD's objects and definitions
20+
- Operator logs
21+
- Logs of Argo CD
22+
- Warning and error-level Events
23+
24+
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+
26+
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+
```
28+
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+
```

0 commit comments

Comments
 (0)