GithubHelp home page GithubHelp logo

thatinfrastructureguy / redeploy-operator Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 26.86 MB

Kubernetes Redeploy Operator to redeploy pods in a deployment in the form of rolling updates.

Go 86.77% Dockerfile 1.63% Shell 11.60%
kubernetes redeploy operator deployments rollout

redeploy-operator's Introduction

redeploy-operator

Kubernetes Redeploy Operator to redeploy pods in a deployment in the form of rolling updates.

This project is built with help of Operator-SDK.

How it works

Redeploy Operator basically adds a label to PodSpec field in deployments. This triggers a deployment rollout. Type of rollout depends on MaxSurge and MaxUnavailable fields in your deployments.

The label you will see added is the datetime (UTC) field. Eg: redeployed: 2018-08-07-05_28_41

Limitations:

  1. It only works for deployments. ( Statefulsets, replicasets and daemonsets are not covered. )

Installation

  1. Install CRD, rbac and operator.
kubectl apply -f deploy/crd.yaml
kubectl apply -f deploy/rbac.yaml
kubectl apply -f deploy/operator.yaml
  1. Install a demo app:
kubectl create namespace nginx
kubectl run nginx --namespace nginx --image nginx:alpine --replicas=2
  1. Trigger a redeploy:
kubectl apply -f deploy/cr.yaml
  1. See it work:
kubectl -n nginx get pods -w
kubectl -n redeploy-operator logs -l name=redeploy-operator
  1. Check status

    1. Check the custom resource.

    kubectl -n redeploy-operator get redeploies -o yaml

    You should see RedeployNeeded set to false and status fields appended.

    spec:
      DeploymentName: nginx
      DeploymentNamespace: nginx
      RedeployNeeded: false
    status:
      Date: 2018-08-07-05_28_41
      Status: REDEPLOYED
    
    1. Check the deployment

    kubectl -n nginx get deployment nginx -o yaml | grep redeployed

     redeployed: 2018-08-07-05_28_41
    

Building from source:

  1. Install Operator-SDK
  2. operator-sdk generate k8s
  3. operator-sdk build <IMAGE-NAME>
  4. docker push <IMAGE-NAME>

Note: operator.yaml is custom built. It is overwritten upon building the project. Please make necessary changes to make it work.

redeploy-operator's People

Contributors

thatinfrastructureguy avatar

Watchers

 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.