Deploy the onap helm chart on Oracle Kubernetes Engine (OKE)
TypeScriptTo deploy the ONAP helm chart on Oracle Kubernetes Engine (OKE), you'll need to set up a Kubernetes Cluster on OKE, configure your Kubernetes environment to interact with the cluster, and then use the Helm provider with Pulumi to deploy the ONAP helm chart. The Pulumi Kubernetes provider enables you to interact with Kubernetes resources, while the Helm Release resource allows you to manage Helm charts within your Kubernetes cluster.
Below is a TypeScript program that uses Pulumi to:
- Set up a Kubernetes Cluster on OKE (this example assumes that the OKE cluster is already set up and that you have necessary access to it).
- Configure Pulumi to use the existing OKE Cluster and Kubernetes context.
- Deploy the ONAP Helm chart to the OKE cluster.
Before you start, make sure you have the following prerequisites in place:
- Pulumi CLI installed and logged in.
- Oracle Cloud Infrastructure (OCI) CLI set up with the necessary credentials and permissions to create and manage OKE resources.
- Kubectl is configured to interact with your Kubernetes cluster.
import * as k8s from "@pulumi/kubernetes"; import * as oci from "@pulumi/oci"; // Begin with loading the required OCI configuration // This may include tenancy OCID, user OCID, Compartment OCID, and necessary keys. const config = new pulumi.Config("oci"); const compartmentId = config.require("compartmentOcid"); const userOcid = config.require("userOcid"); const tenancyOcid = config.require("tenancyOcid"); const publicKeyFingerprint = config.require("publicKeyFingerprint"); const privateKeyPath = config.require("privateKeyPath"); const region = config.require("region"); // Provider configuration for Oracle Cloud Infrastructure // This lets Pulumi know how to communicate with OCI APIs. const ociProvider = new oci.Provider("oci", { region: region, tenancyOcid: tenancyOcid, userOcid: userOcid, fingerprint: publicKeyFingerprint, privateKeyPath: privateKeyPath, compartments: [compartmentId], }); // The example assumes you have an existing OKE cluster, and you are retrieving it. // You will need your OKE cluster OCID for this. const clusterOcid = config.require("clusterOcid"); // Using the OCI provider, create a Kubernetes provider using credentials // from the specified OKE cluster. const k8sProvider = new k8s.Provider("oke-k8s", { kubeconfig: oci.containerengine.getKubeconfig({ clusterId: clusterOcid, }, { provider: ociProvider }).content, }); // Define the ONAP helm chart and its release settings. const onapChart = new k8s.helm.v3.Chart("onap", { // Specify the chart and version you wish to deploy. // You would specify the repository or absolute chart path along with the version. chart: "onap", version: "x.y.z", namespace: "onap", // Replace with the namespace where you want to deploy ONAP. // If you have a custom values file, you can use the 'values' field. // For example: // values: { /* Custom values here */ }, }, { provider: k8sProvider }); // Expose the Kubernetes cluster name and ONAP IP after the chart is deployed export const clusterName = clusterOcid; export const onapIp = onapChart.getResourceProperty("v1/Service", "onap/onap-service", "status").apply(status => status.loadBalancer.ingress[0].ip);
This program will create an instance of the
oci.containerengine.Cluster
resource representing your OKE cluster and will configure Kubernetes provider with the kubeconfig for your OKE cluster. It then defines an instance of a Helm chart to deploy ONAP, using thek8s.helm.v3.Chart
resource. To customize the deployment further, you can always provide additional configuration parameters within thevalues
object.Review OCI Kubernetes Cluster documentation and Helm Chart documentation for more details on configurations and options available for these resources.
Remember to replace the placeholder chart version
x.y.z
with the actual version of the ONAP Helm chart that you want to deploy, and make sure to verify that your Helm chart's repository and any custom values required are correctly specified.After writing this code, you would run it with Pulumi, using the following commands:
pulumi up # To preview and deploy the changes. pulumi stack output onapIp # To get the IP address where ONAP is accessible after the deployment.
Note: The above code assumes you have pre-existing knowledge of OKE, OCI, Kubernetes, Helm, and Pulumi. If some concepts are not clear or you need more specific guidance, I'd be happy to provide further explanations or break down individual parts of the process.