...
Code Block | ||||
---|---|---|---|---|
| ||||
docker exec -it <k8s-pod container id> sh mkdir ~/.kube ( create a file “config” with cluster config data) chmod 600 ~/.kube/config |
Note: We are planning to automate this manual step using HTTP participant in Jakarta and even in Istanbul as a fix if we have time.
Verification:
Now the helm cli in the k8s-participant should be pointing to the configured cluster.
Ex: helm ls → Gives the deployment details from the configured cluster.
Note: The ip of the external cluster is expected to be properly configured on the config.
The k8s-participant can now be used in CLAMP CL workflow to deploy any microservices like PMSH in to the configured cluster.
Commission Control loop to CL Runtime:
Commission Control loop TOSCA definitions to Runtime.
Code Block | ||||
---|---|---|---|---|
| ||||
https://<CL Runtime IP> : <Port> /onap/controlloop/v2/commission |
The CL definitions are commissioned to CL runtime which populates the CL runtime database. The following sample TOSCA template which contains PMSH CL definitions under node template, will be passed on to this endpoint as request body. (Please refer node template section). Helm chart properties along with override parameters are supplied under the node template of CL element.
Request body:
Code Block | ||||
---|---|---|---|---|
| ||||
tosca_definitions_version: tosca_simple_yaml_1_3
data_types:
onap.datatypes.ToscaConceptIdentifier:
derived_from: tosca.datatypes.Root
properties:
name:
type: string
required: true
version:
type: string
required: true
node_types:
org.onap.policy.clamp.controlloop.Participant:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
provider:
type: string
requred: false
org.onap.policy.clamp.controlloop.ControlLoopElement:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
provider:
type: string
required: false
participant_id:
type: onap.datatypes.ToscaConceptIdentifier
requred: true
org.onap.policy.clamp.controlloop.ControlLoop:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
provider:
type: string
required: false
elements:
type: list
required: true
entry_schema:
type: onap.datatypes.ToscaConceptIdentifier
org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement:
version: 1.0.1
derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
properties:
chart:
type: string
required: true
configs:
type: list
required: false
requirements:
type: string
required: false
templates:
type: list
required: false
entry_schema:
values:
type: string
required: true
topology_template:
node_templates:
org.onap.k8s.controlloop.K8SControlLoopParticipant:
version: 2.3.4
type: org.onap.policy.clamp.controlloop.Participant
type_version: 1.0.1
description: Participant for K8S
properties:
provider: ONAP
org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement:
version: 1.2.3
type: org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement
type_version: 1.0.0
description: Control loop element for the K8S microservice PMSH
properties:
provider: ONAP
participant_id:
name: org.onap.k8s.controlloop.K8SControlLoopParticipant
version: 2.3.4
chart:
chartId:
name: dcae-pmsh
version: 8.0.0
namespace: onap
releaseName: pmshms
overrideParams:
global.masterPassword: test
repository:
repoName: chartmuseum
address: 172.125.16.1
port: 8080
protocol: http
username: onapinitializer
password: demo123456!
org.onap.domain.sample.GenericK8s_ControlLoopDefinition:
version: 1.2.3
type: org.onap.policy.clamp.controlloop.ControlLoop
type_version: 1.0.0
description: Control loop for Hello World
properties:
provider: ONAP
elements:
- name: org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement
version: 1.2.3
|
Instantiate Control loop:
Instantiation dialogues are used to create, set parameters on, instantiate, update, and remove Control Loop instances. Assume a suitable Control Loop Definition exists in the Commissioned Control Loop Inventory. To get a Control Loop instance running instantiate and update the Control loop state. The following sample json represents the request body for instantiating the CL elements under the control loop to UNINITIALISED state.
Code Block | ||||
---|---|---|---|---|
| ||||
https://<CL Runtime IP> : <Port> /onap/controlloop/v2/instantiation |
Request body:
Elite soft json viewer |
---|
{
"controlLoopList": [
{
"name": "K8SInstance0",
"version": "1.0.1",
"definition": {
"name": "org.onap.domain.sample.GenericK8s_ControlLoopDefinition",
"version": "1.2.3"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
"description": "K8s control loop instance 0",
"elements": {
"709c62b3-8918-41b9-a747-d21eb79c6c21": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c21",
"definition": {
"name": "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement",
"version": "1.2.3"
},
"participantId" :{
"name": "org.onap.k8s.controlloop.K8SControlLoopParticipant",
"version": "2.3.4"
},
"participantType": {
"name": "org.onap.k8s.controlloop.K8SControlLoopParticipant",
"version": "2.3.4"
},
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
"description": "K8s Control Loop Element for the PMSH instance 0 control loop"
}
}
}
]
}
|
Update Control loop to PASSIVE state:
When the Control loop is updated with state “PASSIVE”, the Kubernetes participant fetches the node template for all control loop elements and deploys the helm chart of each CL element in to the cluster. The following sample json input is passed on the request body.
Code Block | ||||
---|---|---|---|---|
| ||||
https://<CL Runtime IP> : <Port> /onap/controlloop/v2/command |
Request body:
Code Block | ||||
---|---|---|---|---|
| ||||
{
"orderedState": "PASSIVE",
"controlLoopIdentifierList": [
{
"name": "K8SInstance0",
"version": "1.0.1"
}
]
}
|
Control loops can be "UNINTIALISED" after deployment:
Under the UNINITIALISED state, all the helm deployments under a control loop will be uninstalled from the cluster.