Management Service

The Management Service is responsible for orchestration and management of the Edge Compute Platform. It connects to the Altair IoT Studio cloud using MQTT and is installed by running the kubectl commands displayed when creating a new Asset in Studio (see Asset Management).

Interaction with the Management Service is done by requesting Actions. Results of these Actions get set up in Events.

Default Actions

The default Actions are already defined on the Asset's schema upon Asset creation. The section Asset Thing Details in AnythingDB describes how these can be used.
Send kubectl
Action as defined on the schema:
"send-kubectl": {
    "description": "Send a kubectl command to the cluster. Command must be an array of words",
    "input": {
        "properties": {
            "arguments": {
                "title": "The arguments of the command",
                "type": "array"
            },
            "command": {
                "const": "kubectl",
                "title": "The command",
                "type": "string"
            },
            "correlationId": {
                "title": "The correlationId",
                "type": "string"
            }
        },
        "type": "object"
    },
    "title": "Send kubectl"
},
Event as defined on the schema:
"kubectl-logs": {
    "data": {
        "properties": {
            "correlationId": {
                "description": "The ID used to match an incoming message with a response message.",
                "title": "The CorrelationID",
                "type": "string"
            },
            "response": {
                "description": "The output of the command that was run.",
                "title": "The Response",
                "type": "string"
            },
            "statusCode": {
                "description": "An HTTP Response Code.",
                "title": "The StatusCode",
                "type": "integer"
            },
            "statusMessage": {
                "description": "A description of the return status.",
                "title": "The StatusMessage",
                "type": "string"
            }
        },
        "title": "kubectl events",
        "type": "object"
    },
    "description": "Final response of kubectl command",
    "title": "Kubectl command is done"
},
Send Kubernetes API
Action as defined on the schema:
"send-kubernetes-api": {
    "description": "Send a Kubernetes API request to the cluster.",
    "input": {
        "properties": {
            "correlationId": {
                "title": "The correlationId",
                "type": "string"
            },
            "href": {
                "type": "string"
            },
            "requestBody": {
                "type": "string"
            },
            "requestMethod": {
                "type": "string",
                "enum": [
                    "GET",
                    "POST",
                    "PUT",
                    "PATCH",
                    "DELETE"
                ]
            }
        },
        "type": "object"
    },
    "title": "Send Kubernetes API"
},
Event as defined on the schema:
"send-kubernetes-api": {
    "data": {
        "properties": {
            "correlationId": {
                "description": "The ID used to match an incoming message with a response message.",
                "title": "The CorrelationID",
                "type": "string"
            },
            "response": {
                "description": "The output of the request that was run.",
                "title": "The Response",
                "type": "string"
            },
            "statusCode": {
                "description": "An HTTP Response Code.",
                "title": "The StatusCode",
                "type": "integer"
            },
            "statusMessage": {
                "description": "A description of the return status.",
                "title": "The StatusMessage",
                "type": "string"
            }
        },
        "title": "Kubernetes API events",
        "type": "object"
    },
    "description": "Final response of Kubernetes API request",
    "title": "Kubernetes API request is done"
},
Run statistics/metrics gathering
Action as defined on the schema:
"run-stats": {
    "description": "Start sending statistics/metrics as events on an interval",
    "input": {
        "properties": {
            "interval": {
                "title": "Frequency in seconds",
                "type": "integer"
            }
        },
        "type": "object"
    },
    "title": "Run statistics/metrics gathering"
},
Stop statistics/metrics gathering
Action as defined on the schema:
"stop-stats": {
    "description": "Stop sending statistics/metrics as events",
    "title": "Stop statistics/metrics gathering"
},

Additional Actions

The following Actions are not part of the asset schema by default. They can be manually added to enhance functionality. If indicated Studio will add the Action to the schema when installing the associated Edge Application.

