Giter Site home page Giter Site logo

deployment-controller's Introduction

简化版Deployment实现

文章

如何从零开始编写一个CRD.

目的

这是一个简化版的Deployment的实现,实现了部分Kubernetes中Deployment的功能。

测试用例

  • 启动后自动创建出一个MyDeployment的CRD
    • 【触发】启动应用
    • 【期望】可以看到创建出来的CRD
    • 【测试】kubectl get CustomResourceDefinition -o yaml
  • 创建一个MyDeployment: Nginx实例
    • 【触发】kubectl create -f my-deployment-instance.yaml
    • 【期望】可以看到级联创建出来的3个pod
    • 【测试】kubectl get pods
  • 手工删掉一个pod
    • 【触发】kubectl delete pods $pod_name
    • 【期望】pod被重建
    • 【测试】kubectl get pods -w
  • 暴露一个服务
    • 【触发】kubectl create -f my-deployment-service.yaml
    • 【期望】可以通过curl来访问nginx服务
    • 【测试】minikube service my-nginx-app --url 然后 curl
  • 更新镜像
    • 【触发】kubectl replace -f my-deployment-instance-update-image-1.9.1.yaml
    • 【期望】pod的nginx版本被更新为1.9.1
    • 【测试】kubectl get pods -o yaml
  • 扩容
    • 【触发】kubectl replace -f my-deployment-instance-update-scaleup-1.9.1.yaml
    • 【期望】pod被扩容到5个
    • 【测试】kubectl get pods
  • 缩容
    • 【触发】kubectl replace -f my-deployment-instance-update-scaledown-1.9.1.yaml
    • 【期望】pod被缩容到2个
    • 【测试】kubectl get pods
  • 扩容并更新镜像
    • 【触发】kubectl replace -f my-deployment-instance-update-image-and-scaleup-1.14.yaml
    • 【期望】pod被扩容5个,且nginx版本被更新为1.14
    • 【测试】kubectl get pods 然后 kubectl get pods -o yaml
  • 删除一个MyDeployment
    • 【触发】kubectl delete mydeployments my-nginx-app
    • 【期望】MyDeployment被删掉,并且关联的pod也被级联删掉
    • 【测试】kubectl get mydeployments 然后 kubectl get pods
  • 查看状态(TODO)
  • 回滚(TODO)
  • 状态更新【current,update-to-date,available】(TODO)
  • describe EVENTS(TODO)

deployment-controller's People

Contributors

songxinjianqwe avatar

Watchers

James Cloos 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.