pulumi-awsx
pulumi-awsx copied to clipboard
Feedback on ecs.Image APIs
I am using the ecs.Image APIs to build/publish a private Docker image that is then used from my Kubernetes application. There are a few bits of API feedback as a result (full program below):
-
Should this be in the
ecsmodule? I'd have expected maybeecrinstead? -
The choice of
imageas the name of the method, on the typeImage, is unfortunate, as the most likely naming ends up with things likeimage.image(...). -
Related to that, needing to call two things, instead of just one
fromPath-like API, is odd. -
Why do I need to specify two names for my image, the first when I call
fromPath, and the second when I callimageon the result? -
Why is
parentrequired when calling theimagefunction? As you can see below, there actually isn't a natural parent for my particular example, since building is the first thing we do.
Full sample program:
import * as ecs from "@pulumi/awsx";
import * as kx from "@pulumi/kubernetesx";
const img = ecs.Image.fromPath("app", "./app");
const pb = new kx.PodBuilder({
containers: [{
image: img.image("app-img", undefined as any),
ports: { http: 80 },
}],
});
const dep = new kx.Deployment("nginx", {
spec: pb.asDeploymentSpec({ replicas: 3 }),
});
const svc = dep.createService({
type: kx.types.ServiceType.LoadBalancer,
});
export const url = svc.status.loadBalancer.ingress[0].hostname;
I wish I could simply write this as follows:
import * as ecr from "@pulumi/awsx/ecr";
import * as kx from "@pulumi/kubernetesx";
const pb = new kx.PodBuilder({
containers: [{
image: new ecr.Image("app", "./app").url,
ports: { http: 80 },
}],
});
const dep = new kx.Deployment("nginx", {
spec: pb.asDeploymentSpec({ replicas: 3 }),
});
const svc = dep.createService({
type: kx.types.ServiceType.LoadBalancer,
});
export const url = svc.status.loadBalancer.ingress[0].hostname;