Deploy the logdna-agent helm chart on Azure Managed Openshift Service
TypeScriptTo deploy the LogDNA Agent Helm chart on an Azure Managed OpenShift Service, you will need to create an instance of the Azure Managed OpenShift cluster (
azure-native.containerservice.OpenShiftManagedCluster
) and then use the Helm chart resource (kubernetes.helm.v3.Chart
) to deploy the LogDNA Agent to this cluster.Here's a detailed breakdown of the process:
-
Create an Azure Managed OpenShift Cluster: You'll need to provision an Azure Managed OpenShift cluster using the
azure-native.containerservice.OpenShiftManagedCluster
resource. Make sure to configure the necessary parameters such as location, resource group name, and OpenShift version. -
Deploy the Helm Chart: Once the cluster is up and running, you'll deploy the LogDNA Agent Helm chart to your OpenShift cluster using the
kubernetes.helm.v3.Chart
resource from Pulumi's Kubernetes provider. You would need to configure the Helm chart appropriately, usually by passing configuration values that tailor the Helm chart to your specific needs, like setting thevalues
property for the Helm chart which includes agent key, and any other custom LogDNA Agent settings.
Below is a Pulumi program written in TypeScript to achieve this:
import * as pulumi from '@pulumi/pulumi'; import * as azure_native from '@pulumi/azure-native'; import * as k8s from '@pulumi/kubernetes'; // Step 1: Create an Azure Managed OpenShift Cluster const resourceGroupName = "myResourceGroup"; const clusterName = "myOpenShiftCluster"; const openshiftCluster = new azure_native.containerservice.OpenShiftManagedCluster(clusterName, { resourceGroupName: resourceGroupName, location: "East US", openShiftVersion: "v3.11", // Other necessary configurations for cluster // ... }); // Step 2: Deploy the Helm Chart (LogDNA Agent) // Setup Kubernetes provider to use the kubeconfig from the generated OpenShift cluster const k8sProvider = new k8s.Provider("openshiftK8sProvider", { kubeconfig: openshiftCluster.kubeconfig.apply(kubeconfig => kubeconfig), }); // Define the LogDNA Agent Helm chart const logdnaHelmChart = new k8s.helm.v3.Chart("logdna-agent", { chart: "logdna-agent", version: "1.5.6", // Use the correct version of the Helm chart namespace: "logdna-agent", fetchOpts: { repo: "https://assets.logdna.com/charts", // LogDNA Helm repository }, values: { logdna: { key: "<LOGDNA_INGESTION_KEY>", // Placeholder for the LogDNA ingestion key // Add additional configuration parameters if required }, }, }, { provider: k8sProvider }); // Export the public endpoint to access the OpenShift cluster export const publicEndpoint = openshiftCluster.publicHostname;
In this code:
- Replace
<LOGDNA_INGESTION_KEY>
with your actual LogDNA ingestion key. - Fill in any additional required or custom parameters for the OpenShift cluster and LogDNA values.
- The OpenShift cluster's version is provided as
'v3.11'
, but you can change it to the version that you wish to deploy. - The code assumes the East US location, but you can adjust that to the Azure region you prefer.
- The
kubeconfig
output from the OpenShift cluster is used to configure the Kubernetes provider for Pulumi, which in turn allows the Helm chart to be deployed to the cluster. - The Helm chart is fetched from LogDNA's official Helm repository.
- The namespace provided is
'logdna-agent'
, but you can customize this according to your organizational policies. - Lastly, the program exports the public endpoint URL of the OpenShift cluster.
Ensure that you have already configured Pulumi with the correct Azure credentials before running this program. Once you have set it up, you can simply run the Pulumi CLI commands to deploy your configuration:
pulumi up
.-