Kubernetes participant sample use case:
PMSH deployment from DCAE chart server using k8s-participant (docker):
Prerequisites:
- CL runtime, DMaap and k8s-participant deployed and running.
- DCAE up and running to deploy any DCAEGEN2-services like pmsh.
- DCAE chart server (chart museum) installed and initialized with dcae helm charts.
In Istanbul, the following step is manual for configuring K8s-participant with k8s cluster :
Configure K8s-participant with an existing kubernetes cluster:
Login to the k8s-participant container and create a folder for Kubernetes config file under home directory and copy the cluster config:
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.
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:
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.
https://<CL Runtime IP> : <Port> /onap/controlloop/v2/instantiation
Request body:
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.
https://<CL Runtime IP> : <Port> /onap/controlloop/v2/command
Request body:
{ "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.