Git Product home page Git Product logo

capacity's Introduction

capacity

Setup

Copy configuration files and update them:

cp config/kubescaler.conf.example config/kubescaler.conf

Run an application:


go run ./cmd/capacity-service/main.go  --kubescaler-config config/kubescaler.conf

Run with a custom UserData:


go run ./cmd/capacity-service/main.go  --kubescaler-config config/kubescaler.conf --user-data /userdata.txt

Demo

Get a kubescaler config:

➜ $ curl -s -XGET localhost:8081/api/v1/config | jq
{
  "sshPubKey": "",
  "clusterName": "clusterName",
  "masterPrivateAddr": "172.20.1.236",
  "kubeAPIPort": "443",
  "kubeAPIPassword": "0lLEJhRN",
  "providerName": "aws",
  "provider": {
    "awsIAMRole": "kubernetes-node",
    "awsImageID": "ami-cc0900ac",
    "awsKeyID": "keyID",
    "awsKeyName": "clusterName-key",
    "awsRegion": "us-west-1",
    "awsSecretKey": "secretKey",
    "awsSecurityGroups": "sg-59aff721",
    "awsSubnetID": "subnet-7f8daa24",
    "awsTags": "KubernetesCluster=clusterName",
    "awsVolSize": "100",
    "awsVolType": "gp2"
  },
  "stopped": false,
  "nodesCountMin": 0,
  "nodesCountMax": 0,
  "machineTypes": [],
  "maxMachineProvisionTime": 0
}

Update a kubescaler config:

➜ $ curl -s -XPATCH -d'{"nodesCountMin":1000}' localhost:8081/api/v1/config | jq
{
  "sshPubKey": "",
  "clusterName": "clusterName",
  "masterPrivateAddr": "172.20.1.236",
  "kubeAPIPort": "443",
  "kubeAPIPassword": "0lLEJhRN",
  "providerName": "aws",
  "provider": {
    "awsIAMRole": "kubernetes-node",
    "awsImageID": "ami-cc0900ac",
    "awsKeyID": "keyID",
    "awsKeyName": "clusterName-key",
    "awsRegion": "us-west-1",
    "awsSecretKey": "secretKey",
    "awsSecurityGroups": "sg-59aff721",
    "awsSubnetID": "subnet-7f8daa24",
    "awsTags": "KubernetesCluster=clusterName",
    "awsVolSize": "100",
    "awsVolType": "gp2"
  },
  "stopped": false,
  "nodesCountMin": 1000,
  "nodesCountMax": 0,
  "machineTypes": [],
  "maxMachineProvisionTime": 0
}

List all supported machine types:

curl -s localhost:8081/api/v1/machinetypes | jq
[
  {
    "name": "m4.large",
    "cpu": "8Gi",
    "memory": "2"
  },
  {
    "name": "m4.xlarge",
    "cpu": "16Gi",
    "memory": "4"
  }
]

Create a kubescaler worker:

➜ $ curl -s -XPOST -d'{"machineType":"m4.large"}' localhost:8081/api/v1/workers | jq
    {
      "clusterName": "clusterName",
      "machineID": "i-01e9c47fede75cb9a",
      "machineName": "clusterName-worker-e289335e-9579-11e8-b97f-9cb6d0f71293",
      "machineType": "m4.large",
      "machineState": "pending",
      "createdAt": "2018-08-01T10:58:57Z",
      "nodeName": "",
      "reserved": false
    }

Get a kubescaler worker:

➜ $ curl -s -XGET localhost:8081/api/v1/workers/i-01e9c47fede75cb9a | jq
    {
      "clusterName": "clusterName",
      "machineID": "i-01e9c47fede75cb9a",
      "machineName": "clusterName-worker-e289335e-9579-11e8-b97f-9cb6d0f71293",
      "machineType": "m4.large",
      "machineState": "pending",
      "createdAt": "2018-08-01T10:58:57Z",
      "nodeName": "",
      "reserved": false
    }

List kubescaler workers:

➜ $ curl -s localhost:8081/api/v1/workers | jq
    [
      {
        "clusterName": "clusterName",
        "machineID": "i-0f48e8430160865a1",
        "machineName": "clusterName-node-0cqKZ",
        "machineType": "m4.large",
        "machineState": "running",
        "createdAt": "2018-08-01T09:01:28Z",
        "nodeName": "",
        "reserved": false
      },
      {
        "clusterName": "clusterName",
        "machineID": "i-08da815ee67272756",
        "machineName": "clusterName-master",
        "machineType": "m4.large",
        "machineState": "running",
        "createdAt": "2018-08-01T09:01:11Z",
        "nodeName": "",
        "reserved": false
      },
      {
        "clusterName": "clusterName",
        "machineID": "i-01e9c47fede75cb9a",
        "machineName": "clusterName-worker-e289335e-9579-11e8-b97f-9cb6d0f71293",
        "machineType": "m4.large",
        "machineState": "pending",
        "createdAt": "2018-08-01T10:58:57Z",
        "nodeName": "",
        "reserved": false
      }
    ]

Make a worker reserved:

curl -s -XPATCH -d'{"reserved":true}' localhost:8081/api/v1/workers/mocked-worker | jq
{
  "clusterName": "",
  "machineID": "mocked-worker",
  "machineName": "",
  "machineType": "",
  "machineState": "",
  "creationTimestamp": "0001-01-01T00:00:00Z",
  "nodeName": "",
  "reserved": true
}

Delete a kubescaler worker:

➜ curl -s -XDELETE localhost:8081/api/v1/workers/i-01e9c47fede75cb9a | jq
    {
      "clusterName": "fake",
      "machineID": "i-01e9c47fede75cb9a",
      "machineName": "clusterName-worker-e289335e-9579-11e8-b97f-9cb6d0f71293",
      "machineType": "m4.large",
      "machineState": "terminating",
      "createdAt": "2018-08-06T14:26:27.736042905+03:00",
      "nodeName": "",
      "reserved": false
    }

capacity's People

Contributors

saheienko avatar eldridgeh avatar josephkane avatar 9072997 avatar gopherstein 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.