Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for repository to be an output, Adding in test for #133 #269

Merged
merged 5 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# EditorConfig helps maintain consistent coding styles across editors and IDEs
# More details at https://editorconfig.org
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. Eventually I'd like ci-mgmt to ship some commit hooks to apply consistent linting and formatting for us.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be great. I love editorconfig. It allows, it allows vscode to just know what to use automagically. We could ship it via ci-mgmt, like we do go-release.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added it because the default to .ts is 4spaces in my vscode and it kept refactoring files.


root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.{ts,tsx}]
indent_style = space
indent_size = 2
12 changes: 12 additions & 0 deletions examples/examples_ts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,21 @@ func TestTsExamples(t *testing.T) {
p.SetConfig(t, key, value)
}
}
p.SetConfig(t, "repository", "public.ecr.aws/eks-anywhere-dev/cert-manager/cert-manager-controller")
p.Up(t)
p.Preview(t, optpreview.ExpectNoChanges())
p.Refresh(t, optrefresh.ExpectNoChanges())
})
}
}

// This tests the Output being passed to repository to fix #133
func TestTsCertManagerPreview(t *testing.T) {
t.Run("TestSimpleCertManagerTsPreview", func(t *testing.T) {
p := pulumitest.NewPulumiTest(t, "simple-cert-manager-ts",
opttest.LocalProviderPath("pulumi-kubernetes-cert-manager", filepath.Join(getCwd(t), "..", "bin")),
opttest.YarnLink("@pulumi/kubernetes-cert-manager"),
)
p.Preview(t)
})
}
37 changes: 37 additions & 0 deletions examples/simple-cert-manager-ts/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
import * as k8s from "@pulumi/kubernetes";
import * as certmanager from "@pulumi/kubernetes-cert-manager";
import * as random from "@pulumi/random";
import * as pulumi from "@pulumi/pulumi"

const randomString = new random.RandomString("random", {
length: 16,
special: false,
})

const conf = new pulumi.Config()
const confRepo = conf.get("repository")
let repository = randomString.result
if (confRepo) {
repository = pulumi.output(confRepo)
}

// Create a sandbox namespace.
const ns = new k8s.core.v1.Namespace("sandbox-ns");
Expand All @@ -9,7 +23,30 @@ const manager = new certmanager.CertManager("cert-manager", {
installCRDs: true,
helmOptions: {
namespace: ns.metadata.name,
version: "v1.15.3",
},
image: {
repository,
tag: "v1.15.3-eks-a-v0.21.3-dev-build.0"
},
cainjector: {
"image": {
repository: "public.ecr.aws/eks-anywhere-dev/cert-manager/cert-manager-cainjector",
tag: "v1.15.3-eks-a-v0.21.3-dev-build.0",
},
},
startupapicheck: {
"image": {
repository: "public.ecr.aws/eks-anywhere-dev/cert-manager/cert-manager-startupapicheck",
tag: "v1.15.3-eks-a-v0.21.3-dev-build.0",
}
},
webhook: {
image: {
repository: "public.ecr.aws/eks-anywhere-dev/cert-manager/cert-manager-webhook",
tag: "v1.15.3-eks-a-v0.21.3-dev-build.0"
}
}
});

// Create a cluster issuer that uses self-signed certificates.
Expand Down
4 changes: 3 additions & 1 deletion examples/simple-cert-manager-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"dependencies": {
"@pulumi/kubernetes": "4.19.0",
"@pulumi/pulumi": "3.144.1",
"@pulumi/kubernetes-cert-manager": "latest"
"@pulumi/kubernetes-cert-manager": "latest",
"@pulumi/random": "^4.16.8",
"google-protobuf": "3.21.4"
}
}
10 changes: 5 additions & 5 deletions provider/pkg/provider/chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,16 @@ type CertManagerGlobalLeaderElection struct {

type CertManagerImage struct {
// You can manage a registry with `registry: quay.io`.
Registry *string `pulumi:"registry"`
Registry pulumi.StringPtrInput `pulumi:"registry"`
// You can manage a registry with `repository: jetstack/cert-manager-controller`.
Repository *string `pulumi:"repository"`
Repository pulumi.StringPtrInput `pulumi:"repository"`
// Override the image tag to deploy by setting this variable.
// If no value is set, the chart's appVersion will be used.
Tag *string `pulumi:"tag"`
Tag pulumi.StringPtrInput `pulumi:"tag"`
// Setting a digest will override any tag, e.g.
// `digest: sha256:0e072dddd1f7f8fc8909a2ca6f65e76c5f0d2fcfb8be47935ae3457e8bbceb20`.
Digest *string `pulumi:"digest"`
PullPolicy *string `pulumi:"pullPolicy"`
Digest pulumi.StringPtrInput `pulumi:"digest"`
PullPolicy pulumi.StringPtrInput `pulumi:"pullPolicy"`
}

type CertManagerServiceAccount struct {
Expand Down
Loading