{"id":15115358,"url":"https://github.com/NCCloud/mayfly","last_synced_at":"2025-09-27T21:30:32.372Z","repository":{"id":137365501,"uuid":"542496512","full_name":"NCCloud/mayfly","owner":"NCCloud","description":"An operator to manage ephemeral Kubernetes resources :honeybee:","archived":false,"fork":false,"pushed_at":"2024-10-11T10:49:36.000Z","size":269,"stargazers_count":281,"open_issues_count":0,"forks_count":11,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-10-15T21:40:57.272Z","etag":null,"topics":["devops","ephemeral","golang","kubernetes","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/NCCloud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2022-09-28T08:56:15.000Z","updated_at":"2024-10-11T10:46:57.000Z","dependencies_parsed_at":"2023-12-04T09:22:44.967Z","dependency_job_id":"c4ab1f9e-d4ca-4007-a023-22c36eee6814","html_url":"https://github.com/NCCloud/mayfly","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NCCloud%2Fmayfly","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NCCloud%2Fmayfly/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NCCloud%2Fmayfly/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NCCloud%2Fmayfly/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NCCloud","download_url":"https://codeload.github.com/NCCloud/mayfly/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234460505,"owners_count":18836837,"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":["devops","ephemeral","golang","kubernetes","operator"],"created_at":"2024-09-26T01:43:47.363Z","updated_at":"2025-09-27T21:30:32.367Z","avatar_url":"https://github.com/NCCloud.png","language":"Go","readme":"\u003cpicture\u003e\n  \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://github.com/user-attachments/assets/c7b76ed9-1c02-4172-bd6c-c37cf1cf6269\"\u003e\n  \u003cimg alt=\"logo\" width=\"600\"  src=\"https://github.com/user-attachments/assets/65690736-3dbb-4e92-9d18-83b7a6284bd7\"\u003e\n\u003c/picture\u003e\n\n\u003e Mayfly is a Kubernetes operator that enables you to have time-based resources. They creates or deletes on the specified time.\n\n![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/nccloud/mayfly)\n![GitHub Release](https://img.shields.io/github/v/release/nccloud/mayfly)\n[![Go Reference](https://pkg.go.dev/badge/github.com/NCCloud/mayfly.svg)](https://pkg.go.dev/github.com/NCCloud/mayfly)\n![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/nccloud/mayfly/test.yaml?label=tests)\n![GitHub issues](https://img.shields.io/github/issues/nccloud/mayfly)\n![GitHub License](https://img.shields.io/github/license/nccloud/mayfly)\n\n## 📖 General Information\n\n### 📄 Summary\n\nThe Mayfly Operator allows you to have your resources on your cluster for a temporary time by the given expiration or mayfly create the resources at the time you specified.\nIt deletes those resources from the cluster, according to the Mayfly expiration annotation that you set to specify how long the resource should remain active. This can be used to create temporary resources, temporary accesses, or simply to keep your cluster organized and tidy. \nAlso, It creates the resources you specify at the given time or given period by using `ScheduleResource` custom resource definition. You can also merge these two features together, just to have some resource created in the future once or periodically  and only for a specific amount of time.   \n\n### 🛠 Configuration\n\nMayfly is an easy-to-use and configurable project that uses resource watches and schedulers to delete your resources at the appropriate time. It is simple to set up and customize.\nTo specify which resources should be monitored and cleaned up, you can set the `RESOURCES` environment variable to a comma-separated list of `{ApiVersion};{Kind}` as text. This allows you to customize which resources are targeted for cleanup with expiration annotations.\n\nExample:\n```bash\nexport RESOURCES=\"v1;Secret,test.com/v1alpha;MyCRD\"\n```\n\n## 🚀 Usage\n\n### Resouce Expiration\n\nOnce you have determined which resources you want Mayfly to monitor, you can set the `mayfly.cloud.namecheap.com/expire` annotation on those resources with a duration value or an exact date. In case of duration values, mayfly will calculate the expiration time based on the creation time of the resource. In case of exact date values, mayfly will delete the resource when the exact date has passed. See the examples below for duration and exact date values.\n\nDuration Value Example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-pod\n  annotations:\n    mayfly.cloud.namecheap.com/expire: 30s\nspec:\n  containers:\n    - name: alpine\n      image: alpine\n      command:\n        - sleep\n        - infinity\n```\n\nExact Date/Time Example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-pod\n  annotations:\n    mayfly.cloud.namecheap.com/expire: \"2024-12-31T00:00:00Z\"\nspec:\n  containers:\n    - name: alpine\n      image: alpine\n      command:\n        - sleep\n        - infinity\n```\n\n\u003e [!TIP]\n\u003e mayfly uses [araddon/dateparser](https://github.com/araddon/dateparse) for arbitrary date parsing see [examples](https://github.com/araddon/dateparse?tab=readme-ov-file#extended-example) for possible date formats.\n\n### Scheduled Resource Creation\n\nThe `ScheduledResource` CRD allows you to schedule the creation of an object in the future. This can be combined with the expire annotation, enabling Mayfly to create and remove certain objects for a temporary period in the future.\n\nExample:\n```yaml\napiVersion: cloud.namecheap.com/v1alpha1\nkind: ScheduledResource\nmetadata:\n  annotations:\n    mayfly.cloud.namecheap.com/expire: 60m\n  name: example\n  namespace: default\nspec:\n  schedule: \"10s\" # Creates in 10 seconds\n  # schedule: \"2024-12-31T00:00:00Z\" Creates in exact specified date\n  # schedule: \"*/20 * * * * *\" # Creates every 20 seconds\n  content: |\n    apiVersion: v1\n    kind: Secret\n    metadata:\n      name: example\n      namespace: default\n      annotations:\n        mayfly.cloud.namecheap.com/expire: 30m\n    data:\n      .secret-file: dmFsdWUtMg0KDQo=\nstatus:\n  condition: Scheduled\n```\nThis feature is particularly useful for setting up temporary resources that are only needed for a short period, reducing clutter and improving the efficiency of resource management.\n\n## 🛳️ Deployment\n\nThe easiest and most recommended way to deploy the Mayfly operator to your Kubernetes cluster is by using the Helm chart. To do this, you will need to add our Helm repository and install it from there, providing the RESOURCES environment variable as needed. If you prefer, you can also compile the operator and install it using any method you choose.\n\nExample:\n```bash\nhelm repo add nccloud https://nccloud.github.io/charts\nhelm install mayfly nccloud/mayfly --set \"env[0].name=RESOURCES\" --set \"env[0].value=v1;Secret\" #For only secrets\n```\n\n## 🛠 Development\n\nYou can easily compile and run the Mayfly operator by following these steps:\n\n1) Create a Kubernetes Cluster or change context for the existing one.\n\n```bash\nkind create cluster\n```\n\n2) Run the project with the following environment variable.\n\n```bash\nexport RESOURCES=v1;Secret # Mayfly will begin monitoring secrets in the cluster. For more information, see the configuration section.\ngo run ./cmd/manager/main.go\n```\n\n## 🏷️ Versioning\n\nWe use [SemVer](http://semver.org/) for versioning.\nTo see the available versions, check the [tags on this repository](https://github.com/nccloud/mayfly/tags).\n\n## ⭐️ Documentation\n\nFor more information about the functionality provided by this library, refer to the [GoDoc](http://godoc.org/github.com/nccloud/mayfly) documentation.\n\n\n## 🤝 Contribution\n\nWe welcome contributions, issues, and feature requests!\u003cbr /\u003e\nIf you have any issues or suggestions, please feel free to check the [issues page](https://github.com/nccloud/mayfly/issues) or create a new issue if you don't see one that matches your problem. \u003cbr\u003e\nAlso, please refer to our [contribution guidelines](CONTRIBUTING.md) for details.\n\n## 📝 License\nAll functionalities are in beta and is subject to change. The code is provided as-is with no warranties.\u003cbr\u003e\n[Apache 2.0 License](./LICENSE)\u003cbr\u003e\n\u003cbr\u003e\u003cbr\u003e\n\u003cimg alt=\"logo\" width=\"75\" src=\"https://avatars.githubusercontent.com/u/7532706\" /\u003e\u003cbr\u003e\nMade with \u003cspan style=\"color: #e25555;\"\u003e\u0026hearts;\u003c/span\u003e by [Namecheap Cloud Team](https://github.com/NCCloud)\n","funding_links":[],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNCCloud%2Fmayfly","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNCCloud%2Fmayfly","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNCCloud%2Fmayfly/lists"}