Skip to content

Commit

Permalink
initial must-gather base code
Browse files Browse the repository at this point in the history
  • Loading branch information
reginapizza committed Jan 19, 2023
1 parent e3d724f commit b91055e
Show file tree
Hide file tree
Showing 8 changed files with 442 additions and 2 deletions.
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/task.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Task 🔧
about: Internal things, technical debt, and to-do tasks to be performed.
title: ''
labels: 'kind/task'
assignees: ''

---
### Is your task related to a problem? Please describe.
<!-- A clear and concise description of what the problem is.-->

### Describe the solution you'd like
<!-- A clear and concise description of what you want to happen. -->

### Describe alternatives you've considered
<!--A clear and concise description of any alternative solutions or features you've considered. -->

### Additional context
<!-- Add any other context or screenshots about the task here. -->
29 changes: 29 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
**What type of PR is this?**
> Uncomment only one ` /kind` line, and delete the rest.
> For example, `> /kind bug` would simply become: `/kind bug`
> /kind bug
> /kind cleanup
> /kind failing-test
> /kind enhancement
> /kind documentation
> /kind code-refactoring

**What does this PR do / why we need it**:

**Have you updated the necessary documentation?**

* [ ] Documentation update is required by this PR.
* [ ] Documentation has been updated.

**Which issue(s) this PR fixes**:

Fixes #?

**Test acceptance criteria**:

* [ ] Unit Test
* [ ] E2E Test

**How to test changes / Special notes to the reviewer**:
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM quay.io/openshift/origin-must-gather:4.13

# Save original gather script
RUN mv /usr/bin/gather /usr/bin/gather_original

# Use our gather script in place of the original one
COPY gather_gitops.sh /usr/bin/gather

# Make it executable
RUN chmod +x /usr/bin/gather

ENTRYPOINT /usr/bin/gather
53 changes: 53 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
## Copyright 2023 Red Hat, Inc.
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.

default: build

HUB ?= quay.io/redhat-developer
TAG ?= latest

lint:
@if command -v shellcheck >/dev/null; then \
find . -name '*.sh' -print0 | xargs -0 -r shellcheck; \
else \
echo "shellcheck not found, installing it now..."; \
if command -v apt-get >/dev/null; then \
sudo apt-get install -y shellcheck; \
elif command -v yum >/dev/null; then \
sudo yum install -y shellcheck; \
elif command -v dnf >/dev/null; then \
sudo dnf install -y shellcheck; \
elif command -v pacman >/dev/null; then \
sudo pacman -S --noconfirm shellcheck; \
else \
echo "shellcheck not found and unable to install it automatically"; \
echo "Please install shellcheck manually and run the lint target again"; \
exit 1; \
fi; \
find . -name '*.sh' -print0 | xargs -0 -r shellcheck; \
fi

image:
@if command -v podman >/dev/null; then \
podman build -t ${HUB}/gitops-must-gather:${TAG}; \
else \
docker build -t ${HUB}/gitops-must-gather:${TAG}; \
fi

push: image
@if command -v podman >/dev/null; then \
podman push ${HUB}/gitops-must-gather:${TAG}; \
else \
docker push ${HUB}/gitops-must-gather:${TAG}; \
fi
88 changes: 86 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,86 @@
# gitops-must-gather
A client tool for gathering GitOps Operator information in a OpenShift cluster.
# GitOps Operator Must-Gather
=================

`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).

### Usage
```sh
oc adm must-gather --image=quay.io/redhat-developer/gitops-must-gather:latest
```

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.

You will get a dump of:
- Information for the subscription of the gitops-operator
- The GitOps Operator namespace (and its children objects)
- All namespaces where ArgoCD objects exist in, plus all objects in those namespaces, such as ArgoCD, Applications, ApplicationSets, and AppProjects, and configmaps
- No secrets will be collected
- A list of list of the namespaces that are managed by gitops-operator identified namespaces and resources from those namespaces.
- All GitOps CRD's objects and definitions
- Operator logs
- Logs of Argo CD
- Warning and error-level Events

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.

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`:
```
cluster-gitops
└── gitops
├── appprojects.yaml
├── crds.yaml
├── namespace_openshift-gitops_resources
│   ├── application_controller_logs.txt
│   ├── applications
│   ├── applicationsets
│   ├── argocd.yaml
│   ├── deployments
│   │   ├── cluster.yaml
│   │   └── kam.yaml
│   ├── dex-server_logs.txt
│   ├── error-events.txt
│   ├── pods
│   │   ├── cluster-5db4b95547-rdz2m.yaml
│   │   └── kam-fff7f474f-d27c8.yaml
│   ├── redis_logs.txt
│   ├── replicasets
│   │   ├── cluster-5db4b95547.yaml
│   │   └── kam-fff7f474f.yaml
│   ├── repo-server_logs.txt
│   ├── routes
│   │   └── kam.yaml
│   ├── server_logs.txt
│   ├── services
│   │   ├── cluster.yaml
│   │   └── kam.yaml
│   ├── statefulsets
│   └── warning-events.txt
├── namespace_foo_resources
│   ├── application_controller_logs.txt
│   ├── applications
│   │   └── guestbook.yaml
│   ├── applicationsets
│   │   └── guestbook.yaml
│   ├── argocd.yaml
│   ├── deployments
│   ├── dex-server_logs.txt
│   ├── error-events.txt
│   ├── managedNamespace_foo-managed
│   │   ├── deployments
│   │   ├── pods
│   │   ├── replicasets
│   │   ├── routes
│   │   ├── services
│   │   └── statefulsets
│   ├── pods
│   ├── redis_logs.txt
│   ├── replicasets
│   ├── repo-server_logs.txt
│   ├── routes
│   ├── server_logs.txt
│   ├── services
│   ├── statefulsets
│   └── warning-events.txt
├── oc-version.txt
└── subscription.yaml
```
Loading

0 comments on commit b91055e

Please sign in to comment.