Pulumi and Golang to apply a subscription manifest onto a OpenShift Cluster

35 Views Asked by At

I am a newbie in using Pulumi. I am trying to use module github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/operators and when I do go get github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/operators It is showing me below error

go: module github.com/pulumi/pulumi-kubernetes/sdk/v4@upgrade found (v4.9.1), but does not contain package github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/operators
Any ideas on this error please?

My code is below

package main

import (
    "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/apiextensions"
    "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/operators"
    "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        name := "elasticsearch"

        // Deploy an Elasticsearch Operator using the Kubernetes Operator Lifecycle Manager (OLM)
        elasticsearchOperator, err := operators.NewSubscription(ctx, name, &operators.SubscriptionArgs{
            ApiVersion: pulumi.String("operators.coreos.com/v1alpha1"),
            Kind:       pulumi.String("Subscription"),
            Metadata: &apiextensions.ObjectMetaArgs{
                Name:      pulumi.String(name),              // This is the name of your Elasticsearch subscription
                Namespace: pulumi.String("openshift-operators"), // Assuming the default `openshift-operators` namespace is used
            },
            Spec: operators.SubscriptionSpecArgs{
                Channel:           pulumi.String("stable"), // Choose the appropriate subscription channel for your operator
                InstallPlanApproval: pulumi.String("Automatic"),
                Name:              pulumi.String("elasticsearch-operator"), // This is the official name of the Elasticsearch operator
                Source:            pulumi.String("operatorhubio-catalog"),
                SourceNamespace:   pulumi.String("olm"),
                StartingCsv:       pulumi.String("elasticsearch-operator.v2.1.11"), // Replace 'x.x.x' with the operator version desired
            },
        }, pulumi.Protect(true))
        if err != nil {
            return err
        }

        // Export the name of the operator
        ctx.Export("elasticsearchOperatorName", elasticsearchOperator.Metadata.Name())

        return nil
    })
}


0

There are 0 best solutions below