labels page, api as well as integrating labels in the node pool page

This commit is contained in:
allanice001
2025-09-03 21:51:52 +01:00
parent b99a0684fd
commit 816e11dbd4
13 changed files with 3010 additions and 171 deletions

View File

@@ -810,7 +810,7 @@ const docTemplate = `{
"BearerAuth": []
}
],
"description": "Returns node labels for the organization in X-Org-ID. Filters: ` + "`" + `name` + "`" + `, ` + "`" + `value` + "`" + `, and ` + "`" + `q` + "`" + ` (name contains). Add ` + "`" + `include=node_pools` + "`" + ` to include linked node groups.",
"description": "Returns node labels for the organization in X-Org-ID. Filters: ` + "`" + `key` + "`" + `, ` + "`" + `value` + "`" + `, and ` + "`" + `q` + "`" + ` (key contains). Add ` + "`" + `include=node_pools` + "`" + ` to include linked node groups.",
"consumes": [
"application/json"
],
@@ -831,8 +831,8 @@ const docTemplate = `{
},
{
"type": "string",
"description": "Exact name",
"name": "name",
"description": "Exact key",
"name": "key",
"in": "query"
},
{
@@ -843,7 +843,7 @@ const docTemplate = `{
},
{
"type": "string",
"description": "Name contains (case-insensitive)",
"description": "Key contains (case-insensitive)",
"name": "q",
"in": "query"
},
@@ -1180,6 +1180,257 @@ const docTemplate = `{
}
}
},
"/api/v1/labels/{id}/node_pools": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Returns node pools attached to the label. Supports ` + "`" + `q` + "`" + ` (name contains, case-insensitive).",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"labels"
],
"summary": "List node pools linked to a label (org scoped)",
"parameters": [
{
"type": "string",
"description": "Organization UUID",
"name": "X-Org-ID",
"in": "header",
"required": true
},
{
"type": "string",
"description": "Label ID (UUID)",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Name contains (case-insensitive)",
"name": "q",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/labels.nodePoolBrief"
}
}
},
"400": {
"description": "invalid id",
"schema": {
"type": "string"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"type": "string"
}
},
"403": {
"description": "organization required",
"schema": {
"type": "string"
}
},
"404": {
"description": "not found",
"schema": {
"type": "string"
}
},
"500": {
"description": "fetch failed",
"schema": {
"type": "string"
}
}
}
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Links the label to one or more node pools in the same organization.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"labels"
],
"summary": "Attach label to node pools (org scoped)",
"parameters": [
{
"type": "string",
"description": "Organization UUID",
"name": "X-Org-ID",
"in": "header",
"required": true
},
{
"type": "string",
"description": "Label ID (UUID)",
"name": "id",
"in": "path",
"required": true
},
{
"description": "IDs to attach",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/labels.addLabelToPoolRequest"
}
},
{
"type": "string",
"description": "Optional: node_pools",
"name": "include",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/labels.labelResponse"
}
},
"400": {
"description": "invalid id / invalid json / invalid node_pool_ids",
"schema": {
"type": "string"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"type": "string"
}
},
"403": {
"description": "organization required",
"schema": {
"type": "string"
}
},
"404": {
"description": "not found",
"schema": {
"type": "string"
}
},
"500": {
"description": "attach failed",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/labels/{id}/node_pools/{poolId}": {
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "Unlinks the label from the specified node pool.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"labels"
],
"summary": "Detach label from a node pool (org scoped)",
"parameters": [
{
"type": "string",
"description": "Organization UUID",
"name": "X-Org-ID",
"in": "header",
"required": true
},
{
"type": "string",
"description": "Label ID (UUID)",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Node Pool ID (UUID)",
"name": "poolId",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "No Content",
"schema": {
"type": "string"
}
},
"400": {
"description": "invalid id",
"schema": {
"type": "string"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"type": "string"
}
},
"403": {
"description": "organization required",
"schema": {
"type": "string"
}
},
"404": {
"description": "not found",
"schema": {
"type": "string"
}
},
"500": {
"description": "detach failed",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/node-pools": {
"get": {
"security": [
@@ -1545,6 +1796,242 @@ const docTemplate = `{
}
}
},
"/api/v1/node-pools/{id}/labels": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"node-pools"
],
"summary": "List labels attached to a node pool (org scoped)",
"parameters": [
{
"type": "string",
"description": "Organization UUID",
"name": "X-Org-ID",
"in": "header",
"required": true
},
{
"type": "string",
"description": "Node Pool ID (UUID)",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/nodepools.labelBrief"
}
}
},
"400": {
"description": "invalid id",
"schema": {
"type": "string"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"type": "string"
}
},
"403": {
"description": "organization required",
"schema": {
"type": "string"
}
},
"404": {
"description": "not found",
"schema": {
"type": "string"
}
},
"500": {
"description": "fetch failed",
"schema": {
"type": "string"
}
}
}
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"node-pools"
],
"summary": "Attach labels to a node pool (org scoped)",
"parameters": [
{
"type": "string",
"description": "Organization UUID",
"name": "X-Org-ID",
"in": "header",
"required": true
},
{
"type": "string",
"description": "Node Pool ID (UUID)",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Label IDs to attach",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/nodepools.attachLabelsRequest"
}
}
],
"responses": {
"204": {
"description": "No Content",
"schema": {
"type": "string"
}
},
"400": {
"description": "invalid id / invalid label_ids",
"schema": {
"type": "string"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"type": "string"
}
},
"403": {
"description": "organization required",
"schema": {
"type": "string"
}
},
"404": {
"description": "not found",
"schema": {
"type": "string"
}
},
"500": {
"description": "attach failed",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/node-pools/{id}/labels/{labelId}": {
"delete": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"node-pools"
],
"summary": "Detach one label from a node pool (org scoped)",
"parameters": [
{
"type": "string",
"description": "Organization UUID",
"name": "X-Org-ID",
"in": "header",
"required": true
},
{
"type": "string",
"description": "Node Pool ID (UUID)",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Label ID (UUID)",
"name": "labelId",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "No Content",
"schema": {
"type": "string"
}
},
"400": {
"description": "invalid id",
"schema": {
"type": "string"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"type": "string"
}
},
"403": {
"description": "organization required",
"schema": {
"type": "string"
}
},
"404": {
"description": "not found",
"schema": {
"type": "string"
}
},
"500": {
"description": "detach failed",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/node-pools/{id}/servers": {
"get": {
"security": [
@@ -3062,7 +3549,7 @@ const docTemplate = `{
"BearerAuth": []
}
],
"description": "Returns node taints for the organization in X-Org-ID. Filters: ` + "`" + `name` + "`" + `, ` + "`" + `value` + "`" + `, and ` + "`" + `q` + "`" + ` (name contains). Add ` + "`" + `include=node_groups` + "`" + ` to include linked node groups.",
"description": "Returns node taints for the organization in X-Org-ID. Filters: ` + "`" + `key` + "`" + `, ` + "`" + `value` + "`" + `, and ` + "`" + `q` + "`" + ` (key contains). Add ` + "`" + `include=node_groups` + "`" + ` to include linked node groups.",
"consumes": [
"application/json"
],
@@ -3083,8 +3570,8 @@ const docTemplate = `{
},
{
"type": "string",
"description": "Exact name",
"name": "name",
"description": "Exact key",
"name": "key",
"in": "query"
},
{
@@ -3095,7 +3582,7 @@ const docTemplate = `{
},
{
"type": "string",
"description": "Name contains (case-insensitive)",
"description": "key contains (case-insensitive)",
"name": "q",
"in": "query"
},
@@ -3433,6 +3920,87 @@ const docTemplate = `{
}
},
"/api/v1/taints/{id}/node_pools": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Returns node pools attached to the taint. Supports ` + "`" + `q` + "`" + ` (name contains, case-insensitive).",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"taints"
],
"summary": "List node pools linked to a taint (org scoped)",
"parameters": [
{
"type": "string",
"description": "Organization UUID",
"name": "X-Org-ID",
"in": "header",
"required": true
},
{
"type": "string",
"description": "Taint ID (UUID)",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Name contains (case-insensitive)",
"name": "q",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/taints.nodePoolResponse"
}
}
},
"400": {
"description": "invalid id",
"schema": {
"type": "string"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"type": "string"
}
},
"403": {
"description": "organization required",
"schema": {
"type": "string"
}
},
"404": {
"description": "not found",
"schema": {
"type": "string"
}
},
"500": {
"description": "fetch failed",
"schema": {
"type": "string"
}
}
}
},
"post": {
"security": [
{
@@ -3826,6 +4394,17 @@ const docTemplate = `{
"updated_at": {}
}
},
"labels.addLabelToPoolRequest": {
"type": "object",
"properties": {
"node_pool_ids": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"labels.createLabelRequest": {
"type": "object",
"properties": {
@@ -4001,6 +4580,17 @@ const docTemplate = `{
}
}
},
"nodepools.attachLabelsRequest": {
"type": "object",
"properties": {
"label_ids": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"nodepools.attachServersRequest": {
"type": "object",
"properties": {
@@ -4038,6 +4628,20 @@ const docTemplate = `{
}
}
},
"nodepools.labelBrief": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"key": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"nodepools.nodePoolResponse": {
"type": "object",
"properties": {
@@ -4325,6 +4929,43 @@ const docTemplate = `{
}
}
},
"taints.nodePoolResponse": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"servers": {
"type": "array",
"items": {
"$ref": "#/definitions/taints.serverBrief"
}
}
}
},
"taints.serverBrief": {
"type": "object",
"properties": {
"hostname": {
"type": "string"
},
"id": {
"type": "string"
},
"ip": {
"type": "string"
},
"role": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
"taints.taintResponse": {
"type": "object",
"properties": {