Skip to content

Commit

Permalink
Adding in a golang example (#286)
Browse files Browse the repository at this point in the history
Golang Example:
```
Previewing update (dev):
     Type                                          Name                        Plan
 +   pulumi:pulumi:Stack                           simple-cert-manager-go-dev  create
 +   ├─ kubernetes:core/v1:Namespace               sandbox-ns                  create
 +   ├─ kubernetes-cert-manager:index:CertManager  cert-manager                create
 +   │  └─ kubernetes:helm.sh/v3:Release           cert-manager-helm           create
 +   └─ kubernetes:cert-manager.io/v1:Issuer       issuer                      create

Outputs:
    certManagerStatus: output<string>

Resources:
    + 5 to create

Updating (dev):
     Type                                          Name                        Status
 +   pulumi:pulumi:Stack                           simple-cert-manager-go-dev  created (32s)
 +   ├─ kubernetes:core/v1:Namespace               sandbox-ns                  created (0.03s)
 +   ├─ kubernetes-cert-manager:index:CertManager  cert-manager                created (31s)
 +   │  └─ kubernetes:helm.sh/v3:Release           cert-manager-helm           created (31s)
 +   └─ kubernetes:cert-manager.io/v1:Issuer       issuer                      created (0.01s)

Outputs:
    certManagerStatus: {
        appVersion: "v1.15.3"
        chart     : "cert-manager"
        name      : "cert-manager-helm-fe2f0069"
        namespace : "sandbox-ns-8ac9bb51"
        revision  : 1
        status    : "deployed"
        version   : "v1.15.3"
    }

Resources:
    + 5 created

Duration: 39s
```
  • Loading branch information
rshade authored Jan 7, 2025
1 parent ed97a89 commit a3b9576
Show file tree
Hide file tree
Showing 6 changed files with 505 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ nuget/
ci-scripts/
*.tar.gz
**/*.out
**/out.txt

sdk/dotnet/version.txt
sdk/java/.gradle
Expand Down
38 changes: 38 additions & 0 deletions examples/examples_go_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//go:build go || all
// +build go all

package examples

import (
"path/filepath"
"testing"

"github.com/pulumi/providertest/pulumitest"
"github.com/pulumi/providertest/pulumitest/opttest"
"github.com/pulumi/pulumi/sdk/v3/go/auto/optpreview"
"github.com/pulumi/pulumi/sdk/v3/go/auto/optrefresh"
)

func TestGoExamples(t *testing.T) {
tests := map[string]struct {
directoryName string
additionalConfig map[string]string
}{
"TestSimpleCertManagerGo": {directoryName: "simple-cert-manager-go"},
}
for name, test := range tests {
t.Run(name, func(t *testing.T) {
p := pulumitest.NewPulumiTest(t, test.directoryName,
opttest.LocalProviderPath("pulumi-kubernetes-cert-manager", filepath.Join(getCwd(t), "..", "bin")),
)
if test.additionalConfig != nil {
for key, value := range test.additionalConfig {
p.SetConfig(t, key, value)
}
}
p.Up(t)
p.Preview(t, optpreview.ExpectNoChanges())
p.Refresh(t, optrefresh.ExpectNoChanges())
})
}
}
7 changes: 7 additions & 0 deletions examples/simple-cert-manager-go/Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: simple-cert-manager-go
description: A minimal Go Pulumi program
runtime: go
config:
pulumi:tags:
value:
pulumi:template: go
94 changes: 94 additions & 0 deletions examples/simple-cert-manager-go/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
module simple-cert-manager-go

go 1.22.4

require (
github.com/pulumi/pulumi-kubernetes-cert-manager/sdk v0.1.1-beta.0
github.com/pulumi/pulumi-kubernetes/sdk/v4 v4.19.0
github.com/pulumi/pulumi/sdk/v3 v3.144.1
)

require (
dario.cat/mergo v1.0.0 // indirect
github.com/BurntSushi/toml v1.2.1 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/ProtonMail/go-crypto v1.1.3 // indirect
github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da // indirect
github.com/agext/levenshtein v1.2.3 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/atotto/clipboard v0.1.4 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/blang/semver v3.5.1+incompatible // indirect
github.com/charmbracelet/bubbles v0.16.1 // indirect
github.com/charmbracelet/bubbletea v0.25.0 // indirect
github.com/charmbracelet/lipgloss v0.7.1 // indirect
github.com/cheggaaa/pb v1.0.29 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 // indirect
github.com/cyphar/filepath-securejoin v0.3.6 // indirect
github.com/djherbis/times v1.5.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.6.1 // indirect
github.com/go-git/go-git/v5 v5.13.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/glog v1.2.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/hcl/v2 v2.22.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-localereader v0.0.1 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mitchellh/go-ps v1.0.0 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/muesli/reflow v0.3.0 // indirect
github.com/muesli/termenv v0.15.2 // indirect
github.com/opentracing/basictracer-go v1.1.0 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pgavlin/fx v0.1.6 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pkg/term v1.1.0 // indirect
github.com/pulumi/appdash v0.0.0-20231130102222-75f619a67231 // indirect
github.com/pulumi/esc v0.10.0 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 // indirect
github.com/santhosh-tekuri/jsonschema/v5 v5.0.0 // indirect
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
github.com/skeema/knownhosts v1.3.0 // indirect
github.com/spf13/cobra v1.8.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/texttheater/golang-levenshtein v1.0.1 // indirect
github.com/uber/jaeger-client-go v2.30.0+incompatible // indirect
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
github.com/zclconf/go-cty v1.13.2 // indirect
go.uber.org/atomic v1.9.0 // indirect
golang.org/x/crypto v0.31.0 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/mod v0.19.0 // indirect
golang.org/x/net v0.33.0 // indirect
golang.org/x/sync v0.10.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/term v0.27.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/tools v0.23.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect
google.golang.org/grpc v1.67.1 // indirect
google.golang.org/protobuf v1.35.1 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
lukechampine.com/frand v1.4.2 // indirect
)
Loading

0 comments on commit a3b9576

Please sign in to comment.