Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// limitations under the License.
import * as pulumi from "@pulumi/pulumi";
import * as k8s from "@pulumi/kubernetes";
import * as random from "@pulumi/random"
//
// To allow parallel test runs, generate a namespace name with a random suffix.
//
let randomSuffix = new random.RandomString("random-suffix", {
length: 6,
special: false,
upper: false
});
let nsName = pulumi.concat(`test-namespace-`, randomSuffix.result);
//
// Tests that if we force a `Pod` to be created before the `Namespace` it is supposed to exist in,
// it will retry until created.
//
new k8s.core.v1.Pod("nginx", {
metadata: {
namespace: nsName,
name: "nginx"
},
spec: {
containers: [
{
name: "nginx",
image: "nginx:1.7.9",
periodSeconds: 10,
successThreshold: 1,
failureThreshold: 3,
},
lifecycle: {
preStop: {
exec: {
command: ["sleep", "20"],
},
},
},
// For more info on all CLI args available:
// https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/cli-arguments.md
args: pulumi.all([
"/nginx-ingress-controller",
pulumi.concat("--configmap=$(POD_NAMESPACE)/", args.configMapName),
// NGINX service name is fixed vs auto-named & ref'd in order for
// nginx-ing-cntlr arg --publish-service to work.
pulumi.concat("--publish-service=$(POD_NAMESPACE)/", name),
"--annotations-prefix=nginx.ingress.kubernetes.io",
"--ingress-class=" + args.ingressClass,
"--v=2",
]),
},
],
},
},
},
},
{
provider: args.provider,
},
},
lifecycle: {
preStop: {
exec: {
command: ["sleep", "20"],
},
},
},
// For more info on all CLI args available:
// https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/cli-arguments.md
args: pulumi.all([
"/nginx-ingress-controller",
pulumi.concat("--configmap=$(POD_NAMESPACE)/", args.configMapName),
// NGINX service name is fixed vs auto-named & ref'd in order for
// nginx-ing-cntlr arg --publish-service to work.
pulumi.concat("--publish-service=$(POD_NAMESPACE)/", name),
"--annotations-prefix=nginx.ingress.kubernetes.io",
"--ingress-class=" + args.ingressClass,
"--v=2",
]),
},
],
},
},
},
},
{
provider: args.provider,
},
);
}