AS LCM RESTful Protocols for SO CNF Manager
Work in Progress
- 1 Work in Progress
- 2 Lifecycle Management Interface
- 2.1 Create AS Instance Resource
- 2.1.1 REST Interfaces
- 2.1.2 CreateAsRequest
- 2.1.3 AsInstance (response)
- 2.2 Instantiate AS Instance Resource
- 2.2.1 REST Interfaces
- 2.2.2 InstantiateAsRequest
- 2.2.3 ExtCpdParams
- 2.2.4 DeploymentItems
- 2.3 Terminate AS Instance Resource
- 2.3.1 REST Interfaces
- 2.3.2 TerminateAsRequest
- 2.4 Delete AS Instance Resource
- 2.4.1 REST Interfaces
- 2.5 Update AS
- 2.6 Query Individual AS
- 2.6.1 REST Interfaces
- 2.7 AsInstance for Create and Query
- 2.7.1 datatype.instantiationAsInfo
- 2.7.2 datatype._links
- 2.8 Register K8S Clusters
- 2.9 Deregister K8S Clusters
- 2.10 Swagger File
- 2.11 Kubernetes Resource Query
- 2.1 Create AS Instance Resource
Lifecycle Management Interface
This interface allows the CNF Manager (CNFM) client to invoke AS-CNF lifecycle management operations of AS-CNF instances towards the CNFM.
The operations provide through this interface are:
Create AS Identifier
Instantiate AS
Terminate AS
Delete AS Identifier
Update AS
note: register and unregister of K8S cluster(s) are under consideration. May use existing AAI interface??? TBD.
Create AS Instance Resource
The creation of an "individual" AS instance resource.
REST Interfaces
POST .../as_instances (CreateAsRequest)
201 Created (AsInstance)
// Send AsIdentifierCreationNotification
post condition: upon successful completion, AS instance is created in NOT_INSTANTIATED state.
For the response AsInstance structure, see the AsInstance section below, AsInstanceforCreateandQuery .
The caller of SO CNFM (in this case, BPMN Infra) need to use the return asInstanceId for invoking an AS Instance Instantiate.
Note: KeyValuePairs data type is typically realized as Hashmap or Hashtable
CreateAsRequest
Attribute Name | Data Type | Cardinality | Description |
---|---|---|---|
asdId | Identifier (UUID) | 1 | Identifier that identifies the ASD which defines the AS instance to be created. |
asInstanceName | String | 0..1 | Human-readable name of the AS instance to be created. |
asInstanceDescription | String | 0..1 | Human-readable description of the AS instance to be created. |
additionalParams1, 2 | KeyValuePairs | 0..1 | Additional input parameters for the Create AS process (this is a pace holder to hold any additional parameters for the orchestrator, such as CNFM) |
Note:
The additional parameters can be passed to define custom values. All keys that are separated by dots are handled as separate values. Passing a value file content is under consideration. Special characters are allowed to represent \n, \., etc.
The target cluster name could be passed thru additionalParams if the client wants to select the target cluster.
AsInstance (response)
see the AsInstance section below, AsInstanceforCreateandQuery .
Instantiate AS Instance Resource
Before SO CNFM invokes As Instance Instantiate, SO CNFM may need to query for an asInstance based on the asInstanceId parameter.
REST Interfaces
POST .../as_instances/{asInstanceId}/instantiate (InstantiateAsRequest)
202 Accepted ()
Send asLcmOperationOccurrenceNotification (STARTING/PROCESSING/COMPLETED)
200 OK (AsLcmOpOcc:operationState=COMPLETED)
InstantiateAsRequest
Attribute Name | Data Type | Cardinality | Description |
---|---|---|---|
asdExtCpdInputParams | ExtCpdParams | 0..N | contains ext cpd parameter instance-level values |
deploymentItems | DeploymentItems | 1..N | contains lifecycle parameters for deploymentItems |
additionalParams1, 2 | KeyValuePairs | 0..1 | Additional input parameters for the Instantiate AS process (this is a pace holder to hold any additional parameters for the orchestrator, such as CNFM) |
Note:
The additional parameters can be passed to define custom values. All keys that are separated by dots are handled as separate values. Passing a value file content is under consideration. Special characters are allowed to represent \n, \., etc.
The target cluster name could be passed thru additionalParams if the client wants to select the target cluster.
ExtCpdParams
extCpdId | UUID | 1 | identifier |
loadbalancerIP | String | 0..1 | contains the IP address to configure the loadBalancer of the K8s service or ingress controller that the ExtCpd represents |
externalIPs | String | 0..N | contains external IPs |
nadNames | String | 0..N | contains a list of nad names |
nadNamespace | String | 0..1 | contains a nad namespace |
DeploymentItems
Attribute Name | Data Type | Cardinality | Description |
---|---|---|---|
deploymentItemId | Identifier | 1 | Identifies which deploymentItem |
lifecycleParameterKeyValues1 | KeyValuesPairs | 0..N | provides lifecycle parameter keys and values |
Note:
provides instance-level key-value sets for the Helm Charts values file(s).
Terminate AS Instance Resource
The termination of an individual AS instance resource.
REST Interfaces
POST .../as_instances/{asInstanceId}/terminate (TerminateAsRequest)
202 Accepted ()
Send asLcmOperationOccurrenceNotification (STARTING/PROCESSING/COMPLETED)
200 OK (AsLcmOpOcc:operationState=COMPLETED)
TerminateAsRequest
Attribute Name | Data Type | Cardinality | Description |
---|---|---|---|
terminationType | Enum | 1 |
|
gracefulTerminationTimeout | Integer | 0..1 | The unit is seconds |
additionalParams | KeyValuePairs | 0..1 | Additional input parameters for the Terminate AS process (this is a pace holder to hold any additional parameters for the orchestrator, such as CNFM) |
Delete AS Instance Resource
The deletion of an individual AS instance resource.
REST Interfaces
DELETE .../as_instances/{asInstanceId}
204 No Content
// Send AsIdentifierDeletionNotification to Client
Update AS
TBD
Query Individual AS
REST Interfaces
GET .../as_instances/{asInstanceId}
200 OK (AsInstance)
AsInstance for Create and Query
Attribute Name | Data Type | Cardinality | Description |
---|---|---|---|
asInstanceId | Identifier | 1 | Identifier of the AS instance |
asInstanceName | String | 0..1 | Name of the AS instance. This attribute can be modified with the PATCH (i.e., update) method. |
asInstanceDescription | String | 0..1 | Human-readable description of the AS instance. This attribute can be modified with the PATCH method. |
asdId | Identifier | 1 | Identifier of the ASD on which the CNF instance is based. |
asVersion | Version | 1 | Specifies the version of the Application. |
asSchemaVersion | Version | 1 | Specifies the version of the ASD’s schema. The value is copied from the ASD. |
asProvider | String | 1 | Provider of the AS instance. The value is copied from the ASD. |
asApplicationName | String | 1 | Name to identify the AS instance. The value is copied from the ASD. |
asApplicationVersion | String | 1 | Specifies the version of the Application. The value is copied from the ASD. |
asApplicationInfoName | String | 0..1 | Human readable name for the Application service instance. The value is copied from the ASD. |
asInfoDescription | String | 0..1 | Human readable description of the AS instance. The value is copied from the ASD. |
asdExtCpd | datatype.ExtCpd | 0..N | Contains the externally exposed “instance-level” connection points of the application. |
enhancedClusterCapabilities | datatype. enhancedClusterCapabilities | 0..N | Contains a list of “instance-level” expected capabilities of the target Kubernetes cluster to aid placement of the application service on a suitable cluster. |
deploymentItems | DeploymentItems | 1..N | Contains Deployment artifacts with “instance-level” lifecylceparmaeterKeyValues |
instantiationState | String of Enum;
| 0..1 | Indicates the current Instantiation State |
instantiationAsInfo | datatype.instantiationAsInfo | 0..1 | Information specific to an instantiated AS Instance, such as STARTED, STOPPED |
metadata | object (key value pair) | 0..1 | represents a list of “instance-level” metadata key-value pairs |
extensions | object (key value pair) | 0..1 | Additional AS-specific “instance-level” attributes that affect the lifecycle management of this AS instance |
_links | datatype._links | 0..1 | Links to resources related to this resource, such as self, indicators, instantiate, terminate and operate URIs |
asDeploymentName | String | 0..1 | name of the deployment in the namespace (e.g., helm release name) Note: once an app is deployed, the asDeploymentName is required |
targetCluster | String | 0..1 | target cluster name |
datatype.instantiationAsInfo
Attribute Name | Data Type | Cardinality | Description |
---|---|---|---|
asState | String of Enum;
| 1 | Identifier of the AS instance |
localizationLanguage | String | 0..1 | Information about localization language of the AS |
datatype._links
Attribute Name | Data Type | Cardinality | Description |
---|---|---|---|
self | object | 0..1 | represents a link to a resource using an absolute URI |
>href | String | 1 | string formatted according to IETF RFC 3986 |
indicators | object | 0..1 | represents a link to a resource using an absolute URI |
>href | String | 1 | string formatted according to IETF RFC 3986 |
instantiate | object | 0..1 | represents a link to a resource using an absolute URI |
>href | String | 1 | string formatted according to IETF RFC 3986 |
terminate | object | 0..1 | represents a link to a resource using an absolute URI |
>href | String | 1 | string formatted according to IETF RFC 3986 |
operate | object | 0..1 | represents a link to a resource using an absolute URI |
>href | String | 1 | string formatted according to IETF RFC 3986 |
Register K8S Clusters
To instantiate an AS on an non-ONAP K8S cluster, a cluster configuration file that is specific to the cluster must be uploaded.
To add a cluster configuration file of a cluster, create a POST request .../aslcm/v1/clusterconfigs will be performed.
CNFM receives the clusterconfigs info and creates a cluster configuration file (cluster name + "." + "config" to the ./kube directory.
The kubectl configuration file is used to the body of the request to define external K8S clusters.
The cluster configuration file for a particular cluster must be retrieved from the cluster administrator.
Should the cluster configuration file change for any reason, e.g., CA certificate rotation on the target cluster or client key expires, then the cluster file registered in SO CNFM/AAI shall need to be updated.
The target cluster server and port must be reachable from the SO CNFM.
to verify the connectdion to the target cluster, run the following command from the ONAP K8S cluster
kubectl --kubeconfig ${PATH_TO_TARGET_CLUSTER_CONFIGURATION_FILE} get namespaces
Deregister K8S Clusters
To remove a cluster configruation file, create a DELETE request. .../aslcm/v1/clusterconfig/{configName}
CNFM will remove the "configName" + "." + "config" file from the .kube directory.
The command returns the HTTP status code 204 No Content
List Registered K8S Clusters
To get details about registered clusters, create a GET request .../aslcm/v1/clusterconfigs
The API returns a paginated response, but if a customized response is needed, additional parameters for page, size, sor and filtering could be applied.
Swagger File
The following is ASD LCM Restful API Swagger file (work in progress)
Kubernetes Resource Query
Get Nodes
GET /api/v1/nodes
with parameters
labelSelector
findSelector
resourceVersion
Based on the node label (which is not unique), get a node list. To narrow it further, use the additional findSelector parameter.
Once we get target node(s), get node status.
Get Node Status
GET /api/v1/nodes/{name}/status
Query Cluster Capacity
Allocatable capacity of CPU and Memory from the target cluster could be discovered by SO CNFM (later this function could be moved to NFVO) using the K8S API (GET /api/v1/nodes/{name}/status).
Name | Description | Required | Schema | Default |
---|---|---|---|---|
cluster_name | name of Kubernetes Cluster | true | String | |
namespace | namespace | true | String | |
node_name | name of Kubernetes node | true | String | |
capacity | Capacity represents the total resources of a node. | false | object | |
allocatable | Allocatable represents the resources of a node that are available for scheduling. Defaults to Capacity | false | object
| |
conditions | Conditions is an array of current observed node conditions. | false | v1.NodeCondition array | |
addresses | List of addresses reachable to the node. | false | v1.NodeAddresses array | |
daemonEndpoints | Endpoints of daemons running on the Node. | false | v1.NodeDaemonEndpoints | |
nodeInfo | Set of ids/uuids to uniquely identify the node. | false | v1.NodeSystemInfo | |
images | List of container images on this node | false | v1.ContainerImage array | |
volumesInUse | List of attachable volumes in use (mounted) by the node. | false | v1.UniqueVolumeName array | |
volumesAttached | List of volumes that are attached to the node. | false | v1.AttachedVolume array |
Query Cluster POD by name
kubectl get pods -o=name
kubectl get pods -o=name | sed "s/^.\{4\}//" | grep <release name>
kubectl get pods --no-headers -o custom-columns=":metadata.name" | grep <release name>
kubectl get pod -A | grep <release name> | awk '{print $2}'. // find a POD by release name
kubectl get --no-headers=true pods -o name | awk -F "/" '{print $2}'
Get PoD / container status
kubectl get pods <pod name> --no-headers -o custom-columns=":status.phase". // check if pod is running or not
kubectl get pod <pod name> --output="jsonpath={.status.containerStatuses[*].ready}". // check if the container is ready, which is true
Others
kubectl get ns -A
kubectl get pods - n <namespace>
kubectl get pod -o=custom-columns=NAME:.metadata.name,NODE:.spec.nodeName
kubectl get pod -o=custom-columns=NAME:.metadata.name,NODE:.spec.nodeName | awk '{print $2}'. // get the node name
kubectl get pod -o=custom-columns=NAME:.metadata.name,NODE:.spec.nodeName | grep <release name>. // get the pod and node names for release name
kubectl get pod -o=custom-columns=NAME:.metadata.name,NODE:.spec.nodeName | grep <release name> | awk '{print $2}'. // get the node name for release name
kubectl describe pods <pod name> // get a pod description
kubectl describe pods <pod name> | grep 'Container ID'. // get container id(s) from a pod
kubectl get pod <pod name> -o="custom-columns=NAME:.metadata.name,INIT-CONTAINERS:.spec.initContainers[*].name,CONTAINERS:.spec.containers[*].name". // get pod, init-container and containers
kubectl get pods <pod name> -o jsonpath='{range .spec.containers[*]}{.name}{"\n"}{end}'. // get container name(s) from the pod name
kubectl exec -it <pod name> -c <container name> bash. // access pod