jkube icon indicating copy to clipboard operation
jkube copied to clipboard

When k8s:push identifies a push to ECR, JKube should allow autocreating repo using aws-sdk if the repository does not exist

Open nightswimmings opened this issue 2 years ago • 2 comments

Component

Kubernetes Maven Plugin

Is your enhancement related to a problem? Please describe

ECR requires precreation of repositories in order for jkube being able to push images

Describe the solution you'd like

Since the repo information is configured at pom.xml/jkube level (with image name etc..), on a multi-project pipeline, and provided JKube can identify and connect to ECR repositories using aws-sdk specific code, I think there should be an optional flag to request auocreation of repository if the remote repo is not created

Describe alternatives you've considered

Having to parse project's pom.xml jkube metadata in order to infer the future repository name and later on attempt to create it from the pipeline script

Additional context

No response

nightswimmings avatar Oct 24 '23 09:10 nightswimmings

I think there should be an optional flag to request autocreation of repository if the remote repo is not created

How is this flag supposed to work?

Is it performing some sort of HTTP request to ECR? Is there some client util that performs that for you?

manusa avatar Nov 07 '23 10:11 manusa

Yes. in aws cli you can do something like "aws ecr create-repository --repository-name ${repositoryImage} --region ${awsRegion} --image-scanning-configuration scanOnPush=true" so I imagine aws-sdk will have some kind of equivalent.

I know JKube understands "aws sdk", indeed, I guess it uses aws ecr get-login-password somehow already, since even if I don't pass -Djkube.docker.password and i am not docker login'd on my local environment, JKube manages to perform the docker push on ECR

nightswimmings avatar Nov 07 '23 20:11 nightswimmings