Skip to content

Commit 46e3acf

Browse files
committed
Adding in example of returning envVars
1 parent efedd2b commit 46e3acf

File tree

3 files changed

+36
-3
lines changed

3 files changed

+36
-3
lines changed

components-microstacks/index.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
1-
import { OpenSearch } from "./openSearch"
1+
import { OpenSearch } from "./openSearch"
2+
import { EnvVar } from "./types"
3+
4+
const consoleEnvVars: EnvVar[] = []
5+
const apiEnvVars: EnvVar[] = []
6+
7+
8+
// const os = new OpenSearch("opensearc", {
9+
// namespace:
10+
// }, {})
11+
12+
// apiEnvVars.concat(os.envVars)

components-microstacks/openSearch.ts

+20-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as pulumi from "@pulumi/pulumi";
22
import * as k8s from "@pulumi/kubernetes";
33
import { Input, Output, ComponentResource, ComponentResourceOptions } from "@pulumi/pulumi";
44
import { CustomResource } from "@pulumi/kubernetes/apiextensions"
5+
import { EnvVar } from "./types"
56

67
export interface OpenSearchArgs {
78
namespace: Output<string>,
@@ -11,6 +12,7 @@ export interface OpenSearchArgs {
1112

1213
export class OpenSearch extends ComponentResource {
1314
public namespace: Output<string>;
15+
public envVars: EnvVar[];
1416
// public dashboardService: Output<k8s.core.v1.Service>;
1517
// public customResourceName: Output<string>;
1618

@@ -102,7 +104,7 @@ export class OpenSearch extends ComponentResource {
102104
extraEnvs: [
103105
{
104106
name: "OPENSEARCH_INITIAL_ADMIN_PASSWORD",
105-
value: "ChangeMe1234!"
107+
value: args.intitialAdminPassword,
106108
}
107109
],
108110
rbac: {
@@ -116,14 +118,30 @@ export class OpenSearch extends ComponentResource {
116118

117119
this.namespace = pulumi.output(args.namespace)
118120

121+
this.envVars = [
122+
{
123+
name: "PULUMI_SEARCH_DOMAIN",
124+
value: "https://opensearch-cluster-master:9200"
125+
},
126+
{
127+
name: "PULUMI_SEARCH_USER",
128+
value: "admin"
129+
},
130+
{
131+
name: "PULUMI_SEARCH_PASSWORD",
132+
value: args.intitialAdminPassword.toString(),
133+
}
134+
]
135+
119136
// this.dashboardService = args.namespace.apply(namespace => k8s.core.v1.Service.get(
120137
// "opensearch-dashboard",
121138
// `${namespace}/osr-opensearch-operator-controller-manager-metrics-service`,
122139
// {parent: this, provider: opts.provider}
123140
// ))
124141
// this.customResourceName = osc.metadata.name
125142
this.registerOutputs({
126-
namespace: this.namespace
143+
namespace: this.namespace,
144+
envVars: this.envVars,
127145
})
128146
}
129147
}

components-microstacks/types.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export interface EnvVar {
2+
name: string;
3+
value: string;
4+
}

0 commit comments

Comments
 (0)