https://pulumi.com logo
#general
Title
# general
a

acoustic-noon-6208

09/30/2019, 8:13 PM
Hi, I can't found solution how to get existed ECR image to use it in EKS k8s deployment. Maybe someone can help please ๐Ÿ™‚
For example: - first publish Docker Image into ECR registry with
Copy code
const repositoryApi = new aws.ecr.Repository(apiRepoName, 
      {
        name: apiRepoName
      }
    );
  
    // Build and publish a Docker image to a private ECR registry.

    const apiImage = awsx.ecs.Image.fromDockerBuild(repositoryApi, {
      context: config.dockerContextPath,
      dockerfile: config.dockerAPIFile
    });
Note: The reason I am doing it that way is because Dockerfile located in different folder to rest of the content, so needs to use fromDockerBuild instead of buildAndPushImage which seems does not support different path to docker file.
- next I have something like this:
Copy code
const container = {
    name,                            
    image,
    ports: [{ name: "http", containerPort: backendPort }],
  };

  const deployment = new k8s.apps.v1.Deployment(name,
    {
        metadata: {
            namespace: namespaceName,
            labels: appLabels,
        },
        spec: {
            replicas: 1,
            selector: { matchLabels: appLabels },
            template: {
                metadata: {
                    labels: appLabels,
                },
                spec: {
                    containers: [
                      container
                    ],
                },
            },
        },
    },
    {
        provider: cluster.provider,
    }
);
- so in above code, I need to set "image" in the container
However, I can't use
apiImage
because it's of different type (
awsx.ecs.Image
vs
aws.ecr.RepositoryImage
)
I though maybe I can just get image back from registry, but I can't found how to do that "trivial" thing in the docs
aws.ecr.getImage() returns another type
GetImageResult
and so on
Note: as I said above, can't use
Copy code
const image = awsx.ecr.buildAndPushImage(apiRepoName, config.dockerContextPath, { 
  }, {

  }).image();
because seems it does not support different path to dockerfile / context path
So I am stuck ๐Ÿ˜„
UPDATE: just found https://github.com/pulumi/examples/blob/master/kubernetes-ts-jenkins/jenkins.ts#L46, where image just referenced by full path, e.g. image:
${image.registry}/${image.repository}:${image.tag}
, but I am not sure how to get say image.tag from just uploaded image with
fromDockerBuild
etc
c

creamy-potato-29402

09/30/2019, 9:24 PM
๐Ÿ‘๐Ÿผ
a

acoustic-noon-6208

09/30/2019, 9:26 PM
@creamy-potato-29402 by any chance, do you have ideas how can I get image.tag from the just published ECR image?
mean I have
const apiImage = awsx.ecs.Image.fromDockerBuild(....)
. How to get image Tag from it? (or better full URN to image)
c

creamy-potato-29402

09/30/2019, 9:27 PM
I donโ€™t. @white-balloon-205?
a

acoustic-noon-6208

10/06/2019, 12:07 PM
@creamy-potato-29402 @white-balloon-205 I still can't resolve that, I published shorter question to https://pulumi-community.slack.com/archives/CJ909TL6P/p1570363552038600
2 Views