1. Deploy the ibm-offline-docs helm chart on Google Kubernetes Engine (GKE)

    TypeScript

    To deploy the ibm-offline-docs Helm chart on Google Kubernetes Engine (GKE), we will follow these steps:

    1. Set up a GKE cluster.
    2. Configure Pulumi to interact with your Google Cloud account and GKE.
    3. Use Pulumi's Helm support within the Kubernetes provider to deploy the ibm-offline-docs Helm chart to the GKE cluster.

    For this task, we'll use the @pulumi/gcp package to create a GKE cluster and the @pulumi/kubernetes package to deploy the Helm chart. Before you begin, make sure you have the Pulumi CLI and Google Cloud SDK installed, and you are authenticated with Google Cloud.

    Below is a detailed TypeScript program that sets up the GKE cluster and deploys the Helm chart:

    import * as gcp from "@pulumi/gcp"; import * as k8s from "@pulumi/kubernetes"; import * as pulumi from "@pulumi/pulumi"; // Create a GKE cluster. const cluster = new gcp.container.Cluster("my-gke-cluster", { initialNodeCount: 2, nodeVersion: "latest", minMasterVersion: "latest", nodeConfig: { preemptible: true, machineType: "n1-standard-1", oauthScopes: [ "https://www.googleapis.com/auth/compute", "https://www.googleapis.com/auth/devstorage.read_only", "https://www.googleapis.com/auth/logging.write", "https://www.googleapis.com/auth/monitoring" ], }, }); // Export the Cluster name export const clusterName = cluster.name; // Export the Kubeconfig so we can access the cluster with kubectl export const kubeconfig = pulumi. all([cluster.name, cluster.endpoint, cluster.masterAuth]). apply(([name, endpoint, masterAuth]) => { const context = `${gcp.config.project}_${gcp.config.zone}_${name}`; return `apiVersion: v1 clusters: - cluster: certificate-authority-data: ${masterAuth.clusterCaCertificate} server: https://${endpoint} name: ${context} contexts: - context: cluster: ${context} user: ${context} name: ${context} current-context: ${context} kind: Config preferences: {} users: - name: ${context} user: auth-provider: config: cmd-args: config config-helper --format=json cmd-path: gcloud expiry-key: '{.credential.token_expiry}' token-key: '{.credential.access_token}' name: gcp `; }); // Set up the Helm Release for `ibm-offline-docs` Helm chart. const helmRelease = new k8s.helm.v3.Release("ibm-offline-docs-release", { chart: "ibm-offline-docs", version: "1.0.0", // specify the version of the chart you want to deploy repositoryOpts: { repo: "https://charts.myorg.com/", // specify the Helm repository where the chart is hosted }, // Values from the `values.yaml` file can be provided here. values: { service: { type: "LoadBalancer", }, }, }, { provider: new k8s.Provider("k8s-provider", { kubeconfig: kubeconfig }) }); // Export the status of the Helm release export const helmStatus = helmRelease.status;

    This Pulumi program performs the following actions:

    1. Creates a new GKE cluster with a specified initial node count and machine type. The OAuth scopes allow the nodes to interact with other Google Cloud services such as Compute, Storage, Logging, and Monitoring.

    2. Exports two output properties: clusterName which is the name of the created cluster and kubeconfig which is the configuration info required to connect to the cluster using kubectl.

    3. Sets up a new Helm Release for the ibm-offline-docs Helm chart using the specified chart name and repository. The values property allows you to override default values from the chart's values.yaml file. It’s important to replace the repo URL with the actual URL of the Helm repository that hosts your Helm chart.

    4. The helmStatus is exported so that you can see the status of the Helm release once deployed.

    Note that this code assumes that the ibm-offline-docs Helm chart and its repository are correctly configured in your environment. Please replace the placeholder URL https://charts.myorg.com/ with the actual URL of your Helm repository and ensure that the chart name and version are correct.

    Run this Pulumi program by executing pulumi up in the same directory as the code. Pulumi will interpret the code, build an execution plan, and prompt you before proceeding to make the changes in your Google Cloud account. After confirmation, the GKE cluster and Helm chart will be deployed.