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

Feedback on ecs.Image APIs #449

Open
joeduffy opened this issue Nov 20, 2019 · 0 comments
Open

Feedback on ecs.Image APIs #449

joeduffy opened this issue Nov 20, 2019 · 0 comments
Labels
kind/enhancement Improvements or new features

Comments

@joeduffy
Copy link
Member

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 ecs module? I'd have expected maybe ecr instead?

  • The choice of image as the name of the method, on the type Image, is unfortunate, as the most likely naming ends up with things like image.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 call image on the result?

  • Why is parent required when calling the image function? 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;
@lukehoban lukehoban added the kind/enhancement Improvements or new features label Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Improvements or new features
Projects
None yet
Development

No branches or pull requests

2 participants