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

feat(pulumi): enable new varfile schema for modules #6735

Merged
merged 1 commit into from
Dec 20, 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
1 change: 1 addition & 0 deletions plugins/pulumi/src/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface PulumiDeploySpec {
stackReferences: string[]
deployFromPreview: boolean
root: string
useNewPulumiVarfileSchema: boolean
stack?: string
showSecretsInOutput: boolean
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/pulumi/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ export async function applyConfig(params: PulumiParams & { previewDirPath?: stri
// Pulumi variables (from action.spec.pulumiVariables) take precedence over any variables declared in pulumi varfiles.
let vars: DeepPrimitiveMap = {}

if (action.getSpec()["useNewPulumiVarfileSchema"] || provider.config.useNewPulumiVarfileSchema) {
if (action.getSpec().useNewPulumiVarfileSchema || provider.config.useNewPulumiVarfileSchema) {
for (const varfileVars of varfileContents) {
vars = <DeepPrimitiveMap>merge(vars, varfileVars)
}
Expand Down
1 change: 1 addition & 0 deletions plugins/pulumi/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export const gardenPlugin = () =>
cacheStatus: module.spec.cacheStatus || false,
stackReferences: module.spec.stackReferences || [],
deployFromPreview: module.spec.deployFromPreview || false,
useNewPulumiVarfileSchema: module.spec.useNewPulumiVarfileSchema || false,
showSecretsInOutput: module.spec.showSecretsInOutput || false,
root: module.spec.root || ".",
...omit(module.spec, ["build", "dependencies"]),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
config:
pulumi-k8s-test:namespace: pulumi-test
pulumi-k8s-test:appName: app-name-from-pulumi-varfile
pulumi-k8s-test:orgName: foobar123
pulumi-k8s-test:isMinikube: 'true'
backend:
url: https://api.pulumi.com
test: foo
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: pulumi-k8s-test
runtime: nodejs
description: A minimal Kubernetes TypeScript Pulumi program
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
kind: Module
type: pulumi
name: k8s-namespace-new-module
description: Creates a Namespace
useNewPulumiVarfileSchema: true
pulumiVarfiles: [varfile-new-schema.yaml]
createStack: true
cacheStatus: true
allowDestroy: true
pulumiVariables:
pulumi-k8s-test:orgName: ${var.orgName}
pulumi-k8s-test:namespace: pulumi-test
pulumi-k8s-test:isMinikube: "true"


Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright (C) 2018-2024 Garden Technologies, Inc. <[email protected]>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import * as pulumi from "@pulumi/pulumi"
import * as k8s from "@pulumi/kubernetes"

// Minikube does not implement services of type `LoadBalancer`; require the user to specify if we're
// running on minikube, and if so, create only services of type ClusterIP.
const config = new pulumi.Config()

const name = config.require("namespace")

const ns = new k8s.core.v1.Namespace(config.require("namespace"), { metadata: { name } })
export const namespace = ns.metadata.name
Loading