...
In Helm3, the Helm CLI acts as an interface towards a Kubernetes cluster, and allows the user to deploy and manage helm charts. It also supports configuration of multiple chart repositories for the helm client and enables access to charts from those repos for installation of K8S microservices. The repositories can be local chart servers running on the same machine or third party chart servers running elsewhere. The URL of achart a chart server can be configured on the Helm repo list to permit access to Helm charts hosted in those repos. Users can add repositories and push Helm charts to the repositories via Helm CLI commands.
...
Prerequisites for Kubernetes participant:
- Kubernetes cluster running.Helm CLI running.
- Currently, the operator is expected to either store the Helm charts in any of the configured Helm repositories via Helm CLI commands provide the repository information where the helm chart is available, via TOSCA /REST end point or ensure that the charts are available on the local storage directory of kubernetes-participant. (This directory is a preconfigured path specified on the participant config that acts as a local chart repository). Charts can be onboarded to local chart repository via REST endpoints.
Note: When using the Kubernetes participant in docker container, the kubeconfig config file of the required kubernetes cluster should be copied to the k8s-participant's docker container's home directory under /.kube folder in order to make the Helm CLI participant work with the external cluster.
...
- Installation of a Helm chart that is present in the same local file system as where the kubernetes participant is hosted
- Installation of Helm charts from the Helm repositories that are configured on the Helm clientany remote helm repositories. (The remote repository details needs to be passed on via TOSCA or REST API to the kubernetes participant)
The CLAMP Kubernetes participant acts as a mediator between the CLAMP runtime and the Helm Client.
...
The code block below shows a Sample TOSCA service template passed during commissioning of control loops. Charts can be commissioned via TOSCA in the following mentioned ways:
- Chart parameters: chartId(name, version), release_name releaseName and namespace are mandatory in TOSCA.
- Repository can be specified with either configured remote helm repository name or any local directory where the helm charts are available.
(Note: Repository name is an optional parameter in control loop TOSCA template. If not specified, the Kubernetes particpant participant will do a look up on the available local chart storage and configured helm repos)
Code Block | ||||
---|---|---|---|---|
| ||||
org.onap.domain.database.HelloWorld_K8SMicroserviceControlLoopElement: # Chart from local anyfile chartsystem repository(pre configuredonboarded onvia helmREST clientAPI). version: 1.2.3 type: org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement type_version: 1.0.0 description: Control loop element for the K8S microservice for Hello World properties: provider: ONAP participant_id: name: org.onap.k8s.controlloop.K8SControlLoopParticipant version: 2.3.4 chart: release_namereleaseName: helloworld chart_chartId: name: hello version: 0.1.0 repository: chartMuseum namespace: onap org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement: # Chart from localany fileremote systemrepository version: 1.2.3 type: org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement type_version: 1.0.0 description: Control loop element for the K8S microservice for PMSH properties: provider: ONAP participant_id: name: org.onap.k8s.controlloop.K8SControlLoopParticipant version: 2.3.4 chart: release_name: pmshmicroservice chart_chartId: name: dcae_pmsh version: 8.0.1.0 repository: /home/oom/helm-charts/PMSH repository: repoName: chartMuseum address: 172.125.12.1 port: 8082 protocol: http username: username password: password namespace: onap org.onap.domain.database.Local_K8SMicroserviceControlLoopElement: # Chart installation without passing repository name (chart lookup happens on local chart storage and preconfigured helm repos) version: 1.2.3 type: org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement type_version: 1.0.0 description: Control loop element for the K8S microservice for any chart properties: provider: ONAP participant_id: name: org.onap.k8s.controlloop.K8SControlLoopParticipant version: 2.3.4 chart: release_name: nginxms chart_name: nginx-ingress version: 0.9.1 namespace: onap |
The Kubernetes participant receives messages through the participant-intermediary common code, and handles them by invoking the Kubernetes Open API via the Helm client. For example, When a ControlLoopUpdate message is received by Kubernetes participant, the control loop element state changed from UNINITIALIZED UNINITIALISED to PASSIVE, Kubernetes-participant triggers Kubernetes Open API and passes installs the HELM charts towards on the cluster.
Run CLAMP Kubernetes Participant command line using Maven
...
java -jar -DtopicServer=localhost target/policy-clamp-participant-impl-kubernetes-6.1.2-SNAPSHOT.jar
REST APIs on Kubernetes participant:
Kubernetes participant can also be installed as a standalone application which exposes REST endpoints for onboarding, installing, uninstalling helm charts from local chart directories.