wet-noon-14291
05/27/2020, 9:50 AMappsettings.json
file in the frontend app, but that doesn't work since pulumi adds some characters. I guess one way could be to get the name from the environment somehow instead.frontend
and backend
. From frontend
I should now be able to reference the backend
using <https://backend>
since they are in the same namespace (at least I think so).
With pulumi I have to use backend-xxxxxx
where I doesn't know what xxxxx
is before I've deployed backend
once.
For other resources I've seen that you can override the name, but I can't find that for the Deployment
or Service
resources.ancient-megabyte-79588
05/27/2020, 2:22 PMpostgres-svc
In the same namespace, you can use the Url or hostname of postgres-svc
to access that pod, regardless of the pods name.
const postgresServiceName = "postgres-svc";
const postgresService = new k8s.core.v1.Service(postgresServiceName,
{
metadata: {
name: postgresServiceName,
labels: postgresLabels,
},
spec: {
ports: [{ port: 5432, protocol: "TCP"}],
selector: postgresLabels,
},
}, {provider: k8sProvider});
metadata: { name: "insert-value-here" }
ahead of time, you can put that in your appsettings.json
you can also override your appsettings.json with an env var that you put in your deployment resource description in Pulumi.
const postgresDepName = "postgres-dep";
const postgresDeployment = new k8s.apps.v1.Deployment(postgresDepName, {
metadata: {
name: postgresDepName,
labels: postgresLabels
},
spec: {
selector: { matchLabels: postgresLabels },
replicas: 1,
revisionHistoryLimit: 2,
template: {
metadata: { labels: postgresLabels },
spec: {
containers: [{
name: "postgres",
image: "postgres:alpine",
volumeMounts: [{
mountPath: "/var/lib/postgresql/data",
name: "volume"
}],
resources: {
requests: {
cpu: "100m",
memory: "100Mi",
},
},
ports: [{ containerPort: 5432 }],
env: [
{name: "POSTGRES_USER", value: "admin"},
{name: "POSTGRES_PASSWORD", value: "P@ssw0rd!"},
{name: "POSTGRES_DB", value: "identity"},
{name: "PGDATA", value: "/mnt/data/pgdata"}
]
}],
volumes:[{
name: "volume",
persistentVolumeClaim: {
claimName: postgresPVClaimName
}
}]
},
},
},
}, {provider: k8sProvider});
env: []
section in the container speccreamy-potato-29402
05/27/2020, 3:12 PMgorgeous-egg-16927
05/27/2020, 3:12 PM.metadata.name
of any k8s resourcewet-noon-14291
05/28/2020, 6:53 AM