Send API
This Action is needed for the API Client (see Using the Cluster API Inspector) and will be added to the Asset schema by Studio when installing the "App - Edge Compute Platform" application from the Marketplace.
Action as defined on the schema:
"send-api": {
    "description": "Send an API request to the cluster.",
    "input": {
        "properties": {
            "correlationId": {
                "type": "string"
            },
            "href": {
                "type": "string"
            },
            "requestBody": {
                "type": "string"
            },
            "requestMethod": {
                "type": "string",
                "enum": [
                    "GET",
                    "POST",
                    "PUT",
                    "PATCH",
                    "DELETE"
                ]
            }
        },
        "type": "object"
    },
    "title": "Send API"
},
Event as defined on the schema:
"send-api": {
    "data": {
        "properties": {
            "correlationId": {
                "description": "The ID used to match an incoming message with a response message.",
                "title": "The CorrelationID",
                "type": "string"
            },
            "response": {
                "description": "The output of the request that was run.",
                "title": "The Response",
                "type": "string"
            },
            "statusCode": {
                "description": "An HTTP Response Code.",
                "title": "The StatusCode",
                "type": "integer"
            },
            "statusMessage": {
                "description": "A description of the return status.",
                "title": "The StatusMessage",
                "type": "string"
            }
        },
        "title": "API events",
        "type": "object"
    },
    "description": "Final response of API request",
    "title": "API request is done"
},
Configure logger
This Action can be used to set the output level for the log of the Management Service.
Action as defined on the schema:
"configure-logger": {
    "description": "Configure the message output of the logger",
    "input": {
        "properties": {
            "color": {
                "title": "Colorize the pretty print",
                "type": "boolean"
            },
            "level": {
                "title": "Minimum log level",
                "type": "string",
                "enum": [
                    "debug",
                    "info",
                    "warning",
                    "error",
                    "critical"
                ]
            },
            "pretty": {
                "title": "Pretty print",
                "type": "boolean"
            }
        },
        "type": "object"
    },
    "title": "Configure logger"
},
Retrieve kubeconfig
This Action can only be used when the "App - ECP Tunnel" has been deployed. It will return a kubeconfig file to be used by a local client. The kubeconfig file is regenerated every week and would need to be retrieved again once expired.
Action as defined on the schema:
"retrieve-kubeconfig": {
    "description": "Retrieve kubeconfig from cluster",
    "input": {
        "properties": {
            "correlationId": {
                "type": "string"
            },
            "format": {
                "type": "string",
                "enum": [
                    "yaml",
                    "json"
                ]
            },
            "refresh": {
                "type": "boolean"
            }
        },
        "type": "object"
    },
    "title": "Retrieve kubeconfig"
},
Note: The format is "yaml" by default, but can be set to "json" too.
Note: The "refresh" parameter is set to false by default.
Event as defined on the schema:
"retrieve-kubeconfig": {
    "data": {
        "type": "object"
    },
    "description": "Retrieve kubeconfig result",
    "title": "Retrieve kubeconfig is done"
},
Manage a Kubernetes Deployment
This Action can be used to restart or scale a Deployment.
Note: Not all Deployments have been coded to be able to run with multiple instances at the same time.
Action as defined on the schema:
"manage-deployment": {
    "description": "Manage a kubernetes deployment",
    "input": {
        "properties": {
            "command": {
                "title": "The command",
                "type": "string",
                "enum": [
                    "restart",
                    "scale"
                ]
            },
            "correlationId": {
                "title": "The correlationId",
                "type": "string"
            },
            "parameters": {
                "properties": {
                    "deployment": {
                        "title": "Deployment name",
                        "type": "string"
                    },
                    "namespace": {
                        "title": "The namespace",
                        "type": "string"
                    },
                    "replicas": {
                        "title": "Number of replicas",
                        "type": "integer"
                    }
                },
                "title": "The parameters of the command",
                "type": "object"
            }
        },
        "type": "object"
    },
    "title": "Manage Deployment"
},
The command property needs to be either restart or scale. Scale to 0 can be used to temporarily halt the service.
Event as defined on the schema:
"manage-deployment": {
    "data": {
        "type": "object"
    },
    "description": "Final response of Manage Deployment request",
    "title": "Manage Deployment is done"
},
Backup/restore database
This Action can be used to backup or restore a database file to/from a remote SFTP server.
Note: Only applications/services that use an sqlite database have this functionality available.
Action as defined on the schema:
"restore-command": {
    "description": "Backup/restore database",
    "input": {
        "properties": {
            "command": {
                "title": "The command",
                "type": "string",
                "enum": [
                    "backup-database",
                    "restore-database"
                ]
            },
            "correlationId": {
                "title": "The correlationId",
                "type": "string"
            },
            "parameters": {
                "properties": {
                    "deployment": {
                        "title": "Deployment name",
                        "type": "string"
                    },
                    "host": {
                        "title": "SFTP server host",
                        "type": "string"
                    },
                    "port": {
                        "title": "SFTP server port",
                        "type": "integer"
                    },
                    "user": {
                        "title": "SFTP server username",
                        "type": "string"
                    },
                    "password": {
                        "title": "SFTP server password",
                        "type": "string"
                    },
                    "remotePath": {
                        "title": "SFTP server path for storage",
                        "type": "string"
                    }
                },
                "title": "The parameters of the command",
                "type": "object"
            }
        },
        "type": "object"
    },
    "title": "Run backup/restore"
},
The command property needs to be either backup-database or restore-database. Backup will upload the local copy of the database file to the remote SFTP server. Restore will download the remote copy and replace the local copy with it after which the application/service will restart and use the restored database.
Event as defined on the schema:
"restore-command": {
    "data": {
        "type": "object"
    },
    "description": "Final response of backup/restore request",
    "title": "Backup/restore is done"
},
Copy Kubernetes Resource
This Action can be used to copy a kubernetes resource from one namespace to another. This can be useful for copying configmaps or secrets.
Note: This should only be attempted if you are sure there are no adverse consequences.
Action as defined on the schema:
"copy-resource": {
    "description": "Copy kubernetes resource",
    "input": {
        "properties": {
            "command": {
                "title": "The command",
                "type": "string",
                "const": "copy"
            },
            "correlationId": {
                "title": "The correlationId",
                "type": "string"
            },
            "parameters": {
                "properties": {
                    "type": {
                        "title": "Type of resource",
                        "type": "string"
                    },
                    "from": {
                        "properties": {
                            "namespace": {
                                "title": "Namespace of source resource",
                                "type": "string"
                            },
                            "name": {
                                "title": "Name of source resource",
                                "type": "string"
                            }
                        },
                        "title": "Details of source resource",
                        "type": "object"
                    },
                    "to": {
                        "properties": {
                            "namespace": {
                                "title": "Namespace of destination resource",
                                "type": "string"
                            },
                            "name": {
                                "title": "Name of destination resource",
                                "type": "string"
                            }
                        },
                        "title": "Details of destination resource",
                        "type": "object"
                    }
                },
                "title": "The parameters of the command",
                "type": "object"
            }
        },
        "type": "object"
    },
    "title": "Run copy resource"
},
The command property can only be copy. The type of the resource to copy can only be one of the following: secrets, configmaps, deployments, or services.
Event as defined on the schema:
"copy-resource": {
    "data": {
        "properties": {
            "correlationId": {
                "description": "The ID used to match an incoming message with a response message.",
                "title": "The CorrelationID",
                "type": "string"
            },
            "response": {
                "description": "The output of the request that was run.",
                "title": "The Response",
                "type": "string"
            },
            "statusCode": {
                "description": "An HTTP Response Code.",
                "title": "The StatusCode",
                "type": "integer"
            },
            "statusMessage": {
                "description": "A description of the return status.",
                "title": "The StatusMessage",
                "type": "string"
            }
        },
        "title": "Copy resource events",
        "type": "object"
    },
    "description": "Final response of the copy resource request",
    "title": "Copy resource is done"
},
Get Node IP
This Action can be used to retrieve the IP addresses of the nodes of the edge asset.
Action as defined on the schema:
        "get-node-ip": { 
            "description": "Get IP Addresses of the Nodes", 
            "input": {}, 
            "title": "Get Node IP" 
        }, 
