hpe-container-platform-community / hpecp-python-library

Python library for working with HPE Container Platform (Prototype)
https://hpe-container-platform-community.github.io/hpecp-python-library/index.html
MIT License
15 stars 4 forks source link

epic workers #263

Closed snowch closed 4 years ago

snowch commented 4 years ago
POST /api/v1/workers/ HTTP/1.1
Host: 127.0.0.1:8080
Content-Length: 2610
Accept-Encoding: gzip, deflate
REMOTE_ADDR: 86.148.96.78
Accept: */*
User-Agent: python-requests/2.6.0 CPython/2.7.5 Linux/3.10.0-1127.19.1.el7.x86_64
Connection: keep-alive
X-BDS-SESSION: /api/v2/session/e1065c2d-2bb4-44df-9e2a-9e417ec71703
Content-Type: application/json
Authorization: /api/v2/session/e1065c2d-2bb4-44df-9e2a-9e417ec71703

{"ip": "10.1.0.229", "tags": [], "purpose": "worker", "credentials": {"type": "ssh_key_access", "ssh_key_data": "-----BEGIN RSA PRIVATE KEY-----...-----END RSA PRIVATE KEY-----\n"}}

HTTP/1.1 201 Created
Access-Control-Allow-Origin: *
Content-Length: 13
Content-Type: text/plain
Date: Fri, 04 Sep 2020 14:34:16 GMT
Location: /api/v1/workers/3
Server: HPE Ezmeral Container Platform 5.1.1

201 Created
snowch commented 4 years ago
GET /api/v1/workers/ HTTP/1.1
Host: 127.0.0.1:8080
Accept-Encoding: gzip, deflate
REMOTE_ADDR: 86.148.96.78
Accept: */*
User-Agent: python-requests/2.6.0 CPython/2.7.5 Linux/3.10.0-1127.19.1.el7.x86_64
Connection: keep-alive
X-BDS-SESSION: /api/v2/session/e1065c2d-2bb4-44df-9e2a-9e417ec71703
Authorization: /api/v2/session/e1065c2d-2bb4-44df-9e2a-9e417ec71703

HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Length: 10787
Content-Type: application/json
Date: Fri, 04 Sep 2020 14:36:50 GMT
Server: HPE Ezmeral Container Platform 5.1.1

