1. Deploy the ckan helm chart on Google Kubernetes Engine (GKE)


    To deploy the CKAN Helm chart on Google Kubernetes Engine (GKE), we will need to execute the following steps:

    1. Create a GKE cluster using the Pulumi GCP provider.
    2. Deploy the CKAN Helm chart to the GKE cluster using the Pulumi Kubernetes provider.

    First, ensure you have Pulumi installed and configured with your GCP credentials. The Pulumi program below is in TypeScript, which is a statically typed superset of JavaScript that compiles to plain JavaScript.

    We'll use the following Pulumi resources:

    • google-native.container/v1beta1.Cluster to create a Google Kubernetes Engine cluster.
    • kubernetes.helm.sh/v3.Release to deploy the CKAN Helm chart to the created GKE cluster.

    Here is the TypeScript program to deploy the CKAN Helm chart on GKE:

    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("ckan-cluster", { // Specify the required properties for your GKE cluster here initialNodeCount: 2, nodeVersion: "latest", // Based on your project and location requirements. location: "us-central1-a", nodeConfig: { // Choose the machine type based on your CKAN resource needs. 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 to access the GKE cluster 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 `; }); // Get the GKE cluster as a Kubernetes provider. const gkeK8sProvider = new k8s.Provider("gke-k8s", { kubeconfig: kubeconfig, }); // Deploy the CKAN Helm chart to the GKE cluster const ckanRelease = new k8s.helm.v3.Release("ckan-release", { // Provide the chart name and repository of CKAN Helm chart chart: "ckan", version: "2.0.0", // Replace with the desired chart version repositoryOpts: { repo: "https://ckan.github.io/ckan-helm/", // Replace with the CKAN Helm repo URL }, }, { provider: gkeK8sProvider });


    • We first import the necessary Pulumi packages: gcp for GCP resources, kubernetes for Kubernetes resources, and pulumi for the Pulumi programming model itself.
    • We define a GKE cluster by creating an instance of gcp.container.Cluster. Here you can specify the properties of your GKE cluster, like the number of initial nodes, node version, location, and node configurations. For the node scope/oauthScopes, we provided the typical scopes needed for a GKE cluster to interact with GCP services.
    • We use the pulumi.all().apply() pattern to construct the kubeconfig needed to