-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial must-gather base code #1
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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**: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
reginapizza marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@if command -v podman >/dev/null; then \ | ||
podman push ${HUB}/gitops-must-gather:${TAG}; \ | ||
else \ | ||
docker push ${HUB}/gitops-must-gather:${TAG}; \ | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we actually going to write unit-tests and e2e tests for the must-gather?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not at the moment but ideally we will have some, I've created #4