{
  "_links": {
    "self": {
      "href": "/api/v1/workers"
    }
  },
  "_embedded": {
    "workers": [
      {
        "_links": {
          "self": {
            "href": "/api/v1/workers/1"
          }
        },
        "ip": "10.1.0.187",
        "purpose": "primary",
        "state": "installed",
        "hostname": "ip-10-1-0-187.eu-west-3.compute.internal",
        "approved_worker_pubkey": "ssh-rsa ...\n",
        "propinfo": {
          "bds_storage_apollo": "false",
          "bds_storage_thinpooldev": "/dev/mapper/VolBDSCStore-thinpool",
          "bds_network_publicinterface": "ens5",
          "bds_global_version": "5.1.1",
          "bds_global_buildnumber": "2347"
        },
        "status_info": "",
        "schedule": false,
        "hacapable": true,
        "tags": [],
        "hdfs_disks_configured": "/dev/nvme2n1",
        "sysinfo": {
          "network": [
            {
              "info": {
                "IsVirtual": false,
                "IpAddr": {
                  "dynamic": "10.1.0.187/24"
                },
                "Mtu": 9001,
                "State": "up",
                "Carrier": true,
                "HwAddr": "06:e3:96:fd:63:8c",
                "Speed": "UNKNOWN"
              },
              "name": "ens5"
            },
            {
              "info": {
                "IsVirtual": true,
                "IpAddr": {},
                "Mtu": 1500,
                "State": "UNKNOWN",
                "Carrier": "UNKNOWN",
                "HwAddr": "96:9e:37:54:c5:4e",
                "Speed": "UNKNOWN"
              },
              "name": "bds-flood"
            }
          ],
          "keys": {
            "reported_worker_public_key": "ssh-rsa...\n"
          },
          "storage": [
            {
              "info": {
                "IsDisk": false,
                "Name": "/dev/mapper/VolBDSCStore-thinpool",
                "IsReadOnly": false,
                "IsRemovable": false,
                "IsRotational": false,
                "DeviceType": "lvm",
                "HasFilesystem": true,
                "IsLogicalVolume": true,
                "IsPartition": false,
                "ParentName": "/dev/nvme1n1p1",
                "ParentDeviceType": "part",
                "SizeBytes": "548682072064",
                "Mountpoint": "/var/lib/docker"
              },
              "name": "/dev/mapper/VolBDSCStore-thinpool"
            },
            {
              "info": {
                "IsDisk": false,
                "Name": "/dev/nvme0n1p1",
                "IsReadOnly": false,
                "IsRemovable": false,
                "IsRotational": false,
                "DeviceType": "part",
                "HasFilesystem": true,
                "IsLogicalVolume": false,
                "IsPartition": true,
                "ParentName": "/dev/nvme0n1",
                "ParentDeviceType": "disk",
                "SizeBytes": "429495664128",
                "Mountpoint": "/"
              },
              "name": "/dev/nvme0n1p1"
            },
            {
              "info": {
                "IsDisk": true,
                "Name": "/dev/nvme2n1",
                "IsReadOnly": false,
                "IsRemovable": false,
                "IsRotational": false,
                "DeviceType": "disk",
                "HasFilesystem": false,
                "IsLogicalVolume": false,
                "IsPartition": false,
                "ParentName": "",
                "ParentDeviceType": "",
                "SizeBytes": "549755813888",
                "Mountpoint": ""
              },
              "name": "/dev/nvme2n1"
            }
          ],
          "gpu": {
            "gpu_count": 0
          },
          "swap": {
            "swap_total": 0
          },
          "memory": {
            "mem_total": 65842458624
          },
          "mountpoint": [],
          "cpu": {
            "cpu_logical_cores": 16,
            "cpu_count": 8,
            "cpu_physical_cores": 8,
            "cpu_sockets": 1
          }
        },
        "container_disks_configured": "/dev/nvme1n1",
        "hdfs_commission": true,
        "hdfs_commission_status": "Normal"
      },
      {
        "_links": {
          "self": {
            "href": "/api/v1/workers/3"
          }
        },
        "ip": "10.1.0.229",
        "purpose": "worker",
        "state": "ready",
        "hostname": "ip-10-1-0-229.eu-west-3.compute.internal",
        "approved_worker_pubkey": [],
        "propinfo": {
          "bds_storage_apollo": "false",
          "bds_network_publicinterface": "ens5",
          "bds_global_version": "5.1.1",
          "bds_global_buildnumber": "2347"
        },
        "status_info": "",
        "schedule": true,
        "hacapable": true,
        "tags": [],
        "sysinfo": {
          "network": [
            {
              "info": {
                "IsVirtual": false,
                "IpAddr": {
                  "dynamic": "10.1.0.229/24"
                },
                "Mtu": 9001,
                "State": "up",
                "Carrier": true,
                "HwAddr": "06:e3:8a:f6:a4:66",
                "Speed": "UNKNOWN"
              },
              "name": "ens5"
            },
            {
              "info": {
                "IsVirtual": true,
                "IpAddr": {},
                "Mtu": 1500,
                "State": "UNKNOWN",
                "Carrier": "UNKNOWN",
                "HwAddr": "5e:58:22:ae:c6:4b",
                "Speed": "UNKNOWN"
              },
              "name": "bds-flood"
            }
          ],
          "keys": {
            "reported_worker_public_key": "ssh-rsa...\n"
          },
          "storage": [
            {
              "info": {
                "IsDisk": false,
                "Name": "/dev/nvme0n1p1",
                "IsReadOnly": false,
                "IsRemovable": false,
                "IsRotational": false,
                "DeviceType": "part",
                "HasFilesystem": true,
                "IsLogicalVolume": false,
                "IsPartition": true,
                "ParentName": "/dev/nvme0n1",
                "ParentDeviceType": "disk",
                "SizeBytes": "429495664128",
                "Mountpoint": "/"
              },
              "name": "/dev/nvme0n1p1"
            },
            {
              "info": {
                "IsDisk": true,
                "Name": "/dev/nvme1n1",
                "IsReadOnly": false,
                "IsRemovable": false,
                "IsRotational": false,
                "DeviceType": "disk",
                "HasFilesystem": false,
                "IsLogicalVolume": false,
                "IsPartition": false,
                "ParentName": "",
                "ParentDeviceType": "",
                "SizeBytes": "1099511627776",
                "Mountpoint": ""
              },
              "name": "/dev/nvme1n1"
            },
            {
              "info": {
                "IsDisk": true,
                "Name": "/dev/nvme2n1",
                "IsReadOnly": false,
                "IsRemovable": false,
                "IsRotational": false,
                "DeviceType": "disk",
                "HasFilesystem": false,
                "IsLogicalVolume": false,
                "IsPartition": false,
                "ParentName": "",
                "ParentDeviceType": "",
                "SizeBytes": "1099511627776",
                "Mountpoint": ""
              },
              "name": "/dev/nvme2n1"
            }
          ],
          "gpu": {
            "gpu_count": 0
          },
          "swap": {
            "swap_total": 0
          },
          "memory": {
            "mem_total": 65842458624
          },
          "mountpoint": [],
          "cpu": {
            "cpu_logical_cores": 16,
            "cpu_count": 8,
            "cpu_physical_cores": 8,
            "cpu_sockets": 1
          }
        },
        "hdfs_commission": true,
        "hdfs_commission_status": "Normal"
      },
      {
        "_links": {
          "self": {
            "href": "/api/v1/workers/2"
          }
        },
        "ip": "10.1.0.197",
        "purpose": "proxy",
        "state": "installed",
        "hostname": "ip-10-1-0-197.eu-west-3.compute.internal",
        "approved_worker_pubkey": [],
        "propinfo": {
          "bds_storage_apollo": "false",
          "bds_network_publicinterface": "ens5",
          "bds_global_version": "5.1.1",
          "bds_global_buildnumber": "2347"
        },
        "status_info": "",
        "schedule": false,
        "hacapable": true,
        "tags": [],
        "sysinfo": {
          "network": [
            {
              "info": {
                "IsVirtual": true,
                "IpAddr": {},
                "Mtu": 9001,
                "State": "up",
                "Carrier": true,
                "HwAddr": "3a:57:95:e7:b2:cb",
                "Speed": "10000"
              },
              "name": "bds-flood-6-r"
            },
            {
              "info": {
                "IsVirtual": true,
                "IpAddr": {},
                "Mtu": 9001,
                "State": "up",
                "Carrier": true,
                "HwAddr": "76:88:72:3e:55:b4",
                "Speed": "10000"
              },
              "name": "bds-flood-2-r"
            },
            {
              "info": {
                "IsVirtual": true,
                "IpAddr": {},
                "Mtu": 9001,
                "State": "up",
                "Carrier": true,
                "HwAddr": "de:00:17:d2:ca:0c",
                "Speed": "10000"
              },
              "name": "bds-flood-0-r"
            },
            {
              "info": {
                "IsVirtual": true,
                "IpAddr": {},
                "Mtu": 9001,
                "State": "UNKNOWN",
                "Carrier": "UNKNOWN",
                "HwAddr": "6e:a9:47:52:e3:45",
                "Speed": "UNKNOWN"
              },
              "name": "bds-flood"
            },
            {
              "info": {
                "IsVirtual": true,
                "IpAddr": {},
                "Mtu": 9001,
                "State": "up",
                "Carrier": true,
                "HwAddr": "2e:13:4a:c6:3a:2a",
                "Speed": "10000"
              },
              "name": "bds-flood-1-r"
            },
            {
              "info": {
                "IsVirtual": true,
                "IpAddr": {},
                "Mtu": 9001,
                "State": "up",
                "Carrier": true,
                "HwAddr": "16:74:6d:b4:ad:a5",
                "Speed": "10000"
              },
              "name": "bds-flood-1-l"
            },
            {
              "info": {
                "IsVirtual": true,
                "IpAddr": {},
                "Mtu": 9001,
                "State": "up",
                "Carrier": true,
                "HwAddr": "ee:07:8c:bc:5d:9c",
                "Speed": "10000"
              },
              "name": "bds-flood-0-l"
            },
            {
              "info": {
                "IsVirtual": true,
                "IpAddr": {},
                "Mtu": 9001,
                "State": "up",
                "Carrier": true,
                "HwAddr": "ca:56:e0:a5:4d:ad",
                "Speed": "10000"
              },
              "name": "bds-flood-2-l"
            },
            {
              "info": {
                "IsVirtual": true,
                "IpAddr": {},
                "Mtu": 9001,
                "State": "up",
                "Carrier": true,
                "HwAddr": "8a:e4:3a:3e:c6:72",
                "Speed": "10000"
              },
              "name": "bds-flood-6-l"
            },
            {
              "info": {
                "IsVirtual": false,
                "IpAddr": {
                  "dynamic": "10.1.0.197/24"
                },
                "Mtu": 9001,
                "State": "up",
                "Carrier": true,
                "HwAddr": "06:29:d1:d9:b0:26",
                "Speed": "UNKNOWN"
              },
              "name": "ens5"
            },
            {
              "info": {
                "IsVirtual": true,
                "IpAddr": {},
                "Mtu": 9001,
                "State": "up",
                "Carrier": true,
                "HwAddr": "42:60:f2:00:50:6c",
                "Speed": "10000"
              },
              "name": "bds-flood-4-r"
            },
            {
              "info": {
                "IsVirtual": true,
                "IpAddr": {},
                "Mtu": 9001,
                "State": "up",
                "Carrier": true,
                "HwAddr": "4e:2b:9b:41:47:b7",
                "Speed": "10000"
              },
              "name": "bds-flood-5-r"
            },
            {
              "info": {
                "IsVirtual": true,
                "IpAddr": {},
                "Mtu": 9001,
                "State": "up",
                "Carrier": true,
                "HwAddr": "aa:dc:d1:53:ee:34",
                "Speed": "10000"
              },
              "name": "bds-flood-3-l"
            },
            {
              "info": {
                "IsVirtual": true,
                "IpAddr": {},
                "Mtu": 9001,
                "State": "up",
                "Carrier": true,
                "HwAddr": "9a:3f:ce:c0:23:03",
                "Speed": "10000"
              },
              "name": "bds-flood-7-r"
            },
            {
              "info": {
                "IsVirtual": true,
                "IpAddr": {},
                "Mtu": 9001,
                "State": "up",
                "Carrier": true,
                "HwAddr": "86:8b:bc:6e:ac:9d",
                "Speed": "10000"
              },
              "name": "bds-flood-7-l"
            },
            {
              "info": {
                "IsVirtual": true,
                "IpAddr": {},
                "Mtu": 9001,
                "State": "up",
                "Carrier": true,
                "HwAddr": "52:eb:62:2a:dc:36",
                "Speed": "10000"
              },
              "name": "bds-flood-3-r"
            },
            {
              "info": {
                "IsVirtual": true,
                "IpAddr": {},
                "Mtu": 9001,
                "State": "up",
                "Carrier": true,
                "HwAddr": "76:0b:03:c1:7e:02",
                "Speed": "10000"
              },
              "name": "bds-flood-5-l"
            },
            {
              "info": {
                "IsVirtual": true,
                "IpAddr": {},
                "Mtu": 9001,
                "State": "up",
                "Carrier": true,
                "HwAddr": "a2:2c:a3:18:a0:4c",
                "Speed": "10000"
              },
              "name": "bds-flood-4-l"
            }
          ],
          "keys": {
            "reported_worker_public_key": "ssh-rsa ...\n"
          },
          "storage": [
            {
              "info": {
                "IsDisk": false,
                "Name": "/dev/nvme0n1p1",
                "IsReadOnly": false,
                "IsRemovable": false,
                "IsRotational": false,
                "DeviceType": "part",
                "HasFilesystem": true,
                "IsLogicalVolume": false,
                "IsPartition": true,
                "ParentName": "/dev/nvme0n1",
                "ParentDeviceType": "disk",
                "SizeBytes": "429495664128",
                "Mountpoint": "/"
              },
              "name": "/dev/nvme0n1p1"
            }
          ],
          "gpu": {
            "gpu_count": 0
          },
          "swap": {
            "swap_total": 0
          },
          "memory": {
            "mem_total": 65842458624
          },
          "mountpoint": [],
          "cpu": {
            "cpu_logical_cores": 16,
            "cpu_count": 8,
            "cpu_physical_cores": 8,
            "cpu_sockets": 1
          }
        },
        "proxy_nodes_hostname": "ip-10-1-0-197.eu-west-3.compute.internal"
      }
    ]
  }
}
snowch commented 4 years ago

Done.

snowch commented 4 years ago
PUT /api/v1/install/?install_alter HTTP/1.1
Host: 127.0.0.1:8080
Content-Length: 174
Accept-Encoding: gzip, deflate
REMOTE_ADDR: 86.148.96.78
Accept: */*
User-Agent: python-requests/2.6.0 CPython/2.7.5 Linux/3.10.0-1127.19.1.el7.x86_64
Connection: keep-alive
X-BDS-SESSION: /api/v2/session/8f1f1140-3955-43ac-85fe-be6bdfdc22fe
Content-Type: application/json
Authorization: /api/v2/session/8f1f1140-3955-43ac-85fe-be6bdfdc22fe

{"workers": [{"containerdisks": ["/dev/nvme2n1"], "hdfsdisks": ["/dev/nvme1n1"], "id": "/api/v1/workers/5", "name": "10.1.0.218 (ip-10-1-0-218.eu-west-3.compute.internal)"}]}

HTTP/1.1 204 No Content
Access-Control-Allow-Origin: *
Content-Length: 0
Content-Type: text/plain
Date: Sat, 05 Sep 2020 07:04:50 GMT
Server: HPE Ezmeral Container Platform 5.1.1
snowch commented 4 years ago

Done.