Giter Club home page Giter Club logo

bunnycdn-operator's Introduction

bunnycdn-operator

This kubernetes operator helps you dynamically create pull zones and storage zones on BunnyCDN.

Install Custom Resource Definitions

kubectl apply -f ./manifests/crds/

Install the operator

apiVersion: apps/v1
kind: Deployment
metadata:
  name: bunny-cdn-operator
  namespace: default
  labels:
    app: bunny-cdn-operator
spec:
  selector:
    matchLabels:
      app: bunny-cdn-operator
  replicas: 1
  template:
    metadata:
      labels:
        app: bunny-cdn-operator
    spec:
      containers:
      - name:  bunny-cdn-operator
        image: ghcr.io/paulrostorp/bunnycdn-operator:latest
        resources:
          requests:
            cpu: 50m
            memory: 100Mi
          limits:
            cpu: 100m
            memory: 150Mi
        env:
        - name: BUNNY_CDN_API_KEY
          valueFrom:
            secretKeyRef: ### -> Replace this with your own creds
              name: bunny-cdn-credentials
              key: API_KEY
      restartPolicy: Always

If your cluster has RBAC enabled, see the detailed example in the /manifests directory.

Creating a storage zone

Apply StorageZone custom resource to your cluster:

apiVersion: bunny-cdn-operator.com/v1alpha1
kind: StorageZone
metadata:
  name: operator-test-xyz-test-storage-zone
  namespace: default
spec:
  region: DE
  replicationRegions: ["NY", "LA"]
  deletionPolicy: retain # whether the resource should be deleted in bunny cdn when it is deleted in k8s. Possible values are "delete" or "retain"

This creates a storage zone on your bunny CDN account. Keep in mind that name is globally unique and at this time you cannot edit a storage zone once created. It will also produce a k8s secret named <name of storage zone>.storagezone.credentials containing the required credentials to upload/download content.

Creating a pull zone

Apply PullZone custom resource to your cluster:

apiVersion: bunny-cdn-operator.com/v1alpha1
kind: PullZone
metadata:
  name: operator-test-xyz-test-pull-zone
  namespace: default
spec:
  storageZoneRef:
    name: operator-test-xyz-test-storage-zone
    namespace: default
  zoneType: volume
  monthlyBandwidthLimit: 10000
  deletionPolicy: retain # whether the resource should be deleted in bunny cdn when it is deleted in k8s. Possible values are "delete" or "retain"

This creates a pull zone on your bunny CDN account. Keep in mind that name is globally unique and at this time you cannot edit a storage zone once created. It will also produce a k8s secret named <name of pull zone>.pullzone.credentials containing information and credentials about the pull zone.

Creating an edge rule

Apply EdgeRule custom resource to your cluster: Configuration guidelines are documented here: https://docs.bunny.net/reference/pullzonepublic_addedgerule

apiVersion: bunny-cdn-operator.com/v1alpha1
kind: EdgeRule
metadata:
  name: operator-test-xyz-test-pull-zone
  namespace: default
spec:
  pullZoneRef:
    name: testing-pz
    namespace: default
  actionType: 1
  actionParameter1: yahoo.fr
  triggers:
    - type: 0
      patternMatches: ["*"]
      patternMatchingType: 0
  triggerMatchingType: 0
  description: testing operator rule
  enabled: true
  deletionPolicy: delete
  

bunnycdn-operator's People

Contributors

jeroenvermeulen avatar paulrostorp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

bunnycdn-operator's Issues

If an error occurs the pod gets OOMkilled

Example:

---
apiVersion: bunny-cdn-operator.com/v1alpha1
kind: PullZone
metadata:
  name: test.something.else # => This is wrong
  namespace: default
spec:
  originUrl: https://google.com
  deletionPolicy: delete

The problem is caused by the logger from the winston-logfmt going into an endless loop.

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.