{"id":13818005,"url":"https://github.com/redhat-cop/must-gather-operator","last_synced_at":"2025-04-09T22:02:30.153Z","repository":{"id":40501324,"uuid":"224239001","full_name":"redhat-cop/must-gather-operator","owner":"redhat-cop","description":"An operator to simplify the creation and upload of cluster diagnostics from the must-gather tool","archived":false,"fork":false,"pushed_at":"2024-04-07T08:50:55.000Z","size":405,"stargazers_count":10,"open_issues_count":20,"forks_count":15,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-09T22:02:20.028Z","etag":null,"topics":["container-cop","k8s-operator"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/redhat-cop.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-26T16:36:47.000Z","updated_at":"2023-12-23T18:54:25.000Z","dependencies_parsed_at":"2024-01-25T06:25:55.716Z","dependency_job_id":"37529a9d-4be5-45a9-b97a-eadb73332ca1","html_url":"https://github.com/redhat-cop/must-gather-operator","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-cop%2Fmust-gather-operator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-cop%2Fmust-gather-operator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-cop%2Fmust-gather-operator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-cop%2Fmust-gather-operator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redhat-cop","download_url":"https://codeload.github.com/redhat-cop/must-gather-operator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248119296,"owners_count":21050755,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["container-cop","k8s-operator"],"created_at":"2024-08-04T07:00:26.709Z","updated_at":"2025-04-09T22:02:30.135Z","avatar_url":"https://github.com/redhat-cop.png","language":"Go","funding_links":[],"categories":["Operations"],"sub_categories":[],"readme":"# Must Gather Operator\n\n![build status](https://github.com/redhat-cop/must-gather-operator/workflows/push/badge.svg)\n[![Go Report Card](https://goreportcard.com/badge/github.com/redhat-cop/must-gather-operator)](https://goreportcard.com/report/github.com/redhat-cop/must-gather-operator)\n![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/redhat-cop/must-gather-operator)\n\nThe must gather operator helps collecting must gather information on a cluster and uploading it to a case.\nTo use the operator a cluster administrator can create the following must gather CR:\n\n```yaml\napiVersion: redhatcop.redhat.io/v1alpha1\nkind: MustGather\nmetadata:\n  name: example-mustgather\nspec:\n  caseID: '02527285'\n  caseManagementAccountSecretRef:\n    name: case-management-creds\n```\n\nthis request will collect the standard must gather info and upload it to case `#02527285` using the credentials found in the `caseManagementCreds` secret.\n\nA more complex example:\n\n```yaml\napiVersion: redhatcop.redhat.io/v1alpha1\nkind: MustGather\nmetadata:\n  name: full-mustgather\nspec:\n  caseID: '02527285'\n  caseManagementAccountSecretRef:\n    name: case-management-creds\n  serviceAccountRef:\n    name: must-gather-admin\n  mustGatherImages:\n  - quay.io/kubevirt/must-gather:latest\n  - quay.io/ocs-dev/ocs-must-gather\n```\n\nin this example we are using a specific service account (which must have cluster admin permissions as per must-gather requirements) and we are specifying a couple of additional must gather images to be run for the `kubevirt` and `ocs` subsystem. If not specified serviceAccountRef.Name will default to `default`. Also the standard must gather image: `quay.io/openshift/origin-must-gather:latest` is always added by default.\n\n## Proxy Support\n\nThe MustGather operator supports using a proxy. The proxy setting can be specified in the MustGather object. If not specified, the cluster default proxy setting will be used. Here is an example:\n\n```yaml\napiVersion: redhatcop.redhat.io/v1alpha1\nkind: MustGather\nmetadata:\n  name: example-mustgather\nspec:\n  caseID: '02527285'\n  caseManagementAccountSecretRef:\n    name: case-management-creds\n  proxyConfig:\n    httpProxy: http://myproxy\n    httpsProxy: https://my_http_proxy\n    noProxy: master-api  \n```\n\n## Garbage collection\n\nMustGather instances are cleaned up by the Must Gather operator about 6 hours after completion, regardless of whether they were successful.\nThis is a way to prevent the accumulation of unwanted MustGather resources and their corresponding job resources.\n\n## Deploying the Operator\n\nThis is a cluster-level operator that you can deploy in any namespace, `must-gather-operator` is recommended.\n\nIt is recommended to deploy this operator via [`OperatorHub`](https://operatorhub.io/), but you can also deploy it using [`Helm`](https://helm.sh/).\n\n### Multiarch Support\n\n| Arch  | Support  |\n|:-:|:-:|\n| amd64  | ✅ |\n| arm64  | ✅  |\n| ppc64le  | ✅  |\n| s390x  | ❌  |\n\n### Deploying from OperatorHub\n\n\u003e **Note**: This operator supports being installed disconnected environments\n\nIf you want to utilize the Operator Lifecycle Manager (OLM) to install this operator, you can do so in two ways: from the UI or the CLI.\n\n#### Deploying from OperatorHub UI\n\n* If you would like to launch this operator from the UI, you'll need to navigate to the OperatorHub tab in the console.Before starting, make sure you've created the namespace that you want to install this operator to with the following:\n\n```shell\noc new-project must-gather-operator\n```\n\n* Once there, you can search for this operator by name: `must gather`. This will then return an item for our operator and you can select it to get started. Once you've arrived here, you'll be presented with an option to install, which will begin the process.\n* After clicking the install button, you can then select the namespace that you would like to install this to as well as the installation strategy you would like to proceed with (`Automatic` or `Manual`).\n* Once you've made your selection, you can select `Subscribe` and the installation will begin. After a few moments you can go ahead and check your namespace and you should see the operator running.\n\n![Must Gather Operator](./media/must-gather-operator.png)\n\n#### Deploying from OperatorHub using CLI\n\nIf you'd like to launch this operator from the command line, you can use the manifests contained in this repository by running the following:\n\n```shell\noc new-project must-gather-operator\noc apply -f config/operatorhub -n must-gather-operator\n```\n\nThis will create the appropriate OperatorGroup and Subscription and will trigger OLM to launch the operator in the specified namespace.\n\n### Deploying with Helm\n\nHere are the instructions to install the latest release with Helm.\n\n```shell\noc new-project must-gather-operator\nhelm repo add must-gather-operator https://redhat-cop.github.io/must-gather-operator\nhelm repo update\nhelm install must-gather-operator must-gather-operator/must-gather-operator\n```\n\nThis can later be updated with the following commands:\n\n```shell\nhelm repo update\nhelm upgrade must-gather-operator must-gather-operator/must-gather-operator\n```\n\n## Metrics\n\nPrometheus compatible metrics are exposed by the Operator and can be integrated into OpenShift's default cluster monitoring. To enable OpenShift cluster monitoring, label the namespace the operator is deployed in with the label `openshift.io/cluster-monitoring=\"true\"`.\n\n```shell\noc label namespace \u003cnamespace\u003e openshift.io/cluster-monitoring=\"true\"\n```\n\n### Testing metrics\n\n```sh\nexport operatorNamespace=must-gather-operator-local # or must-gather-operator\noc label namespace ${operatorNamespace} openshift.io/cluster-monitoring=\"true\"\noc rsh -n openshift-monitoring -c prometheus prometheus-k8s-0 /bin/bash\nexport operatorNamespace=must-gather-operator-local # or must-gather-operator\ncurl -v -s -k -H \"Authorization: Bearer $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)\" https://must-gather-operator-controller-manager-metrics.${operatorNamespace}.svc.cluster.local:8443/metrics\nexit\n```\n\n## Development\n\n### Running the operator locally\n\n```shell\nmake install\nexport repo=raffaelespazzoli #replace with yours\ndocker login quay.io/$repo/must-gather-operator\nmake docker-build IMG=quay.io/$repo/must-gather-operator:latest\nmake docker-push IMG=quay.io/$repo/must-gather-operator:latest\noc new-project must-gather-operator-local\nkustomize build ./config/local-development | oc apply -f - -n must-gather-operator-local\nexport DEFAULT_MUST_GATHER_IMAGE='quay.io/openshift/origin-must-gather:4.6'\nexport JOB_TEMPLATE_FILE_NAME=./config/templates/job.template.yaml\nexport token=$(oc serviceaccounts get-token 'must-gather-controller-manager' -n must-gather-operator-local)\noc login --token ${token}\nmake run ENABLE_WEBHOOKS=false\n```\n\n### Test helm chart locally\n\nDefine an image and tag. For example...\n\n```shell\nexport imageRepository=\"quay.io/redhat-cop/must-gather-operator\"\nexport imageTag=\"$(git -c 'versionsort.suffix=-' ls-remote --exit-code --refs --sort='version:refname' --tags https://github.com/redhat-cop/must-gather-operator.git '*.*.*' | tail --lines=1 | cut --delimiter='/' --fields=3)\"\n```\n\nDeploy chart...\n\n```shell\nmake helmchart IMG=${imageRepository} VERSION=${imageTag}\nhelm upgrade -i must-gather-operator-local charts/must-gather-operator -n must-gather-operator-local --create-namespace\n```\n\nDelete...\n\n```shell\nhelm delete must-gather-operator-local -n must-gather-operator-local\nkubectl delete -f charts/must-gather-operator/crds/crds.yaml\n```\n\n### Building/Pushing the operator image\n\n```shell\nexport repo=raffaelespazzoli #replace with yours\ndocker login quay.io/$repo/must-gather-operator\nmake docker-build IMG=quay.io/$repo/must-gather-operator:latest\nmake docker-push IMG=quay.io/$repo/must-gather-operator:latest\n```\n\n### Deploy to OLM via bundle\n\n```shell\nmake manifests\nmake bundle IMG=quay.io/$repo/must-gather-operator:latest\noperator-sdk bundle validate ./bundle --select-optional name=operatorhub\nmake bundle-build BUNDLE_IMG=quay.io/$repo/must-gather-operator-bundle:latest\ndocker login quay.io/$repo/must-gather-operator-bundle\ndocker push quay.io/$repo/must-gather-operator-bundle:latest\noperator-sdk bundle validate quay.io/$repo/must-gather-operator-bundle:latest --select-optional name=operatorhub\noc new-project must-gather-operator\noc label namespace must-gather-operator openshift.io/cluster-monitoring=\"true\"\noperator-sdk cleanup must-gather-operator -n must-gather-operator\noperator-sdk run bundle --install-mode AllNamespaces -n must-gather-operator quay.io/$repo/must-gather-operator-bundle:latest\n```\n\n### Releasing\n\n```shell\ngit tag -a \"\u003ctagname\u003e\" -m \"\u003ccommit message\u003e\"\ngit push upstream \u003ctagname\u003e\n```\n\nIf you need to remove a release:\n\n```shell\ngit tag -d \u003ctagname\u003e\ngit push upstream --delete \u003ctagname\u003e\n```\n\nIf you need to \"move\" a release to the current main\n\n```shell\ngit tag -f \u003ctagname\u003e\ngit push upstream -f \u003ctagname\u003e\n```\n\n### Cleaning up\n\n```shell\noperator-sdk cleanup must-gather-operator -n must-gather-operator\noc delete operatorgroup operator-sdk-og\noc delete catalogsource must-gather-operator-catalog\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredhat-cop%2Fmust-gather-operator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredhat-cop%2Fmust-gather-operator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredhat-cop%2Fmust-gather-operator/lists"}