Event as described on the schema:
        "get-node-ip": { 
            "data": { 
                "type": "object" 
            }, 
            "description": "Node IP Info", 
            "title": "Get Node IP request is done" 
        }, 
Get Authorization ID
This Action can be used to retrieve the Authorization ID required for use in actions such as "Restart K3s".
Note:
  • The Authorization ID expires after two minutes.
  • The Authorization ID is for one-time use only.
Action as defined on the schema:
    "get-authorization-id": { 
        "input": { 
            "properties": { 
                "correlationId": { 
                    "type": "string" 
                } 
            }, 
            "type": "object" 
        }, 
        "title": "Get Authorization ID" 
    }, 
Event as described on the schema:
    "get-authorization-id": { 
        "data": { 
            "type": "object" 
        }, 
        "description": "", 
        "title": "Get Authorization ID" 
    }, 
Restart K3s
This Action can be used to restart the K3s service running on the host.
Note:
  • This should only be used when there are problems reaching the kubernetes API server or the metrics server.
  • This operation takes several minutes to complete and should not be triggered again while running.
  • An Authorization ID is required.
Action as defined on the schema:
    "restart-k3s": { 
        "input": { 
            "properties": { 
                "authorizationId": { 
                    "type": "string" 
                }, 
                "correlationId": { 
                    "type": "string" 
                } 
            }, 
            "type": "object" 
        }, 
        "title": "Restart K3s" 
    },  
Event as described on the schema:
    "restart-k3s": { 
        "data": { 
            "type": "object" 
        }, 
        "description": "", 
        "title": "Restart K3s" 
    },