Giter VIP home page Giter VIP logo

mayfly's Introduction

logo

Mayfly is a Kubernetes operator that enables you to have time-based resources. They creates or deletes on the specified time.

GitHub go.mod Go version GitHub Release Go Reference GitHub Actions Workflow Status GitHub issues GitHub License

๐Ÿ“– General Information

๐Ÿ“„ Summary

The 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. It 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. Also, It creates the resources you specify at the given time by using ScheduleResource custom resource definition. You can also merge these two features together, just to have some resource created in the future and only for a specific amount of time.

๐Ÿ›  Configuration

Mayfly 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. To 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.

Example:

export RESOURCES="v1;Secret,test.com/v1alpha;MyCRD"

๐Ÿš€ Usage

Resouce Expiration

Once 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. This will cause Mayfly to delete the resources once the specified duration has passed, based on the time of their creation. Keep in mind that the expiration will be calculated based on the creation time of the resource.

Example:

apiVersion: v1
kind: Pod
metadata:
  name: my-pod
  annotations:
    mayfly.cloud.namecheap.com/expire: 30s
spec:
  containers:
    - name: alpine
      image: alpine
      command:
        - sleep
        - infinity

Scheduled Resource Creation

The 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.

Example:

apiVersion: cloud.namecheap.com/v1alpha1
kind: ScheduledResource
metadata:
  annotations:
    mayfly.cloud.namecheap.com/expire: 60m
  name: example
  namespace: default
spec:
  in: 30m
  content: |
    apiVersion: v1
    kind: Secret
    metadata:
      name: example
      namespace: default
      annotations:
        mayfly.cloud.namecheap.com/expire: 30m
    data:
      .secret-file: dmFsdWUtMg0KDQo=
status:
  condition: Scheduled

This 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.

๐Ÿ›ณ๏ธ Deployment

The 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.

Example:

helm repo add nccloud https://nccloud.github.io/charts
helm install mayfly nccloud/mayfly --set "env[0].name=RESOURCES" --set "env[0].value=v1;Secret" #For only secrets

๐Ÿ›  Development

You can easily compile and run the Mayfly operator by following these steps:

  1. Create a Kubernetes Cluster or change context for the existing one.
kind create cluster
  1. Run the project with the following environment variable.
export RESOURCES=v1;Secret # Mayfly will begin monitoring secrets in the cluster. For more information, see the configuration section.
go run .

๐Ÿท๏ธ Versioning

We use SemVer for versioning. To see the available versions, check the tags on this repository.

โญ๏ธ Documentation

For more information about the functionality provided by this library, refer to the GoDoc documentation.

๐Ÿค Contribution

We welcome contributions, issues, and feature requests!
If you have any issues or suggestions, please feel free to check the issues page or create a new issue if you don't see one that matches your problem.
Also, please refer to our contribution guidelines for details.

๐Ÿ“ License

All functionalities are in beta and is subject to change. The code is provided as-is with no warranties.
Apache 2.0 License


logo
Made with โ™ฅ by Namecheap Cloud Team

mayfly's People

Contributors

yunussandikci avatar dependabot[bot] avatar glourenco avatar sandromodarelli avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.